Booth Algorithm
with an example
Multiplication in Computer Digital Logic is very intriguing since there exists myraid ways to implement it. You can simply create it in combinational style, or reluctantly compromise on speed for reducing the number of gates in the circuit by using sequential logic.
Naive Sequential Multiplication
Here is how to multiply 2 and 6 on binary representation.
The algorithm is very simple. Assume that your multiplicand and multiplier are n-bit binary number. First, intialize 2n bits with multiplier at nth least significant bits and zero at the remaining bits, and we will call it ‘product’. Iterating for n times, if current least significant bit of product is one, add multiplicand to nth most significant bits of product, which is the left half. Then shift right the product by one bit.
Table below represents steps to multiply 0010 and 0110.
Booth’s Algorithm
Booth has discovered that some addition steps can be reduced by decomposing consecutive ones as an example.
01101 x (10000 – 00001) requires only one addition and one subtraction while 01101 x 01111 requires four addition!
Here is a flowchart of Booth Algorithm.
Since the flowchart itself is not quite comprehensive, taking a look on an example might help you understand.
Example : 2 x 6
Initialize values (CNT stands for Count in the flowchart)
Q0 Q-1 = 00, then right shift and decrement CNT by 1
Q0 Q-1 = 10, then deduct A by M,
and right shift, then decrement CNT by 1
If you are confusing why the left bit become one after right shift, this is called arithmetic shift which preserves 2’s complements sign https://en.wikipedia.org/wiki/Arithmetic_shift
Q0 Q-1 = 11, then right shift and decrement CNT by 1
Q0 Q-1 = 01, then add A by M,
and right shift and decrement CNT by 1
CNT = 0, thus the algorighm terminates, the result is 00001100, i.e. 12.
Booth’s Algorithm also supports negative value multiplication such as 2 x -6 or -7 x -3, no need to convert 2’s compliment to unsigned integer.
Hope this article helps you understand how Booth’ Algorithm works
Lastly, I upload 16-bits Booth’s circuit simulation on GitHub. If you are interested in circuit implementation, you can download and try it.
Reference
- http://staff.ustc.edu.cn/~han/CS152CD/Content/COD3e/InMoreDepth/IMD3-Booths-Algorithm.pdf
- Computer Organization and Architecture 10th — William Stallings
- https://thevaishnud.wordpress.com/2020/03/09/booths-algorithm-for-binary-multiplication/
- https://www.imath.sg/blog/the-challenges-of-math-tutoring-for-each-primary-school-grade-level-in-singapore-math-13 for cover image