Post on 04-Jan-2016
Cell n-1Xn-1
Y n-1
A n-1Bn-1
Cn-1
Xn
Y nCell 1
X1
Y 1
A 1
C1
Cell 0X0
Y 0
B0
C0
X2
Y 2
Iterative Arrays
Example: n = 32 Number of inputs = ? Truth table rows = ? Equations with up to ? input variables Equations with huge number of terms Design impractical!
Iterative array takes advantage of the regularity to make design feasible
Half Adder (1-bit)A B S(um
)C(arry)
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1
HalfAdder
A B
SC AB C
BABABAS
B
A
0 1
321
1
S B
A
0 1
32 1
C
A
BSum
Carry
Full AdderCin A B S(um
)Cout
0 0 0 0 0
0 0 1 1 0
0 1 0 1 0
0 1 1 0 1
1 0 0 1 0
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1
FullAdder
A B
SCarry Out(Cout)
Carry In(Cin)
00 01 11 10
0 0 1 0 1
1 1 0 1 0
CinAB
BACin
B)(ACin)BACin(
)BABA(CinAB)BACin(
BACinCinABBACinBACinS
00 01 11 10
0 0 0 1 0
1 0 1 1 1
CinAB
ABCinACinBCout
B)Cin(AAB)BABACin(ABCout
Full AdderBACinS
A
B
Cin
Cout
S
H.A. H.A.
B)Cin(AABCout
Cout
S
HalfAdder
S
C
A
B
HalfAdder
S
C
A
BB
A
Cin
4-bit Ripple Adder using Full Adder
FullAdder
A B
CinCout
S
S0
A0 B0
FullAdder
A B
CinCout
S
S1
A1 B1
FullAdder
A B
CinCout
S
S2
A2 B2
FullAdder
A B
CinCout
S
S3
A3 B3
Carry
A
BS
C
Half Adder
A
B
CinCout
SH.A. H.A.
Full Adder
Half Subtractor(1-bit)A B Difference
(D)Borrow (B)
0 0 0 0
0 1 1 1
1 0 1 0
1 1 0 0
HalfSubtractor
A B
DiffBorrow
BA Borrow
BABABADifference
A
BDiff
Borrow
Full SubtractorBorrow (in)
A B Difference (D)
Borrow (out)
0 0 0 0 0
0 0 1 1 1
0 1 0 1 0
0 1 1 0 0
1 0 0 1 1
1 0 1 0 1
1 1 0 0 0
1 1 1 1 1
FullSubtractor
A B
DifferenceBorrowOut(Bout)
Borrow In(Bin)
BABDifference in
ininout BBBABAB
4-bit Ripple Subtractor using Full Subtractor
A B
BinBout
D
D0
A0 B0
A B
BinBout
D
D1
A1 B1
A B
BinBout
D
D2
A2 B2
FullSubtractor
A B
BinBout
D
D3
A3 B3
BorrowFull
SubtractorFull
SubtractorFull
Subtractor
Adder/Subtractor Design
A – B = A + (-B) Take 2’s complement of B Perform addition of A and 2’s complement of B
FullAdder
A B
CinCout
S
S0
A0
FullAdder
A B
CinCout
S
S1
A1
FullAdder
A B
CinCout
S
S2
A2
FullAdder
A B
CinCout
S
S3
A3
B0B1B2B3
C
Subtract
Overflow/Underflow
01001000 (+72)00111001 (+57)+__________ (+129)
8-bit Signed number addition
10000001 (-127)11111010 (-6)-_____________ (-133)
8-bit Signed number addition
Cn-1 = 1
Cn = 0
Cn-1 = 0
Cn = 1
What is largest positive number represented by 8-bit?
What is smallest negative number represented by 8-bit?
Overflow/Underflow DetectionCn-1 An-1 Bn-1 Sn-1 Cn OF
0 0 0 0 0
0 0 1 1 0
0 1 0 1 0
0 1 1 0 1
1 0 0 1 0
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1
Examine the MSB bit Bottom line:
P: positive; N: negative N + N = N P + P = P P+N or N+P always fall
into the range E.g. -128+P cannot be
smaller than -128 or bigger than 127
Problem lies in N+N = P P+P = N
Discarded
Overflow/Underflow DetectionCn-1 An-1 Bn-1 Sn-1 Cn OF
0 0 0 0 0 0
0 0 1 1 0 0
0 1 0 1 0 0
0 1 1 0 1 1
1 0 0 1 0 1
1 0 1 0 1 0
1 1 0 0 1 0
1 1 1 1 1 0
BACABCOF
Discarded
n1n CCOF
or
Overflow/Underflow Detection
A B
CinCout
S
S0
A0 B0
A B
CinCout
SS1
A1 B1
A B
CinCout
SS2
A2 B2
A B
CinCout
SS3
A3 B3
Carry
Overflow/Underflow
n-bit Adder/Subtractor
Overflow/Underflow
Cn
Cn-1
Design by Contraction Contraction is a technique for simplifying the logic
in a functional block to implement a different function
Contraction of a ripple carry adder to incrementer for n = 3 Set B = 001
Unsigned Integer Multiplier (2-bit)
s
00100111
1011
0001
01
01
ba baba ba
ba ba
ba ba
b b x
a a
carrycarry out p0
a0b0
H.A.
p1
cs
a1b0a0b1
H.A.cs
p2p3
a1b1
Unsigned Integer Multiplier (3-bit)
ba ba ba
ba ba ba
ba ba ba
b b b x
a a a
202122
101112
000102
012
012
p0
a0b0
s
F.A.
p1
a1b0a0b1
0co
s
ci
c
F.A.
p2
s
a2b0a1b1
co
s
ci
c
F.A.
s
co
s
ci
a0b2
00
c
F.A.
p3
a2b1
co
s
ci
c
F.A.co
s
ci
a1b2
0
s
s
s
c
p4
c
F.A.co
s
ci
a2b2
p5