Multiplier = 0xffffffff
Multiplicand = 0xffffffff
Result = 0xFFFFFFFE 00000001 (multiplier * multiplicand)
mulh
instruction is expected to give the upper XLEN bits of the result as per RISC-Vs pec. But when I run mulh t0, a0, a1;
with multiplier in a0
and multiplicand in a1
, the result in t0
is 0. Can someone explain why? I run this in RV32IMAC (FE310 core).
assembly and C code below:
mulh_asm:
mulh t0, a0, a1;
addi a0, x0, 0; // **Break point here to watch t0 value**
ret;
mrest[0] = mulh_asm(0xffffffff, 0xffffffff);