def run_regressions(self, regressions_fn):
vals = repeat(self.dut.num_rows, regressions_fn())
+ print ("regressions", vals)
tname = "test_fp%s_pipe_fp%d_regressions" % (self.name, self.width)
runfp(self.dut, self.width, tname, self.fmod, self.fpfn, vals=vals)
m.d.comb += self.o.z.inf(sabx)
# b is zero return NaN
with m.If(b1.is_zero):
- m.d.comb += self.o.z.nan(1)
+ m.d.comb += self.o.z.nan(0)
# if b is inf return inf (or NaN)
with m.Elif(b1.is_inf):
m.d.comb += self.o.z.inf(sabx)
# a is zero return NaN
with m.If(a1.is_zero):
- m.d.comb += self.o.z.nan(1)
+ m.d.comb += self.o.z.nan(0)
# if a is zero or b zero return signed-a/b
with m.Elif(obz):
def regressions():
yield 0x0000, 0xfc00
+ yield 0xfc00, 0x0000
yield 0xe7bb, 0x81ce
yield 0xe225, 0x8181
yield 0x0201, 0x4901
--- /dev/null
+def regressions():
+ yield 0x40000000, 0x40000000
+ yield 0x41400000, 0x40A00000
+ yield 0xffcaeefa, 0x3f803262
+ yield 0xae430313, 0x901c3214
+ yield 0x0a4504d7, 0xb4658540
+ yield 0xba57711a, 0xee1818c5
+ yield 0xbf9b1e94, 0xc038ed3a
+ yield 0x34082401, 0xb328cd45
+ yield 0x05e8ef81, 0x114f3db
+ yield 0x5c75da81, 0x2f642a39
+ yield 0x0002b017, 0xff3807ab
--- /dev/null
+""" test of FPMULMuxInOut
+"""
+
+from ieee754.fpmul.pipeline import (FPMULMuxInOut,)
+from ieee754.fpcommon.test.case_gen import run_pipe_fp
+from ieee754.fpcommon.test import unit_test_half
+from ieee754.fpmul.test.mul_data16 import regressions
+
+from sfpy import Float16
+from operator import mul
+
+
+def test_pipe_fp16():
+ dut = FPMULMuxInOut(16, 4)
+ run_pipe_fp(dut, 16, "mul", unit_test_half, Float16,
+ regressions, mul, 10)
+
+
+if __name__ == '__main__':
+ test_pipe_fp16()
--- /dev/null
+""" test of FPMULMuxInOut
+"""
+
+from ieee754.fpmul.pipeline import (FPMULMuxInOut,)
+from ieee754.fpcommon.test.case_gen import run_pipe_fp
+from ieee754.fpcommon.test import unit_test_single
+from ieee754.fpmul.test.mul_data32 import regressions
+
+from sfpy import Float32
+from operator import mul
+
+
+def test_pipe_fp32():
+ dut = FPMULMuxInOut(32, 4)
+ run_pipe_fp(dut, 32, "mul", unit_test_single, Float32,
+ regressions, mul, 10)
+
+
+if __name__ == '__main__':
+ test_pipe_fp32()