4-Bit Magnitude Comparator Design Report
4-Bit Magnitude Comparator Design Report
Section: 7
Submitted by:
Name ID
Submitted to:
Nishat Tasnim
Lecturer
Department of Computer Science & Engineering
Date of Submission: 01.09.2025
Problem Statement:
The 4-bit Magnitude comparator project is to design a combinational digital circuit that
takes two 4-bit binary numbers A and B. A (A3, A2, A1, A0) and
B (B3, B2, B1, B0), as inputs and produces three outputs: A > B, A = B, A < B. The
circuit needs to analyse which binary number is larger while producing a logic high (1)
output line for the condition that A > B, A = B, and A < B. The comparator circuit
implements the logic to determine which of these conditions holds for any given pair
of 4-bit input numbers.
Design Details:
● Inputs: Two 4-bit binary numbers (A3, A2, A1, A0) and (B3, B2, B1, B0).
● Outputs: Three comparison results (A > B, A = B, A < B)
● Used ICs:
IC 7404 NOT gate (2)
IC 7408 AND gate (3)
IC 7402 NOR gate (1)
IC 7421 AND gate (2)
IC 7411 AND gate (1)
IC 4072 OR gate (1)
• Connection: Jumper Wires (Male-Male, Male-Female, Female-Female)
● Equality comparison (A=B)
A = A3A2A1A0
B = B3B2B1B0
The equality of each pair of bits (Ai, Bi) is expressed using XNOR.
𝑥ᵢ = 𝐴ᵢ𝐵ᵢ + 𝐴ᵢ′𝐵ᵢ′
The binary variable is 1 if and only if 𝑥𝑖 variables are 1. From the AND operation of xi
variables, we get,
(𝐴 = 𝐵) = 𝑥₃𝑥₂𝑥₁𝑥₀
In a 4-bit comparator, the condition of A > B can be possible in the following four
cases.
1. If A3 = 1 and B3 = 0
2. If A3 = B3 and A2 = 1 and B2 = 0
3. If A3 = B3, A2 = B2 and A1 = 1 and B1 = 0
4. If A3 = B3, A2 = B2, A1 = B1 and A0 = 1 and B0 = 0
(𝐴 > 𝐵) = 𝐴₃′𝐵₃ + 𝑥₃𝐴₂′𝐵₂ + 𝑥₃𝑥₂𝐴₁′ 𝐵₁ + 𝑥₃𝑥₂𝑥₁𝐴₀′ 𝐵₀
Similarly, the condition for A<B can be possible in the following four cases.
1. If A3 = 0 and B3 = 1
2. If A3 = B3 and A2 = 0 and B2 = 1
3. If A3 = B3, A2 = B2 and A1 = 0 and B1 = 1
4. If A3 = B3, A2 = B2, A1 = B1 and A0 = 0 and B0 = 1
A3 > B3 X X X H L L
A3 < B3 X X X L H L
A3 = B3 A2 > B2 X X H L L
A3 = B3 A2 < B2 X X L H L
A3 = B3 A2 = B2 A1 > B1 X H L L
A3 = B3 A2 = B2 A1 < B1 X L H L
A3 = B3 A2 = B2 A1 = B1 A0 > B0 H L L
A3 = B3 A2 = B2 A1 = B1 A0 < B0 L H L
A3 = B3 A2 = B2 A1 = B1 A0 = B0 H L L
A3 = B3 A2 = B2 A1 = B1 A0 = B0 L H L
A3 = B3 A2 = B2 A1 = B1 A0 = B0 L L H
Circuit Diagram
Simulation Result:
Circuit Diagram
Input
Output
● A=B
● A<B