Skip to content

Commit

Permalink
🐛 Use correct round mode in FMA underflow detection (#137)
Browse files Browse the repository at this point in the history
* 🐛 Use correct round mode in multi FMA of/uf detection

* 🐛 Use correct round mode in FMA of/uf detection
  • Loading branch information
michael-platzer authored Aug 2, 2024
1 parent cb5dc24 commit a6af691
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/fpnew_fma.sv
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ module fpnew_fma #(
// Classification after rounding
assign uf_after_round = (rounded_abs[EXP_BITS+MAN_BITS-1:MAN_BITS] == '0) // denormal
|| ((pre_round_abs[EXP_BITS+MAN_BITS-1:MAN_BITS] == '0) && (rounded_abs[EXP_BITS+MAN_BITS-1:MAN_BITS] == 1) &&
((round_sticky_bits != 2'b11) || (!sum_sticky_bits[MAN_BITS*2 + 4] && ((rnd_mode_i == fpnew_pkg::RNE) || (rnd_mode_i == fpnew_pkg::RMM)))));
((round_sticky_bits != 2'b11) || (!sum_sticky_bits[MAN_BITS*2 + 4] && ((rnd_mode_q == fpnew_pkg::RNE) || (rnd_mode_q == fpnew_pkg::RMM)))));
assign of_after_round = rounded_abs[EXP_BITS+MAN_BITS-1:MAN_BITS] == '1; // exponent all ones

// -----------------
Expand Down
2 changes: 1 addition & 1 deletion src/fpnew_fma_multi.sv
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ module fpnew_fma_multi #(
// detect of / uf
fmt_uf_after_round[fmt] = (rounded_abs[EXP_BITS+MAN_BITS-1:MAN_BITS] == '0) // denormal
|| ((pre_round_abs[EXP_BITS+MAN_BITS-1:MAN_BITS] == '0) && (rounded_abs[EXP_BITS+MAN_BITS-1:MAN_BITS] == 1) &&
((round_sticky_bits != 2'b11) || (!sum_sticky_bits[MAN_BITS*2 + 4] && ((rnd_mode_i == fpnew_pkg::RNE) || (rnd_mode_i == fpnew_pkg::RMM)))));
((round_sticky_bits != 2'b11) || (!sum_sticky_bits[MAN_BITS*2 + 4] && ((rnd_mode_q == fpnew_pkg::RNE) || (rnd_mode_q == fpnew_pkg::RMM)))));
fmt_of_after_round[fmt] = rounded_abs[EXP_BITS+MAN_BITS-1:MAN_BITS] == '1; // inf exp.

// Assemble regular result, nan box short ones.
Expand Down

0 comments on commit a6af691

Please sign in to comment.