Professional Documents
Culture Documents
Lecture # 5
Instructor: Zeshan Chishti
zeshan@ece.pdx.edu
• Reference:
– Chapter 9: Sections 9.1, 9.2
Two’s Complement Representation
• N-bit binary digit can represent
any integer between -2N-1 and
+2N-1-1 -1 +0
• Most significant bit (MSB) -2 1111 0000 +1
indicates sign of the integer -3
1110 0001
+2
• To obtain representation for a 1101 0010
+
For addition:
Overflow cannot occur if the sign of two operands is different
Overflow occurs when the sign of two operands is the same AND the sign of result
is different from the sign of operands
s = x y c + x y c + x y c + x y c = x y c
i i i i i i i i i i i i i i i i
c = y c +x c +x y
i +1 i i i i i i
Example:
X 7 0 1 1 1 xi
Carry-out Carry-in
+ Y = +6 = + 0 0 1 1 1 1 0 0 0 yi
ci+1 ci
Z 13 1 1 0 1 si
y
i
c
x i
i
x
y s i c
i i c i +1
i
c
i x
x y i
i i y
i
c Full adder c
i +1 (FA) i
s
i
xn-1 yn-1 x1 y1 x0 y0
cn cn-1 c2 c1
FA ……. FA FA c0
Sn-1 s1 s0
c
n-bit n-bit n n-bit
c c
kn adder adder adder 0
s s s s s s
kn- 1 (k - 1)n 2n- 1 n n- 1 0
_ _ _
xn-1 yn-1 x1 y1 x0 y0
cn cn-1 c2 c1
FA ……. FA FA 1
Sn-1 s1 s0
xn- 1 x1 x0
cn n-bit adder
c
0
sn- 1 s1 s0
s0
Sum Carry
• ci needed to compute si yi
• Carry propagation is xi
c
i
ci
x
i
yi
Computing the Add Time (contd..)
Cascade of 4 Full Adders, or a 4-bit adder
x3 y3 x2 y2 x1 y1 x0 y0
FA FA FA FA c0
c4 c3 c2 c1
s3 s2 s1 s0
For an n-bit ripple adder, sn-1 is available after 2n-1 gate delays
cn is available after 2n gate delays.
Fast Addition
Recall the equations:
si xi yi ci
ci 1 xi yi xi ci yi ci
Second equation can be written as:
ci 1 xi yi ( xi yi )ci
We can write:
ci 1 Gi Pi ci
where Gi xi yi and Pi xi yi
s3 s2 s1 s0
G3 P3 G2 P2 G1 P1 G0 P0
Carry-lookahead logic
xi yi
.
Pi implemented as XOR
B-cell for a . of xi and yi instead of xi
single stage ci + yi . This is ok because
when xi = 1, yi = 1, Gi is
equal to 1.
Gi Pi si