03 Combinational Circuits
03 Combinational Circuits
Neeraj Goel
IIT Ropar
Objectives
• Commonly used combinational circuits
– Multiplexers, decoders, encoders
• Arithmetic circuits
– Adders and multipliers
• Design and analysis of combinational circuits
• Programmable logic devices (PLDs)
– PALs, CPLDs, FPGAs
I0 What if N ≠2k
N-to-1 MUX
I1
Z
IN-2
IN-1
4 to-1
To I3 MUX
I4
4 to-1
MUX
To I7 Z
4 to-1
MUX
I8
4 to-1
MUX
c3c2
To I11
I12
4 to-1
MUX
To I15
2-to-1 MUX
I01
2-to-1 MUX
I02 4
2-to-1 MUX
I03 Z
2-to-1 MUX
I04 Z1 4
2-to-1 MUX
Z2 I1
I11 Z3
I12 Z4
I13
I14
C C
C
C
C
4x1 Memory
4-to-1 MUX
0 0
0 1 Z = A AND B
0 2
1 3
A B
4-to-1 MUX
If(a == 0) 4 4
15 Z
z = 10 0
4
4
else if (a == 1) ?
z = 15 2
a
else if (a == 2)
z = 0 Q: Can’t we make 3:1 mux?
3-to-1 MUX
4 4
construct 15
4
Z
– What if condition are 0
not 0,1,2...
If(a < 0) 3
z = 10 cond
else if (a == 0)
One hot encoded Mux
z = 15
Cond[0] = (a < 0)
else if (a > 0) Cond[1] = (a == 0)
z = 0 Cond[2] = (a > 0)
Digital System Design 15
Application of Mux(3)
• Where selection of one input is required out
several inputs
– Arbiter
– Device hub controller
– Bus controllers
– Routers
– Network switches
B
Z2
AND 0 1 X Z OR 0 1 X Z
0 0 0 0 0 0 0 1 X X
1 0 1 X X 1 1 1 1 1
X 0 X X X X X 1 X X
Z 0 X X X Z X 1 X X
Simulations shows X output due to
Wrong connections, missing inputs or incorrect design
Actual gates:
X means not certain (could be 0 or 1)
IC or gates can also be faulty
Inputs or connections can be wrong
Digital Logic Design:Combinational Circuits. 20
Tri-state buffer
• Buffer
– used to strengthen the signal
– increase driving capability
• Tristate buffer
B AA BB Y YY
00 01 0 00
A Y
11 01 1 11
00 10 ZZ
11 10 ZZ
signal B
– Interconnects
2:1 Mux
• Not preferred by
digital designers
Y0 = a’b’c’
Y1 = a’b’c
a
Y2= a’bc’
b 3 to 8 line Y3= a’bc
decoder Y4= ab’c’
c
Y5= ab’c
Y6= abc’
Y7= abc
• 3 to 8 line decoder
W
One bit R
Memory Cell
E
DataIn
Data-out
16 bit memory
4
Address
W
W0
E0
W1
E1
1:16 DEMUX
1:16 DEMUX
W2
E2
DataIN
W
W15
E15
4
Address 4
Address
D0
16-to-1 MUX
D1
DataOut
D15
4
Address
DataIn
W0
E M0 D
W1 0 0
M1 D1
1:16 DEMUX
E1
16-to-1 MUX
DataOut
W15
E15 M15 D
15
4
Address 4
Address
Y0 = a’b’c’
Y1 = a’b’c
a
Y2= a’bc’
b 3 to 8 line Y3= a’bc
decoder Y4= ab’c’
c
Y5= ab’c
Y6= abc’
Y7= abc
• 3 to 8 line decoder
Y0 = a + b + c
Y1 = a + b + c’
a
Y2= a + b’ + c
b 3 to 8 line Y3= a + b’ + c’
decoder Y4= a’ + b + c
c
Y5= a’ + b + c’
Y6= a’ + b’ + c
Y7= a’ + b’ + c’
Y0 = E a’b’c’
Y1 = E a’b’c
a
Y2= E a’bc’
b 3 to 8 line Y3= E a’bc
decoder Y4= E ab’c’
c
Y5= E ab’c
Y6= E abc’
E Y7= E abc
b Y0
c 2 to 4 line Y1
decoder Y2
a’ Enable
Y3
Y4
b
Y5
c 2 to 4 line Y6
decoder
Enable Y7
a
b Y0
c 2 to 4 line Y1
decoder Y2
a Enable
Y3
1 to 2 line Y4
decode b
Y5
c 2 to 4 line Y6
decoder
Enable Y7
Y0
Y1
a Y2
b 3 to 8 line Y3 F
decoder Y4
c Y5
Y6
Y7
M0
ROM cells
M1 -PROM
8-to-1 MUX
F0 -EEPROM
4 -Magnetic
-Optical
-Flash
M7
3
Address
M output
N Input lines
lines AND array OR Array
K product
Word lines
A1
A2
LUT Out1
A3
A4
C 2:1 Out2
B1 Mux
B2
LUT Out3
B3
B4
A A
B
B C
C
Digital Logic Design:Combinational Circuits. 60
Structure of N Bit Adder
Bn-1 An-1 B1 A1 B0 A0
Sn-1 S1 S0
S0 = A0 B0 C0
C1 = A0 . B0 + A0 C0 + B0 C0
Si = Ai Bi Ci
Ci+1 = Ai . Bi + Ai Ci + Bi Ci
Sn-1 S1 S0
Area: N (Two 2-input XOR gate + 3 two input AND + one Three input OR)
Delay N bit adder: (N-1) (2 level Gate delay) + max(XOR delay, AND-OR delay)
= ~ N (2 level Gate delay)
S3 G3 P3 S2 G2 P2 S1 G1 P1 S0 G0 P0
Delay analysis
-Assume simplistic model, One AND/OR gate -> ∆G
-Total delay = 1 ∆G delay (P, G) generation + 2 ∆G delay carry generation
+ 2 ∆G delay for Sum
• Delay: (n/2 + 3) ∆G
– ∆G for propagate and generate values
– (n/4) (2 ∆G ) for generating carry
– 2 ∆G for calculating sum
• For 16 bit adder = 11 ∆G
Sum3:0
Sum15:12 Sum11:8 Sum7:4
G3* P3* G2* P2* G1* P1* G0* P0*
G** P**
Sum0
Overall delay of K bit adder
k A k B 2K ∆G + 2 ∆G
Cout1 K bit adder 1
Sum1
Cin
Mux Cin
Cout
Sum
K Bit carry select K-1 Bit carry select K-2 Bit carry select
adder adder adder
Sum
21 20
22 21 21 20
20 20 20 20 20
21 20 21 20
22 21 20
23 22 21
S4 S3 S2 S1 S0
Digital Logic Design:Combinational Circuits. 84
Example: 4 four bit operands
a 4 x2 a 3 x2 a 2 x2 a 1 x2 a 0 x2
a 4 x3 a 3 x3 a 2 x3 a 1 x3 a 0 x3
a 4 x4 a 3 x4 a 2 x4 a 1 x4 a 0 x4
p3 p2 p1 p0
p4
p9 p8 p6 p5
p7
100
Summary
• Efficient design of multipliers
• Are these multipliers valid for unsigned as well
as signed numbers?
– No, for signed number, partial products need to
be signed extended
– Need some modification in the design
G g0
E Compn-1 Comp2 Comp1 Comp0 e0
L l0
a0 a1 ai a15
Boundary condition
p1 = a0’
Digital Logic Design:Combinational Circuits. 108
Sequence detector
• Example
yi = 1 if {xi, xi-1, xi-2, xi-3} == 1101
0 otherwise
• Designing a system irrespective if input size.
• Example input and output. Rightmost bit is x0
– 101101101010 - Input
– 001001000000 - Output
01 1 01 0
10 0 00 0 ci+10 =ci0 xi + ci1ci0’ xi
ci+11 = xi
10 1 11 0 yi = ci0 ci1 xi
11 0 10 0
11 1 01 1