Comparator design using a 4-bit adder

Click For Summary

Discussion Overview

The discussion revolves around designing a 4-bit magnitude comparator using a single 4-bit adder and various logic gates for signed numbers in two's complement representation. Participants explore the requirements and methodologies for creating the comparator, including the construction of a truth table.

Discussion Character

  • Homework-related
  • Technical explanation
  • Conceptual clarification
  • Debate/contested

Main Points Raised

  • One participant expresses uncertainty about the design, noting it is their first encounter with comparator design and that it was not covered in the course syllabus.
  • Another participant questions the source of the carry-in (Cin) signal, suggesting that only two 4-bit numbers are being compared.
  • Several participants agree that the numbers should be in two's complement format.
  • A participant raises a concern about the design's ability to perform two's complement correctly, noting that it involves both inverting bits and adding one.
  • There is a suggestion to create a truth table to clarify the design process, with one participant providing guidance on how to structure it for comparing two 4-bit two's complement numbers.

Areas of Agreement / Disagreement

Participants generally agree on the necessity of using two's complement for the numbers being compared. However, there is uncertainty regarding the implementation details, such as the handling of carry-in and the construction of the truth table, indicating that the discussion remains unresolved.

Contextual Notes

Participants express varying levels of familiarity with truth tables and comparator design, highlighting a potential gap in understanding the requirements for implementing the design correctly.

ichabodgrant
Messages
48
Reaction score
0

Homework Statement


Hi, it's me again.
Now I am going to design a 4-bit magnitude comparator using just ONE 4-bit adder and infinitely large number of gates (AND, OR, NOT, NAND, NOR, XOR, XNOR) for signed numbers (negative binary).

a 4-bit magnitude comparator using 4-bit adder for signed values.png


Homework Equations


A > B => A3barB3 + A2barB2x3 + A1barB1x3x2 + A0barB0x3x2x1

similar for A < B and A = B.

The Attempt at a Solution


a 4-bit magnitude comparator using 4-bit adder for signed values_attempts.png
[/B]
This is my attempt. Frankly, this is my first time encountering problems related to comparator design because this is never said to be in the syllabus of the course (introductory course). I find this in a past paper... seemingly indicating that the instructor wants us to divide and conquer it within the 3 hours of exam.

I do this all by resources on the internet. So there may be a lot of mistakes.
 
Physics news on Phys.org
I think you are on the right track, but I have some comments:
  • Where is the Cin coming from? You are only comparing two 4-bit numbers!
  • Are the numbers supposed to be in two's complement?
And - there are only 16 combinations possible. I suggest making a truth table before continuing.
 
I think it should be using 2's complement.
 
ichabodgrant said:
I think it should be using 2's complement.
Then get busy on your truth table.
 
A truth table looks like this? because I have never drawn a truth table for such a design...so I searched on google...
 

Attachments

  • Table_de_verite_du_CI_7485.gif
    Table_de_verite_du_CI_7485.gif
    32.9 KB · Views: 13,607
I have a question about the XOR gates. Are those XOR gates for doing 2's complement (i am thinking in this way)?
But I know that 2's complement is not just inverting 1 and 0, but also needs to add 1 after that. It seems that the above design cannot do that?
 
And you mentioned that there should not be Cin? Does this mean there are no cascading inputs?
 
ichabodgrant said:
A truth table looks like this? because I have never drawn a truth table for such a design...so I searched on google...
No. I meant the truth table for what you are trying to design. Since you are trying to compare two 4-bit 2's complement numbers, create a table with the A-numbers horizontally (-8 to +7) and the B-numbers vertically (-8 to +7). Now fill in the interior of the table with the result of the comparison you want (e. g. A>B). After you have done that, start thinking about how to implement it.
 

Similar threads

  • · Replies 6 ·
Replies
6
Views
19K
  • · Replies 16 ·
Replies
16
Views
3K
  • · Replies 7 ·
Replies
7
Views
8K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
5K
  • · Replies 1 ·
Replies
1
Views
5K
Replies
5
Views
8K
  • · Replies 15 ·
Replies
15
Views
10K
  • · Replies 2 ·
Replies
2
Views
5K
Replies
4
Views
6K