from unit_test_single import (get_mantissa, get_exponent, get_sign, is_nan,
is_inf, is_pos_inf, is_neg_inf,
- match, get_case, check_case, run_test,
+ match, get_case, check_case, run_fpunit,
run_edge_cases, run_corner_cases)
def testbench(dut):
0x5e8ef81, 0x5c75da81, 0x2b017]
stimulus_b = [0xadd79efa, 0xC0000000, 0x1c800000, 0xc038ed3a, 0xb328cd45,
0x114f3db, 0x2f642a39, 0xff3807ab]
- yield from run_test(dut, stimulus_a, stimulus_b, add, get_case)
+ yield from run_fpunit(dut, stimulus_a, stimulus_b, add, get_case)
count += len(stimulus_a)
print (count, "vectors passed")
from ieee754.fpcommon.test.unit_test_single import (get_mantissa, get_exponent,
get_sign, is_nan,
is_inf, is_pos_inf, is_neg_inf,
- match, get_rs_case, check_rs_case, run_test,
+ match, get_rs_case, check_rs_case, run_fpunit,
run_edge_cases, run_corner_cases)
def testbench(dut):
stimulus_b = [0xff800001, 0xadd79efa, 0xC0000000, 0x1c800000,
0xc038ed3a, 0xb328cd45,
0x114f3db, 0x2f642a39, 0xff3807ab]
- yield from run_test(dut, stimulus_a, stimulus_b, add, get_rs_case)
+ yield from run_fpunit(dut, stimulus_a, stimulus_b, add, get_rs_case)
count += len(stimulus_a)
print (count, "vectors passed")
from unit_test_half import (get_mantissa, get_exponent, get_sign, is_nan,
is_inf, is_pos_inf, is_neg_inf,
- match, get_case, check_case, run_test,
+ match, get_case, check_case, run_fpunit,
run_edge_cases, run_corner_cases)
def testbench(dut):
#regression tests
stimulus_a = [ 0x8000, 0x8000 ]
stimulus_b = [ 0x0000, 0xfc01 ]
- yield from run_test(dut, stimulus_a, stimulus_b, add)
+ yield from run_fpunit(dut, stimulus_a, stimulus_b, add)
count += len(stimulus_a)
print (count, "vectors passed")
from unit_test_double import (get_mantissa, get_exponent, get_sign, is_nan,
is_inf, is_pos_inf, is_neg_inf,
- match, get_case, check_case, run_test,
+ match, get_case, check_case, run_fpunit,
run_edge_cases, run_corner_cases)
#regression tests
stimulus_a = [0x3ff00000000000c5, 0xff80000000000000]
stimulus_b = [0xbd28a404211fb72b, 0x7f80000000000000]
- yield from run_test(dut, stimulus_a, stimulus_b, add)
+ yield from run_fpunit(dut, stimulus_a, stimulus_b, add)
count += len(stimulus_a)
print (count, "vectors passed")
assert out_z == z, "Output z 0x%x not equal to expected 0x%x" % (out_z, z)
-def run_test(dut, stimulus_a, stimulus_b, op):
+def run_fpunit(dut, stimulus_a, stimulus_b, op):
expected_responses = []
actual_responses = []
0x7ff0000000000000,
0xfff0000000000000
], 2)]
- yield from run_test(dut, stimulus_a, stimulus_b, op)
+ yield from run_fpunit(dut, stimulus_a, stimulus_b, op)
count += len(stimulus_a)
print (count, "vectors passed")
#edge cases
stimulus_a = [0x8000000000000000 for i in range(maxcount)]
stimulus_b = [randint(0, 1<<64) for i in range(maxcount)]
- yield from run_test(dut, stimulus_a, stimulus_b, op)
+ yield from run_fpunit(dut, stimulus_a, stimulus_b, op)
count += len(stimulus_a)
print (count, "vectors passed")
stimulus_a = [0x0000000000000000 for i in range(maxcount)]
stimulus_b = [randint(0, 1<<64) for i in range(maxcount)]
- yield from run_test(dut, stimulus_a, stimulus_b, op)
+ yield from run_fpunit(dut, stimulus_a, stimulus_b, op)
count += len(stimulus_a)
print (count, "vectors passed")
stimulus_b = [0x8000000000000000 for i in range(maxcount)]
stimulus_a = [randint(0, 1<<64) for i in range(maxcount)]
- yield from run_test(dut, stimulus_a, stimulus_b, op)
+ yield from run_fpunit(dut, stimulus_a, stimulus_b, op)
count += len(stimulus_a)
print (count, "vectors passed")
stimulus_b = [0x0000000000000000 for i in range(maxcount)]
stimulus_a = [randint(0, 1<<64) for i in range(maxcount)]
- yield from run_test(dut, stimulus_a, stimulus_b, op)
+ yield from run_fpunit(dut, stimulus_a, stimulus_b, op)
count += len(stimulus_a)
print (count, "vectors passed")
stimulus_a = [0x7FF8000000000000 for i in range(maxcount)]
stimulus_b = [randint(0, 1<<64) for i in range(maxcount)]
- yield from run_test(dut, stimulus_a, stimulus_b, op)
+ yield from run_fpunit(dut, stimulus_a, stimulus_b, op)
count += len(stimulus_a)
print (count, "vectors passed")
stimulus_a = [0xFFF8000000000000 for i in range(maxcount)]
stimulus_b = [randint(0, 1<<64) for i in range(maxcount)]
- yield from run_test(dut, stimulus_a, stimulus_b, op)
+ yield from run_fpunit(dut, stimulus_a, stimulus_b, op)
count += len(stimulus_a)
print (count, "vectors passed")
stimulus_b = [0x7FF8000000000000 for i in range(maxcount)]
stimulus_a = [randint(0, 1<<64) for i in range(maxcount)]
- yield from run_test(dut, stimulus_a, stimulus_b, op)
+ yield from run_fpunit(dut, stimulus_a, stimulus_b, op)
count += len(stimulus_a)
print (count, "vectors passed")
stimulus_b = [0xFFF8000000000000 for i in range(maxcount)]
stimulus_a = [randint(0, 1<<64) for i in range(maxcount)]
- yield from run_test(dut, stimulus_a, stimulus_b, op)
+ yield from run_fpunit(dut, stimulus_a, stimulus_b, op)
count += len(stimulus_a)
print (count, "vectors passed")
stimulus_a = [0x7FF0000000000000 for i in range(maxcount)]
stimulus_b = [randint(0, 1<<64) for i in range(maxcount)]
- yield from run_test(dut, stimulus_a, stimulus_b, op)
+ yield from run_fpunit(dut, stimulus_a, stimulus_b, op)
count += len(stimulus_a)
print (count, "vectors passed")
stimulus_a = [0xFFF0000000000000 for i in range(maxcount)]
stimulus_b = [randint(0, 1<<64) for i in range(maxcount)]
- yield from run_test(dut, stimulus_a, stimulus_b, op)
+ yield from run_fpunit(dut, stimulus_a, stimulus_b, op)
count += len(stimulus_a)
print (count, "vectors passed")
stimulus_b = [0x7FF0000000000000 for i in range(maxcount)]
stimulus_a = [randint(0, 1<<64) for i in range(maxcount)]
- yield from run_test(dut, stimulus_a, stimulus_b, op)
+ yield from run_fpunit(dut, stimulus_a, stimulus_b, op)
count += len(stimulus_a)
print (count, "vectors passed")
stimulus_b = [0xFFF0000000000000 for i in range(maxcount)]
stimulus_a = [randint(0, 1<<64) for i in range(maxcount)]
- yield from run_test(dut, stimulus_a, stimulus_b, op)
+ yield from run_fpunit(dut, stimulus_a, stimulus_b, op)
count += len(stimulus_a)
print (count, "vectors passed")
for i in range(num_loops):
stimulus_a = [randint(0, 1<<64) for i in range(maxcount)]
stimulus_b = [randint(0, 1<<64) for i in range(maxcount)]
- yield from run_test(dut, stimulus_a, stimulus_b, op)
+ yield from run_fpunit(dut, stimulus_a, stimulus_b, op)
count += maxcount
print (count, "random vectors passed")
assert out_z == z, "Output z 0x%x not equal to expected 0x%x" % (out_z, z)
-def run_test(dut, stimulus_a, stimulus_b, op):
+def run_fpunit(dut, stimulus_a, stimulus_b, op):
expected_responses = []
actual_responses = []
from itertools import permutations
stimulus_a = [i[0] for i in permutations(corners, 2)]
stimulus_b = [i[1] for i in permutations(corners, 2)]
- yield from run_test(dut, stimulus_a, stimulus_b, op)
+ yield from run_fpunit(dut, stimulus_a, stimulus_b, op)
count += len(stimulus_a)
print (count, "vectors passed")
#edge cases
stimulus_a = [0x8000 for i in range(maxcount)]
stimulus_b = [randint(0, maxint16-1) for i in range(maxcount)]
- yield from run_test(dut, stimulus_a, stimulus_b, op)
+ yield from run_fpunit(dut, stimulus_a, stimulus_b, op)
count += len(stimulus_a)
print (count, "vectors passed")
stimulus_a = [0x0000 for i in range(maxcount)]
stimulus_b = [randint(0, maxint16-1) for i in range(maxcount)]
- yield from run_test(dut, stimulus_a, stimulus_b, op)
+ yield from run_fpunit(dut, stimulus_a, stimulus_b, op)
count += len(stimulus_a)
print (count, "vectors passed")
stimulus_b = [0x8000 for i in range(maxcount)]
stimulus_a = [randint(0, maxint16-1) for i in range(maxcount)]
- yield from run_test(dut, stimulus_a, stimulus_b, op)
+ yield from run_fpunit(dut, stimulus_a, stimulus_b, op)
count += len(stimulus_a)
print (count, "vectors passed")
stimulus_b = [0x0000 for i in range(maxcount)]
stimulus_a = [randint(0, maxint16-1) for i in range(maxcount)]
- yield from run_test(dut, stimulus_a, stimulus_b, op)
+ yield from run_fpunit(dut, stimulus_a, stimulus_b, op)
count += len(stimulus_a)
print (count, "vectors passed")
stimulus_a = [0x7800 for i in range(maxcount)]
stimulus_b = [randint(0, maxint16-1) for i in range(maxcount)]
- yield from run_test(dut, stimulus_a, stimulus_b, op)
+ yield from run_fpunit(dut, stimulus_a, stimulus_b, op)
count += len(stimulus_a)
print (count, "vectors passed")
stimulus_a = [0xF800 for i in range(maxcount)]
stimulus_b = [randint(0, maxint16-1) for i in range(maxcount)]
- yield from run_test(dut, stimulus_a, stimulus_b, op)
+ yield from run_fpunit(dut, stimulus_a, stimulus_b, op)
count += len(stimulus_a)
print (count, "vectors passed")
stimulus_b = [0x7800 for i in range(maxcount)]
stimulus_a = [randint(0, maxint16-1) for i in range(maxcount)]
- yield from run_test(dut, stimulus_a, stimulus_b, op)
+ yield from run_fpunit(dut, stimulus_a, stimulus_b, op)
count += len(stimulus_a)
print (count, "vectors passed")
stimulus_b = [0xF800 for i in range(maxcount)]
stimulus_a = [randint(0, maxint16-1) for i in range(maxcount)]
- yield from run_test(dut, stimulus_a, stimulus_b, op)
+ yield from run_fpunit(dut, stimulus_a, stimulus_b, op)
count += len(stimulus_a)
print (count, "vectors passed")
stimulus_a = [0x7C00 for i in range(maxcount)]
stimulus_b = [randint(0, maxint16-1) for i in range(maxcount)]
- yield from run_test(dut, stimulus_a, stimulus_b, op)
+ yield from run_fpunit(dut, stimulus_a, stimulus_b, op)
count += len(stimulus_a)
print (count, "vectors passed")
stimulus_a = [0xFC00 for i in range(maxcount)]
stimulus_b = [randint(0, maxint16-1) for i in range(maxcount)]
- yield from run_test(dut, stimulus_a, stimulus_b, op)
+ yield from run_fpunit(dut, stimulus_a, stimulus_b, op)
count += len(stimulus_a)
print (count, "vectors passed")
stimulus_b = [0x7C00 for i in range(maxcount)]
stimulus_a = [randint(0, maxint16-1) for i in range(maxcount)]
- yield from run_test(dut, stimulus_a, stimulus_b, op)
+ yield from run_fpunit(dut, stimulus_a, stimulus_b, op)
count += len(stimulus_a)
print (count, "vectors passed")
stimulus_b = [0xFC00 for i in range(maxcount)]
stimulus_a = [randint(0, maxint16-1) for i in range(maxcount)]
- yield from run_test(dut, stimulus_a, stimulus_b, op)
+ yield from run_fpunit(dut, stimulus_a, stimulus_b, op)
count += len(stimulus_a)
print (count, "vectors passed")
for i in range(num_loops):
stimulus_a = [randint(0, maxint16-1) for i in range(maxcount)]
stimulus_b = [randint(0, maxint16-1) for i in range(maxcount)]
- yield from run_test(dut, stimulus_a, stimulus_b, op)
+ yield from run_fpunit(dut, stimulus_a, stimulus_b, op)
count += maxcount
print (count, "random vectors passed")
assert out_mid == mid, "Output mid 0x%x != expected 0x%x" % (out_mid, mid)
-def run_test(dut, stimulus_a, stimulus_b, op, get_case_fn):
+def run_fpunit(dut, stimulus_a, stimulus_b, op, get_case_fn):
expected_responses = []
actual_responses = []
from itertools import permutations
stimulus_a = [i[0] for i in permutations(corner_cases, 2)]
stimulus_b = [i[1] for i in permutations(corner_cases, 2)]
- yield from run_test(dut, stimulus_a, stimulus_b, op, get_case_fn)
+ yield from run_fpunit(dut, stimulus_a, stimulus_b, op, get_case_fn)
count += len(stimulus_a)
print (count, "vectors passed")
-def run_test_2(dut, stimulus_a, stimulus_b, op, get_case_fn):
- yield from run_test(dut, stimulus_a, stimulus_b, op, get_case_fn)
- yield from run_test(dut, stimulus_b, stimulus_a, op, get_case_fn)
+def run_fpunit_2(dut, stimulus_a, stimulus_b, op, get_case_fn):
+ yield from run_fpunit(dut, stimulus_a, stimulus_b, op, get_case_fn)
+ yield from run_fpunit(dut, stimulus_b, stimulus_a, op, get_case_fn)
def run_cases(dut, count, op, fixed_num, maxcount, get_case_fn):
if isinstance(fixed_num, int):
report = "random"
stimulus_b = [randint(0, 1<<32) for i in range(maxcount)]
- yield from run_test_2(dut, stimulus_a, stimulus_b, op, get_case_fn)
+ yield from run_fpunit_2(dut, stimulus_a, stimulus_b, op, get_case_fn)
count += len(stimulus_a)
print (count, "vectors passed 2^32", report)
# non-canonical NaNs.
stimulus_b = [set_exponent(randint(0, 1<<32), 128) \
for i in range(maxcount)]
- yield from run_test_2(dut, stimulus_a, stimulus_b, op, get_case_fn)
+ yield from run_fpunit_2(dut, stimulus_a, stimulus_b, op, get_case_fn)
count += len(stimulus_a)
print (count, "vectors passed Non-Canonical NaN", report)
# -127
stimulus_b = [set_exponent(randint(0, 1<<32), -127) \
for i in range(maxcount)]
- yield from run_test_2(dut, stimulus_a, stimulus_b, op, get_case_fn)
+ yield from run_fpunit_2(dut, stimulus_a, stimulus_b, op, get_case_fn)
count += len(stimulus_a)
print (count, "vectors passed exp=-127", report)
# nearly zero
stimulus_b = [set_exponent(randint(0, 1<<32), -126) \
for i in range(maxcount)]
- yield from run_test_2(dut, stimulus_a, stimulus_b, op, get_case_fn)
+ yield from run_fpunit_2(dut, stimulus_a, stimulus_b, op, get_case_fn)
count += len(stimulus_a)
print (count, "vectors passed exp=-126", report)
# nearly inf
stimulus_b = [set_exponent(randint(0, 1<<32), 127) \
for i in range(maxcount)]
- yield from run_test_2(dut, stimulus_a, stimulus_b, op, get_case_fn)
+ yield from run_fpunit_2(dut, stimulus_a, stimulus_b, op, get_case_fn)
count += len(stimulus_a)
print (count, "vectors passed exp=127", report)
from unit_test_single import (get_mantissa, get_exponent, get_sign, is_nan,
is_inf, is_pos_inf, is_neg_inf,
- match, get_case, check_case, run_test,
+ match, get_case, check_case, run_fpunit,
run_edge_cases, run_corner_cases)
#regression tests
stimulus_a = [0xbf9b1e94, 0x34082401, 0x5e8ef81, 0x5c75da81, 0x2b017]
stimulus_b = [0xc038ed3a, 0xb328cd45, 0x114f3db, 0x2f642a39, 0xff3807ab]
- yield from run_test(dut, stimulus_a, stimulus_b, truediv, get_case)
+ yield from run_fpunit(dut, stimulus_a, stimulus_b, truediv, get_case)
count += len(stimulus_a)
print (count, "vectors passed")
from ieee754.fpcommon.test.unit_test_single import (get_mantissa, get_exponent, get_sign, is_nan,
is_inf, is_pos_inf, is_neg_inf,
- match, get_case, check_case, run_test,
+ match, get_case, check_case, run_fpunit,
run_edge_cases, run_corner_cases)
0x5c75da81, 0x2b017]
stimulus_b = [0xee1818c5, 0xc038ed3a, 0xb328cd45, 0x114f3db,
0x2f642a39, 0xff3807ab]
- yield from run_test(dut, stimulus_a, stimulus_b, mul, get_case)
+ yield from run_fpunit(dut, stimulus_a, stimulus_b, mul, get_case)
count += len(stimulus_a)
print (count, "vectors passed")
from unit_test_double import (get_mantissa, get_exponent, get_sign, is_nan,
is_inf, is_pos_inf, is_neg_inf,
- match, get_case, check_case, run_test,
+ match, get_case, check_case, run_fpunit,
run_edge_cases, run_corner_cases)
#regression tests
stimulus_a = [0xff80000000000000, 0x3351099a0528e138]
stimulus_b = [0x7f80000000000000, 0xd651a9a9986af2b5]
- yield from run_test(dut, stimulus_a, stimulus_b, mul)
+ yield from run_fpunit(dut, stimulus_a, stimulus_b, mul)
count += len(stimulus_a)
print (count, "vectors passed")