1 """ test of FPDIVMuxInOut
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
11 from sfpy
import Float32
, Float64
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()))
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
)
28 if __name__
== '__main__':