written 2.6 years ago by |
A 4-bit magnitude comparator compares two 4-bit numbers A and B and gives one of the following outputs : A = B, A < B and A > B.
Let $A = A_3 A_2 A_1 A_0 $ and $B = B_2 B_2 B_2 B_0 $ be the two 4- bit numbers to be compared. The steps involved in comparing two such numbers can be used as the basis for a hardware implementation. The stops involves in comparing two 4-bit numbers are:
1] Examine the two most significant bits ($A_3$ and $B_3$) If $A_3 \gt B_3$ then A>B if $A_3 \times B_3$ then A < B. If $A_3 = B_3$, no decision can be made regarding the relative magnitudes of the two numbers and next pair of bits ($A_2$ and $B_2$) must be examined.
2] If $A_3 = B_3$ and $A_2 \gt B_2$, then A>B, if $A_3 = B_3$ and $A_2 \lt B_2$ then A
3] If $A_3 = B_3, A_2 = B_2 $ and $A_1 \gt B_1$, then A>B, If $A_3 = B_3, A_2 = B_2 $ and $A_1 \lt B,$ no conclusion can yet be drawn regarding the relative magnitudes of two numbers and the LsBs ($A_O$ and $B_O$) must be examined.
4] If $A_3 = B_3 , A_2 = B_2, A_1 = B_1 $ and $A_O \gt B_O$ , then A > B , if $A_3 = B_3, A_2 = B_2 , A_1 = B_1 $ and $A_O \lt B_O$ then a
Fig(2) IC7485 - 4-bit magnitude comparator.
- IC 7485 has three cascading inputs which allow several comparators to be cascaded, by cascading several such comparators, any number of bits can be compared.