From aa8920abe608425c803e5cf8589baa528ac7d45a Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Mon, 8 Jul 2019 07:09:53 +0100 Subject: [PATCH] add test data --- src/ieee754/fpadd/test/add_data32.py | 54 +++++++++++++++++++ src/ieee754/fpcommon/test/unit_test_single.py | 13 +++++ 2 files changed, 67 insertions(+) create mode 100644 src/ieee754/fpadd/test/add_data32.py diff --git a/src/ieee754/fpadd/test/add_data32.py b/src/ieee754/fpadd/test/add_data32.py new file mode 100644 index 00000000..e50afdad --- /dev/null +++ b/src/ieee754/fpadd/test/add_data32.py @@ -0,0 +1,54 @@ +def regressions(): + yield 0x36093399, 0x7f6a12f1 + yield 0x006CE3EE, 0x806CE3EC + yield 0x00000047, 0x80000048 + yield 0x000116C2, 0x8001170A + yield 0x7ed01f25, 0xff559e2c + yield 0, 0 + yield 0xFFFFFFFF, 0xC63B800A + yield 0xFF800000, 0x7F800000 + yield 0xFF800000, 0x7F800000 + yield 0x7F800000, 0xFF800000 + yield 0x42540000, 0xC2540000 + yield 0xC2540000, 0x42540000 + yield 0xfe34f995, 0xff5d59ad + yield 0x82471f51, 0x243985f + yield 0x40000000, 0xc0000000 + yield 0x3F800000, 0x40000000 + yield 0x40000000, 0x3F800000 + yield 0x447A0000, 0x4488B000 + yield 0x463B800A, 0x42BA8A3D + yield 0x42BA8A3D, 0x463B800A + yield 0x463B800A, 0xC2BA8A3D + yield 0xC2BA8A3D, 0x463B800A + yield 0xC63B800A, 0x42BA8A3D + yield 0x42BA8A3D, 0xC63B800A + yield 0x7F800000, 0x00000000 + yield 0x00000000, 0x7F800000 + yield 0xFF800000, 0x00000000 + yield 0x00000000, 0xFF800000 + yield 0x7F800000, 0x7F800000 + yield 0xFF800000, 0xFF800000 + yield 0xFF800000, 0x7F800000 + yield 0x00018643, 0x00FA72A4 + yield 0x001A2239, 0x00FA72A4 + yield 0x3F7FFFFE, 0x3F7FFFFE + yield 0x7EFFFFEE, 0x7EFFFFEE + yield 0x7F7FFFEE, 0xFEFFFFEE + yield 0x7F7FFFEE, 0x756CA884 + yield 0x7F7FFFEE, 0x758A0CF8 + yield 0x42500000, 0x51A7A358 + yield 0x51A7A358, 0x42500000 + yield 0x4E5693A4, 0x42500000 + yield 0x42500000, 0x4E5693A4 + + yield 0x08000000, 0xff8000010 + yield 0x22cb525a, 0xadd79efa + yield 0x40000000, 0xC0000000 + yield 0x83e73d5c, 0x1c800000 + yield 0xbf9b1e94, 0xc038ed3a + yield 0x34082401, 0xb328cd45 + yield 0x05e8ef81, 0x0114f3db + yield 0x5c75da81, 0x2f642a39 + yield 0x0002b017, 0xff3807ab + diff --git a/src/ieee754/fpcommon/test/unit_test_single.py b/src/ieee754/fpcommon/test/unit_test_single.py index 8926bade..2c187d54 100644 --- a/src/ieee754/fpcommon/test/unit_test_single.py +++ b/src/ieee754/fpcommon/test/unit_test_single.py @@ -36,6 +36,19 @@ def match(x, y): (x == y) ) +def create(s, e, x): + return (s<<31) | ((e+127) << 23) | m + +def inf(s): + return create(s, 128, 0) + +def nan(s): + return create(s, 128, 1<<23) + +def zero(s): + return s<<31 + + def get_rs_case(dut, a, b, mid): in_a, in_b = dut.rs[0] out_z = dut.res[0] -- 2.30.2