0% found this document useful (0 votes)
4 views23 pages

09 Arithmetic1 C

The document provides an overview of various types of comparators, including two-bit and four-bit comparators, along with their truth tables and Karnaugh maps for output functions. It discusses the functionality of equality and magnitude comparators, detailing how to determine relationships between binary numbers. Additionally, it mentions the use of TTL 74x85 and 74x682 chips for constructing comparators and maximum finders in digital circuits.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views23 pages

09 Arithmetic1 C

The document provides an overview of various types of comparators, including two-bit and four-bit comparators, along with their truth tables and Karnaugh maps for output functions. It discusses the functionality of equality and magnitude comparators, detailing how to determine relationships between binary numbers. Additionally, it mentions the use of TTL 74x85 and 74x682 chips for constructing comparators and maximum finders in digital circuits.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 23

Comparator

Two-Bit Comparator

A B C D LT EQ GT
0 0 0 0 0 1 0
0 1 1 0 0
1 0 1 0 0
N1 A LT AB<CD 1 1 1 0 0
B 0 1 0 0 0 0 1
EQ AB=CD 0 1 0 1 0
C
N2 GT AB>CD 1 0 1 0 0
D
1 1 1 0 0
1 0 0 0 0 0 1
0 1 0 0 1
1 0 0 1 0
1 1 1 0 0
block diagram 1 1 0 0 0 0 1
and 0 1 0 0 1
1 0 0 0 1
truth table 1 1 0 1 0

we'll need a 4-variable Karnaugh map


for each of the 3 output functions

2
Two-Bit Comparator (cont’d)
A A A
0 0 0 0 1 0 0 0 0 1 1 1

1 0 0 0 0 1 0 0 0 0 1 1
D D D
1 1 0 1 0 0 1 0 0 0 0 0
C C C
1 1 0 0 0 0 0 1 0 0 1 0
B B B

K-map for LT K-map for EQ K-map for GT

LT = A' B' D + A' C + B' C D


EQ = A'B'C'D' + A'BC'D + ABCD + AB'CD’ = (A xnor C) • (B xnor D)
GT = B C' D' + A C' + A B D'

3
Equality Comparator

XNOR
X Y Z
X 0 0 1
Z 0 1 0
Y 1 0 0
1 1 1
Z = X XNOR Y

4
4-bit Equality Detector

A[3..0] Equality
Detector A_EQ_B
B[3..0]

5
4-Bit Equality Comparator
A0 C0
B0
A1 C1
B1 A_EQ_B
A2
B2 C2
A3
B3 C3

6
4-bit Magnitude Comparator

A[3..0] A_LT_B
Magnitude
Detector A_EQ_B
B[3..0]
A_GT_B

7
Magnitude Comparator

A0 C0
B0
A1 C1
B1 A_EQ _B
A2
B2 C2
A3
B3 C3

How can we find A_GT_B?

How many rows would a truth table have?

28 = 256!
8
Magnitude Comparator

A0 C0
B0
A1 C1 Find A_GT_B
B1 A_E Q_B
A2
B2 C2
A3
B3 C3

If A = 1001 and
B = 0111
is A > B?
Why?

9
Magnitude Comparator

A0 C0
B0
A1 C1 Find A_GT_B
B1 A_E Q_B
A2
B2 C2
A3
B3 C3
Because A3 > B3
If A = 1001 and i.e. A3 . B3’ = 1
B = 0111 Therefore, one term in the
is A > B? logic equation for A_GT_B is
Why? A3 . B3’

10
Magnitude Comparator
A0 C0
B0 A_GT_B = A3 . B3’
A1 C1
B1 A_EQ _B + …..
A2
B2 C2
A3
B3 C3 Because A3 = B3 and
A2 > B2
If A = 1101 and i.e. C3 = 1 and
B = 1011 A2 . B2’ = 1
is A > B?
Why?

11
Magnitude Comparator
A0 C0
B0 A_GT_B = A3 . B3’
A1 C1
B1 A_EQ _B + …..
A2
B2 C2
A3
B3 C3 Because A3 = B3 and
A2 > B2
If A = 1101 and i.e. C3 = 1 and
B = 1011 A2 . B2’ = 1
is A > B? Therefore, the next term in the
Why? logic equation for A_GT_B is
C3 . A2 . B2’

12
Magnitude Comparator
A0 C0
B0 A_GT_B = A3 . B3’
A1 C1
B1 A_EQ _B + C3 . A2 . B2’
A2 + …..
B2 C2
A3 Because A3 = B3 and
B3 C3 A2 = B2 and
A1 > B1
If A = 1010 and i.e. C3 = 1 and C2 = 1 and
B = 1001 A1 . B1’ = 1
is A > B?
Therefore, the next term in the
Why?
logic equation for A_GT_B is
C3 . C2 . A1 . B1’

13
Magnitude Comparator
A_GT_B = A3 . B3’
A0 C0
B0 + C3 . A2 . B2’
A1 C1
A_EQ _B
+ C3 . C2 . A1 . B1’
B1
A2 + …..
B2 C2
A3
Because A3 = B3 and
B3 C3 A2 = B2 and
If A = 1011 and A1 = B1 and
B = 1010 A0 > B0
is A > B? i.e. C3 = 1 and C2 = 1 and
Why? C1 = 1 and A0 . B0’ = 1
Therefore, the last term in the
logic equation for A_GT_B is
C3 . C2 . C1 . A0 . B0’
14
Magnitude Comparator
a0
b0

a1
b1

a2
b2 A_GT_B = A3 . B3’
+ C3 . A2 . B2’
+ C3 . C2 . A1 . B1’
a3 + C3 . C2 . C1 . A0 . B0’
b3
15
Magnitude Comparator
A0 C0
B0
A1 C1 Find A_LT_B
B1 A_EQ _B
A2
B2 C2
A3
B3 C3

A_LT_B = A3’ . B3
+ C3 . A2’ . B2
+ C3 . C2 . A1’ . B1
+ C3 . C2 . C1 . A0’ . B0

16
TTL 74x85

4
A
B
4
lt
eq
l
gt
e
g

17
TTL 74x85
if (A>B) lt=0, eq=0, gt=1
4
A
if (A<B) lt=1, eq=0, gt=04
B
lt
if (A=B) lt=l, eq=e, gt=g
l
eq
gt
e
g

 The three l, e and g inputs are used when


cascading.

18
Comparator (continued…)
 Let us now cascade four of the 74x85 to construct
a 16 bit comparator.
a[ 15:0 ]

b[ 15:0 ]

[15:12] [15:12] [11:8] [11:8] [7:4] [7:4] [3:0] [3:0]

4 A 4 A 4 A 4 A
4 B lt 4 B
lt 4 B
lt 4 B
lt
eq eq eq 0 eq
l gt l gt l gt l gt
e e e 1 e
g g g 0 g

gt eq lt

Exercise: Analyze it.


Final results of
comparison

19
TTL 74x682
8-bit Comparator

− Arithmetic conditions derived from


74x682 outputs?
− And their circuits?

20
21
Maximum Finder
• Design a maximum finder

4 4
a a A
b b B
4 4
4 4 lt
eq
0 l gt
1 e
0 g

0 4
Max(a,b)
1

22
Maximum Finder
• Design a maximum finder

a 4
A
b B
4
4 4 lt
eq
0 l gt
1 e
0 g

0 4
Max(a,b)
1

23

You might also like