56 ms·
I'm still trying to understand is twos-complement multiplication. When you're computing the product of two n-bit numbers, the product potentially requires 2n b
by CoastalCoder 3y ago
I'm still trying to understand is twos-complement multiplication.
When you're computing the product of two n-bit numbers, the product potentially requires 2n bits of representation.
As I discovered in the RISC-V "M" instructions [0], the n least-significant bits of the result are the same, regardless of whether each operand is signed or unsigned.
However, the most-significant n-bits of the result are contingent on the signed-ness of the two operands.
Anyone know where I find get a good explanation for that?
[0] https://msyksphinz-self.github.io/riscv-isadoc/html/rvm.html https://msyksphinz-self.github.io/riscv-isadoc/html/rvm.html
- a1369209993 3y agoTry multiplying signed and unsigned 16-bit integers with values in the range -128 (65408) thru +255. Signed n-bit multiplication is just multiplication with sign-extension to 2n bits.