fix tests/mark as expected failure
[ieee754fpu.git] / src / ieee754 / fpdiv / test / test_fprsqrt_pipe.py
1 """ test of FPDIVMuxInOut
2 """
3
4 from ieee754.fpdiv.pipeline import FPDIVMuxInOut
5 from ieee754.fpcommon.test.fpmux import runfp
6 from ieee754.div_rem_sqrt_rsqrt.core import DivPipeCoreOperation
7
8 import unittest
9 from sfpy import Float64, Float32, Float16
10
11
12 def rsqrt(x):
13 # FIXME: switch to correct implementation
14 # needs to use exact arithmetic and rounding only once at the end
15 return x.__class__(float(Float64(1.0) / x.to_f64().sqrt()))
16
17
18 class TestDivPipe(unittest.TestCase):
19 # FIXME: AttributeError: 'NextControl' object has no attribute 'ready_i'
20 @unittest.expectedFailure
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 runfp(dut, 16, "test_fprsqrt_pipe_fp16", Float16, rsqrt,
26 single_op=True, opcode=opcode, n_vals=100, cancel=True)
27
28 # FIXME: AttributeError: 'NextControl' object has no attribute 'ready_i'
29 @unittest.expectedFailure
30 def test_pipe_rsqrt_fp32(self):
31 dut = FPDIVMuxInOut(32, 8)
32 # don't forget to initialize opcode; don't use magic numbers
33 opcode = int(DivPipeCoreOperation.RSqrtRem)
34 runfp(dut, 32, "test_fprsqrt_pipe_fp32", Float32, rsqrt,
35 single_op=True, opcode=opcode, n_vals=100, cancel=True)
36
37 @unittest.skip("rsqrt not implemented for fp64")
38 def test_pipe_rsqrt_fp64(self):
39 dut = FPDIVMuxInOut(64, 8)
40 # don't forget to initialize opcode; don't use magic numbers
41 opcode = int(DivPipeCoreOperation.RSqrtRem)
42 runfp(dut, 64, "test_fprsqrt_pipe_fp64", Float64, rsqrt,
43 single_op=True, opcode=opcode, n_vals=100, cancel=True)
44
45
46 if __name__ == '__main__':
47 unittest.main()