fc44458e95b1a10d62e0e69893fd3cefa2919a30
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.ui32_to_f16(x
)
28 def test_int_pipe_ui16_f32():
29 # XXX softfloat-3 doesn't have ui16_to_xxx so use ui32 instead.
31 dut
= FPCVTIntMuxInOut(16, 32, 4)
32 runfp(dut
, 16, "test_fcvt_int_pipe_ui16_f32", to_uint16
, fcvt_32
, True,
35 def test_int_pipe_ui16_f64():
36 dut
= FPCVTIntMuxInOut(16, 64, 4)
37 runfp(dut
, 16, "test_fcvt_int_pipe_ui16_f64", to_uint16
, fcvt_64
, True,
40 def test_int_pipe_ui32_f64():
41 dut
= FPCVTIntMuxInOut(32, 64, 4)
42 runfp(dut
, 32, "test_fcvt_int_pipe_ui32_64", to_uint32
, fcvt_64
, True,
45 def test_int_pipe_ui64_f16():
46 # ok, doing 17 bits here because it's pretty pointless (not entirely)
47 # to do random numbers statistically likely 99.999% of the time to be
49 dut
= FPCVTIntMuxInOut(64, 16, 4)
50 runfp(dut
, 17, "test_fcvt_int_pipe_ui64_16", to_uint64
, fcvt_16
, True,
53 def test_int_pipe_ui32_f16():
54 # ok, doing 17 bits here because it's pretty pointless (not entirely)
55 # to do random numbers statistically likely 99.999% of the time to be
57 dut
= FPCVTIntMuxInOut(32, 16, 4)
58 runfp(dut
, 17, "test_fcvt_int_pipe_ui32_16", to_uint32
, fcvt_16
, True,
61 if __name__
== '__main__':
63 test_int_pipe_ui32_f16()
64 test_int_pipe_ui64_f16()
65 test_int_pipe_ui16_f32()
66 test_int_pipe_ui16_f64()
67 test_int_pipe_ui32_f64()