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_half
7 #from ieee754.fpdiv.test.rsqrt_data16 import regressions
8 from ieee754
.div_rem_sqrt_rsqrt
.core
import DivPipeCoreOperation
11 from sfpy
import Float16
, 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_fp16(self
):
22 dut
= FPDIVMuxInOut(16, 8)
23 # don't forget to initialize opcode; don't use magic numbers
24 opcode
= int(DivPipeCoreOperation
.RSqrtRem
)
25 run_pipe_fp(dut
, 16, "rsqrt16", unit_test_half
, Float16
, None,
26 rsqrt
, 100, single_op
=True, opcode
=opcode
)
28 if __name__
== '__main__':