Sie sind auf Seite 1von 24

DEPARTMENT OF TECHNICAL EDUCATION

ANDHRAPRADESH

Name : A. PADMAVATHI
Designation : Head of ECE Section
Branch : Electronics & Comm. Engg.
Institute : Govt. Polytechnic for women, Guntur
Year/ Semester : III
Subject : Digital Electronics
Subject Code : CM-305
Topic : Logic gates & Boolean Algebra
Duration : 100 mts.
Sub topic : Comparator
Teaching aids : Diagrams
CM305.19 to 20 1
Objectives

On completion of this period, you would be


able to know

• What is digital comparator?

• Use of EX-NOR gate in digital comparator

• Working of of 1-bit digital comparator

• Working of 4-bit digital comparator

• Working of 7485 IC

CM305.19 to 20 2
What is digital comparator?
• A digital comparator is a combinational logic circuit that
compares two numbers in binary form and generates a
one or a zero at its output depending on whether they
are the same or not

• A comparator can be simulated by subtracting the two


values (A & B) in question and checking if the result is
zero. This works because if A = B then A - B = 0.
contd…

CM305.19 to 20 3
What is digital comparator?

• Comparators can be used in a central processing unit


(CPU) or microcontroller

• Equality comparator outputs whether two binary


numbers are equal or not

• Magnitude comparator compares two binary numbers A


& B and outputs A<B or A=B or A>B

CM305.19 to 20 4
EX-NOR can used as 1-Bit Equality Comparator

A B Y
A
Y
0 0 1
B
0 1 0
Fig 19.1 1 0 0
1 1 1
Table19.1

The output is ‘1’ if two input bits are equal

CM305.19 to 20 5
4-Bit Equality Comparator

A0 C0
B0
A1 C1
B1 A_EQ_B
A2
B2 C2
A3
B3 C3
Fig 19.2

This compares two 4-bit numbers A & B, and outputs ‘1’


if they are equal
CM305.19 to 20 6
Magnitude Comparator
• Magnitude comparator: compare two values A and B
to ensure that if A>B or A=B or A<B

• Explore dissimilarity

• How we compare two 4-bit values A(a3 a2 a1 a0) and


B(b3 b2 b1 b0)

• If (a3>b3) therefore A>B

• If (a3<b3) therefore A<B

• If (a3=b3) therefore A=B and so on..


CM305.19 to 20 7
1-Bit Magnitude Comparator

x y

Gout 1 - bit Gin


Eout comparator
Lout Lin
Fig 19.3

The variable Eout is 1 if X = Y and Gin = 0 and Lin = 0.


The variable Gout is 1 if X > Y or if A = B and Gin = 1.
The variable Lout is 1 if X < Y or if A = B and Lin = 1.

CM305.19 to 20 8
4-Bit Magnitude (digital) Comparator
x3 y3 x2 y2 x1 y1 x0 y0

G 4 G G 2 G G
3 1 0
gt G in=0
eq 1-bit comp 1-bit comp 1-bit comp 1-bit comp
lt L in=0
L4 L3 L2 L1 L0
Fig 19.4

X Y
1101 0110 gt = 1
1110 1011
1011 1011 eq = 1
0101 0111
lt = 1
1010 1011

CM305.19 to 20 9
Logic circuit of 4-bit digital comparator

A3’B3
A3
x3
A3 B3’
B3
A3’B3 + x3A2’B2 +
A2 x2 x3x2A1’B1 +
B2
x3x2x1A0’B0
(A<B)
A1
x1
B1
A3B3’ + x3A2B2’ +
x3x2A1B1’ +
A0 x3x2x1A0B0’
x0 (A>B)
B0
(A=B)
Fig 19.5 x3x2x1x0

CM305.19 to 20 10
Block diagram of 4-bit magnitude comparator

0 A3
1 A2
1 A1
0 A0 4-bit
Comp
A<B 1
1 A3 A>B 0
0 A2 A=B 0
1 A1
0 A0

Fig 19.6

Output for a sample input is shown in the above block diagram

CM305.19 to 20 11
7485 IC - Magnitude comparator

• This compares two 4-bit binary numbers and indicates

whether one number is:

• Larger than the other number

• Less than other number

• Equal to the other number

CM305.19 to 20 12
Fig 19.7

CM305.19 to 20 13
The magnitude comparator has four lines for input A, four

lines for input B and three output lines that indicate whether

• A is larger than B and is labeled A>B

• A is less than B and is labeled A<B

• A is equal to B and is labeled A=B

CM305.19 to 20 14
Table 19.2

CM305.19 to 20 15
7485

Fig 19.8

CM305.19 to 20 16
Summary
• A digital comparator is a combinational logic circuit that
compares two binary numbers

• Comparators can be used in a central processing unit


(CPU) or microcontroller

• Equality comparator outputs whether two binary


numbers are equal or not

• Magnitude comparator compares two binary numbers A


& B and outputs A<B or A=B or A>B

• 7485 is a magnitude comparator

CM305.19 to 20 17
Quiz

Which of the following logic gate can be used in


equality comparison

1. NAND

3. NOR

5. EX-NOR

7. AND

CM305.19 to 20 18
A equality comparator has outputs

1. A<B

3. A>B

5. A=B

7. None of the above

CM305.19 to 20 19
A magnitude comparator has outputs

1. Less than

3. Equal

5. Greater than

7. All of the above

CM305.19 to 20 20
Which of the following IC is a magnitude comparator?

1. 7440

3. 7432

5. 7485

7. 7400

CM305.19 to 20 21
7485 is a 

1. 1-bit magnitude comparator

3. 4-bit magnitude comparator

5. 8-bit magnitude comparator

7. None of the above

CM305.19 to 20 22
Frequently asked questions in Exam

1. Explain the working of 1-bit comparator

3. Explain the working of 4-bit comparator with logic circuit


diagram

5. Explain the working of the 4-bit magnitude comparator


using block diagram

7. Draw the logic circuit of 4-bit magnitude comparator

9. Explain the features and use of 7485 IC

CM305.19 to 20 23
Assignment

1. Draw the logic circuit diagram of 7485 I c

4. Write the function table of 4- bit comparator.

CM305.19 to 20 24

Das könnte Ihnen auch gefallen