Detecting ascending/descending 4-bit number

Thread Starter

VeloceT

Joined Dec 11, 2010
2
Hello,

I need to build a device that accepts a 4-bit number and deciphers whether it's ascending, or descending (or both, such as 0000 or 1111.) The device has two outputs. The first gives 1 if and only if the number is ascending (each bit is greater than or equal to the bit to its left.), the other when it is descending.
For example:
0000
0001
0011
0111
1111

are all examples for ascending numbers, whereas;

0000
1000
1100
1110
1111

are all descending. The rest are neither one.

The design needs to include minimum number of logic gates!
gates allowed (AND,OR,NAND,NOR,XOR).

I have managed to create it using 12 gates. Can anyone come up with less?

I would really be glad for help!
 
Top