Professional Documents
Culture Documents
Digital Logic Design Combinational Logic: Mustafa Kemal Uyguroğlu
Digital Logic Design Combinational Logic: Mustafa Kemal Uyguroğlu
Combinational Logic
Combinational Circuits
Output is function of input only
i.e. no feedback
n inputs
Combinational Circuits
m outputs
1 / 65
Combinational Circuits
Analysis
Given a circuit, find out its function
Function may be expressed as:
Boolean function
A B C A B C A B A C B C F2 F1
? ?
Truth table
Design
Given a desired function, determine its circuit Function may be expressed as:
Boolean function Truth table
Eastern Mediterranean University
?
2 / 65
Analysis Procedure
Boolean Expression Approach
A B C A B C A B A C B C
F2=AB+AC+BC
F1
T2=ABC T1=A+B+C T3=AB'C'+A'BC'+A'B'C
F2=(A+B)(A+C)(B+C)
F2
F1=AB'C'+A'BC'+A'B'C+ABC F2=AB+AC+BC
3 / 65
Analysis Procedure
Truth Table Approach
A =0 B =0 C =0 A =0 B =0 C =0 A =0 B =0 A =0 C =0 B =0 C =0
A B C 0 0 0
F1
F1 0
F2 0
0 1 0 0 0 0
F2
4 / 65
Analysis Procedure
Truth Table Approach
A =0 B =0 C =1 A =0 B =0 C =1 A =0 B =0 A =0 C =1 B =0 C =1
F1
A B C 0 0 0 0 0 1
F1 0 1
F2 0 0
1 1 0 0 0 0
F2
5 / 65
Analysis Procedure
Truth Table Approach
A =0 B =1 C =0 A =0 B =1 C =0 A =0 B =1 A =0 C =0 B =1 C =0
F1
A 0 0 0
B 0 0 1
C 0 1 0
F1 0 1 1
F2 0 0 0
1 1 0 0 0 0
F2
6 / 65
Analysis Procedure
Truth Table Approach
A =0 B =1 C =1 A =0 B =1 C =1 A =0 B =1 A =0 C =1 B =1 C =1
F1
1 0 0 0 1 1
A 0 0 0 0
B 0 0 1 1
C 0 1 0 1
F1 0 1 1 0
F2 0 0 0 1
F2
7 / 65
Analysis Procedure
Truth Table Approach
A =1 B =0 C =0 A =1 B =0 C =0 A =1 B =0 A =1 C =0 B =0 C =0
F1
1 1 0 0 0 0
A 0 0 0 0 1
B 0 0 1 1 0
C 0 1 0 1 0
F1 0 1 1 0 1
F2 0 0 0 1 0
F2
8 / 65
Analysis Procedure
Truth Table Approach
A =1 B =0 C =1 A =1 B =0 C =1 A =1 B =0 A =1 C =1 B =0 C =1
F1
1 0 0 1 0 1
A 0 0 0 0 1 1
B 0 0 1 1 0 0
C 0 1 0 1 0 1
F1 0 1 1 0 1 0
F2 0 0 0 1 0 1
F2
9 / 65
Analysis Procedure
Truth Table Approach
A =1 B =1 C =0 A =1 B =1 C =0 A =1 B =1 A =1 C =0 B =1 C =0
F1
1 0 1 0 0 1
A 0 0 0 0 1 1 1
B 0 0 1 1 0 0 1
C 0 1 0 1 0 1 0
F1 0 1 1 0 1 0 0
F2 0 0 0 1 0 1 1
F2
10 / 65
Analysis Procedure
Truth Table Approach
A =1 B =1 C =1 A =1 B =1 C =1 A =1 B =1 A =1 C =1 B =1 C =1
F1
1 0 1 1 1 1
F2
A 0 0 0 0 1 1 1 1
B 0 0 1 1 0 0 1 1
C 0 1 0 1 0 1 0 1
F1 0 1 1 0 1 0 0 1
F2 0 0 0 1 0 1 1 1
B 0 A 1 1 0 C 0 1 1 0 A 0 0 0 1 C 1 1
B 0 1
F1=AB'C'+A'BC'+A'B'C+ABC
F2=AB+AC+BC
11 / 65
Design Procedure
Given a problem statement:
Determine the number of inputs and outputs
Derive the truth table Simplify the Boolean expression for each output
Example:
Design a circuit to convert a BCD code to Excess 3 code
4-bits 0-9 values
4-bits Value+3
12 / 65
Design Procedure
BCD-to-Excess 3 Converter
A B 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1 1 C 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 D 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 w 0 0 0 0 0 1 1 1 1 1 x x x x x x x 0 1 1 1 1 0 0 0 0 1 x x x x x x y 1 0 0 1 1 0 0 1 1 0 x x x x x x z 1 0 1 0 1 0 1 0 1 0 x x x x x x
1 x 1 1 x x
C
1 1 x x 1 x x
C
1 x x
x 1
B A
1 x
x 1
w = A+BC+BD
C
1 1 x 1 1 1 x x
x = BC+BD+BCD
C
x x
B
A
1 1 x 1
x x
1 1 x x
D y = CD+CD
Eastern Mediterranean University
D z = D
13 / 65
Design Procedure
BCD-to-Excess 3 Converter
A B 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1 1 C 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 D 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 w 0 0 0 0 0 1 1 1 1 1 x x x x x x x 0 1 1 1 1 0 0 0 0 1 x x x x x x y 1 0 0 1 1 0 0 1 1 0 x x x x x x z 1 0 1 0 1 0 1 0 1 0 x x x x x x
A
x
B
y z
w = A + B(C+D) x = B(C+D) + B(C+D)
Eastern Mediterranean University
y = (C+D) + CD z = D
14 / 65
Seven-Segment Decoder
a
w 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 x 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 y 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 z 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 abcdefg 1111110 0110000 1101101 1111001 0110011 1011011 1011111 1110000 1111111 1111011 xxxxxxx xxxxxxx xxxxxxx xxxxxxx xxxxxxx xxxxxxx
w x y z
?
BCD code
y
1 x 1 1 x 1 1 1 x x 1 1 x x
a b c d e f g
f e
d
b c
z a = w + y + xz + xz
Eastern Mediterranean University
15 / 65
Binary Adder
Half Adder
Adds 1-bit plus 1-bit
Produces Sum and Carry x y 0 0 1 1 0 1 0 1 C 0 0 0 1 S 0 1 1 0
x y
HA x + y C S
S C
x y
S C
16 / 65
Binary Adder
Full Adder
Adds 1-bit plus 1-bit plus 1-bit
Produces Sum and Carry x y 0 0 0 0 0 1 0 1 1 0 1 0 1 1 1 1 z 0 1 0 1 0 1 0 1
x y z
FA x + y + z C S
S C
C 0 0 0 1 0 1 1 1
S 0 1 1 0 1 0 0 1
y 0 x 1 1 0 0 1 1 0
z S = xy'z'+x'yz'+x'y'z+xyz = x y z y 0 0 1 0 x 0 1 1 1 z C = xy + xz + yz
Eastern Mediterranean University
17 / 65
Binary Adder
Full Adder
x y z x y z x y z x y z
S = xy'z'+x'yz'+x'y'z+xyz = x y z C = xy + xz + yz
x y z
x y x z y z
S x y z C
x y
x z y z
18 / 65
Binary Adder
Full Adder
x y z x S y z
Eastern Mediterranean University
HA
HA
S C
19 / 65
Binary Adder
x3x2x1x0 y3y2y1y0 Carry Propagate Addition
Cy
Binary Adder
S3S2S1S0
C0
c3 c2 c1 . + x3 x2 x1 x0 + y3 y2 y1 y0 Cy S3 S2 S1 S0
x3 y3
x2 y2
x1 y1
x0 y0
0 FA
C4 C3
FA
C2
FA
C1
FA
S3
S2
S1
S0
20 / 65
Binary Adder
Carry Propagate Adder
x7 x6 x 5 x4
y7 y6 y5 y4
x3 x2 x1 x 0
y3 y2 y1 y0
A3 A2 A1 A0 B3 B2 B1 B0 Cy
A3 A2 A1 A0 B3 B2 B1 B0
Cy
CPA
S3 S2 S1 S0
C0
CPA
S3 S2 S1 S0
C0
S7 S6 S5 S 4
S3 S2 S1 S0
21 / 65
Carry propagation
When the correct outputs are available The critical path counts (the worst case) (A1, B1, C1) C2 C3 C4 (C5, S4) When 4-bits full-adder 8 gate levels (n-bits: 2n gate levels)
22 / 65
Parallel Adders
Reduce the carry propagation delay
Employ faster gates Look-ahead carry (more complex mechanism, yet faster)
23 / 65
24 / 65
25 / 65
BCD Adder
4-bits plus 4-bits
+ x3 x2 x1 x0 + y3 y2 y1 y0 Cy S3 S2 S1 S0
=9 0 =A 0 =2 0
Invalid Code
Wrong BCD Value
26 / 65
1 0 0 1 = 12 1
BCD Adder
X +Y 9+0 9+1 9+2 9+3 9+4 9+5 9+6 9+7 9+8 9+9 x3 x2 x1 x0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 y3 y2 y1 y0 Sum Cy S3 S2 S1 S0 Required BCD Output Value 0 0 0 0 0 0 0 0 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 0 0 1 1 0 0 0 1 0 1 0 1 0 1 0 1 =9 = 10 = 11 = 12 = 13 = 14 = 15 = 16 = 17 = 18 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1 0 0 0 0 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 1 1 1 0 0 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 0 1 0 =9 = 16 = 17 = 18 = 19 = 20 = 21 = 22 = 23 = 24
+6
Eastern Mediterranean University
27 / 65
BCD Adder
Correct Binary Adders Output (+6)
If the result is between A and F
If Cy = 1
S3 S2 S1 S0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 Err 0 0 0 1 1 1 1 1 1
1 1 1 1
S1 S2
S3
1 1
S0 Err = S3 S2 + S3 S1
28 / 65
BCD Adder
x3 x2 x1 x0 y3 y2 y1 y0
A3 A2 A1 A0 B3 B2 B1 B0 Cy Binary Adder Ci S3 S2 S1 S0
Err
A3 A2 A1 A0 B3 B2 B1 B0 Cy Binary Adder Ci S3 S2 S1 S0 Cy S3 S2 S1 S0
Eastern Mediterranean University
29 / 65
Binary Subtractor
Use 2s complement with binary adder
x y = x + (-y) = x + y + 1
x3 x2 x1 x0 y3 y2 y1 y0
A3 A2 A1 A0 B3 B2 B1 Cy Binary Adder S3 S2 S1 S0 F3 F2 F1 F0
Eastern Mediterranean University
B0 Ci
30 / 65
Binary Adder/Subtractor
M: Control Signal (Mode)
M=0 F = x + y
M=1 F = x y
x3 x2 x1 x0
y3
y2
y1
y0
A3 A2 A1 A0 B3 B2 B1 Cy Binary Adder S3 S2 S1 S0 F3 F2 F1 F0
B0 Ci
31 / 65
Overflow
Unsigned Binary Numbers x
3
x2 y2
x1 y1
y3
x0 y0
0
FA FA FA FA
Carry
C4
S3 x3 y3
C3
S2 x2 y2
C2
S1 x1 y1
C1
S0 x0 y0 0
2s Complement Numbers
FA
FA
FA
FA
Overflow
C4
S3
C3
S2
C2
S1
C1
S0
32 / 65
Magnitude Comparator
Compare 4-bit number to 4-bit number
3 Outputs: < , = , >
Expandable to more number of bits
x3 A3 B3 A3 B3
x2 A2 B2 A2 B2
x1 A1 B1 A1 B1
x0 A0 B0 A0 B0
( A B) x3 x2 x1 x0 ( A B ) A3 B3 x3 A2 B2 x3 x2 A1 B1 x3 x2 x1 A0 B0 ( A B ) A3 B3 x3 A2 B2 x3 x2 A1 B1 x3 x2 x1 A0 B0
Eastern Mediterranean University
33 / 65
Magnitude Comparator
A3 x3 B3 A2 x2 B2 A1 x1 B1 A0 x0 B0 (A=B)
Eastern Mediterranean University
(A<B)
(A>B)
34 / 65
Magnitude Comparator
x7 x6 x 5 x4
y7 y6 y5 y4
x 3 x2 x1 x0
y3 y2 y1 y0
0 1 0
A3 A2 A1 A0 B3 B2 B1 B0
A3 A2 A1 A0 B3 B2 B1 B0
35 / 65
Decoders
Extract Information from the code
Only one lamp will turn on
Binary Decoder
Example: 2-bit Binary Number
x1
x0 0
1 0 Binary Decoder 0 0
36 / 65
Decoders
2-to-4 Line Decoder
I1 y3 y2 y1 y0 Binary Decoder
Y3 Y2 Y1 Y0
I0 I1 I0
0 0 1 1 0 1 0 1
Y3 Y2 Y1 Y0
0 0 0 1 0 0 1 0 0 1 0 0 1 0 0 0
I1 I0
Y3 I1 I 0
Y1 I1 I 0
Y2 I1 I 0 Y0 I1 I 0
37 / 65
Decoders
3-to-8 Line Decoder
Y7 Y6 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 Y2 Y1 Y0
x y z
I2 I1 I0
Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0
C
Eastern Mediterranean University
C
43 / 65
Uses of decoders
44 / 65
Encoders
Put Information into code
Only one switch should be activated at a time x3 x2 x1 y1 y0
Binary Encoder
Example: 4-to-2 Binary Encoder x1
x2
x3
Binary Encoder
y1
y0
0 0 0 1
0 0 1 0
0 1 0 0
0 0 1 1
0 1 0 1
45 / 65
Encoders
Octal-to-Binary Encoder (8-to-3)
I7 0 0 0 0 0 0 0 1 I6 0 0 0 0 0 0 1 0 I5 0 0 0 0 0 1 0 0 I4 0 0 0 0 1 0 0 0 I3 0 0 0 1 0 0 0 0 I2 0 0 1 0 0 0 0 0 I1 0 1 0 0 0 0 0 0 I0 1 0 0 0 0 0 0 0 Y2 Y1 Y0 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 I7 I6 I5 I4 I3 I2 I1 I0
Binary Encoder
Y2 Y1 Y0
Y2 I 7 I 6 I 5 I 4 Y1 I 7 I 6 I 3 I 2 Y0 I 7 I 5 I 3 I1
I7 I6 I5 I4 I3 I2 I1 I0
Y2
Y1
Y0
46 / 65
Priority Encoders
4-Input Priority Encoder
I3 I2 I1 I0 0 0 0 0 1
Y1
0 0 0 1 x
I1
0 0 1 x x
0 1 x x x
Y1 Y0 V 0 0 0 0 0 1 0 1 1 1 0 1 1 1 1
I3 I2 I1 I0
Priority Encoder
V Y1 Y0
I3 I2 I1
Y0
Y1 I 3 I 2
I2
1 1 1 1
Y1 I0 V
I3
1 1 1 1
Y0 I 3 I 2 I1 V I 3 I 2 I1 I 0
1 1 1 1
I0
47 / 65
Binary Decoder
Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0
Y2 Y1 Y0
I2 I1 I0
48 / 65
Multiplexers
S1 S0
0 0 1 1
0 1 0 1
I0 I1 I2 I3
I0 I1 MUX Y I2 I3 S1 S0
49 / 65
Multiplexers
2-to-1 MUX
I0
I0 MUX Y I1 S
Y I1 S
4-to-1 MUX
I0 I1 MUX Y I2 I3 S1 S0
I0 I1 I2 I3 Y
S1
Eastern Mediterranean University
S0
50 / 65
Multiplexers
Quad 2-to-1 MUX A
x3
3
Y3 A2
y3
I0 MUX Y I1 S
I0 MUX Y I1 S I0 MUX Y I1 S I0 MUX Y I1 S S
Y2 A1 A0 B3 B2 B1 Y1 Y0
x2
y2
x1
y1
B0
A3 A2 A1 A0
x0
y0
Y3 Y MUX 2 Y1 B3 Y0 B2 B1 B0 S E
51 / 65
Multiplexers
Quad 2-to-1 MUX
A3 Y3 A2 Y2 A1 A0 B3 B2 B1 B0 Y1 Y0
A3 A2 A1 A0
Y3 Y2 MUX Y1 B3 Y0 B2 B1 B0 S E
Extra Buffers
S E
Eastern Mediterranean University
52 / 65
x y
53 / 65
I0 I1 I2 I3 Y I4 MUX I5 I6 I7 S2 S1 S0
x y z
54 / 65
z z 0 1
I0 I1 MUX Y I2 I3 S1 S0
x y
55 / 65
D D D 0 0 D 1 1
F=D
F=1 F=1
I0 I1 I2 I3 Y MUX I4 I5 I6 I7 S2 S1 S0 A B C
56 / 65
Multiplexer Expansion
8-to-1 MUX using Dual 4-to-1 MUX
I0 I1 I2 I3
I0 I1 MUX Y I2 I3 S1 S0 I0 I1 MUX Y I2 I3 S1 S0
I4 I5 I6 I7
I0 MUX Y I1 S
57 / 65
DeMultiplexers
Y3 Y2 I DeMUX Y 1 S S Y0
1 0
Y3 Y2 I Y1 Y0
S1 S0
0 0 1 1 0 1 0 1
Y3 Y2 Y1 Y0
0 0 0 I 0 0 I 0 0 I 0 0 I 0 0 0
58 / 65
S1 S0
S2 S1 S0 Synchronize
Eastern Mediterranean University
S2 S1 S0
x2 x1 x0
y2 y1 y0
59 / 65
DeMultiplexers / Decoders
Y3 Y2 I DeMUX Y 1 S S Y0
1 0
I1 I0 E
Y3 Y2 Y1 Y0
E
S1 S0 0 0 1 1 0 1 0 1 Y3 Y2 Y1 Y0 0 0 0 I 0 0 I 0 0 I 0 0 I 0 0 0 0 1 1 1 1
I1 I0
x 0 0 1 1 x 0 1 0 1
Binary Decoder 0 0 0 0 1 0 0 0 1 0
Y 3 Y2 Y1 Y0
0 0 1 0 0 0 1 0 0 0
60 / 65
Three-State Gates
Tri-State Buffer
C A A Y 0 x 1 0 1 1 A Y Hi-Z 0 1 Y
Tri-State Inverter
C
61 / 65
Three-State Gates
A C B Y C D 0 0 1 1 0 1 0 1 Y Hi-Z B A ? Not Allowed A
D C
Y= B
Eastern Mediterranean University
A
B
if C = 1
if C = 0
62 / 65
Three-State Gates
I3
I2
Y I1
I0 S1 S0 E I1 I0 E Y3 Y2 Y1 Y0
63 / 65
Binary Decoder
Binary multiplication
64 / 65
2-bit by 2-bit
Binary Multiplication
65 / 65
66 / 65