> Ok. Suppose you just have a single 32x32 to 64-bit multiplier. > > To do l.mul, send both 32-bit values to the multiplier as is (not > sign- or zero-extended). > Then the bottom 32 bits get written to the register file. > Then look at the top 32 bits. If the top bits are all zeros *or* the > top bits are all ones, clear the OV flag. Otherwise set it. > If *any* of the top 32 bits are ones, set the CY flag. > > To do l.mulu, again, send both 32-bit values to the multiplier without > extending. > Write the bottom 32 bits to the register file. > Clear the OV flag. > If *any* of the top 32 bits are ones, set the CY flag.
I tried to apply those rules, but I don't quite get it. Let's look at this test case I ran with Verilator: 0xfffffffe * 0xfffffffd ( -2 * -3 ) If I use a signed multiplier like this: result64 = $signed(operand_a_value) * $signed(operand_b_value); I get: 0x00000000:0x00000006 According to the rules above, the Carry flag should be False, which is wrong. If I use an unsigned multiplier like this: result64 = $unsigned(operand_a_value) * $unsigned(operand_b_value); I get: 0xfffffffb:0x00000006 According to the rules above, the Overflow flag should be True, which is wrong, regardless of which top bits I choose to look at (the highest 32 or 33). Thanks in advance, rdiez _______________________________________________ OpenRISC mailing list [email protected] http://lists.openrisc.net/listinfo/openrisc
