Magnitude Comparator

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

The Digital Comparator

Another common and very useful combinational logic circuit is that of the Digital Comparator circuit.
Digital or Binary Comparators are made up from standard AND, NOR and NOT gates that compare the
digital signals present at their input terminals and produce an output depending upon the condition of those
inputs.

For example, along with being able to add and subtract binary numbers we need to be able to compare them
and determine whether the value of input A is greater than, smaller than or equal to the value at input B etc.
The digital comparator accomplishes this using several logic gates that operate on the principles of Boolean
Algebra. There are two main types of Digital Comparator available and these are.

1. Identity Comparator – an Identity Comparator is a digital comparator that has only one output
terminal for when A = B either “HIGH” A = B = 1 or “LOW” A = B = 0

2. Magnitude Comparator – a Magnitude Comparator is a type of digital comparator that has three
output terminals, one each for equality, A = B greater than, A > B and less than A < B

The purpose of a Digital Comparator is to compare a set of variables or unknown numbers, for example A
(A1, A2, A3, …. An, etc) against that of a constant or unknown value such as B (B1, B2, B3, …. Bn, etc)
and produce an output condition or flag depending upon the result of the comparison. For example, a
magnitude comparator of two 1-bits, (A and B) inputs would produce the following three output conditions
when compared to each other.

Which means: A is greater than B, A is equal to B, and A is less than B

1-bit Digital Magnitude Comparator:

Truth Table:

Inputs Outputs
B A A>B A=B A<B
0 0 0 1 0
0 1 1 0 0
1 0 0 0 1
1 1 0 1 0

Logic Expression:

X0 = A0B0+A0’B0’

(A=B)=X0, (A<B)= A0’B0 , (A>B)= A0B0’


Logic Diagram:

Figure 1: 1 Bit Comparator

2-bit Digital Magnitude Comparator:

Logic Expression:

Xn= AnBn+An’Bn’

(A=B)= X1X0

(A<B)= A1’B1+X1A0’B0

(A>B)= A1B1’+X1A0B0’

Block Diagram:

Figure 2: 2 Bit Comparator


3-bit Digital Magnitude Comparator:

Logic Expression:

Xn= AnBn+An’Bn’

(A=B)=X2X1X0

(A<B)=A2’B2+X2A1’B1+X2X1A0’B0

(A>B)=A2B2’+X2A1B1’+X2X1A0B0’

Block Diagram:

Figure 3: 3 Bit Comparator

5-bit Digital Magnitude Comparator:

Logic Expression:

Xn= AnBn+An’Bn’

(A=B)=X4X3X2X1 X0

(A<B)=A4’B4+X4A3’B3+X4X3A2’B2+X4X3X2A1’B1+X4X3X2X1A0’B0

(A>B)=A4B4’+X4A3B3’+X4X3A2B2’+X4X3X2A1B1’+X4X3X2X1A0B0’
Block Diagram:

Figure 4: 5 bit comparator

You might also like