From 072d1917c653facf5dd6a98162ca9a90f0e09aec Mon Sep 17 00:00:00 2001 From: Pascal Gouedo Date: Fri, 11 Aug 2023 16:59:27 +0200 Subject: [PATCH] Issues #726 and #729 correction. Signed-off-by: Pascal Gouedo --- rtl/vendor/pulp_platform_fpnew/src/fpnew_fma.sv | 7 ++++++- rtl/vendor/pulp_platform_fpnew/src/fpnew_fma_multi.sv | 8 +++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/rtl/vendor/pulp_platform_fpnew/src/fpnew_fma.sv b/rtl/vendor/pulp_platform_fpnew/src/fpnew_fma.sv index 051e6a698..2baf6ad60 100644 --- a/rtl/vendor/pulp_platform_fpnew/src/fpnew_fma.sv +++ b/rtl/vendor/pulp_platform_fpnew/src/fpnew_fma.sv @@ -613,7 +613,12 @@ module fpnew_fma #( ); // Classification after rounding - assign uf_after_round = rounded_abs[EXP_BITS+MAN_BITS-1:MAN_BITS] == '0; // exponent = 0 + 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))))); assign of_after_round = rounded_abs[EXP_BITS+MAN_BITS-1:MAN_BITS] == '1; // exponent all ones // ----------------- diff --git a/rtl/vendor/pulp_platform_fpnew/src/fpnew_fma_multi.sv b/rtl/vendor/pulp_platform_fpnew/src/fpnew_fma_multi.sv index e691f6777..84fde8f09 100644 --- a/rtl/vendor/pulp_platform_fpnew/src/fpnew_fma_multi.sv +++ b/rtl/vendor/pulp_platform_fpnew/src/fpnew_fma_multi.sv @@ -746,7 +746,13 @@ module fpnew_fma_multi #( if (FpFmtConfig[fmt]) begin : active_format always_comb begin : post_process // detect of / uf - fmt_uf_after_round[fmt] = rounded_abs[EXP_BITS+MAN_BITS-1:MAN_BITS] == '0; // denormal + 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))))); fmt_of_after_round[fmt] = rounded_abs[EXP_BITS+MAN_BITS-1:MAN_BITS] == '1; // inf exp. // Assemble regular result, nan box short ones.