diff --git a/model/riscv_insts_zfa.sail b/model/riscv_insts_zfa.sail index 9f1e19925..1443daf3d 100644 --- a/model/riscv_insts_zfa.sail +++ b/model/riscv_insts_zfa.sail @@ -745,7 +745,10 @@ 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 then nvFlag() + else if unsigned(integer) > max_integer then nvFlag() else if (fractional != zeros()) then nxFlag() else zeros();