1 """ test of FPCVTMuxInOut
4 from ieee754
.fcvt
.pipeline
import (FPCVTIntMuxInOut
,)
5 from ieee754
.fpcommon
.test
.fpmux
import runfp
8 from sfpy
import Float64
, Float32
, Float16
20 return sfpy
.float.ui32_to_f64(x
)
23 return sfpy
.float.ui32_to_f32(x
)
26 return sfpy
.float.ui64_to_f32(x
)
29 return sfpy
.float.ui32_to_f16(x
)
31 def test_int_pipe_ui16_f32():
32 # XXX softfloat-3 doesn't have ui16_to_xxx so use ui32 instead.
34 dut
= FPCVTIntMuxInOut(16, 32, 4)
35 runfp(dut
, 16, "test_fcvt_int_pipe_ui16_f32", to_uint16
, fcvt_32
, True,
38 def test_int_pipe_ui16_f64():
39 dut
= FPCVTIntMuxInOut(16, 64, 4)
40 runfp(dut
, 16, "test_fcvt_int_pipe_ui16_f64", to_uint16
, fcvt_64
, True,
43 def test_int_pipe_ui32_f64():
44 dut
= FPCVTIntMuxInOut(32, 64, 4)
45 runfp(dut
, 32, "test_fcvt_int_pipe_ui32_64", to_uint32
, fcvt_64
, True,
48 def test_int_pipe_ui64_f32():
49 # ok, doing 33 bits here because it's pretty pointless (not entirely)
50 # to do random numbers statistically likely 99.999% of the time to be
52 dut
= FPCVTIntMuxInOut(64, 32, 4)
53 runfp(dut
, 33, "test_fcvt_int_pipe_ui64_32", to_uint64
, fcvt_64_to_32
, True,
56 def test_int_pipe_ui64_f16():
57 # ok, doing 17 bits here because it's pretty pointless (not entirely)
58 # to do random numbers statistically likely 99.999% of the time to be
60 dut
= FPCVTIntMuxInOut(64, 16, 4)
61 runfp(dut
, 17, "test_fcvt_int_pipe_ui64_16", to_uint64
, fcvt_16
, True,
64 def test_int_pipe_ui32_f16():
65 # ok, doing 17 bits here because it's pretty pointless (not entirely)
66 # to do random numbers statistically likely 99.999% of the time to be
68 dut
= FPCVTIntMuxInOut(32, 16, 4)
69 runfp(dut
, 17, "test_fcvt_int_pipe_ui32_16", to_uint32
, fcvt_16
, True,
72 if __name__
== '__main__':
74 test_int_pipe_ui64_f32()
75 test_int_pipe_ui32_f16()
76 test_int_pipe_ui64_f16()
77 test_int_pipe_ui16_f32()
78 test_int_pipe_ui16_f64()
79 test_int_pipe_ui32_f64()