How to build a 2 bit comparator using multiplexers

1 reply · 3K views · last reply
jisbon
Messages
475
Reaction score
30
Homework Statement
Build a 2-bit comparator using either two 74151 8-to-1 MUXs or two 3 to 8 binary decoders. Additional gates such as AND, NAND, OR, NOR, inverters can be used.
Relevant Equations
-
So I got this question while coming across, and I would like to seek some advice/tips for these types of questions.
1) Assuming I want to try and build using MUXs, I will get the truth table of both a 2 bit comparator and MUXs.

In this case: For comparator:
Truth table for a 4-bit magnitude comparator with inputs A3B3, A2B2, A1B1, A0B0, cascading inputs I(A>B), I(A<B), I(A=B), and outputs Y(A>B), Y(A<B), Y(A=B), listing H and L values for each case.

And for MUX:

Truth table of a 3-to-8 line decoder with Select inputs C, B, A, active-low Strobe G, and outputs Y and W, where Y is D0 through D7 and W is the complement of each.

So from what I learnt, MUX simply selects 1 input to be the output.
Is there any tips/tricks on to how to start with this question by possibly comparing the outputs? How should I be thinking to tackle these types of use 'something else'to build 'something' questions?
Thanks
 
I haven't thought it all the way thru, but the first thing you must realize for THIS problem is there are 3 conditions to detect:
variable 1 is larger than variable 2
variable 2 is larger than variable 1
they are equal

In general, you want to reduce (compress) the incoming information from 16 possible bit combinations to some smaller number of bits; then repeat until you have reduced to the minimal number of output bits.

And I agree that using the MUX is probably the easiest approach mentally. (at least for you and me, others may differ!)

Cheers,
Tom