m.d.comb += is_sig_nan.eq(a1.exp_128 & (msbzero) & (~a1.m_zero))
subnormal = a1.exp_n127
+ # this is hardware-optimal but very hard to understand.
+ # see unit test test_fclass_pipe.py fclass() for what's
+ # going on.
m.d.comb += self.o.z.eq(Cat(
a1.s & a1.is_inf, # | −inf.
a1.s & finite_nzero & ~subnormal, # | -normal number.
def fclass(wid, x):
""" analyses the FP number and returns a RISC-V "FCLASS" unary bitfield
+
+ this is easy to understand however it has redundant checks (which
+ don't matter because performance of *testing* is not hardware-critical)
+ see FPClassMod for a hardware-optimal (hard-to-read) version
"""
x = x.bits
fmt = FPFormat.standard(wid)