一般来说,有两种方法,我知道什么是乘法定点/浮点乘法。我是像 Verilog 这样的硬件工程师。
1.Verilog的一种方式 -浮点乘法
2.另一种方法是左移“<<”然后右移“>>”
我认为上述方法的结果都是一样的。但我不确定,所以我在这里问我想知道哪种方式可以使用和纠正?
更新1。
I think there are some way what multiplication in verilog.
1.方式一。
What if I want to multipicate with 3.82 *2.581.
Then we can make integer above fractional numbers like this.
3.98*8 = 31.84.
What if we want only integer result then we could like this way to calculate .
3.98<<7 =3.98 * 2^7 = almost 509.
Then we can get 509 * 8 = 4072
Then we can 31 at 4072>>7.
2.方式二。3.98 = 几乎'b11_111110101...在这里,我们可以选择适合的深度来计算乘法。8 = 'b1000 11_11111010 * 1000 = (4 int),(0 frac) * (2 int),(8 frac) 11 1111101000 = 8144 然后我们得到 8144*2^-8 = 31.8125
更新 2
我对如何将固定分数应用于整数和Verilog - 浮点乘法之间的乘法感到困惑
哪一个是更好的方法?