EXPERIMENT 8
Aim: Verilog Implementation of 2-bit, 4-bit 8-bit comparators
Important Concept/ Theory:
A magnitude digital Comparator is a combinational circuit that compares two digital or binary numbers in order
to find out whether one binary number is equal, less than or greater than the other binary number. We logically
design a circuit for which we will have two inputs one for A and other for B and have three output terminals,
one for A > B condition, one for A = B condition and one for A < B condition.
2-bit Comparator:
Logical Equations:
A>B:A1B1’ + A0B1’B0’ + A1A0B0’
Fig.1: Logic Circuit of 2-bit Comparator A=B: A1’A0’B1’B0’ + A1’A0B1’B0 + A1A0B1B0 +
Table 1: Truth Table for 2-bit Comparator A1A0’B1B0’
: A1’B1’ (A0’B0’ + A0B0) + A1B1 (A0B0 +
A0’B0’)
: (A0B0 + A0’B0’) (A1B1 + A1’B1’)
: (A0 Ex-Nor B0) (A1 Ex-Nor B1)
A<B:A1’B1 + A0’B1B0 + A1’A0’B0
4-bit Comparator:
Logic Equation:
Fig.2: Logic Circuit of 4-bit Comparator
Table 2: Truth Table for 4-bit Comparator
Design Analysis:
Codes:
1. 2-bit Comparator:
2. 4-bit Comparator:
3. 8-bit Comparator:
Results/Discussions:
Simulation (Waveforms)
1. 2-bit Comparator:
2. 4-bit Comparator:
3. 8-bit Comparator:
RTL Schematic:
1. 2-bit Comparator:
2. 4-bit Comparator:
3. 8-bit Comparator:
Tech Schematic:
1. 2-bit Comparator:
2. 4-bit Comparator:
3. 8-bit Comparator:
Area Report:
1. 2-bit Comparator:
2. 4-bit Comparator:
3. 8-bit Comparator:
Conclusion:
Verilog HDL code for 2-bit, 4-bit & 8-bit comparator has been implemented and their
simulation with signals has been tested.
Criteria Total Marks Marks Obtained Comments
Concept (A) 2
Implementation (B) 2
Performance (C) 2
Total 6