Building a 2 bit comparator using either....

In summary, the conversation discusses seeking advice for building using MUXs and comparing the outputs of a 2 bit comparator and MUXs. They suggest reducing the incoming information from 16 possible bit combinations to a smaller number of bits using MUXs. The speaker also mentions the importance of considering the 3 conditions to detect: when one variable is larger than the other, when they are equal, and when the second variable is larger than the first. They agree that using MUXs is the easiest approach for this problem.
  • #1
jisbon
476
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:
1599035278506.png

And for MUX:

1599035295443.png

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
 
Physics news on Phys.org
  • #2
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
 

1. How do I build a 2 bit comparator using logic gates?

To build a 2 bit comparator using logic gates, you will need to use a combination of AND, OR, and NOT gates. First, compare the two bits of the first input using an XOR gate. Then, compare the two bits of the second input using another XOR gate. Finally, use an AND gate to combine the outputs of the two XOR gates. The final output will be 1 if the first input is greater than the second input, and 0 otherwise.

2. What is the purpose of a 2 bit comparator?

A 2 bit comparator is used to compare two binary numbers of two bits each and determine which number is greater. It is commonly used in digital circuits to perform arithmetic operations and decision-making processes.

3. Can I build a 2 bit comparator using only NAND gates?

Yes, you can build a 2 bit comparator using only NAND gates. You will need to use a combination of NAND gates to create the logic for the XOR and AND operations required for the comparator. This approach is known as a NAND gate implementation.

4. How do I test the functionality of my 2 bit comparator?

To test the functionality of your 2 bit comparator, you can input different combinations of binary numbers and observe the output. Make sure to test all possible combinations to ensure that the comparator is functioning correctly. You can also use a truth table to compare the expected output with the actual output.

5. Are there any limitations to a 2 bit comparator?

Yes, a 2 bit comparator can only compare two binary numbers of two bits each. It is not capable of comparing larger numbers, and multiple comparators would be needed to compare longer binary numbers. Additionally, a 2 bit comparator can only determine if one number is greater than the other, it cannot determine if the numbers are equal.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
5
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
6
Views
17K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
4K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
4K
  • Engineering and Comp Sci Homework Help
Replies
25
Views
11K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
5K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
4K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
9K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
2K
Back
Top