From 0e2d2c7dac79240372b7b883b05d47d9493c3dbb Mon Sep 17 00:00:00 2001 From: Michael Platzer Date: Wed, 5 Jun 2024 07:30:04 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20status=20flags=20for=20I2F?= =?UTF-8?q?=20and=20F2I=20conversions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/fpnew_cast_multi.sv | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/fpnew_cast_multi.sv b/src/fpnew_cast_multi.sv index 7abe3304..65286a8e 100644 --- a/src/fpnew_cast_multi.sv +++ b/src/fpnew_cast_multi.sv @@ -718,13 +718,13 @@ module fpnew_cast_multi #( logic [WIDTH-1:0] fp_result, int_result; fpnew_pkg::status_t fp_status, int_status; - assign fp_regular_status.NV = src_is_int_q & (of_before_round | of_after_round); // overflow is invalid for I2F casts + assign fp_regular_status.NV = 1'b0; // floating-point results are always valid assign fp_regular_status.DZ = 1'b0; // no divisions - assign fp_regular_status.OF = ~src_is_int_q & (~info_q.is_inf & (of_before_round | of_after_round)); // inf casts no OF + assign fp_regular_status.OF = ~info_q.is_inf & (of_before_round | of_after_round); // inf casts no OF assign fp_regular_status.UF = uf_after_round & fp_regular_status.NX; - assign fp_regular_status.NX = src_is_int_q ? (| fp_round_sticky_bits) // overflow is invalid in i2f - : (| fp_round_sticky_bits) | (~info_q.is_inf & (of_before_round | of_after_round)); - assign int_regular_status = '{NX: (| int_round_sticky_bits), default: 1'b0}; + assign fp_regular_status.NX = (| fp_round_sticky_bits) | (~info_q.is_inf & (of_before_round | of_after_round)); + assign int_regular_status = '{NV: of_before_round | of_after_round, // overflow is invalid for F2I casts + NX: (| int_round_sticky_bits), default: 1'b0}; assign fp_result = fp_result_is_special ? fp_special_result : fmt_result[dst_fmt_q2]; assign fp_status = fp_result_is_special ? fp_special_status : fp_regular_status;