Академический Документы
Профессиональный Документы
Культура Документы
Arithmetic ckt:
Chapter Overview
5-1
5-2
5-3
5-4
5-5
5-6
5-7
5-8
5-9
2. Formulation:
Derive the truth table or initial Boolean eqs that define the
required relationships b/t inputs and outputs.
3. Optimization:
4. Technology Mapping:
5. Verification:
Arithmetic block:
is typically designed to operate on
binary input vectors and produce
binary output vectors.
The function implemented often
requires that the same subfunction
be applied to each bit position.
A function block can be designed
for the subfunction and then used
repetitively for each bit positions
of the overall arithmetic block.
An-1 Bn-1
cell
A0 B0
Cn-1
cell
C0
C
J.J. Shann 5-5
Iterative array
Iterative array:
A. Half Adder
S
C
Step2: Formulation
Truth
table
Step 3: Optimization
S = xy + xy = x y
C = xy
B. Full Adder
Step 2
X
Y
Z
S
Full Adder
Step3
Step 4
Parallel adder:
Binary addition:
Truth table:
9 inputs; 2 4-bit numbers & a carry-in bit
512 entries (impractical)
J.J. Shann 5-13
* Hierarchy &
Iterative design
Si = Ai Bi Ci
Ci+1 = Ai Bi + Ci(Ai Bi)
J.J. Shann 5-14
Carry Propagation
B2 A2
B3 A3
B1 A1
B0 A0 C0
critical
path
C4
S3
C3
S2
C2
S1
C1
S0
Method 1:
Method 2:
simple
has a long ckt delay in the carry path from LSB to MSB
Carry Lookahead
Full adder:
Carry lookahead:
RCA
RCA
C1 = G0 + P0C0
C2 = G1 + P1C1
= G1 + P1(G0 + P0C0)
= G1 + P1G0 + P1P0C0
Pi = Ai Bi
Gi = Ai Bi
C3 = G2 + P2C2
= G2 + P2G1 + P2P1G0 + P2P1P0C0
C4 =
= G?3 + P3C3
= G3+P3G2 + P3P2G1 + P3P2P1G0 + P3P2P1P0C0
P2 = A2 B2
G2 = A2 B2
P1 = A1 B1
G1 = A1 B1
P0 = A0 B0
G0 = A0 B0
Ripple carry
Carry lookahead
* Propagation delay = 6
2
Ai 2 Pi 2
Ci S i
Bi
Gi
J.J. Shann 5-23
Pi = Ai Bi
Gi = Ai Bi
C1 = G0 + P0C0
C2 = G1 + P1G0 + P1P0C0
C3 = G2 + P2G1 + P2P1G0 + P2P1P0C0
Si = Pi Ci
(2-level)
* Propagation delay = 6
CLA Expansion
C1 = G0 + P0C0
C2 = G1 + P1G0 + P1P0C0
C3 = G2 + P2G1 + P2P1G0 + P2P1P0C0
C4 = ?
max fan-in = 5
excessive fan-in
Multi-level CLA
J.J. Shann 5-25
Multi-Level CLA
4-bit groups:
P03 = P3 P2 P1 P0
C4 = G0-3 + P0-3C0
4-bit CLA
w/ group
functions:
C4
S3
S2
S1
S0
Group
functions
J.J. Shann 5-27
B3~0
B15~12 A15~12
B11~8 A11~8
4-bit CLA
4-bit CLA
4-bit CLA
4-bit CLA
G15-12
C16, S15~12
P15-12
G11-8
S11~8
C12
A7~4
G7-4
S7~4
P11-8
C8
A3~0
C0
G3-0
S3~0
P7-4
P3-0
C4
G15-0 P15-0
J.J. Shann 5-29
Propagation delay:
2
2
Ai 2 Pi 2 P(4j+3)-4j 2
C4k Ci Si
Bi
Gi
G(4j+3)-4j
Delays:
Ripple
carry
adder
(RCA)
Carry
lookahead
adder
(CLA)
4-bit adder
16-bit adder
64-bit adder
10
34
130
10
(5 copies in
2 levels of
lookahead)
(4 + 1)
14
(21 copies in
3 levels of
lookahead)
(16 + 4 +J.J.1)Shann 5-31
Method 1: (1-3)
A. Complement
1s Complement
E.g.s:
1011001
1s comp
0100110
0001111
1s comp
1110000
2s Complement
E.g.s:
1101100
2s comp
0010100
E.g.:
end borrow
Borrows into:
11100
Minuend:
10011
Subtrahend:
11110
Difference:
10101
Correct Difference: 01011
2s complement
negative
10011110
01100100
10010110
11001110
28
Initial Result:
Final Result
1 00000000
11001110
00110010
J.J. Shann 5-38
minuend M: M + (2n N) = M N + 2n
2. If M N, the sum produces an end carry, 2n. Discard the
end carry, leaving result M N .
3. If M < N, the sum does not produce an end carry since it
is equal to 2n (N M). Perform a correction, taking the
2s complement of the sum and placing a minus sign in
front to obtain the result (N M).
{2n [2n (N M)]} = (N M)
<Ans.>
XY
X=
1010100
2s complement of Y = + 0111101
Sum = 1 0010001
Discard end carry 27 = 1 0000000
Answer: X Y =
0010001
YX
Y=
1000011
2s complement of X = + 0101100
Sum =
1101111
(No end carry)
Answer: Y X = (2s comp of sum)
= 0010001
J.J. Shann 5-41
minuend M: M + (2n 1 N) = M N + 2n 1
2. If M > N, the sum produces an end carry, 2n. Discard the
end carry and add one to the sum for the correct result of
M N . (end-around carry)
3. If M N, the sum does not produce an end carry.
Perform a correction, taking the 1s complement of the
sum and placing a minus sign in front to obtain the
result (2n 1 ( M N + 2n 1)) = (N M).
<Ans.>
X=
2s complement of Y =
Sum =
End-around carry
Answer: X Y =
XY
1010100
+ 0111100
1 0010000
+1
0010001
YX
Y=
1000011
2s complement of X = + 0101011
Sum =
1101110
(No end carry)
Answer: Y X = (1s comp of sum)
= 0010001
J.J. Shann 5-43
Summary:
S
0
1
X Y Cin
A B 0
A B 1
X=A
Y = SB + SB
= SB
Cin = S
adder
Sum
4
S
0
1
X Y Cin
A B 0
A B 1
X=A
Y = SB
Cin = S
CoutParallel
adder
Cin
Sum
4
Signed-Magnitude Representation
Signed-magnitude representation:
Signed-Complement Representation
Signed-complement representation:
+9
00001001
00001001
00001001
9
10001001
11110110
11110111
J.J. Shann 5-50
(a)
(b)
(c)
Signed-magnitude system:
Signed-magnitude system:
Addition of 2 numbers: M + N
Example 5-4:
+ 6 00000110
+ 13 00001101
+ 19 00010011
11111010
+ 13
00001101
+ 7 1 00000111
+6
00000110
13 11110011
7 11111001
6 11111010
13 11110011
19 1 11101101
J.J. Shann 5-54
6
( 13)
+7
Example 5-5:
11111010
11111010
11110011
+ 00001101
1 00000111
+6
( 13)
+ 19
00000110
00000110
11110011
+ 00001101
00010011
J.J. Shann 5-55
Summary:
In the signed-complement system, binary numbers are
added and subtracted by the same basic addition and
subtraction rules as are unsigned numbers.
Computers need only one common HW ckt to handle
both types of arithmetic.
The same adder-subtractor designed for unsigned
numbers can be used for signed numbers.
C. Overflow
Detection of an overflow:
For signed numbers: carry into the sign bit carry out of the sign bit
detects an overflow: the (n+1)th bit is the actual sign, but it cannot occupy
the sign bit position in the result.
J.J. Shann 5-59
Decimal Adder
(p.5-59~5-62)
Decimal adder:
Design method:
Classic method
Add the numbers w/ FA ckts
BCD Adder
Addend
digit
Augend
digit
BCD adder:
Cout BCD
adder
Cin
Sum
4
Design approaches
i. Classic method: a truth table with 29 entries
ii. Add the numbers w/ FA ckts
Addend Augend
digit
digit
4
1-digit
BCD adder
4-bit
Binary Adder
K
Carry
in
Z8Z4Z2Z1
Carry
out
S8S4S2S1
Magnitude Comparator
(p.5-63~5-65)
A
Magnitude comparator:
Design Approaches
B
4
Magnitude
Comparator
A>B
A=B A<B
Algorithm logic:
A = A3A2A1A0 ; B = B3B2B1B0
A=B
(A=B) = x3x2x1x0
(A>B) = A3B3' + x3A2B2' + x3x2A1B1' + x3x2x1 A0B0'
(A<B) = A3'B3 + x3A2'B2 + x3x2A1'B1 + x3x2x1 A0'B0
Binary multiplication:
multiplicand
multiplier
partial product
partial product
J.J. Shann 5-68
A0B1
A1B1
A0B0
A1B0
Example:
A 4-bit by 3-bit
binary multiplier
B3
B2
A2
B1
A1
B0
A0
A2B3
C6 C5
C4
C3
C2
C1
C0
General rule:
A bit of the multiplier is ANDed w/ each bit of the
multiplicand in as many levels as there are bits in the
multiplier.
The binary output in each level of AND gates is added w/
the product.
For J multiplier bit & K multiplicand bits:
Need (J K) AND gates & (J 1) K-bit adders
to produce a product of J + K bits.
Incrementing
Decrementing
Multiplication by a constant
Division by a constant
Greater than comparison
Less than comparison
Design approaches:
i. Each of these functions can be implemented for multiple-bit ops by
using an iterative array of 1-bit cells.
ii. Use a combination of rudimentary functions and contraction
technique.
simplifies design by converting existing ckts into useful, lesscomplicated ckts (instead of designing the latter ckts directly)
J.J. Shann 5-72
A. Contraction
Contraction:
Ci +1 = Ai Bi + Ai Ci + Bi Ci
Contraction by setting Bi = 1 and simplifying the results:
Si = Ai 1 Ci = Ai Ci
Ci +1 = Ai 1 + Ai Ci + 1 Ci = Ai + Ci
J.J. Shann 5-74
S = A + 111 + C0
= A 1 + C0 (in 2s complement)
=A1
(if C0 = 0; decrement op)
Si = Ai Ci
Ci +1 = Ai + Ci
Add1
Add1
Add1
Add1
C
Z
A
B
C
Z
B. Incrementing
Incrementing:
Example
B = 001, C0 = 0, C3 =
S1 = A1 C1
C2 = A1C1
C. Decrementing
Decrementing:
S=1
B = 001
1
1
Incrementer/Decrementer:
Contracting an adder-subtractor to
incrementer/decrementer:
D. Multiplication by Constants
Multiplication by a
constant:
B3
B2
1
B1
0
B0
1
B1
0
B3
B2
0
B0
B0
0
B2
B3
0
B1
C5
C4
C3
C2
B1
B0
E.g.: 100 B
E. Division by Constants
Division by powers of 2:
E.g.: B 100
quotient
remainder
Zero fill:
Sign extension:
Binary adder:
Problems
Sections
5-1
5-2
5-3
5-4
5-5
5-6
5-7
5-8
Exercises
5-1, 5-2
5-3, 5-4
5-5~5-8, 5-12, 5-13,
5-15~5-17
5-18
5-9~5-11, 5-14,
5-19~5-20
5-21~5-24
5-25~5-28
J.J. Shann 5-91
Homework