Week 12 - Arithmetic Circuits
Week 12 - Arithmetic Circuits
Binary addition
• This is the primitive of almost all arithmetic computation.
A B CI Truth Table:
A B CI | S CO
----------|--------
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
CO S 1 1 1 | 1 1
CO = A B+B CI+CI A
S = A + B + CI
4-Bit Ripple-Carry Adder (RCA)
• The carry chain ripples from the least to the most significant bit (LSB
to MSB).
A B
Cout Cin
SUM
A[3] B[3] A[2] B[2] A[1] B[1] A[0] B[0] Cin
A B CI A B CI A B CI A B CI
CO S CO S CO S CO S
Area = O(bit-width)
Delay = O(bit-width)
Adder/subtractor
• Use an adder to do subtraction thanks to 2s complement representation
– A – B = A + (– B) = A + B' + 1
– control signal selects B or 2s complement of B
0 1 0 1 0 1 0 1
A B A B A B A B
Cout Cin Cout Cin Cout Cin Cout Cin sub
Sum Sum Sum Sum
S3 S2 S1 S0
Overflow
FA Based Adders – Carry-save adder
Carry-save Adder (CSA) A B C
• There is no carry chain rippling from LSB to MSB
• Each CO pin goes to the next higher bit column COUT
S CIN
SUM CARRY
A[3] B[3] C[3] A[2] B[2]C[2] A[1] B[1] C[1] A[0] B[0] C[0] Cin
A B CI A B CI A B CI A B CI
CO S CO S CO S CO S
Area = O(bit-width)
Delay = O(1)
Carry Save Addition
• Sum of 3 addends : A+B+C
A
Sum of addends
CSA B Can use carry
C save addition
+
Redundant
CLA Binary
+
Number
• With Carry save addition, A+B+C can be computed with a single CLA
adder for the final sum in binary. Conventional addition (fast) would
require 2 CLAs.
Designing Optimized Arithmetic
Conventional
Arithmetic Carry Save Addition (CSA) Arithmetic
+ a
b S
+
b c
c S
+ + Y
d
e S S + Y
d
e f
+
f
a-b-c-d-e
- -
a+b+c+d+e+4
- -
a b c d e - - -d -e
a b c
Logic1
- - S
Logic1
- Logic1
S
Logic1
+
-
y
y
Summary
C8 4-bit adder 1
[7:4]
C8 4-bit adder 0
[7:4]
C8 S7 S6 S5 S4 S3 S2 S1 S0
P&G Based Adders – Carry-lookhead adder
P&G Logic
• Carry Generate: Gi = Ai Bi
– must generate carry when Gi = 1, which means A = B = 1
• Carry Propagate: Pi = Ai xor Bi
– carryin will equal carryout when Pi = 1
• Sum and Cout can be re-expressed in terms of
generate/propagate:
– Ci+1 = Gi + Ci Pi
– Si = Ai xor Bi xor Ci
= Pi xor Ci
• Carryout logic:
– C1 = G0 + P0 C0
– C2 = G1 + P1 C1 = G1 + P1 G0 + P1 P0 C0
– C3 = G2 + P2 C2 = G2 + P2 G1 + P2 P1 G0 + P2 P1 P0 C0
– C4 = G3 + P3 C3 = G3 + P3 G2 + P3 P2 G1 + P3 P2 P1 G0
+ P3 P2 P1 P0 C0
Gi
C0
P0
P1
C0 P2
C0 P3
P0 C1 P0
P1 G0
G0 P2 P1
G0 P2
P1 P3
C0 P2 G1
P0 P2
P1 G1 P3
C3
G0 P2 G2 C4
P1 C2
P3
G2
G1 G3
4-Bit Carry Look-ahead (CLA) Adder
A B
Cout Cin
SUM
A[3] B[3] A[2] B[2] A[1] B[1] A[0] B[0]
A+B
A3 B3 A2 B2 A1 B1 A0 B0
Carry Look-ahead (CLA) Logic
C4 C3 C2 C1
A B CI A B CI A B CI A B CI
CO S CO S CO S CO S
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Legend i i
i:j
Pi:i Gi:i
Pi:j Gi:j
Si
Summary
✓ Prefix adder 와 Carry-skip adder는 _________ based adder 의 대표적인
분류이다.
• If Pi-1:k = 0 (it means not all P values from bit i-1 to bit k are 1), the
result of the carry is generated within this block.
• If Pi-1:k = 1, the carry of the previous block is propagated.
Multiplier – Partial products
multiplicand 1101 (13)
product of 2 4-bit numbers
multiplier * 1011 (11) is an 8-bit number
1101
1101
Partial products
0000
1101
10001111 (143)
Partition Products
B3 B2 B1 B0
A2 B0 A2 B0 A1 B0 A0 B0
A3 B1 A2 B1 A1 B1 A0 B1
A3 B2 A2 B2 A1 B2 A0 B2
A3 B3 A2 B3 A1 B3 A0 B3
S7 S6 S5 S4 S3 S2 S1 S0
Multiplier - Compressor
Original matrix of 36-bits Reorganized matrix of bits
Dot products
...
Compressor
Parallel multiplier
Final adder
FA based compressor
CSA based compressor
Multiplier – Recoding
Partial Product Generation using Canonical
Recoding
Partial Product Generation using Booth
Recoding
Bit b7 b6 b5 b4 b3 b2 b1 b0 b-1
weight -128 64 32 16 8 4 2 1 n/a
(0)
d3 -128 64 64
d2 -32 16 16
d1 -8 4 4
d0 -2 1 1
Summary
▪ Sequential multiplier
회로 ____, 시간 ____ 걸림
▪ Parallel multiplier
회로 ____, 시간 _____ 걸림
▪ Partial product reduction (compression)
CSAs, FAs
▪ Partial product generation
Canonical recoding, Booth recoding