Source

Adapted from my own handwritten and hand-typed notes from Year 1 to Year 3 of my EEE degree

1-Bit Comparison

For two bits and :

00100
01001
10010
11100

So equality is an XNOR, see XOR XNOR Operations and Operator Precedence.

4-Bit Magnitude Comparator

Inputs and . Outputs , , .

For each bit define the equality signal:

Equal only if every bit is equal:

when the first bit (from the MSB) that differs has , . That gives exactly four cases:

7485 Comparator and Cascading

The 7485 is a 4-bit MSI comparator with three cascading inputs , , . These only matter when all four data bits are equal, then the outputs copy the cascading inputs.

Rules for use:

  • for a single 4-bit comparison set and
  • for 8 bits, feed the outputs of the low-order 7485 into the cascading inputs of the high-order 7485
  • the high-order chip decides whenever its bits differ, and passes on the lower result only when they are equal

A spare cascading input can also act as an extra LSB. For example, to compare a 5-bit with 01011 on one 7485, put against 0101 and use to drive the cascading inputs: if the top bits are equal, means and means .