Design of 8-bit digital Comparator using MSI ICs

Introduction:

The outcome of comparison between two numbers takes any of the three possibilities: Either both the numbers A & B are equal (A = B), or number A is greater than number B (A > B) or number A is smaller than number B (A < B). Any byte consists of two nibbles (lower nibble and the upper nibble) i.e. 8 bits. To compare two – 8 bit numbers, the concept used is to compare the most significant bits (MSB’s) of the two numbers and proceed with the next bit.

IC 7485 Based 8 bit Comparator:

IC 7485 is a 4-bit comparator with two – 4 bit inputs and three cascade inputs and three compare outputs, A < B, A = B and A > B. The cascade inputs enable cascading of multiple ICs 7485 to obtain N- magnitude comparator (N is an integer). To compare two 8-bit numbers two such ICs are required. IC 7485 can be expanded to compare more than 4 bit numbers. An 8-bit comparator compares the two 8-bit numbers by cascading of two 4-bit comparator ICs 7485.

Connection Diagram:

  1. For the lower order comparator IC 7485 (1), the A=B cascade input must be connected to Logic 1 (Vcc), while the other two cascade inputs must be connected to Logic 0 (ground).
  2. The lower order comparator outputs, A < B, A = B and A > B are connected to the respective cascade inputs of the higher order comparator IC 7485(2).
  3. The outputs of the higher order comparator become the final outputs of this eight-bit comparator.
  4. Fig.1 shows the connection diagram for 8 bit comparator using multiple 7485 ICs.

Fig 1. Eight bit Magnitude Comparator

Note:
8 bit Input A: A7   A6   A5   A4   A3   A2   A1   A0
8 bit Input B: B7   B6   B5   B4   B3   B2   B1   B0
Where A7 & B7 are the MSBs of binary numbers A & B respectively.

The Comparator compare the number bit by bit from MSB to LSB.

The function table of 8-bit comparator is:

Comparing Input Output
A7,B7 A6,B6 A5,B5 A4,B4 A3,B3 A2,B2 A1,B1 A0,B0 A > B A = B A < B
A7 > B7 X X X X X X X 1 0 0
A7< B7 X X X X X X X 0 0 1
A3 = B7 A6> B6 X X X X X X 1 0 0
A7= B7 A6< B6 X X X X X X 0 0 1
A7= B7 A6= B6 A5> B5 X X X X X 1 0 0
A7= B7 A6= B6 A5< B5 X X X X X 0 0 1
A7= B7 A6= B2 A5= B5 A4> B4 X X X X 1 0 0
A7= B7 A6= B6 A5= B5 A4< B4 X X X X 0 0 1
A7= B7 A6= B6 A5= B5 A4= B4 A3> B3 X X X 1 0 0
A7= B7 A6= B6 A5= B5 A4= B4 A3< B3 X X X 0 0 1
A7= B7 A6= B6 A5= B5 A4= B4 A3= B3 A2> B2 X X 1 0 0
A7= B7 A6= B6 A5= B5 A4= B4 A3= B3 A2< B2 X X 0 0 1
A7= B7 A6= B6 A5= B5 A4= B4 A3= B3 A2= B2 A1> B1 X 1 0 0
A7= B7 A6= B6 A5= B5 A4= B4 A3= B3 A2= B2 A1< B1 X 0 0 1
A7= B7 A6= B6 A5= B5 A4= B4 A3= B3 A2= B2 A1= B1 A0> B0 1 0 0
A7= B7 A6= B6 A5= B5 A4= B4 A3= B3 A2= B2 A1= B1 A0< B0 0 0 1
A7= B7 A6= B6 A5= B5 A4= B4 A3= B3 A2= B2 A1= B1 A0= B0 0 1 0



Example:

  1. A = 0, B = 8
         A = 0 (Decimal)           0000 0000 (Binary)
         B = 8 (Decimal)           0000 1000 (Binary)
    Ans:
    A>B A=B A<B
    Low Low High



  2. A = 64, B = 8
         A = 64 (Decimal)           0100 0000 (Binary)
         B =   8 (Decimal)           0000 1000 (Binary)
    Ans:
    A>B A=B A<B
    High Low Low



  3. A = 96, B = 96
         A = 96 (Decimal)           0110 0000 (Binary)
         B = 96 (Decimal)           0110 0000 (Binary)
    Ans:
    A>B A=B A<B
    Low High Low



  4. A = 30, B = 23
         A = 30 (Decimal)           0001 1110 (Binary)
         B = 23 (Decimal)           0001 10111 (Binary)
    Ans:
    A>B A=B A<B
    High Low Low



  5. A = 42, B = 42
         A = 42 (Decimal)           00101010 (Binary)
         B = 42 (Decimal)           00101010 (Binary)
    Ans:
    A>B A=B A<B
    Low High Low