 2-bit comparator

Similarly we can have 2 bit comparator and the table to list all the combinations at input and their corresponding outputs is as:

A             B             f (A>B)  f (A=B) f (A<B)

00           00           0              1              0

01           00           1              0              0

10           00           1              0              0

11           00           1              0              0

00           01           0              0              1

01           01           0              1              0

10           01           1              0              0

11           01           1              0              0

00           10           0              0              1

01           10           0              0              1

10           10           0              1              0

11           10           1              0              0

00           11           0              0              1

01           11           0              0              1

10           11           0              0              1

11           11           0              1              0

And we get the equations for all three outputs from the K-maps as We can also obtain these equations orally as for A1A0 to be greater than B1B0 either A1 is greater than B1 (i.e. A1=1 & B1=0) or A1 is equal to B1 (or A1is not less than B1 i.e. (f(A1<B1))’ = (A1’B1)’= (A1 + B1‘) & A0 is greater than B0 (i.e. A0=1 & B0=0).

Hence the equation we get is f (A>B) = A1B1‘+ (A1 + B1’) A0B0’ = A1B1‘+ A0 B1’B0’+ A1A0B0  We can also get the equation orally similar to the above case.

Now we can implement the above equation easily. Similarly we can implement other higher comparators