You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Modifying the solution, I misunderstood multiply signed overflow.
The bug was that the original mul_signed_overflow code does not consider when one of the operands is 0 and the other is a negative value.
In this case, the original code will always set mul_signed_overflow.
My solution is
// One signed overflow detection for all multiplication implmentationsassign mul_signed_overflow = (FEATURE_MULTIPLIER=="NONE") ||
(FEATURE_MULTIPLIER=="PIPELINED") ? 1'b0 :
// When either a or b is 0, result should not// be negative
((a ==0|| b ==0) && mul_result[OPTION_OPERAND_WIDTH-1]) ||// Same signs, check for negative result// (should be positive)
((a[OPTION_OPERAND_WIDTH-1] ==
b[OPTION_OPERAND_WIDTH-1]) &&
mul_result[OPTION_OPERAND_WIDTH-1]) ||// Differring signs, check for positive result// (should be negative)
((a[OPTION_OPERAND_WIDTH-1] ^
b[OPTION_OPERAND_WIDTH-1]) &&!mul_result[OPTION_OPERAND_WIDTH-1]);
in the code mor1kx_excute_alu.v
multiplying negative value with 0 will mistakenly assert the overflow.
Also, other cases such as '0x4 * 0x5fffffff' will not detect the overflow.
In the case of SERIAL multiplier, we can fix it by changing
The text was updated successfully, but these errors were encountered: