Booth's Algorithm Tutorial - CS Course Webpages
Booth's Algorithm Tutorial - CS Course Webpages
Booth's Algorithm Tutorial - CS Course Webpages
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Booth’s <strong>Algorithm</strong> <strong>Tutorial</strong> (Tim Berger)<br />
Signed multiplication is a careful process. With unsigned multiplication there is no need<br />
to take the sign of the number into consideration. However in signed multiplication the<br />
same process cannot be applied because the signed number is in a 2’s compliment form<br />
which would yield an incorrect result if multiplied in a similar fashion to unsigned<br />
multiplication. That’s where Booth’s algorithm comes in. Booth’s algorithm preserves<br />
the sign of the result.<br />
Methods Used<br />
There are 2 methods that you should know before attempting Booth’s algorithm. Rightshift<br />
circulant and right-shift arithmetic.<br />
Right-shift circulant, or RSC for short, is simply shifting the bit, in a binary string, to<br />
the right 1 bit position and take the last bit in the string and append it to the beginning of<br />
the string.<br />
Example:<br />
10110<br />
after right-shift circulant now equals – 01011<br />
Right-shift arithmetic, or RSA for short, is where you add 2 binary number together<br />
and shift the result to the right 1 bit position<br />
Example:<br />
0100<br />
+0110<br />
result = 1010<br />
Now shift all bits right and put the first bit of the result at the beginning of the new<br />
string:<br />
result 1010<br />
shift 11010<br />
The Process<br />
Step 1: Convert the two operands into binary. Then determine which operand has the<br />
least transitions between bits and set X equal to that operand and Y equal to the other<br />
operand.<br />
Example:<br />
13 = 1101<br />
10 = 1010<br />
1101 has less bit transitions so set X = 1101 and set Y=1010<br />
Note: It’s a good idea to calculate –Y as well because you will most likely be<br />
subtracting Y from the value in U which is the same as add –Y to the value in U<br />
-Y = 0110
Step 2: Set up 4 columns as follows:<br />
1 st column is U. This column holds the results from each step in the algorithm<br />
2 nd column is V. This column hold the overflow from U when right-shifting<br />
3 rd column is X. This holds X operand. This will show each RSC step.<br />
4 th column is X-1. This holds the least significant bit from X before RSC.<br />
Initially set this to 0.<br />
Example Setup:<br />
X=1101<br />
Y=1010<br />
U V X X-1<br />
0000 0000 1101 0<br />
Step 3: Analyze the least significant bit of X and the bit in X-1. From that string take<br />
the following action:<br />
If the string = “01” Add Y to the value in U and right-shift the result<br />
If the string = “10” Subtract Y from the value in U and right-shift the result<br />
If the string = “00” Take no action<br />
If the string = “11”Right-shift the value in U 1 bit position<br />
Example:<br />
String = “10” so subtract Y(or add –Y) from the value in U<br />
U V X X-1<br />
0000 0000 1101 0<br />
0110 0000<br />
0011 0000<br />
Step 4: RSC X . Go to step 3 and repeat the process until the X has been RSC to its<br />
original position<br />
Example:<br />
String = “10” so subtract Y(or add –Y) from the value in U<br />
U V X X-1<br />
0000 0000 1101 0<br />
0110 0000<br />
0011 0000 1110 1<br />
An Example:<br />
X=0100 = 4<br />
Y=0110 = 6<br />
-Y=1010 = -6
U V X X-1<br />
0000 0000 0100 0<br />
0000 0000 0010 0<br />
0000 0000 0001 0<br />
+1010 0000<br />
1010 0000<br />
1101 0000 1000 1<br />
+0110 0000<br />
0011 0000<br />
0001 1000 0100 0<br />
Take U and V together and you get 00011000 which is 24<br />
4 x 6 = 24 so the answer is correct.<br />
Another Example:<br />
This time with a signed number.<br />
X=0100 = 4<br />
Y=1010 = -6<br />
-Y=0110 = 6<br />
U V X X-1<br />
0000 0000 0100 0<br />
0000 0000 0010 0<br />
0000 0000 0001 0<br />
+0110 0000<br />
0110 0000<br />
0011 0000 1000 1<br />
+1010 0000<br />
1101 0000<br />
1110 1000 0100 0<br />
Take U and V together and you get 11101000 which is -24<br />
4 x -6 = -24 so the answer is correct.