allow alias SimdSignal<-PartitionedSignal to allow tracking back through
[ieee754fpu.git] / src / ieee754 / fpdiv / test / test_fprsqrt_pipe_32.py
1 """ test of FPDIVMuxInOut
2 """
3
4 from ieee754.fpdiv.pipeline import (FPDIVMuxInOut,)
5 from ieee754.fpcommon.test.case_gen import run_pipe_fp
6 from ieee754.fpcommon.test import unit_test_single
7 #from ieee754.fpdiv.test.rsqrt_data32 import regressions
8 from ieee754.div_rem_sqrt_rsqrt.core import DivPipeCoreOperation
9
10 import unittest
11 from sfpy import Float32, Float64
12
13
14 def rsqrt(x):
15 # FIXME: switch to correct implementation
16 # needs to use exact arithmetic and rounding only once at the end
17 return x.__class__(float(Float64(1.0) / x.to_f64().sqrt()))
18
19
20 class TestDivPipe(unittest.TestCase):
21 def test_pipe_rsqrt_fp32(self):
22 dut = FPDIVMuxInOut(32, 4)
23 # don't forget to initialize opcode; don't use magic numbers
24 opcode = int(DivPipeCoreOperation.RSqrtRem)
25 run_pipe_fp(dut, 32, "rsqrt32", unit_test_single, Float32, None,
26 rsqrt, 100, single_op=True, opcode=opcode)
27
28 if __name__ == '__main__':
29 unittest.main()