4-Bit Comparator
Design Specification
The comparator compares the value of two 4-bit inputs (A0-A3 and B0-B3) and
determines whether A is equal to, not equal to, less than, or greater than B. The
result of the comparison is shown on the output lines EQ, NE, LT, and GT.
Design Method
The following figure shows the simplified block diagram for the comparator.
The inputs are grouped into the sets A and B.
The equations section of the source file contains the following equations:
4-Bit Comparator Source File
title `4-bit lookahead comparator`
A3..A0 pin;
A = [A3..A0];
B3..B0 pin;
B = [B3..B0];
NE,EQ,GT,LT pin istype `com`;
No,Yes = 0,1;
equations
EQ = A == B;
NE = !(A == B);
GT = A > B;
LT = !((A > B) # (A == B));
``test_vectors deleted...
end
NE = !(A == B);
GT = A > B;
LT = !((A > B) # (A == B));
NE = A != B;
GT = A > B;
LT = A < B;
GT = A > B;