Chap 3 Boolean Algebra (Cont.)

Lecture
Adders
• Half adder
C-H1
Full Adder
xi yi
ci
ci
xi
yi
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
c
i
+
1
0
0
0
1
0
1
1
1
00
01
11
10
1
1
si is0 the modulo1
1
2 sum
of ci, 1xi,
yi. s = x  y  c
si
0
1
1
0
1
0
0
1
i
i
i
i
xi yi
ci
00
01
(a) Truth table
10
1
0
1
11
1
1
1
ci + 1 = xi yi + xici + yici
(b) Karnaugh maps
xi
yi
si
ci
ci + 1
(c) Circuit
C-H2
An n-bit Ripple Adder
Xn-1 Yn-1
X0
Y0
………
Cn FA
Sn-1
MSB
Cn-1
C1 FA
C0
S0
LSB
C-H3
Adder/subtractor
• - = add 2’s complement of the subtrahend
• y xor 0 = y; y xor 1 = ~y
yn–1
y1
y0
AddSub
control
xn–1
x1 x0
cn
c0
n-bit adder
sn–1
s1
s0
C-H4
Overflow v.s. Carry-out
• n-bit signed number: -2n-1 to 2n-1 -1
Detect overflow for signed number:
Overflow = Cn-1 ⊕ Cn
Overflow = Xn-1 Yn-1 ~Sn-1 (110) + ~Xn-1 ~Yn-1 Sn-1 (001)
where X and Y represent the 2’s complement numbers,
S = X+Y. (sign bits 0, 0 ≠ 1 )
0111
0111
1111
Carry-out: for unsigned number
C-H5
Propagate and Generate
ripple carry
• ci+1 = xiyi + (xi+yi)ci = gi + pici
• A ripple-carry adder: critical
path = 2n + 1
x1
g1
y1
x0
p1
g0
y0
p0
c1
c2
Stage 1
c0
Stage 0
s1
s0
C-H6
Propagate and Generate
Carry-Lookahead
ci+1 = xiyi + (xi+yi)ci = gi + pici
= gi + pi (gi-1 + pi-1ci-1)
= gi + pigi-1 + pipi-1gi-2 + …+ pipi-1
…p2p1g0 + pipi-1…p1p0c0
For instance,
c1 = g0 + p0c0
c2 = g1 + p1g0 + p1p0c0
C-H7
Propagate and Generate
Carry-Lookahead
c1 = g0 + p0c0
c2 = g1 + p1g0 + p1p0c0
3 gate delays
x1
y1
x0
x0
g1
p1
D1
y0
y0
g0
p0
c0
c2
c1
D2
D3
s1
s0
C-H8
A Multiplier Array
and
adder
C-H9
Array of Adders for
Unsigned Multiplication
4-bit example
C-H10