Sei sulla pagina 1di 3

Booth`s Algorithm Tutorial (Tim Berger)

Signed multiplication is a careIul process. With unsigned multiplication there is no need


to take the sign oI the number into consideration. However in signed multiplication the
same process cannot be applied because the signed number is in a 2`s compliment Iorm
which would yield an incorrect result iI multiplied in a similar Iashion to unsigned
multiplication. That`s where Booth`s algorithm comes in. Booth`s algorithm preserves
the sign oI the result.

Methods Used
There are 2 methods that you should know beIore attempting Booth`s algorithm. Right-
shiIt circulant and right-shiIt arithmetic.

Right-shift circulant, or RSC Ior short, is simply shiIting the bit, in a binary string, to
the right 1 bit position and take the last bit in the string and append it to the beginning oI
the string.
Example:
10110
aIter right-shiIt circulant now equals 01011

Right-shift arithmetic, or RSA Ior short, is where you add 2 binary number together
and shiIt the result to the right 1 bit position
Example:
0100
0110
result 1010

Now shiIt all bits right and put the Iirst bit oI the result at the beginning oI the new
string:
result 1010
shiIt 11010

The Process
Step 1: Convert the two operands into binary. Then determine which operand has the
least transitions between bits and set X equal to that operand and Y equal to the other
operand.
Example:
13 1101
10 1010
1101 has less bit transitions so set X 1101 and set Y1010

Note: It`s a good idea to calculate Y as well because you will most likely be
subtracting Y Irom the value in U which is the same as add Y to the value in U

-Y 0110


Step 2: Set up 4 columns as Iollows:
1
st
column is U. This column holds the results Irom each step in the algorithm
2
nd
column is V. This column hold the overIlow Irom U when right-shiIting
3
rd
column is X. This holds X operand. This will show each RSC step.
4
th
column is X-1. This holds the least signiIicant bit Irom X beIore RSC.
Initially set this to 0.

Example Setup:
X1101
Y1010
U V X X-1
0000 0000 1101 0

Step 3: Analyze the least signiIicant bit oI X and the bit in X-1. From that string take
the Iollowing action:
II the string '01 Add Y to the value in U and right-shiIt the result
II the string '10 Subtract Y Irom the value in U and right-shiIt the result
II the string '00 Take no action
II the string '11Right-shiIt the value in U 1 bit position

Example:
String '10 so subtract Y(or add Y) Irom the value in U
U V X X-1
0000 0000 1101 0
0110 0000
0011 0000

Step 4: RSC X . Go to step 3 and repeat the process until the X has been RSC to its
original position

Example:
String '10 so subtract Y(or add Y) Irom the value in U
U V X X-1
0000 0000 1101 0
0110 0000
0011 0000 1110 1


An Example:
X0100 4
Y0110 6
-Y1010 -6




U V X X-1
0000 0000 0100 0
0000 0000 0010 0
0000 0000 0001 0
1010 0000
1010 0000
1101 0000 1000 1
0110 0000
0011 0000
0001 1000 0100 0

Take U and V together and you get 00011000 which is 24
4 x 6 24 so the answer is correct.


Another Example:
This time with a signed number.
X0100 4
Y1010 -6
-Y0110 6

U V X X-1
0000 0000 0100 0
0000 0000 0010 0
0000 0000 0001 0
0110 0000
0110 0000
0011 0000 1000 1
1010 0000
1101 0000
1110 1000 0100 0

Take U and V together and you get 11101000 which is -24
4 x -6 -24 so the answer is correct.

Potrebbero piacerti anche