Implementation of 4-bit digital comparator using MSI ICs

IC 74LS85 is a four-bit magnitude comparator that compares Binary Numbers. It checks whether a 4-bit binary number A3 A2 A1 A0 is greater than, less than or equal to another 4-bit number B3 B2 B1 B0. The IC has two sets of four bit inputs to be compared and also has three cascade inputs A > B, A = B and A < B and produces three outputs A > B, A = B and A < B. These devices are fully expandable to any number of bits without external gates.

Diagram:









Numerical:

The Comparator compare the number bit by bit from MSB to LSB.
The function table of 4-bit comparator is:

Comparing Input Output
A3, B3 A2, B2 A1, B1 A0, B0 A > B A = B A < B
A3 > B3 X X X 1 0 0
A3 < B3 X X X 0 0 1
A3 = B3 A2 > B2 X X 1 0 0
A3 = B3 A2 < B2 X X 0 0 1
A3 = B3 A2 = B2 A1 > B1 X 1 0 0
A3 = B3 A2 = B2 A1 < B1 X 0 0 1
A3 = B3 A2 = B2 A1 = B1 A0 > B0 1 0 0
A3 = B3 A2 = B2 A1 = B1 A0 < B0 0 0 1
A3 = B3 A2 = B2 A1 = B1 A0 = B0 0 1 0


Example:

  1. A = 0, B = 0
       A = 0     0000
       B = 0     0000
    Ans:
    A>B A=B A<B
    Low High Low


  2. A = 0, B = 2
       A = 0     0000
       B = 2     0010
    Ans:
    A>B A=B A<B
    Low Low High


  3. A = 4, B = 2
       A = 4     0100
       B = 2     0010
    Ans:
    A>B A=B A<B
    High Low Low