Lec Combinational Circuits
Lec Combinational Circuits
Combinational Combinational
inputs : : Logic :: outputs inputs : : Logic :: outputs
Memory
Combinational
n inputs • • m outputs
• Circuits •
• •
When input changes, output may change (after a delay)
Design
● Given a desired function, determine its circuit
● Function may be expressed as:
♦ Boolean function
♦ Truth table
F2 = (A'+B')' = AB
A'+B'
▪ Steps: A B (A+B) (A'+B') F1 F2
0 0 0 1 0 0
1. Label the inputs and outputs.
0 1 1 1 1 0
2. Obtain the functions of 1 0 1 1 1 0
intermediate points and the outputs. 1 1 1 0 0 1
3. Draw the truth table.
4. Deduce the functionality of the circuit Half adder.
A
B
F1
C T2=ABC
A T1=A+B+C
B T3=AB'C'+A'BC'+A'B'C
C
A
B F’2=(A’+B’)(A’+C’)(B’+C’)
A
F2
C
F2=AB+AC+BC
B
C
F1=AB'C'+A'BC'+A'B'C+ABC
F2=AB+AC+BC
A =0 0 0
F2
C =0
B =0 0
C =0
A =0 0 0
F2
C =1
B =0 0
C =1
A =0 0 0
F2
C =0
B =1 0
C =0
A =0 0 1
F2
C =1
B =1 1
C =1
A =1 0 0
F2
C =0
B =0 0
C =0
A =1 1 1
F2
C =1
B =0 0
C =1
B =1 0
C =0
F1=AB'C'+A'BC'+A'B'C+ABC F2=AB+AC+BC
Dr. Babar Mansoor Fundamentals of Digital Logic Design 14
Combinational Circuits – Design Procedure
Given a problem statement:
● Determine the number of inputs and outputs
● Derive the truth table
● Simplify the Boolean expression for each output
● Produce the required circuit
Example:
Design a circuit to convert a “BCD” code to “Excess 3”
code
➢ 4-bits ➢ 4-bits
➢ 0-9 values
? ➢ Value+3
BCD-to-Excess 3 Converter
C C
A B C D w x y z
1 1 1
0 0 0 0 0 0 1 1
1 1 1 1
0 0 0 1 0 1 0 0 B B
x x x x x x x x
0 0 1 0 0 1 0 1 A A
1 1 x x 1 x x
0 0 1 1 0 1 1 0
D D
0 1 0 0 0 1 1 1
0 1 0 1 1 0 0 0 w = A+BC+BD x = B’C+B’D+BC’D’
0 1 1 0 1 0 0 1
0 1 1 1 1 0 1 0 C C
1 0 0 0 1 0 1 1 1 1 1 1
1 0 0 1 1 1 0 0 1 1 1 1
1 0 1 0 x x x x x x x x
B x x x x
B
A 1 x x
A 1 x x
1 0 1 1 x x x x
1 1 0 0 x x x x D D
1 1 0 1 x x x x
1 1 1 0 x x x x y = C’D’+CD z = D’
1 1 1 1 x x x x
Dr. Babar Mansoor Fundamentals of Digital Logic Design 16
Combinational Circuits – Design Procedure
BCD-to-Excess 3 Converter
A B C D w x y z A
0 0 0 0 0 0 1 1 w
0 0 0 1 0 1 0 0
0 0 1 0 0 1 0 1
0 0 1 1 0 1 1 0
0 1 0 0 0 1 1 1 x
B
0 1 0 1 1 0 0 0
0 1 1 0 1 0 0 1
0 1 1 1 1 0 1 0
1 0 0 0 1 0 1 1 C y
1 0 0 1 1 1 0 0
1 0 1 0 x x x x
D z
1 0 1 1 x x x x
1 1 0 0 x x x x
1 1 0 1 x x x x w = A + B(C+D) y = (C+D)’ + CD
1 1 1 0 x x x x x = B’(C+D) + B(C+D)’ z = D’
1 1 1 1 x x x x
Dr. Babar Mansoor Fundamentals of Digital Logic Design 17
Combinational Circuits – Design Procedure
Seven Segment Decoder a
w x y z abcdefg
w a
0 0 0 0 1111110 b
0 0 0 1 0110000 x c f b
? d g
0 0 1 0 1101101 y e
0 0 1 1 1111001 z f
g
0 1 0 0 0110011 e c
0 1 0 1 1011011 BCD code
0 1 1 0 1011111
0 1 1 1 1110000 y d
1 0 0 0 1111111 1 1 1
1 0 0 1 1111011 1 1 1
1 0 1 0 xxxxxxx x x x x
x
1 0 1 1 xxxxxxx w 1 1 x x
1 1 0 0 xxxxxxx z
1 1 0 1 xxxxxxx
1 1 1 0 xxxxxxx a = w + y + xz + x’z’ b=...
c=...
1 1 1 1 xxxxxxx
d=...
Dr. Babar Mansoor Fundamentals of Digital Logic Design 18
Combinational Circuits - Binary Adder
Half Adder x S
y HA
C
● Adds 1-bit plus 1-bit
● Produces Sum and Carry x
+ y
───
x y C S C S
0 0 0 0
0 1 0 1 x S
1 0 0 1
1 1 1 0
y C
Full Adder x S
y FA
z C
● Adds 1-bit plus 1-bit plus 1-bit
● Produces Sum and Carry x
+ y
y + z
x y z C S ───
0 1 0 1
0 0 0 0 0 C S
0 0 1 0 1 x 1 0 1 0
z
0 1 0 0 1
S = xy'z'+x'yz'+x'y'z+xyz = x y z
0 1 1 1 0
y
1 0 0 0 1
0 0 1 0
1 0 1 1 0
x 0 1 1 1
1 1 0 1 0
z
1 1 1 1 1 C = xy + xz + yz
Dr. Babar Mansoor Fundamentals of Digital Logic Design 20
Combinational Circuits – Binary Adder
Full Adder
x S
y HA HA
z C
x
S
y
C
x3 x2 x1 x0
y3 y2 y1 y0
0
FA FA FA FA
C4 C3 C2 C1
S3 S2 S1 S0
Dr. Babar Mansoor Fundamentals of Digital Logic Design 23
4-bit Ripple Carry Adder (RCA)
x3 x2 x1 x0
y3 y2 y1 y0
0
FA FA FA FA
C4 S C3 C2 C1
3 S2 S1 S0
x7 x6 x5 x4 x3 x2 x1 x0
y7 y6 y5 y4 y3 y2 y1 y0
A3 A2 A1 A0 B3 B2 B1 B0 A3 A2 A1 A0 B3 B2 B1 B0
Cy CPA C0 Cy CPA C0 0
S3 S2 S1 S0 S3 S2 S1 S0
S7 S6 S5 S4 S3 S2 S1 S0
• Propagation delay of
𝐶3 , 𝐶2 and 𝐶1 are
equal.
4-bit carry-look
ahead adder
a3 a2 a1 a0 b3 b2 b1 b0
A3 A2 A1 A0 B3 B2 B1 B0
Cy Binary Adder Ci 1
S3 S2 S1 S0
D3 D2 D1 D0
A3 A2 A1 A0
B3 B2 B1 B0
1
FA FA FA FA
D3 D2 D1 D0
M IN F
● M=0 ➔ F = IN
0 0 0
0 1 1 ● M=1 ➔ F = IN’
1 0 1
1 1 0 IN
F
M
A3 A2 A1 A0 B3 B2 B1 B0
Cy Binary Adder Ci
S3 S2 S1 S0
F3 F2 F1 F0
Dr. Babar Mansoor Fundamentals of Digital Logic Design 33
Binary Adder/Subtractor
Multiplier: 𝑀 = 𝑚3 𝑚2 𝑚1 𝑚0
Multiplicand: Q = 𝑞3 𝑞𝑞1 𝑞0
Product: P = 𝑝7 𝑝6 𝑝5 𝑝4 𝑝3 𝑝2 𝑝1 𝑝0
❖ Two Inputs:
Unsigned integer A (m-bit number)
1 0 1
Some device
0 1 2 3 4 5 6 7
2n Outputs
n Inputs
n to 2n
than 2n outputs if some
Decoder
input codes are unused
▪ Example: If codes 00, 01, 10, 11 are used to identify four light
bulbs, we may use a 2-bit decoder.
2x4
F0 Bulb 0
2-bit X DEC F Bulb 1
1
code Y
F2 Bulb 2
F3 Bulb 3
0 d0 Circuit
4 Outputs
2 Inputs
a1 1 2-to-4 1 d1
a0 0
Decoder 2 d2 𝑎1
3 d3 𝑑0 = 𝑎1′ 𝑎0′
𝑎0
Truth Table 𝑑1 = 𝑎1′ 𝑎0
𝑑2 = 𝑎1 𝑎0′
Inputs Outputs
a1 a0 d0 d1 d2 d3 𝑑3 = 𝑎1 𝑎0
0 0 1 0 0 0
0 1 0 1 0 0
1 0 0 0 1 0 Each decoded output is a
1 1 0 0 0 1 minterm of 2 variables
Dr. Babar Mansoor Fundamentals of Digital Logic Design 50
Decoders
Inputs Outputs
0 d0
1 d1 a 2 a 1 a 0 d0 d1 d2 d3 d4 d5 d 6 d7
2 d2 0 0 0 1 0 0 0 0 0 0 0
a2
8 Outputs
2
3 Inputs
0 0 1 0 1 0 0 0 0 0 0
3-to-8 3 d3
a1 1 0 1 0 0 0 1 0 0 0 0 0
4 d4
a0 0 Decoder 0 1 1 0 0 0 1 0 0 0 0
5 d5 1 0 0 0 0 0 0 1 0 0 0
6 d6 1 0 1 0 0 0 0 0 1 0 0
7 d7 1 1 0 0 0 0 0 0 0 1 0
1 1 1 0 0 0 0 0 0 0 1
1 0 1 0 1 0 0
E
1 1 0 0 0 1 0
𝑎1
1 1 1 0 0 0 1
𝑎0 𝑑0 = 𝐸𝑎1′ 𝑎0′
𝑑1 = 𝐸𝑎1′ 𝑎0
If E input is zero then all
outputs are zeros, regardless 𝑑2 = 𝐸𝑎1 𝑎0′
of a1 and a0
𝑑3 = 𝐸𝑎1 𝑎0
𝐸
Dr. Babar Mansoor Fundamentals of Digital Logic Design 53
Decoders
2-to-4 Decoder with Active Low Enable Input
Inputs Outputs 0 d0
a1 1
E a1 a0 d0 d1 d2 d3 2-to-4 1 d1
a0 0
d2
Decoder 2
1 X X 0 0 0 0
3 d3
0 0 0 1 0 0 0
0 0 1 0 1 0 0
E
0 1 0 0 0 1 0
𝑎1
0 1 1 0 0 0 1
𝑎0 𝑑0 = 𝐸′𝑎1′ 𝑎0′
𝑑1 = 𝐸′𝑎1′ 𝑎0
If E input is 1then all
outputs are zeros, 𝑑2 = 𝐸′𝑎1 𝑎0′
regardless of a1 and a0
𝑑3 = 𝐸′𝑎1 𝑎0
𝐸
Dr. Babar Mansoor Fundamentals of Digital Logic Design 54
Decoders
Constructing Larger Decoders with Smaller Ones
• A 3-to-8 decoder can be built using:
Two 2-to-4 decoders with Enable and an inverter
Inputs Outputs
a2
a 2 a 1 a 0 d0 d1 d2 d3 d4 d5 d6 d7 a 0 d0
1 1 Top 1 d1
0 0 0 1 0 0 0 0 0 0 0 a0 0 2-to-4
Decoder
2 d2
0 0 1 0 1 0 0 0 0 0 0
EN 3 d3
0 1 0 0 0 1 0 0 0 0 0
0 1 1 0 0 0 1 0 0 0 0
1 0 0 0 0 0 0 1 0 0 0 0 d4
1 Bottom
1 0 1 0 0 0 0 0 1 0 0 1 d5
0 2-to-4
1 1 0 0 0 0 0 0 0 1 0 Decoder
2 d6
1 1 1 0 0 0 0 0 0 0 1
EN 3 d7
Homework
Construct a 5-to-32 decoder using 2-to-4 decoders
Construct 4-to-16 decoder using 3-to-8 decoders
Construct 5-to-32 decoder using 3-to-8 decoders
a
I3 BCD to b
❖ BCD to 7-Segment Decoder I2 c
7-Segment d
I1 e
Called also a decoder, but not a binary decoder Decoder f
I0
g
Accepts as input a BCD decimal digit (0 to 9)
Generates output to the seven LED segments to display the BCD digit
Each segment can be turned on or off separately
Dr. Babar Mansoor Fundamentals of Digital Logic Design 58
BCD to 7-Segment Decoder
Specification: Truth Table
Input: 4-bit BCD (I3, I2, I1, I0) BCD input 7-Segment Output
I3 I2 I 1 I 0 a b c d e f g
Output: 7-bit (a, b, c, d, e, f, g) 0 0 0 0 1 1 1 1 1 1 0
0 0 0 1 0 1 1 0 0 0 0
Display should be OFF for Non-BCD 0 0 1 0 1 1 0 1 1 0 1
input codes. 0 0 1 1 1 1 1 1 0 0 1
0 1 0 0 0 1 1 0 0 1 1
Implementation can use: 0 1 0 1 1 0 1 1 0 1 1
0 1 1 0 1 0 1 1 1 1 1
A binary decoder 0 1 1 1 1 1 1 0 0 0 0
1 0 0 0 1 1 1 1 1 1 1
Additional gates
1 0 0 1 1 1 1 1 0 1 1
1010 to 1111 0 0 0 0 0 0 0
9 f 1010 – 1111 0 0 0 0 0 0 0
𝐼3 (𝐼2 + 𝐼1 ) g
Input > 9
NOR gate is used for 0's
Dr. Babar Mansoor Fundamentals of Digital Logic Design 60
Implementing Boolean Functions Using Decoders
❖ A decoder generates all the minterms
❖ A Boolean function can be expressed as a sum of minterms
❖ Any function can be implemented using a decoder + OR gate
Note: the function must not be minimized
❖ Example: Full Adder sum = ∑(1, 2, 4, 7), cout = ∑(3, 5, 6, 7)
Inputs Outputs
d0
a b c cout sum
d1
0 0 0 0 0 sum
0 0 1 0 1 d2
a 2
0 1 0 0 1 3-to-8 d3
b 1
0 1 1 1 0 d
1 0 0 0 1 c 0 Decoder 4 cout
d5
1 0 1 1 0
d6
1 1 0 1 0
1 1 1 1 1 d7
Dr. Babar Mansoor Fundamentals of Digital Logic Design 61
Implementing Boolean Functions Using Decoders
d0
0
A 1 d
2-to-4 1 1
B 0 d2 F
Decoder 2
d3
3
Homework
Implement 𝐹 = 𝐴 + 𝐵𝐶 using decoders
0 0 0 0 1 1 1
0 0 1 1 0 1 1 𝑎1
0 1 0 1 1 0 1
𝑎0 𝑑0 = (𝐸𝑁 ′ 𝑎1′ 𝑎0′ )′
0 1 1 1 1 1 0
𝑑1 = (𝐸𝑁 ′ 𝑎1′ 𝑎0 )′
d0
0
A 1 d1=(A’B)’
1
2-to-4
B 0 F
Decoder d2=(AB’)’
2
3 d3
0 0
3x8 1 3x8 1
Dec 2 Dec 2
Q 3 f(Q,X,P) Q 3 f(Q,X,P)
4 4
X X
5 5
P 6 P 6 (m0'·m1'·m4'·m6'·m7)'
7 7 =m0+m1+m4+m6+m7
(a) Active-high decoder with OR gate. (b) Active-low decoder with NAND gate.
0 0
3x8 1 3x8 1
Dec 2 f(Q,X,P) Dec 2
f(Q,X,P)
Q 3 Q 3
4 4
X X
5 (m2+m3+m5)' 5 m2'·m3'·m5'
P 6 = m2'·m3'·m5' P 6 = M2·M3·M5
7 = M2·M3·M5 7
(c) Active-high decoder with NOR gate. (d) Active-low decoder with AND gate.
n Outputs
2n Inputs
2n to n
than 2n inputs if some input
Encoder
lines are unused
8-to-3 2 a2
8 Inputs
0 0 0 0 0 0 1 0 0 0 1
d3 3
a1 0 0 0 0 0 1 0 0 0 1 0
d4 4 Binary 1
0 a0 0 0 0 0 1 0 0 0 0 1 1
d5 5 Encoder 0 0 0 1 0 0 0 0 1 0 0
d6 6 0 0 1 0 0 0 0 0 1 0 1
d7 7 0 1 0 0 0 0 0 0 1 1 0
1 0 0 0 0 0 0 0 1 1 1
d3
a1
d2
Output Expressions:
𝑎1 = 𝑑3 + 𝑑2 a0
𝑎0 = 𝑑3 + 𝑑1 𝑑2′ d1
𝑉 = 𝑑3 + 𝑑2 + 𝑑1 + 𝑑0 V
d0
Dr. Babar Mansoor Fundamentals of Digital Logic Design 72
Multiplexers
❖ Selecting data is an essential function in digital systems
2n Inputs
An n-bit select input S used for control
d2
Mux
. Y
One output Y .
.
❖ The n-bit select input directs one of the data d2n–1
n
inputs to the output
S
if (S == 0) Y = d0 ; Inputs Output
else Y = d1; d0 0 S d0 d1 Y
Mux
Y 0 0 X 0 = d0
d1 1 0 1 X 1 = d0
Logic expression: 1 X 0 0 = d1
𝑌 = 𝑑0 𝑆 ′ + 𝑑1 𝑆 S 1 X 1 1 = d1
d0 0
Mux
𝑌 = 𝑑0 𝑆 ′ + 𝑑1 𝑆
d1 1
S
d0
Y
d1
if (S1S0 == 00) Y = d0 ;
else if (S1S0 == 01) Y = d1; Inputs Output
else if (S1S0 == 10) Y = d2; S1 S0 d0 d1 d2 d3 Y
0 0 0 X X X 0 = d0
else Y = d3; 0 0 1 X X X 1 = d0
d0 0
0 1 X 0 X X 0 = d1
d1 1
Mux
𝑌 0 1 X 1 X X 1 = d1
d2 2
1 0 X X 0 X 0 = d2
d3 3 1 0 X X 1 X 1 = d2
1 1 X X X 0 0 = d3
S1 S0 1 1 X X X 1 1 = d3
Logic expression:
𝑌 = 𝑑0 𝑆1′ 𝑆0′ + 𝑑1 𝑆1′ 𝑆0 + 𝑑2 𝑆1 𝑆0′ + 𝑑3 𝑆1 𝑆2
4-to-1 Multiplexer
d0
d1
d0 0
d1 1 d2 Y
Mux
S1S0 S1
S0
Mux
d1 1 0 0 0 d0 d2 2
d2 2 0 0 1 d1
8-to-1 Mux
0 1 0 d2 d3 3
d3 3 0
Y 0 1 1 d3
Mux
d4 4 1 0 0 d4 S1S0 Y
1
d5 5 1 0 1 d5
1 1 0 d6 d4 0
d6 6 1 1 1 d7 S2
d5 1
Mux
d7 7
d6 2
S2S1S0 d7 3
S1S0
Dr. Babar Mansoor Fundamentals of Digital Logic Design 78
Building Larger Multiplexers
d0 0
Mux
d0 0 d1 1
0
d1 1
Mux
Mux
𝑌 S0 Y
d2 2 1
d2 0
d3
Mux
3
S1
d3 1
S1S0
S0
Homework
Construct an 8-to-1 Mux using 2-to-1 Muxes
Construct 16-to-1 Mux using 8-to-1 Muxes
Construct 16-to-1 Mux using 4-to-1 Muxes
Construct 16-to-1 Mux using 2-to-1 Muxes
A [m–1:0] 0
A [m–1:0] 0 m
m B [m–1:0] 1
Mux
Mux
Y [m–1: 0] m Y [m–1: 0]
B [m–1:0] m C [m–1:0] 2 m
1 m
m D [m–1:0] 3
m
S
S1S0
8-to-1 Mux
used as select 0 0 1 1
0 1 0 1
0 3
lines to a Mux. F
0 1 1 0 0 4
An 8-to-1 1 0 0 0 0 5
Mux is used 1 0 1 0 1 6
1 1 0 1 1 7 0
because there 2
1
1 1 1 1
are 3 variables
S2 S1 S0 = a b c
Dr. Babar Mansoor Fundamentals of Digital Logic Design 82
Implementing Boolean Function with Multiplexers
❖ Re-implement F(a, b, c) = ∑(1, 2, 6, 7) using a 4-to-1 Mux
❖ We will use the two select lines for variables a and b
❖ Variable c and its complement are used as inputs to the Mux
4-to-1 Mux
0 1 0 1
F = c' c' 1
0 1 1 0
F
1 0 0 0
F=0 0 2
1 0 1 0
0
1 1 0 1 1 3 1
F=1
1 1 1 1
S1 S0 = a b
Dr. Babar Mansoor Fundamentals of Digital Logic Design 83