Skip to content

Commit

Permalink
🐛 Fix fpnew_cast_multi signedness bug
Browse files Browse the repository at this point in the history
There was a signedness bug in fpnew_cast_multi that causes VCS to behave
incorrectly when converting a small double into float. This fixes openhwgroup#24.
  • Loading branch information
b1f6c1c4 committed May 31, 2020
1 parent c15c548 commit bfd4320
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/fpnew_cast_multi.sv
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ module fpnew_cast_multi #(
// Handle FP over-/underflows
end else begin
// Overflow or infinities (for proper rounding)
if ((destination_exp_q >= 2**fpnew_pkg::exp_bits(dst_fmt_q2)-1) ||
if ((destination_exp_q >= signed'(2**fpnew_pkg::exp_bits(dst_fmt_q2)-1)) ||
(~src_is_int_q && info_q.is_inf)) begin
final_exp = unsigned'(2**fpnew_pkg::exp_bits(dst_fmt_q2)-2); // largest normal value
preshift_mant = '1; // largest normal value and RS bits set
Expand Down

0 comments on commit bfd4320

Please sign in to comment.