e474ba86d913f37452364b8971eab491bfef874e
[ieee754fpu.git] / src / ieee754 / fpdiv / test / test_fpsqrt_pipe.py
1 """ test of FPDIVMuxInOut
2 """
3
4 from ieee754.fpdiv.pipeline import (FPDIVMuxInOut,)
5 from ieee754.fpcommon.test.fpmux import runfp
6
7 import unittest
8 from sfpy import Float64, Float32, Float16
9
10
11 def sqrt(x):
12 return x.sqrt()
13
14
15 class TestDivPipe(unittest.TestCase):
16 def test_pipe_sqrt_fp16(self):
17 dut = FPDIVMuxInOut(16, 4)
18 runfp(dut, 16, "test_fpsqrt_pipe_fp16", Float16, sqrt,
19 single_op=True, opcode=1, n_vals=100)
20
21 def test_pipe_sqrt_fp32(self):
22 dut = FPDIVMuxInOut(32, 4)
23 runfp(dut, 32, "test_fpsqrt_pipe_fp32", Float32, sqrt,
24 single_op=True, opcode=1, n_vals=100)
25
26 def test_pipe_sqrt_fp64(self):
27 dut = FPDIVMuxInOut(64, 4)
28 runfp(dut, 64, "test_fpsqrt_pipe_fp64", Float64, sqrt,
29 single_op=True, opcode=1, n_vals=100)
30
31
32 if __name__ == '__main__':
33 unittest.main()