CS 140
Class Notes 1
Consider two unsigned binary numb ers X and Y . Wewanttomultiply these numb ers. The basic
algorithm is similar to the one used in multiplying the numb ers on p encil and pap er. The main
op erations involved are shift and add.
Recall that the `p encil-and-pap er' algorithm is inecient in that each pro duct term obtained
bymultiplying each bit of the multiplier to the multiplicand has to b e saved till all such pro duct
terms are obtained. In machine implementations, it is desirable to add all such pro duct terms to
form the partial product. Also, instead of shifting the pro duct terms to the left, the partial pro duct
is shifted to the right b efore the addition takes place. In other words, if P is the partial pro duct
i
after i steps and if Y is the multiplicand and X is the multiplier, then
P P + x Y
i i j
and