X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fieee754%2Ffclass%2Ftest%2Ftest_fclass_pipe.py;h=ce870082fd0409b7dff014629a264f88cd1b41ff;hb=4d31bab9e4e1bda62aa7965c4acb56aa0ebf39de;hp=8c4726b82378756ef5f488c0e7759a75d9a8690c;hpb=88affcb4c01a971a51735665f054947cce77fcfa;p=ieee754fpu.git diff --git a/src/ieee754/fclass/test/test_fclass_pipe.py b/src/ieee754/fclass/test/test_fclass_pipe.py index 8c4726b8..ce870082 100644 --- a/src/ieee754/fclass/test/test_fclass_pipe.py +++ b/src/ieee754/fclass/test/test_fclass_pipe.py @@ -3,38 +3,49 @@ from ieee754.fclass.pipeline import (FPClassMuxInOut,) from ieee754.fpcommon.test.fpmux import runfp +from ieee754.fpcommon.test.case_gen import run_pipe_fp +from ieee754.fpcommon.test import unit_test_half from ieee754.fpcommon.fpbase import FPFormat +import unittest + import sfpy from sfpy import Float64, Float32, Float16 + 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) - print (hex(x), "exp", fmt.get_exponent(x), fmt.emax, - "m", hex(fmt.get_mantissa(x)), - fmt.get_mantissa(x) & (1<