- Asked 6/22
- 2075 Chaitra · 5 marks
- 2074 Chaitra · 5 marks
3-bit magnitude comparator
Short answer
Comparison starts at MSB. Equality of bit pairs gives xi = Ai XNOR Bi. (A=B) = x2·x1·x0. (A>B) = A2·B2' + x2·A1·B1' + x2·x1·A0·B0'. (A<B) is the dual: A2'·B2 + x2·A1'·B1 + x2·x1·A0'·B0.
Explain the operation of 3 bit magnitude comparator with truth table and draw the circuit.
A magnitude comparator compares two binary numbers and indicates whether , or . A 3-bit comparator compares with (6 inputs, 64 combinations, 3 outputs).
Operation
Comparison starts at the most significant bit:
- If , the result is decided: gives ; gives .
- If , compare and in the same way.
- If and , compare and .
- If all three pairs are equal, .
Bit equality is detected by X-NOR gates:
Truth table (condensed)
The full table has 64 rows; it is written compactly by bit priority (X = any value):
| vs | vs | vs | |||
|---|---|---|---|---|---|
| (1,0) | X | X | 1 | 0 | 0 |
| (0,1) | X | X | 0 | 0 | 1 |
| X | 1 | 0 | 0 | ||
| X | 0 | 0 | 1 | ||
| 1 | 0 | 0 | |||
| 0 | 0 | 1 | |||
| 0 | 1 | 0 |
Sample rows: gives (decided at ); gives (decided at ); gives .
Output expressions
Circuit
A2,B2 ─[XNOR]─ x2 A1,B1 ─[XNOR]─ x1
A0,B0 ─[XNOR]─ x0
x2, x1, x0 ──────────[AND]──────────── A=B
A2, B2' ─────────[AND]──┐
x2, A1, B1' ─────[AND]──┼─[OR]──────── A>B
x2, x1, A0, B0' ─[AND]──┘
A2', B2 ─────────[AND]──┐
x2, A1', B1 ─────[AND]──┼─[OR]──────── A<B
x2, x1, A0', B0 ─[AND]──┘
Gates: 3 X-NOR, 7 AND, 2 OR (plus inverters for the complemented bits). The output can also be obtained as using one NOR gate.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- 2-bit magnitude comparator · Digital Logic, chapter 4 · asked 6×
- Hazards in asynchronous design; 2-bit comparator · Digital Logic, chapter 4
- 2-bit equality comparator · Digital Logic, chapter 4 · asked 2×
- 4-bit equality comparator · Digital Logic, chapter 4 · asked 2×
- Shift register and 4-bit PISO operation · Digital Logic, chapter 7
- Circuit giving 2's complement of a 4-bit number · Digital Logic, chapter 5
- JK flip-flop operation and truth table · Basic Electronics Engineering, chapter 6