3. MAGNITUDE COMPARATOR: DIGITAL COMPARATOR
• It is a combinational logic circuit.
• Digital Comparator is used to compare the value of two binary
digits.
• There are two types of digital comparator (i) Identity Comparator
(ii) Magnitude Comparator.
• IDENTITY COMPARATOR: This comparator has only one output
terminal for when A=B, either A=B=1 (High) or A=B=0 (Low)
• MAGNITUDE COMPARATOR: This Comparator has three output
terminals namely A>B, A=B, A<B. Depending on the result of
comparison, one of these output will be high (1)
• Block Diagram of Magnitude Comparator is shown in Fig. 1
Syed Hasan Saeed, Integral University,
Lucknow
3
4. BLOCK DIAGRAM OF MAGNITUDE COMPARATOR
Syed Hasan Saeed, Integral University,
Lucknow
4
n- Bit Digital Comparator
A
n-Bit
B
n-Bit
A<B A=B A>B
Fig. 1
5. 1- Bit Magnitude Comparator:
• This magnitude comparator has two inputs A and B and three
outputs A<B, A=B and A>B.
• This magnitude comparator compares the two numbers of single
bits.
• Truth Table of 1-Bit Comparator
Syed Hasan Saeed, Integral University,
Lucknow
5
INPUTS OUTPUTS
A B Y1 (A<B) Y2 (A=B) Y3 (A>B)
0 0 0 1 0
0 1 1 0 0
1 0 0 0 1
1 1 0 1 0
6. K-Maps For All Three Outputs :
Syed Hasan Saeed, Integral University,
Lucknow
6
A
B
0 1
0
1
0
0 0
1
B B
A
A
BAY1
K-Map for Y1 : A<B
7. K-Maps For All Three Outputs :
Syed Hasan Saeed, Integral University,
Lucknow
7
A
B
0 1
0
1
0
0 0
1
B B
A
A
BAY1
K-Map for Y1 : A<B
A
B
0 1
0
1
1
0 1
0
B B
A
A
ABBAY2
K-Map for Y2 : A=B
8. K-Maps For All Three Outputs :
Syed Hasan Saeed, Integral University,
Lucknow
8
A
B
0 1
0
1
0
0 0
1
B B
A
A
BAY1
K-Map for Y1 : A<B
A
B
0 1
0
1
1
0 1
0
B B
A
A
ABBAY2
K-Map for Y2 : A=B
A 0 1
0
1
0
1
0
BB
A
A
B
0
BAY3
K-Map for Y2 : A>B
9. Realization of One Bit Comparator
Syed Hasan Saeed, Integral University,
Lucknow
9
BA
BAY1
A
B
AB
BA
ABBAY2
BAY3
BA
BA
BAY1
ABBAY2
BAY3
10. Realization of by Using AND , EX-NOR gates
Syed Hasan Saeed, Integral University,
Lucknow
10
BA
BAY1
BA
BAY2
BAY3
BA
A
B
11. 2-Bit Comparator:
• A comparator which is used to compare two binary numbers each of two
bits is called a 2-bit magnitude comparator.
• Fig. 2 shows the block diagram of 2-Bit magnitude comparator.
• It has four inputs and three outputs.
• Inputs are A0 ,A1,B0 and B1 and Outputs are Y1, Y2 and Y3
Syed Hasan Saeed, Integral University,
Lucknow
11
A0
A1
B1
B0
Y1
Y2
Y3
2-Bit Comparator
Fig. 2
A
B
Input Output
12. GREATER THAN (A>B)
LESS THAN (A<B)
Similarly,
1. If A1= B1=1 and A0= 0, B0=1, then A<B
2. If A1= B1= 0 and A0= 0, B0=1 then A<B
Syed Hasan Saeed, Integral University,
Lucknow
12
A1 A0 B1 B0
1 0 0 1
1 1 1 0
0 1 0 0
1. If A1= 1 and B1= 0 then A>B
2. If A1 and B1 are same, i.e A1=B1=1 or A1=B1=0 and A0=1, B0=0
then A>B
16. For A=B From K-Map
Syed Hasan Saeed, Integral University,
Lucknow
16
01010101010101012 BBAABBAABBAABBAAY
)B(A)BA(Y
)BABA()BABA(Y
)BABA(BA)BABA(BAY
00112
000011112
1111001111002
17. LOGIC DIAGRAM OF 2-BIT COMPARATOR:
Syed Hasan Saeed, Integral University,
Lucknow
17
A1 A0 B1 B0
A< B
A=B
A > B
001 BAA
11 BA
010 BBA
11 BA
001 BAA
010 BBA
11 BA
00 BA