How to design 4-bit comparator using the below described logic

digital-logic

Suppose we have 2 4-bit binary number represented as:

A3A2A1A0       
B3B2B1B0

We use 1-bit comparator for it.

Diagram

Comparison starts from MSB.

  1. Compare A3 with B3 using above 1-bit comparator. If A=B give high output (logic 1) then only it compare other bits. If A=B is false (logic 0) then the final answer of comparison is same as the output of 1-bit comparator.

  2. If previous A=B is logic 1 (true) then it compare using 1 bit comparator and again the same consequences.

Is it possible to design 4-bit comparator using gates with above logic? If, yes then how can it be?

As a find comparator in Google which is drawn using K-Map.

Best Answer

Yes, this is certainly possible.

From your question it is not clear whether you want a 4-bit comparator that outputs only equality, or the three conclusions as shown for your 1-bit comparator.

This smells of homework, and as a rule we don't give full answers to such questions, but we can gently steer you in the right direction.

Consider the equality. Your 1) text indicates that for a 0 output the conclusion must be 0, for a 1 output the conclusion must be the 'other' input (from the lower bis).

  1. which logic gate does this describe?

  2. how would you connect this gate to the single bit comparator (you will need one extra input, the 'lower bits are equal' input (often called 'cascade')) Draw the diagram of this one-bit-comparator-with-cascade-input.

  3. Now draw the final 4-bit comparator.