[BUG] `fleq.*` returns 1 on NaNs when FP16ALT is enabled
Is there an existing CVA6 bug for this?
-
I have searched the existing bug issues
Bug Description
CVA6: Zfa fleq.* returns 1 on NaNs when FP16ALT is enabled
What we saw
-
fleq.{d,s,h}writes 1 (true) when comparing a quiet NaN with itself; Spike writes 0. - No floating-point exception flag is raised.
Minimal config
- Core: RV64, FLEN=64, scalar FP present (F/D/Zfh enabled so S/H/D compares decode).
- Extensions: Zfa enabled; FP16ALT (BF16 alternative half-precision) enabled via
CVA6Cfg.XF16ALT=1; vector FP can be off. - FRM value does not matter; reproduces for any rounding mode.
- Current build config snippet:
localparam CVA6ConfigRVF = 1; localparam CVA6ConfigRVD = 1; localparam CVA6ConfigF16En = 1; localparam CVA6ConfigF16AltEn = 1; localparam CVA6ConfigF8En = 1; localparam CVA6ConfigFVecEn = 1;
Repro snippet
li x1, 0xffffffffffff7e00
fmv.d.x f14, x1
fleq.d x18, f14, f14
li x3, 0xffffffffffff7e00
fmv.h.x f8, x3
fleq.h x20, f8, f8
li x3, 0xffffffffffff7e00
fmv.s.x f10, x3
fleq.s x22, f10, f10
The constant encodes a quiet NaN in FP64/FP32/FP16.
Expected vs actual
- Expected: each
fleq.*returns 0. - CVA6 (Zfa + FP16ALT):
x18 = 1,x20 = 1,x22 = 1. - Spike:
x18 = 0,x20 = 0,x22 = 0.