674daa35452cd2e99e8706ea35a019b660e0cb4e
[ieee754fpu.git] / src / ieee754 / fcvt / test / test_fcvt_int_pipe_16_32.py
1 """ test of FPCVTIntMuxInOut.
2
3 this one still uses the run_pipe_fp infrastructure which assumes
4 that it's being passed FP input. it doesn't make a heck of a lot
5 of sense, but hey.
6 """
7
8 from ieee754.fcvt.pipeline import FPCVTIntMuxInOut
9 from ieee754.fpcommon.test.case_gen import run_pipe_fp
10 from ieee754.fpcommon.test import unit_test_half
11 from ieee754.fcvt.test.up_fcvt_data_16_32 import regressions
12
13 import sfpy
14 from sfpy import Float64, Float32, Float16
15
16
17 def to_uint16(x):
18 return x
19
20
21 def to_uint32(x):
22 return x
23
24
25 def fcvt_64(x):
26 return sfpy.float.ui32_to_f64(x)
27
28
29 def fcvt_32(x):
30 return sfpy.float.ui32_to_f32(x)
31
32
33 def test_int_pipe_fp16_32():
34 dut = FPCVTIntMuxInOut(16, 32, 4)
35 run_pipe_fp(dut, 16, "int_16_32", unit_test_half, to_uint16,
36 regressions, fcvt_32, 100, True)
37
38
39 if __name__ == '__main__':
40 for i in range(200):
41 test_int_pipe_fp16_32()