Skip to content

Commit

Permalink
🩹 Fix result of not equal compare w signaling NaNs (#116)
Browse files Browse the repository at this point in the history
* 🩹 Set result bit of not equal compare on signaling NaN

* 💡 Update comment w.r.t. signaling NaNs in compares
  • Loading branch information
michael-platzer committed Jun 5, 2024
1 parent 403ca74 commit 0293e8c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/fpnew_noncomp.sv
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,12 @@ module fpnew_noncomp #(
cmp_result = '0; // false
cmp_status = '0; // no flags

// Signalling NaNs always compare as false and are illegal
if (signalling_nan) cmp_status.NV = 1'b1; // invalid operation
// Signalling NaNs always compare as false (except for "not equal" compares) and are illegal
if (signalling_nan) begin
cmp_status.NV = 1'b1; // invalid operation
cmp_result = inp_pipe_rnd_mode_q[NUM_INP_REGS] == fpnew_pkg::RDN && inp_pipe_op_mod_q[NUM_INP_REGS];
// Otherwise do comparisons
else begin
end else begin
unique case (inp_pipe_rnd_mode_q[NUM_INP_REGS])
fpnew_pkg::RNE: begin // Less than or equal
if (any_operand_nan) cmp_status.NV = 1'b1; // Signalling comparison: NaNs are invalid
Expand Down

0 comments on commit 0293e8c

Please sign in to comment.