From d7373930aa2c6a0334125ec6cdd7110fd31b8f86 Mon Sep 17 00:00:00 2001 From: Jordan Carlin Date: Mon, 25 Mar 2024 12:48:40 -0700 Subject: [PATCH] Correct fcvtmod.w.d flag generation logic --- model/riscv_insts_zfa.sail | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/model/riscv_insts_zfa.sail b/model/riscv_insts_zfa.sail index 9f1e19925..5f9f713d4 100644 --- a/model/riscv_insts_zfa.sail +++ b/model/riscv_insts_zfa.sail @@ -745,7 +745,9 @@ function fcvtmod_helper(x64) = { else integer; /* Raise FP exception flags, honoring the precedence of nV > nX */ - let flags : bits(5) = if (true_exp > 31) then nvFlag() + let max_integer = if sign == 0b1 then unsigned(0x80000000) + else unsigned(0x7fffffff); + let flags : bits(5) = if (true_exp > 31 | unsigned(integer) > max_integer) then nvFlag() else if (fractional != zeros()) then nxFlag() else zeros();