Professional Documents
Culture Documents
DIGEL Binary Adderv3
DIGEL Binary Adderv3
• Half adder
– 0+0=0 ; 0+1=1 ; 1+0=1 ; 1+1=10
– two input variables: x, y
– two output variables: C (carry), S (sum)
– truth table x y C S
0 0 0 0
0 1 0 1
1 0 0 1
1 1 1 0
S = x'y+xy'
C = xy
the flexibility for implementation
S=x⊕y
S = (x+y)(x'+y')
S' = xy+x'y'
S = (C+x'y')'
C = xy = (x'+y')'
x y z C S
• Full-Adder
0 0 0 0 0
– The arithmetic sum of three 0 0 1 0 1
input bits 0 1 0 0 1
– three input bits 0 1 1 1 0
• x, y: two significant bits 1 0 0 0 1
• z: the carry bit from the 1 0 1 1 0
previous lower significant bit 1 1 0 1 0
– Two output bits: C, S 1 1 1 1 1
C
S = x'y'z+x'yz'+ xy'z'+xyz
C = xy + xz + yz
S = z⊕ (x⊕y)
= z'(xy'+x'y)+z(xy'+x'y)'
= z'xy'+z'x'y+z((x'+y)(x+y'))
= xy'z'+x'yz'+xyz+x'y'z
C = z(xy'+x'y)+xy
= xy'z+x'yz+ xy
Binary adder - Ripple-Carry Adder
tadder = (N-1)tcarry + tsum
• Carry propagation
– when the correct outputs are available
– the critical path counts (the worst case)
– (A00,B0,C0) > C1 > C2 > C3 > (C4,S3)
– > 8 gate levels
Carry-Bypass Adder
P0 G1 P0 G1 P2 G2 P3 G3 Also called
Carry-Skip
Ci,0 C o,0 C o,1 Co,2 Co,3
FA FA FA FA
P0 G1 P0 G1 P2 G2 P3 G3
BP=P oP1 P2 P3
Ci,0 C o,0 Co,1 C o,2
Multiplexer
FA FA FA FA
Co,3
M bits
g i = a i ⋅ bi p i = a i + bi
si = pi ⋅ g i ⊕ ci c i +1 = p i ⋅ ( g i + c i )
LookAhead - Basic Idea
A0, B0 A1, B1 ••• AN-1, BN-1
Ci,0 P0 Ci,1 P1
Ci, N-1 PN-1
S0 S1 ••• SN-1
C o, k = f (A k, B k, Co , k – 1 ) = Gk + P k Co , k – 1
Look-Ahead: Topology
C o, k = Gk + Pk (Gk – 1 + Pk – 1 Co , k – 2 ) G3
G2
G1
All the way:
G0
C o, k = Gk + Pk ( Gk – 1 + P k – 1( … + P1 ( G0 + P0 Ci , 0 ) ) )
Ci,0
Co,3
P0
P1
P2
P3
– Logic diagram
• 4-bit carry-look ahead adder
– propagation delay
ČETVOROBITNI SABIRAČ SA CLA
(PARALELNIM PRENOSOM)
Binary subtractor
• A-B = A+(2’s complement of B)
• 4-bit Adder-subtractor
– M=0, A+B; M=1, A+B’+1
• Overflow
– The storage is limited
– Add two positive numbers and obtain a
negative number
– Add two negative numbers and obtain a
positive number
– V=0, no overflow; V=1, overflow
4-5 Decimal Adder
• Add two BCD's
– 9 inputs: two BCD's and one carry-in
– 5 outputs: one BCD and one carry-out
• Design approaches
– A truth table with 2^9 entries
– use binary full Adders
• the sum <= 9+9+1 = 19
• binary to BCD
• The truth table
• Modifications are needed if the sum > 9
–C=1
• K=1
• Z8Z4 = 1
• Z8Z2 = 1
– modification: -(10)d or +6
• Block diagram
AKUMULACIONI SABIRAČ
AKUMULATOR R.
FUNKCIJE ARITMETIČKO-LOGIČKE
JEDINICE (ALU SN74181
LOGIČKA ŠEMA ALU SN74181
Multipliers
Binary Multiplier
• Partial products – AND operations
• 4-bit by 3-bit binary multiplier
The Binary Multiplication
M+ N– 1
Z ·· × Y
X Zk 2
k
= =
∑
k=0
⎛M – 1 ⎞⎛N – 1 ⎞
⎜ i⎟⎜ j⎟
X i2 ⎟⎜ ∑ Yj2
⎜ ∑
= ⎜ ⎟
⎟⎜ ⎟
⎝ i=0 ⎠⎝ j = 0 ⎠
M – 1⎛ N – 1 ⎞
⎜ i + j⎟
=
∑ ⎜
⎜
∑ Xi Yj2 ⎟
⎟
⎝
i=0 j= 0 ⎠
with
M –1
i
X =
∑ Xi 2
i=0
N– 1
j
Y =
∑ Y j2
j= 0
The Binary Multiplication
1 0 1 0 1 0 Multiplicand
x 1 0 1 1 Multiplier
1 0 1 0 1 0
1 0 1 0 1 0
0 0 0 0 0 0 Partial products
+ 1 0 1 0 1 0
1 1 1 0 0 1 1 1 0 Result
The Array Multiplier
X3 X2 X1 X0 Y0
X3 X2 X1 X0 Y1 Z0
HA FA FA HA
X3 X2 X1 X0 Y2 Z1
FA FA FA HA
X3 X2 X1 X0 Y3 Z2
FA FA FA HA
Z7 Z6 Z5 Z4 Z3
The MxN Array Multiplier
— Critical Path
HA FA FA HA
FA FA FA HA Critical Path 1
Critical Path 2
HA FA FA FA
HA FA FA FA
HA FA FA HA
Y0
Y1 HA Multiplier Cell
C S C S C S C S
Z0
FA Multiplier Cell
Y2
C S C S C S C S
Z1 Vector Merging Cell
Y3
C S C S C S C S X and Y signals are broadcasted
Z2 through the complete array.
( )
C C C C
S S S S
Z7 Z6 Z5 Z4 Z3
Wallace-Tree Multiplier
Partial products First stage
6 5 4 3 2 1 0 6 5 4 3 2 1 0 Bit position
(a) (b)
FA HA
(c) (d)
Wallace-Tree Multiplier
x3y2 x2y2 x3y1 x1y2 x3y0 x1y1 x2y0 x0y1
Partial products x3y3 x2y3 x1y3 x0y3 x2y1 x0y2 x1y0 x0y0
First stage
HA HA
Second stage FA FA FA FA
Final adder
z7 z6 z5 z4 z3 z2 z1 z0
Wallace-Tree Multiplier
y0 y1
y2
y 0 y 1 y2 y3 y4 y5
Ci-1
FA
y3
FA FA
Ci Ci Ci-1
Ci-1
FA Ci Ci-1
y4
FA
Ci Ci-1 Ci Ci-1
FA
y5
Ci FA
FA
C S
C S
Multipliers —Summary
• Optimization Goals Different Vs Binary Adder
Za tablicu množenja dva 8-o bitna broja potreban je ROM kapaciteta 64K*16
Za tablicu množenja dva 16-o bitna broja potreban je ROM kapaciteta 4G*32
Table Lookup Arithmetic Def’n
• Given an m-variable function
f(xm-1, xm-2, …, x1, x0)
the table lookup evaluation of f requires the
construction of a 2u x n table that holds, for each
combination of input values (needing a total of u-
bits to represent), the desired n-bit result.
Result(s)
n bits
processing Smaller
Operand(s) Logic
Pre-
Table(s)
u bits
(ROM or RAM)
Postprocessing
Much smaller Logic
than u !
Result(s)
n bits
Constructing Big Mult’s from Small
• Can synthesize a 2b x 2b multiplier from
four b x b multipliers and a three operand
addition operation
AH AL
BH BL
AL BL
3b bits AL BH b bits AL BH
AH BL AH BH AL BL
AH BH AH BL
4b product
Množač 8-o bitnih brojeva realizovan 4-o
bitnim tablicama množenja i sabiračima
Indirect Table Lookup Example
• Pre- and postprocessing hardware should be
simple and fast
• Consider the multiplication identity that
converts the problem to one of squaring
X * Y = ¼ [(X + Y)2 – (X – Y)2]
Subtractor
n +1 bits
Right shifter (¼)
X*Y (2n-bits)
Množač realizovan
akumulacionim sabiranjem
Redno-paralelni množač
Četvorobitni redno-paralelni množač
Sekvenca rada registara množača
Generator kontrolnih signala
prethodnog množača
Kolo za deljenje binarnih brojeva A/B
Primer deljenja binarnih brojeva
1010000 / 0100
Primer deljenja binarnih brojeva
101 / 1000