Adder Dengan Dua Operand
Adder Dengan Dua Operand
x + y + cin = 2ncout + s
The solution:
s = (x + y + cin) mod 2n
1 if (x + y + cin) ≥ 2n
cout =
0 otherwise
= b(x + y + cin)/2nc
X xi yi
Y
n n
cout cin ci+1 ci
ADDER FA
n
si
S
(a) (b)
Figure 2.1: (a) An n-bit adder. (b) 1-bit adder (full adder module).
xi + yi + ci = 2ci+1 + si
with solution
si = (xi + yi + ci) mod 2
ci+1 = b(xi + yi + ci)/2c
X Y
n n
c 0 = cin
cout = c n Step 1:
Obtain carries
c n-1 ci c1 c0
yn-1 yi y1 y0
xn-1 xi x1 x0
Step 2:
Compute sum bits
sn-1 si s1 s0
Two types:
i 9 8 7 6 5 4 3 2 1 0
xi 1 0 1 0 1 1 1 1 0 0
yi 0 0 0 1 0 1 0 0 1 0
p k p p p g p p p k
a a a a a a a a
ci+1 0 ← 0 1 ← 1 ← 1 ← 1 0 ← 0 ← 0 ← 0
f e e-1 d
gL aL gR aR
GA GA
(a) (b)
y n-1 x n-1 yi xi y0 x0
c c i+1 ci
out =cn FA FA
c1
FA c 0 = c in
s n-1 si s0
xi x’i
yi y’i
xi xi
y’i
c’i yi
x’i xi
yi ci+1
c’i ci
si yi
x’i c’i+1
y’i ci
ci
xi
yi
ci (a)
xi pi
yi si
g’i
ci+1
ci
(c)
Figure 2.5: Implementation of full-adder. (a) Two-level network. (b) Multilevel network with xor, and and or gates; (c) Multilevel
implementation with xor and nand gates.
yi xi
CC
(Chain Control) GKP
"0"
ki pi
(a) "1"
gi
ci+1 ci
CC CC CC CC CC
cin
ci
cout c n-1 ci+1 c2 c1
(b)
(j) (j)
x y
CSK-m adder m m
1
m
(j)
s
(a)
m m m m m m
CSK-m CSK-m CSK-m
ADDER ADDER ADDER
m m m
(b)
Figure 2.7: Carry-skip adder: (a) A group with carry bypass. (b) n-bit CSK adder.
MUX
MUX
MUX
sn-1 (a)
X 1 1 1 01 1 0 01 0 0 01 0 0 1
Y 0 0 0 10 0 1 10 1 1 10 1 1 1
15 12 8 4 0
position
c1
c2 2
c3
c4 4
c8 c5
c12 c9 c6 6
c16 c13 c10 c7
c14 c11 8
carry-skip path
c15 carry-ripple path
t group size m = 4
(b)
Figure 2.9: (a) Critical path in carry-skip adder. (b) The worst-case situation for n = 16.
n
TCSK = mtc + tmux + ( − 2)tmux + (m − 1)tc + ts
m
n
= (2m − 1)tc + ( − 1)tmux + ts
m
(j)
(j+1) cout (j)
cin cin
m-bit Carry-Ripple Adder
(group j)
(j)
P
Fixed-size:
mopt = ( tmux
2tc n) 1/2
(minimum delay)
Topt ≈ (8tmuxtcn)1/2
Variable-size:
Group size
mi
Group i
M-1 0
M - number of groups
Figure 2.11: Optimal distribution of group sizes in carry-skip adder.
cn CLA c2m cm c0
CLA CLA CLA
k-1 j 1 0
m m m m
k=n/m
y3 x3 y2 x2 y1 x1 y0 x0
CLA-4
g3 a p3 g2 a2 p2 g1 a1 p 1 g0 a0 p 0
3
c4
CARRY LOOKAHEAD GENERATOR c0
G
(CLG-4)
A
c3 c2 c1
p3 p2 p1 p0
s3 s2 s1 s0
g3 a3 g2 a g1 a1 g0 a0
2
CLG-4
A
c
0
G
c c c c
4 3 2 1
x7 y7 x6 y6 x5 y5 x4 y4 x3 y3 x2 y2 x1 y1 x0 y0
4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
* * * * * * * * c
CLA-4 CLA-4 CLA-4 CLA-4 CLA-4 CLA-4 CLA-4 CLA-4 0
2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4
s7 s6 s5 s4 s3 s2 s1 s0
G A G A G A G A G A G A G A G A
7 7 6 6 5 5 4 4 3 3 2 2 1 1 0 0
CLG-4 CLG-4
(8)
c =c32
c (7)=c28 c (6)=c24 c (5)=c20 c (4)=c16 c (3)=c12 c (2)=c8 c (1)=c4
critical path
x3 y3 x2 y2 x1 y1 x0 y0
2 2 2 2 2 2 2 2
* * * * c
CLA-2 CLA-2 CLA-2 CLA-2 0
2 2 2 2 2 2 2 2
s3 s2 s1 s0
(1) (1) (1) (1) c4 (1) (1) (1) (1)
G A3 G2 A 2 G1 A 1 G0 A 0
3
CLG-2 CLG-2
(3) (1)
(1)
G1 A 1
(1)
c =c6 G0 A 0
(2) (2) c =c2
c8
CLG-2
g(left2,left1)
a(left2,left1)
g(right2,right1)
a(right2,right1)
2 2
GA GA
g(left2,right1) 2
a(left2,right1)
gout aout
(a) (b)
( gL , aL ) ( gR, aR ) ( gL , aL ) gR
2 2 2
2 g out = g L + a L g R g out = g L + a L g R
( g out , a out ) a out = a L a R
c0
from position
2 g(2,1) g(0,-1) (-1)
g(6,5) g(4,3)
a(6,5) a(4,3) a(2,1)
g(6,-1) =c7 c6 c5 c4 c3 c2 c1 c0
p7 p p5 p4 p3 p2 p1 p0
6
XOR XOR XOR XOR XOR XOR XOR XOR
c8 s7 s6 s5 s4 s3 s2 s1 s0
Figure 2.18: 8-bit prefix adder. (Modules to obtain pi , gi , and ai signals not shown.)
( gL , aL ) ( gR, aR ) ( gL , aL ) gR
2 2 2
2 g out = g L + a L g R g out = g L + a L g R
( g out , a out ) a out = a L a R
g(2,-1) g(1,-1)
g(4,-1) g(3,-1)
c8 s7 s s s s s s s
6 5 4 3 2 1 0
Figure 2.19: 8-bit prefix adder with maximum fanout of three and five levels. (Modules to obtain p i , gi , and ai signals not shown.)
2 g out = g L + a L g R g out = g L + a L g R
( g out , a out ) a out = a L a R
c0
buffer
g(7,6) g(6,5) g(5,4) g(4,3) g(3,2) g(2,1) g(1,0) g(0,-1)
a(7,6) a(6,5) a(5,4) a(4,3) a(3,2) a (2,1) a(1,0)
g(7,0)
* c7 c c c4 c c c1
6 5 3 2
p p6 p p p p2 p1 p0
7 5 4 3
XOR XOR XOR XOR XOR XOR XOR XOR
g(7,-1)
c8 s7 s6 s s s s2 s1 s0
5 4 3
Figure 2.20: 8-bit prefix adder with minimum number of levels and fanout of two.(Modules to obtain p i , gi , and ai signals not shown.)
Digital Arithmetic - Ercegovac/Lang 2003 2 – Fast Two-Operand Adders
28
CONDITIONAL ADDER (COND ADDER)
x y
m m COND ADDER y
x
m m
m-BIT 1 m-BIT 0 COND
ADDER ADDER ADDER
m+1 m+1 m+1 m+1
Figure 2.21: (a) Obtaining conditional outputs. (b) Combined conditi onal adder.
XL YL XR YR
COND-ADDER COND-ADDER
MUX MUX
n/2+1
n/2+1
n/2 n/2
n+1 n+1
(c 1, S 1 ) (c 0, S 0 )
Y Y 11-8 Y Y 3-0
15-12 7-4
X 15-12 X 11-8 X 7-4 X 3-0
c
8
MUX
9 4 4
c
16
Increase throughput
y3 x3 y2 x2 y1 x1 y0 x0
c FA FA FA FA c0
4
- latch
s s s s
3 2 1 0
1 1 1 1 1
cn cn-1 ci c1 c0
STFA STFA STFA STFA
0 0 0 0 0
cn cn-1 ci c1 c0
ki = x0iyi0 , g i = x i yi , pi = xi ⊕ yi
Addition time: based on actual delays, not worst-case
n−1
Tvar−1 = tc,i
X
i=0
1 1 1 1 1
cn cn-1 ci c1 c0
X 0 1 1 0 0 0 1 1 1 0 0 1 1 0 1 0
Y 1 0 1 0 1 1 0 0 1 1 1 0 0 1 1 0
+ a a a b c c c c c d d d d d d e Prop.chains
Completion signal:
n−1
F = (c0i c1i )
Y
i=0
Prefix Network
(Notes: no cin input;
last level consists
of "circle" modules)
end-around
carry
c c c c c c c c
7 6 5 4 3 2 1 0
p p6 p p p p2 p p
7 5 4 3 1 0
XOR XOR XOR XOR XOR XOR XOR XOR
s s s s s s s s
7 6 5 4 3 2 1 0
Figure 2.29: Implementing ones’ complement adder with prefix network. (Modules to obtain pi , gi , and ai signals not shown.)
S[i+1] S[i+1]
redundant
(a) (b)
Figure 2.30: Accumulation with (a) non-redundant, and (b) redundant representation of sum.
FA FA FA FA cin
n n
VC VS
(vc0 = cin)
Figure 2.31: Carry-save adder: (a) Bit level. (b) Bit-vector level.
X 0 1 1 1 0 1 0 0
Y 0 0 1 1 1 0 1 1
Z 1 0 1 0 1 0 1 0
VS 1 1 1 0 0 1 0 1
(cout, V C) 0 0 1 1 1 0 1 0 1
digit value 0 1 2 2 1 0 2 0 2
xi yi wi zi
FA FA
FA FA FA
XS 1 0 1 1 0 1 1 0 0
XC 1 1 0
Y 0 1 0 0 0 1 1 1 1
VS 0 0 0 1 1 1 0 1 1
(cout,VC) 1 0 1 0
XS:
XC:
Y:
VS:
VC:
0
with digit set
D = {−a, . . . , −1, 0, 1, . . . , a}
• Limits carry propagation to next position
• Addition algorithm:
Step 1: x + y = w + t
xi + yi = wi + rti+1
Step 2: s = w + t
si = w i + t i
• No carry produced in Step 2
X Y
n n
(a)
tn
SDA t0
TW TW TW TW Step 1
tn wn-1 tn-1 ti+1 wi ti wi-1 ti-1 t1 w0 t0
sn sn-1 si si-1 s0
(b)
(0, xi + yi)
if −a + 1 ≤ xi + yi ≤ a − 1
(ti+1, wi) = (1, xi + yi − r) if xi + yi ≥ a
(−1, x + y + r) if xi + yi ≤ −a
i i
RECODING 1:
HZ HZ HZ
Recoding 1 h z hi z i-1 h
i+1 i i-1
ADD ADD
q q
i i-1
TW TW
Recoding 2
t w ti wi-1 t
i+1 i i-1
ADD ADD
s s
i i-1
0 if (xi, yi) both nonnegative
Pi = (which implies ti+1 ≥ 0)
1 otherwise (t
i+1 ≤ 0)
xi + y i Pi−1 ti+1 wi
2 - 1 0
1 0(ti ≥ 0) 1 -1
1 1(ti ≤ 0) 0 1
0 - 0 0
-1 0(ti ≥ 0) 0 -1
-1 1(ti ≤ 0) -1 1
-2 - -1 0
TW TW TW
t w ti wi-1 t
i+1 i i-1
ADD ADD
s s
i i-1
Figure 2.36: Signed-bit addition using the information from previous digit
X 011111011
Y 011010101
P 000010010
W 000101110
T 0110110010
S 110011100
xi + yi -1 0 1 2
wi -1 0 -1 0
ti+1 0 0 1 1
xi y+
i
y-
i
xi-1 y+ y-
i-1 i-1
FA FA
t i+1 wi ti wi-1
t i-1
s+ s-i s+
i-1 s-i-1
i
Figure 2.37: Redundant adder: one operand conventional, one operand redundant, result redundant.
FA FA
{-2,-1,0}
hi+1 hi hi-1
{0,1}
zi z i-1 {0,1}
vi v i-1
FA FA
t i+1 wi ti wi-1 t i-1
{0,1} {-1,0}
s+
i
s-i s+ s-
i-1 i-1