如何执行右移二进制乘法? [英] How to perform right shifting binary multiplication?
本文介绍了如何执行右移二进制乘法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是一个家庭作业问题,我尝试自己解决,但无法解决.这项工作是要实现一个通过使用右移将两个二进制数相乘的电路.我对Verilog没任何问题,我唯一的问题是如何总结算法,以便我自己实现.
This is a homework problem which I tried to solve by myself but I couldn't. The homework is to implement a circuit that multiplies two binary numbers by using right shifting. I don't have any problems with Verilog, my only problem is how to conclude the algorithm so I can implement it by myself.
推荐答案
示例相乘.注意4位加法器产生5位和(最高位为进位).加法器的输入是被乘数加上乘积寄存器的位3至6,包括进位在内的总和进入乘积寄存器的位3至7.
Example multiplies. Note 4 bit adder produces a 5 bit sum (top bit is carry). Input to adder is multiplicand plus bits 3 to 6 of product register, the sum including carry, goes to bits 3 to 7 of product register.
multiplicand 1100, multiplier 0101
7 6 5 4 3 2 1 0 product bit index
0 0 0 0 0 1 0 1 initial 8 bit register
0 0 0 0 0 0 1 0 1 shift right, 1 bit shifted out
1 1 0 0 add multiplicand
0 1 1 0 0 0 1 0
0 0 1 1 0 0 0 1 0 shift right, 0 bit shifted out
0 0 0 0 no add
0 0 1 1 0 0 0 1
0 0 0 1 1 0 0 0 1 shift right, 1 bit shifted out
1 1 0 0 add multiplicand
0 1 1 1 1 0 0 0
0 0 1 1 1 1 0 0 0 shift right, 0 bit shifted out
0 0 0 0 no add
0 0 1 1 1 1 0 0
multiplicand 1111, multiplier 1111
0 0 0 0 1 1 1 1 initial 8 bit register
0 0 0 0 0 1 1 1 1 shift right, 1 bit shifted out
1 1 1 1 add multiplicand
0 1 1 1 1 1 1 1
0 0 1 1 1 1 1 1 1 shift right, 1 bit shifted out
1 1 1 1 add multiplicand
1 0 1 1 0 1 1 1
0 1 0 1 1 0 1 1 1 shift right, 1 bit shifted out
1 1 1 1 add multiplicand
1 1 0 1 0 0 1 1
0 1 1 0 1 0 0 1 1 shift right, 1 bit shifted out
1 1 1 1 add multiplicand
1 1 1 0 0 0 0 1
这篇关于如何执行右移二进制乘法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文