-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] signed_mul_overflow bug #98
Comments
Modifying the solution, I misunderstood multiply signed overflow. My solution is // One signed overflow detection for all multiplication implmentations
assign 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]);
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: