Professional Documents
Culture Documents
INS3179 Digital Design Lecture 6 Combinational Logic Design Principles
INS3179 Digital Design Lecture 6 Combinational Logic Design Principles
ĐẠI HỌC
CÔNG NGHỆ VIETNAM NATIONAL UNIVERSITY HANOI (VNU) ĐẠI HỌC
CÔNG NGHỆ
Outline
ĐẠI HỌC
CÔNG NGHỆ VNU UNIVERSITY OF ENGINEERING AND TECHNOLOGY
• Introduction
• Design methodology
• Half Adder (HA)
1
3/29/2023
ĐẠI HỌC
CÔNG NGHỆ Introduction ĐẠI HỌC
CÔNG NGHỆ
Analysis of Mixed-Logic Circuits
• History
– The earliest hardware for carrying out digital
communication was a simple adding machine A
built by Blaise Pascal (1640) called the B
Pascaline.
C
– In 1822 Charles Babbage designed a
mechanical calculator called a difference D
engine (a famous calculating engine), which
was capable of holding and manipulating
seven numbers of 31 decimal digits each.
E
The London Science Museum's working
difference engine, built from Charles
– Both of this calculators were constructed using Babbage's design (1991).
gears, cams, levers, and the like.
2
3/29/2023
ĐẠI HỌC
CÔNG NGHỆ
Analysis of Mixed-Logic Circuits ĐẠI HỌC
CÔNG NGHỆ
Analysis of Mixed-Logic Circuits
A A+ B A A+ B
B B ( A + B )C
C C
D D
A+ B + D
E E
3
3/29/2023
ĐẠI HỌC
CÔNG NGHỆ
Analysis of Mixed-Logic Circuits ĐẠI HỌC
CÔNG NGHỆ
Analysis of Mixed-Logic Circuits
A A+ B A A+ B
B ( A + B )C B ( A + B )C
C (( A + B)C )(A + B + D ) C (( A + B)C )(A + B + D )
D D F
A+ B + D A+ B + D
E E
DE DE
4
3/29/2023
ĐẠI HỌC
CÔNG NGHỆ
Design methodology ĐẠI HỌC
CÔNG NGHỆ Design methodology
– Construct the Truth table – Design a comparator for two inputs (A & 0 0 1
B) with 0 1 0
– Build the switching function
• C = 1 when A = B
– Optimize this switching function 1 0 0
• C = 0 when A B
– From the switching function, design the switching circuit by using basic 1 1 1
logic elements
C
A
C = A B + AB
B
Karnaugh map can be used !
3/29/2023 Xuan-Tu Tran 9
3/29/2023 Xuan-Tu Tran 10
5
3/29/2023
ĐẠI HỌC
CÔNG NGHỆ Half Adder (HA) ĐẠI HỌC
CÔNG NGHỆ Half Adder (HA)
• Description • Schematic S = A B
– HA has two inputs, generally labelled A and B, A B S C
and two outputs, the sum S and carry C. 0 0 0 0 XOR C = A.B
0 1 1 0
– S is the two-bit XOR of A and B, and 1 0 1 0 A
– C is the AND of A and B. 1 1 0 1 S
B
S = A B
C = A.B A S C
B HA C
– Essentially the output of a half adder is the sum of
two one-bit numbers, with C being the most
significant of these two outputs
6
3/29/2023
ĐẠI HỌC
CÔNG NGHỆ Full Adder (FA) ĐẠI HỌC
CÔNG NGHỆ
Full Adder (FA)
• Description
A B Ci S CO S = A B Ci
0 0 0 0 0
– 3 inputs: A, B, and carry in Ci Co = AB + Ci ( A B) = AB + Ci A + Ci B
0 1 0 1 0
– 2 outputs: the sum S and carry out CO 1 0 0 1 0
Ci
1 1 0 0 1
A S 0 0 1 1 0 S
B 0 1 1 0 1 A
FA CO
Ci 1 0 1 0 1
1 1 1 1 1 B
CO
S = Ci ( AB + A B) + Ci ( A B + AB) CO = Ci AB + Ci ( AB + A B + AB)
= Ci ( AB + A B ) + Ci ( AB + A B ) ( )
= Ci + Ci AB + Ci ( AB + A B)
= A B Ci = AB + Ci ( A B)
3/29/2023 Xuan-Tu Tran 14
3/29/2023 Xuan-Tu Tran 13
7
3/29/2023
ĐẠI HỌC
CÔNG NGHỆ
Full Adder (FA) ĐẠI HỌC
CÔNG NGHỆ
4-bit adder
S = A B Ci
A3 B3 Cin3 A2 B2 Cin2 A1 B1 Cin1 A0 B0 Cin0
Co = AB + Ci ( A B) = AB + Ci A + Ci B
Ci FA FA FA FA
S
A
HA
HA Cout3 S3 Cout2 S2 Cout1 S1 Cout0 S0
B
8
3/29/2023
ĐẠI HỌC
CÔNG NGHỆ
4-bit adder circuits ĐẠI HỌC
CÔNG NGHỆ Half Subtractor
• Description
A B D Br
– Subtraction
5 A1 S1 4 10 A1 S1 9
– Inputs: A and B 0 0 0 0
3 A2 S2 1 8 A2 S2 6
– Outputs: D (Difference) and Br (Borrow)
14 13 3 2 0 1 1 1
A3 S3 A3 S3
12 10 1 15
A4 S4 A4 S4 1 0 1 0
6 B1 6 B1
D = A B 1 1 0 0
2 7
B2 B2 Br = A.B
15 4
B3 B3
11 16
B4 B4
7 C0 C4 9 7 C0 C4 14 A D D
A
74LS283 74LS83 B HS Br
Br
B
9
3/29/2023
ĐẠI HỌC
CÔNG NGHỆ Full Subtractor ĐẠI HỌC
CÔNG NGHỆ
Full Subtractor
10
3/29/2023
ĐẠI HỌC
CÔNG NGHỆ Full Adder vs. Full Subtractor ĐẠI HỌC
CÔNG NGHỆ
Full Adder vs. Full Subtractor
D = A B Bri FS
Bro = A.B + A.Bri + B.Bri Bro = A.B + A.Bri + B.Bri
A Bri
S D
Ci S
= A.B. A.Bri .B.Bri B A
FA CO FA BrO
( )( )
A
= ( A + B ) A + Bri B + Bri Ci CO
B
B
= ( A + B )(Br + A.B )
i
11
3/29/2023
ĐẠI HỌC
CÔNG NGHỆ
4-bit parallel Adder/Subtractor ĐẠI HỌC
CÔNG NGHỆ 4-bit parallel Adder/Subtractor
• Operation principle
• Architecture B3 B2 B1 B0
SUB / ADD
B3 B2 B1 B0
– Addition operation
SUB / ADD A3 Cin3 A2 Cin2 A1 Cin1 A0
SUB / ADD = 0
A3 Cin3 A2 Cin2 A1 Cin1 A0 FA
FA FA
FA FA
FA FA
FA
– Subtraction operation
SUB / ADD = 1 Cout3 S3 Cout2 S2 Cout1 S1 Cout0 S0
FA FA FA FA
12
3/29/2023
ĐẠI HỌC
CÔNG NGHỆ Equal comparator ĐẠI HỌC
CÔNG NGHỆ Equal comparator (cont’d)
C = A + B + A + B = ( A + B )(A + B ) = AB + A B A
C = A B + AB
➔ NXOR function B
13
3/29/2023
ĐẠI HỌC
CÔNG NGHỆ
Equal comparator (cont’d) ĐẠI HỌC
CÔNG NGHỆ 4-bit equal comparator
• Construct an 1-bit equal comparator (NXOR function) from NOT and NOR gates?
• Comparison for two 4-bit number
– A = A3 A2 A1 A0
– B = B3 B2 B1 B0 A0
B0
– Q = 1 when A = B
A1
– Q = 0 when A B
B1
Q
A2
B2
A3
B3
14
3/29/2023
ĐẠI HỌC
CÔNG NGHỆ 1-bit comparator ĐẠI HỌC
CÔNG NGHỆ
1-bit comparator (cont’d)
• Functionality
– When A > B then Y2 = 1, Y1 = Y = 0 Y2 = AB ; Y1 = A B Y = AB + AB = A B + AB
– When A < B then Y1 = 1, Y2 = Y = 0
– When A = B then Y = 1, Y1 = Y2 = 0
Y1 (A < B)
A
A B Y2 Y1 Y
Y (A = B)
0 0 0 0 1 A= B B
Y2 (A > B)
0 1 0 1 0 A< B
1 0 1 0 0 A> B
1 1 0 0 1 A= B
Y2 = AB ; Y1 = A B Y = A.B + AB = A B + AB
3/29/2023 Xuan-Tu Tran 30
3/29/2023 Xuan-Tu Tran 29
15
3/29/2023
ĐẠI HỌC
CÔNG NGHỆ
1-bit comparator (cont’d) ĐẠI HỌC
CÔNG NGHỆ
N-bit comparator
• Construct an 1-bit comparator from 2-input NOR gates (IC 7402). • Algorithm for building N-bit comparator
– A & B are two given binary N-bit numbers.
– Begin the comparison by looking at the high-order bits
– If the high-order bit of B is a 1 and that of A is 0, then A less than B
– If they are the same, either both 0 or both 1, we must look at the bits of the next higher
order.
– Continuing bit-by-bit comparison from left to right → we will eventually determine the
ordering of the two numbers (A & B).
– Using the algorithm to design 1-bit comparator and then, by cascading n of these,
produce an n-bit comparator.
16
3/29/2023
ĐẠI HỌC
CÔNG NGHỆ N-bit comparator (cont’d) ĐẠI HỌC
CÔNG NGHỆ N-bit comparator (cont’d)
• 1-bit comparator Ein Gin Ai Bi Eout Gout Eout = Ein Ai Bi + Ein Ai Bi Gout = Gin + Ein Ai Bi
– 4 inputs: Ai, Bi, Ein, and Gin
– 2 outputs: Eout, Gout
0 0 - - 0 0 = Ein ( Ai Bi + Ai Bi )
0 1 - - 0 1
Note: when Eout = Gout = 0 → Ai < Bi 1 0 0 0 1 0 = Ein ( Ai Bi )
Ai, Bi Ai 1 0 0 1 0 0 Ai Bi
Ein, Gin 00 01 11 10 1 0 1 0 0 1
00 00 00 00 00 1 0 1 1 1 0
01 01 01 01 01
Eout = Ein Ai Bi + Ein Ai Bi Ei (L)
Eout (L)
Gin = Ein ( Ai Bi + Ai Bi )
11 - - - -
Ein = Ein ( Ai Bi ) Gi (L)
Gout (L)
10 10 00 10 01
Eout, Gout Gout = Gin + Ein Ai Bi
3/29/2023 Xuan-Tu Tran 34
3/29/2023 Bi Xuan-Tu Tran 33
17
3/29/2023
ĐẠI HỌC
CÔNG NGHỆ N-bit comparator (cont’d) ĐẠI HỌC
CÔNG NGHỆ
Multiplexer (MUX)
• Why
– A single line is required to carry two or more different signals
An-1 Bn-1 A1 B1 A0 B0
• Only one signal at a time can be placed on the one line.
18
3/29/2023
ĐẠI HỌC
CÔNG NGHỆ Multiplexer (cont’d) ĐẠI HỌC
CÔNG NGHỆ Multiplexer (cont’d)
S1 S0 S1 S0
3/29/2023 Xuan-Tu Tran 38
3/29/2023 Xuan-Tu Tran 37
19
3/29/2023
ĐẠI HỌC
CÔNG NGHỆ De-multiplexer (DEMUX) ĐẠI HỌC
CÔNG NGHỆ
DEMUX (cont’d)
S1 S0 Y3 Y2 Y1 Y0 Y0 = I S 1 S 0
• Perform the reserve task of the
0 0 0 0 0 I Y1 = IS1S 0
MUX
– One data input line
0 1 0 0 I 0 Y2 = IS1 S 0
– Four data output lines
1 0 0 I 0 0 Y3 = IS1S 0
1 1 I 0 0 0
– Two control lines are needed to
select which output will be
Y0 = I S 1 S 0
connected to the input.
Y1 = IS1S 0
Y2 = IS1 S 0
Y3 = IS1S 0
20
3/29/2023
ĐẠI HỌC
CÔNG NGHỆ
DEMUX (cont’d) ĐẠI HỌC
CÔNG NGHỆ
DEMUX (cont’d)
21
3/29/2023
ĐẠI HỌC
CÔNG NGHỆ Analog MUX/DEMUX ĐẠI HỌC
CÔNG NGHỆ
Analog MUX/DEMUX (cont’d)
A B A B
D2
D3
C A
T3
C
S0 B = A when VC = H
Channel address decoder T3 T4
S1
B
3/29/2023 Xuan-Tu Tran 44
3/29/2023 Xuan-Tu Tran 43
22
3/29/2023
ĐẠI HỌC
CÔNG NGHỆ
CMOS tri-state buffer ĐẠI HỌC
CÔNG NGHỆ
Analog MUX/DEMUX (cont’d)
• Application
EN = High ➔ Y = X VDD
– MUX, DEMUX (digital and analog signals)
– Modulators, demodulators
T1
– A/D, D/A converters
– Frequency, phase, resistance control units
T1 – …
X Y
• Some MUX/DEMUX circuits
T2
– CD4051 (8-input MUX), CD4052 (2 x 4-input MUX), CD4053 (3 x 2-input MUX)
EN
T2
X Y
EN
23
3/29/2023
ĐẠI HỌC
CÔNG NGHỆ
Encoding and Decoding ĐẠI HỌC
CÔNG NGHỆ Encoding: Binary-to-complement
1110
• Decoding
original number 1011
– BCD-to-Decimal decoding inversion
2’s complement code
– BCD-to-7 segment code decoding
1’s complement 0100
– Johnson code-to-Decimal decoding
+1
2’s complement 0101
-1110
3/29/2023 Xuan-Tu Tran 47
3/29/2023 Xuan-Tu Tran 48
24
3/29/2023
ĐẠI HỌC
CÔNG NGHỆ Encoding: Binary-to-complement ĐẠI HỌC
CÔNG NGHỆ Encoding: Binary-to-complement
B3 = ( A0 + A1 + A2 ) A3 6 0 1 1 0 1 0 1 0 B2
7 0 1 1 1 1 0 0 1 A2
8 1 0 0 0 1 0 0 0
9 1 0 0 1 0 1 1 1 B3
10 1 0 1 0 0 1 1 0 A3
11 1 0 1 1 0 1 0 1
12 1 1 0 0 0 1 0 0 Binary-to-Complement encoder
13 1 1 0 1 0 0 1 1
14 1 1 1 0 0 0 1 0
3/29/2023 15 1
Xuan-Tu Tran 1 1 1 0 0 0 1
49 3/29/2023 Xuan-Tu Tran 50
25
3/29/2023
ĐẠI HỌC
CÔNG NGHỆ Encoding: Binary-to-Gray ĐẠI HỌC
CÔNG NGHỆ
Encoding: Binary-to-Gray
3/29/2023
15 1
Xuan-Tu Tran
1 1 1 1 0 0 0
51
3/29/2023 Xuan-Tu Tran 52
26
3/29/2023
ĐẠI HỌC
CÔNG NGHỆ
Encoding: Decimal-to-BCD ĐẠI HỌC
CÔNG NGHỆ
Encoding: Decimal-to-BCD
Truth table
A = L1 + L3 + L5 + L7 + L9
N L9 L8 L7 L6 L5 L4 L3 L2 L1 L0 D C B A
B = L2 + L3 + L6 + L7
0 0 0 0 0 0 0 0 0 0 1 0 0 0 0
1 0 0 0 0 0 0 0 0 1 0 0 0 0 1 C = L4 + L5 + L6 + L7 L0 L1 L2 L3 L4 L5 L6 L7 L8 L9
2 0 0 0 0 0 0 0 1 0 0 0 0 1 0 D = L8 + L9
3 0 0 0 0 0 0 1 0 0 0 0 0 1 1 D
4 0 0 0 0 0 1 0 0 0 0 0 1 0 0
5 0 0 0 0 1 0 0 0 0 0 0 1 0 1 Note: 4-input OR gates are normally C
6 0 0 0 1 0 0 0 0 0 0 0 1 1 0 constructed from 2-input NOR and 2-
input NAND gates (use De Morgan B
7 0 0 1 0 0 0 0 0 0 0 0 1 1 1
theorem to get the logic schematic).
8 0 1 0 0 0 0 0 0 0 0 1 0 0 0
9 1 0 0 0 0 0 0 0 0 0 1 0 0 1 A
27
3/29/2023
ĐẠI HỌC
CÔNG NGHỆ Decoding: BCD-to-Decimal ĐẠI HỌC
CÔNG NGHỆ
Decoding: BCD-to-Binary
Truth table
D
0
C
0
B
0
A
0
L9
0
L8
0
L7
0
L6
0
L5
0
L4
0
L3
0
L2
0
L1
0
L0
1
L0 = A B C D L5 = AB CD
0 0 0 1 0 0 0 0 0 0 0 0 1 0
L1 = AB C D L6 = A BCD
0 0 1 0 0 0 0 0 0 0 0 1 0 0
0 0 1 1 0 0 0 0 0 0 1 0 0 0 L2 = A BC D L7 = ABCD
0 1 0 0 0 0 0 0 0 1 0 0 0 0
0 1 0 1 0 0 0 0 1 0 0 0 0 0 L3 = ABC D L8 = A B C D
L4 = A B CD
0 1 1 0 0 0 0 1 0 0 0 0 0 0
0 1 1 1 0 0 1 0 0 0 0 0 0 0 L9 = AB C D
1 0 0 0 0 1 0 0 0 0 0 0 0 0
1 0 0 1 1 0 0 0 0 0 0 0 0 0
28
3/29/2023
L0 = A B C D L5 = AB CD
L1 = AB C D
ĐẠI HỌC
CÔNG NGHỆ
Decoding:
L = A BCD
6
BCD-to-Decimal ĐẠI HỌC
CÔNG NGHỆ
Decoding: BCD-to-Decimal
L2 = A BC D L7 = ABCD
L3 = ABC D L8 = A B C D • Circuit 74LS42, 74LS45, 74145
L4 = A B CD L9 = AB C D
L0 L1 L2 L3 L4 L5 L6 L7 L8 L9 – 4 inputs: A, B, C, and D
– 10 outputs: L0, L1, L2,… L9
D C B A – Logic schematic as bellow
29
3/29/2023
ĐẠI HỌC
CÔNG NGHỆ
Decoding: BCD-to-7 segment code ĐẠI HỌC
CÔNG NGHỆ
Decoding: BCD-to-7 segment code
d Common K
a a a a a
7-segmen LED
f f b f b f b
g g g g
c e c c e c c
d d d d
a b c d e f g
Common A
3/29/2023 Xuan-Tu Tran 59 3/29/2023 Xuan-Tu Tran 60
30
3/29/2023
ĐẠI HỌC
CÔNG NGHỆ
Decoding: BCD-to-7 segment code ĐẠI HỌC
CÔNG NGHỆ
Decoding: BCD-to-7 segment code
31
3/29/2023
ĐẠI HỌC
CÔNG NGHỆ
Decoding: BCD-to-7 segment code ĐẠI HỌC
CÔNG NGHỆ Decoding: Johnson-to-BCD
32
3/29/2023
ĐẠI HỌC
CÔNG NGHỆ
Decoding: Johnson-to-BCD ĐẠI HỌC
CÔNG NGHỆ Priority encoder
Y1 = P3 + P2
Y0 = P3 + P2 P1
R = P3 + P2 + P1 + P0
33