You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(rtl_gen): format-ID collision in gf_formats + degenerate gf4_add normalization
Audit of the rest of the canonical RTL master set (after gf16_mul/gf16_add) found
two more defects in the GoldenFloat sources, under issue #129:
gf_formats.v: the format-ID registry declared all GF_ID_* as 4'dN, but the IDs run
0..19 -- so GF_ID_INT8 (4'd16), GF_ID_NF4 (17), GF_ID_POSIT16 (18), GF_ID_BINARY16
(19) silently WRAPPED to 0..3 and COLLIDED with GF_ID_GF4/GF8/GF12/GF16. Any future
dispatch on these IDs would mis-select the format. Widened all GF_ID_* to 5 bits ->
20 distinct IDs (verilator: no more "value too large for 4 bit"). They are currently
declared-but-unused, so this is a latent trap, not an active fault.
gf4_add.v: the degenerate GF4 (E1/M2) adder had a normalization width bug
(3-bit norm assigned a 4-bit replicate -> truncation). Replaced with the verified
gf4_add (round-to-nearest over the {0,+-1.25,+-1.5,+-1.75,+-Inf,NaN} grid;
256/256 exhaustive). Both units now verilator -Wall clean; the whole rtl_gen master
set (gf4/gf8/gf16 add, gf16 mul, gf_formats, nf4/int4 quantizers) is clean.
Fixes#129
0 commit comments