From 735330c420049a2f0ffd40182b029063c85506da Mon Sep 17 00:00:00 2001 From: stnolting <22944758+stnolting@users.noreply.github.com> Date: Sat, 6 Jul 2024 05:57:14 +0200 Subject: [PATCH] :bug: [rtl] fix FPU float-to-int corner case --- rtl/core/neorv32_cpu_cp_fpu.vhd | 4 ++-- rtl/core/neorv32_package.vhd | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rtl/core/neorv32_cpu_cp_fpu.vhd b/rtl/core/neorv32_cpu_cp_fpu.vhd index 94fdc19bd..2a0aa5e46 100644 --- a/rtl/core/neorv32_cpu_cp_fpu.vhd +++ b/rtl/core/neorv32_cpu_cp_fpu.vhd @@ -2267,8 +2267,8 @@ begin -- the mantissa is not 0 (without hidden 1) then we have a true overflow. -- Otherwise we have a "real" 1 in the result MSB which should result in -MAX as the correct value. -- This captures the corner case where the number is exactly 2^-31 - elsif ((ctrl.sign = '1') and (ctrl.over = '1') and - (ctrl.result_tmp /= x"80000000") and (mantissa_i /= "00000000000000000000000")) then -- negative out-of-range + elsif (ctrl.sign = '1') and (ctrl.over = '1') then -- negative out-of-range +-- and (ctrl.result_tmp /= x"80000000") and (mantissa_i /= "00000000000000000000000") then -- negative out-of-range ctrl.result <= x"80000000"; -- if we had a negative out of range we are not valid but never inexact ctrl.flags(fp_exc_nv_c) <= '1'; diff --git a/rtl/core/neorv32_package.vhd b/rtl/core/neorv32_package.vhd index 7f01fac0b..7908cc9b2 100644 --- a/rtl/core/neorv32_package.vhd +++ b/rtl/core/neorv32_package.vhd @@ -29,7 +29,7 @@ package neorv32_package is -- Architecture Constants ----------------------------------------------------------------- -- ------------------------------------------------------------------------------------------- - constant hw_version_c : std_ulogic_vector(31 downto 0) := x"01100101"; -- hardware version + constant hw_version_c : std_ulogic_vector(31 downto 0) := x"01100102"; -- hardware version constant archid_c : natural := 19; -- official RISC-V architecture ID constant XLEN : natural := 32; -- native data path width