CS221 CS221 Computer Arithmetic: Computer Arithmetic: Multiplier
CS221 CS221 Computer Arithmetic: Computer Arithmetic: Multiplier
CS221
Computer Arithmetic :
ComputerArithmetic:
Multiplier
Dr.A.Sahu
Dept of Comp. Sc. & Engg.
DeptofComp.Sc.&Engg.
IndianInstituteofTechnologyGuwahati
1
Outline
MultiplicationAlgorithms
ShiftandAdd,SequentialAlgorithms
Shift d Add S
ti l Al ith
BoothMultiplier
ArrayMultiplierwithRCA/CSA
/
DivisionAlgorithms
n
+
s
n
step1:i=0;s=0|B
p
;
|
do{
step2:
if(s0)sH +=A
step3:
control step3:
s=s/2;i++
}while(i<n)
} while (i < n)
FSMDesign
g
Start
S
Sst
CLK
( )
CLK.(i<8)
Do
Sd
Stop
S
Sst
CLK.(i<8)
4
BoothMultiplier
Recodeeach1inmultiplieras+21
Might reducethenumberof1s
+1 1
+1 1
1
+1 1
+1 1
1
+1 1
+1 1
1
1 0 0 0 0 0 1
BoothMultiplier:RecodingExample
0
11
01
(+11)(+11)
(+11) (+11)
(+11)
00010
(+11)
+1 0 1 +1 0 0 1 0 0 +1 1 0
+101+100100+110
If
Ifyouusethelastrowinmultiplication,you
you use the last row in multiplication you
shouldgetexactlythesameresultasusingthe
(
,
y p
firstrow(afterall,theyrepresentthesame
number!)
6
BoothRecoding:MultiplicationExample
g
p
p
Signextension
0
0 0
0 0 1
0 0 1
1
0
0
1
0
0
0
+1
0
1
0
0
0
1
0
1
0
0
0
0
0
1
1
0
0
1
0
1 0
1 0
1 0
0 0
00
0
0 1 0 0
6x
14
(6)
84
7
BoothRecoding:Advantagesand
Disadvantages
d
Dependsonthearchitecture
Depends on the architecture
Potentialadvantage:mightreducethe#of1s
in multiplier
inmultiplier
Inthemultipliersthatwehaveseensofar:
Doesntsaveinspeed
Doesnt save in speed
(stillhavetowaitforthecriticalpath,e.g.,the
shiftadd
shift
adddelayinsequentialmultiplier)
delay in sequential multiplier)
Increasesarea:recodingcircuitryANDsubtraction
SimpleSpeedingup
n 1
A B = A Bi 2
i=0
n 1
NAdditioncanbedoneinparallelinLog(N)
steps using N Adder
stepsusingNAdder
A.B0.20
A.B1.21
A.B2.22
A.B3.23
+
9
pij=ai.bj
p33
s7
p22p13
p21p12
p32
p31
p03
p20 p11
+
p30
+ +
+ +
s4
s3
s2
s5
p02
p10
p01 p00
+
s6
s1
s0
Division:example
p
0011
0100|00001101
0000
0001101
B
0000
001101
0100
00101
0101
0001
Q
A
A = QB + R
0xBx23
0xBx22
1xBx21
1xBx20
Unsigned Division
UnsignedDivision
A = QB + R
step1:i=0;R=A;Q=0;D=B
do{
step2:
if(Dx2ni1 R)R=R Dx2ni1 ;Qni1=1
Qni1
elseQ
n i 1 =0
i++
} while (i < n)
}while(i<n)
Divider design 1
Dividerdesign
D
2n
2n
control
R
2n
Divider design 2
Dividerdesign
D
n
control
R
n
Reducing registers
Reducingregisters
A = QB + R
step1:i=0;R=2xA;D=B
do{
step2:
if(D RH)RH =RH D ;R =2xR+1
elseR =2xR
i++
}while(i<n)#RH =remainder,RL =quotient
Divider design 3
Dividerdesign
D
n
control
R
n