Upload
bernadette-davis
View
212
Download
0
Embed Size (px)
Citation preview
C-H1
Lecture Adders
• Half adder
C-H2
Full Adder
0 0 0 1 0 1 1 1
c i 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
c i x i y i
00 01 11 10
0
1
x i y i c i
1
1
1
1
s i x i y i c i =
00 01 11 10
0
1
x i y i c i
1
1 1 1
c i 1 + x i y i x i c i y i c i + + =
c i
x i
y i s i
c i 1 +
(a) Truth table
(b) Karnaugh maps
(c) Circuit
0 1 1 0 1 0 0 1
s i si is the modulo-2 sum of ci, xi, yi.
C-H3
An n-bit Ripple Adder
FA
Xn-1 Yn-1
Sn-1
Cn-1Cn FA
X0 Y0
S0
C0C1
………
MSB LSB
Adder/subtractor
• - = add 2’s complement of the subtrahend
• y xor 0 = y; y xor 1 = ~y
C-H4
s 0 s 1 s n 1 –
x 0 x 1 x n 1 –
c n n -bit adder
y 0 y 1 y n 1 –
c 0
Add Sub control
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 )
C-H5
Carry-out: for unsigned number
011101111111
Propagate and Generateripple carry
• ci+1 = xiyi + (xi+yi)ci = gi + pici
• A ripple-carry adder: critical path = 2n + 1
C-H6
x 1 y 1
g 1 p 1
s 1
Stage 1
x 0 y 0
g 0 p 0
s 0
Stage 0
c 0 c 1 c 2
Propagate and GenerateCarry-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 GenerateCarry-Lookahead
c1 = g0 + p0c0
c2 = g1 + p1g0 + p1p0c0
3 gate delays
C-H8
x 1 y 1
g 1 p 1
s 1
x 0 y 0
s 0
c 2
x 0 y 0
c 0
c 1
g 0 p 0 D1
D2
D3
A Multiplier Array
C-H9
and
adder
Array of Adders for Unsigned Multiplication
C-H10
4-bit example