Booth 算法

综述

记一次介绍Booth 算法思想的答疑.

正文

Here I give the idea and explanation of the algorithm.

First, let me introduce the idea:
Consider the multiplication of 1101(multiplicand) and 1110 (multiplier).
在这里插入图片描述

In this process, you may notice that if the current bit in the multiplier is 0 there are 4 zeros. (Yellow box)
If the current bit is 1, we need to add multiplicand (1101) to the current result. (Red box)

If a multiplier has many non-zero bits 1111111111110, then the number of operations will be more (we do not like this : | )

The Booth algorithm solves this problem well. Since addition will multiply so many times, why not use subtraction. Actually, the above 1110 can be written as 10000-10, then you can get the result by multiplying twice (note there are only two 1s) and then do subtracting, so this is the principle of Booth’s algorithm.

Then, let me explain how the algorithm is derived.

As you can see here
1110 = 01110 = (10000 - 10)
So how can we get this transformation easily?

Just consider a general case:
在这里插入图片描述

For this multiplier, there are n bits of 1, followed by m bits of 0.
You can write down the transformation like this:
在这里插入图片描述

The grey one is equal to the blue one minus the red one.
To get the blue one, all you need is 1 and (n+m) bits zeros.
To get the orange one, all you need is 1 and (m) bits zeros.
We know for the blue, we will add multiplicand at the current position, for the red one we need to do subtraction.

Then how can we identify this in CPU?
Let’s see the number again: (here I just add one zero in front of the number. This will not influence the value.)
在这里插入图片描述

You can identify the number by identifying 0-1 and 1-0 transitions.

Let’s go back to this problem.
Recall The Booth algorithm solves this problem well. Since addition will multiply so many times, why not use subtraction. Actually, the above 1110 can be written as 10000-10, then you can get the result by multiplying twice (note there are only two 1s) and then do subtracting, so this is the principle of Booth’s algorithm.

For 1101(multiplicand) and 1110 (multiplier), suppose now, you identified 0-1 transition, then you know you need to do the subtraction, then get 2’s complement.
在这里插入图片描述

Similarly, when you identify the 1-0 transition, you need to do addition.
在这里插入图片描述

During this process, do not forget the shift to make sure when we perform operations, these bits are aligned.

Hope this helps!
Further, I suggest you derive it by yourself, and you will experience the beauty of this algorithm.

0、 约定 …………………………………………………………………………………………… 5 1、 无符号数一位乘法 …………………………………………………………………………… 7 2、 符号数一位乘法 ……………………………………………………………………………… 8 3、 布思算法(Booth algorithm) ……………………………………………………………… 9 4、 高基(High Radix)布思算法 ……………………………………………………………… 10 5、 迭代算法 …………………………………………………………………………………… 14 6、 乘法运算的实现——迭代 ………………………………………………………………… 18 7、 乘法运算的实现——阵列 ………………………………………………………………… 20 8、 乘加运算 …………………………………………………………………………………… 24 9、 设计示例1 —— 8位、迭代 ……………………………………………………………… 26 1、 实现方案1 —— 一位、无符号 ………………………………………………… 26 2、 实现方案2 —— 一位、布思 …………………………………………………… 33 3、 实现方案3 —— 二位 …………………………………………………………… 39 10、设计示例2 —— 16位、阵列 …………………………………………………………… 45 11、设计示例3 —— 32位、 迭代、阵列 …………………………………………………… 55 1、 实现方案1 —— 乘、加一步走 ………………………………………………… 56 2、 实现方案2 —— 乘、加两步走 ………………………………………………… 67 后记 ……………………………………………………………………………………… 77 个人介绍 ………………………………………………………………………………… 79
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值