How to make a 4-bit comparator

alucomparatorlogic-gates

I'm making an ALU (Arithmetic and Logic Unit), I've made a 1-bit ALU with ease, but 1-bit (1b) is impractical, who would need only 1b? I've made that adder/subtractor and I need the comparator (multiplication/division is insane), I don't know how to make a 4b comparator (obviously). Please help!
EDIT: I have found a PURE 4b comparator, that uses 1b comparators:
Valid XHTML http://www.setupsolution.com/wp-content/uploads/2013/08/Magnitude-Comparator.jpg
Thanks to the people that helped!

Best Answer

In the architectures I've looked at, the addition/subtraction operation usually sets some bits in a FLAGS or STATUS register, indicating certain conditions of the result. For example, there's often a flag bit indicating the result of the last operation was zero, or the result of the last operation was less than zero.

Notice these two flags are easilly generated with a single wide-fan-in NOR gate, and by simply checking the sign bit of the result, respectively.

The comparison operation is typically done by executing a subtraction, and throwing away the result, just leaving the FLAGS registe affected by the operation.