- Asked 2/22
- 2078 Bhadra · 5 marks
2-bit equality comparator
Short answer
Two 2-bit numbers A1A0 and B1B0 are equal if both bit pairs match. Use XNOR gates: E1 = A1 ⊙ B1, E0 = A0 ⊙ B0, then AND their outputs: x = E1·E0. x=1 only when A = B.
Design a circuit that compares two 2-bit numbers, A and B, to check if they are equal. The circuit has one output x, so that x = 1 if A = B and x = 0 if A≠B.
Two 2-bit numbers and are equal only when each pair of corresponding bits is equal. Bit equality is given by the XNOR gate.
Truth table (16 rows; x = 1 only when A = B)
| x | ||
|---|---|---|
| 00 | 00 | 1 |
| 01 | 01 | 1 |
| 10 | 10 | 1 |
| 11 | 11 | 1 |
| any other pair | 0 |
So
Simplification
Group the terms by the bit-1 pair and the bit-0 pair:
The K-map (rows , columns ) has 1s only on the diagonal cells 0, 5, 10, 15, which cannot be grouped, confirming that the SOP form has four terms; the XNOR form is the simplest circuit.
Logic circuit
A1 --+
+--[XNOR]-- E1 --+
B1 --+ |
+--[AND]--- x
A0 --+ |
+--[XNOR]-- E0 --+
B0 --+
Alternative: , i.e. two XOR gates followed by one NOR gate.
Check: , : , , so . , : , so .
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- 4-bit equality comparator · Digital Logic, chapter 4 · asked 2×
- Hazards in asynchronous design; 2-bit comparator · Digital Logic, chapter 4
- 2-bit magnitude comparator · Digital Logic, chapter 4 · asked 6×
- 3-bit magnitude comparator · Digital Logic, chapter 4 · asked 6×
- C program: sum of two 8-bit BCD numbers · Embedded System, chapter 9