From: Luke Kenneth Casson Leighton Date: Mon, 29 Jul 2019 13:18:26 +0000 (+0100) Subject: add fpsqrt 16 coverage test X-Git-Tag: ls180-24jan2020~682 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=eb58938610455da3a0c9ae4bf85bd168e06cf17b;p=ieee754fpu.git add fpsqrt 16 coverage test --- diff --git a/src/ieee754/fpdiv/test/sqrt_data16.py b/src/ieee754/fpdiv/test/sqrt_data16.py new file mode 100644 index 00000000..d1a6740f --- /dev/null +++ b/src/ieee754/fpdiv/test/sqrt_data16.py @@ -0,0 +1,9 @@ +def regressions(): + yield 0x3686, + yield 0x4400, + yield 0x4800, + yield 0x48f0, + yield 0x429, + yield 0x2631, + yield 0x3001, + diff --git a/src/ieee754/fpdiv/test/test_fpsqrt_pipe_16.py b/src/ieee754/fpdiv/test/test_fpsqrt_pipe_16.py new file mode 100644 index 00000000..e1709c36 --- /dev/null +++ b/src/ieee754/fpdiv/test/test_fpsqrt_pipe_16.py @@ -0,0 +1,27 @@ +""" test of FPDIVMuxInOut +""" + +from ieee754.fpdiv.pipeline import (FPDIVMuxInOut,) +from ieee754.fpcommon.test.case_gen import run_pipe_fp +from ieee754.fpcommon.test import unit_test_half +from ieee754.fpdiv.test.sqrt_data16 import regressions +from ieee754.div_rem_sqrt_rsqrt.core import DivPipeCoreOperation + +import unittest +from sfpy import Float16 + + +def sqrt(x): + return x.sqrt() + + +class TestDivPipe(unittest.TestCase): + def test_pipe_sqrt_fp16(self): + dut = FPDIVMuxInOut(16, 4) + # don't forget to initialize opcode; don't use magic numbers + opcode = int(DivPipeCoreOperation.SqrtRem) + run_pipe_fp(dut, 16, "sqrt16", unit_test_half, Float16, regressions, + sqrt, 100, single_op=True, opcode=opcode) + +if __name__ == '__main__': + unittest.main()