-from random import randint
-from random import seed
from operator import add
from nmigen import Module, Signal
def testbench(dut):
yield from check_case(dut, 0, 0, 0)
- yield from check_case(dut, 0xFFFFFFFF, 0xC63B800A, 0xFFC00000)
- yield from check_case(dut, 0xFF800000, 0x7F800000, 0xFFC00000)
+ yield from check_case(dut, 0xFFFFFFFF, 0xC63B800A, 0x7FC00000)
+ yield from check_case(dut, 0xFF800000, 0x7F800000, 0x7FC00000)
#yield from check_case(dut, 0xFF800000, 0x7F800000, 0x7FC00000)
- yield from check_case(dut, 0x7F800000, 0xFF800000, 0xFFC00000)
+ yield from check_case(dut, 0x7F800000, 0xFF800000, 0x7FC00000)
yield from check_case(dut, 0x42540000, 0xC2540000, 0x00000000)
yield from check_case(dut, 0xC2540000, 0x42540000, 0x00000000)
yield from check_case(dut, 0xfe34f995, 0xff5d59ad, 0xff800000)
yield from check_case(dut, 0x00000000, 0xFF800000, 0xFF800000)
yield from check_case(dut, 0x7F800000, 0x7F800000, 0x7F800000)
yield from check_case(dut, 0xFF800000, 0xFF800000, 0xFF800000)
+ yield from check_case(dut, 0xFF800000, 0x7F800000, 0x7FC00000)
yield from check_case(dut, 0x00018643, 0x00FA72A4, 0x00FBF8E7)
yield from check_case(dut, 0x001A2239, 0x00FA72A4, 0x010A4A6E)
yield from check_case(dut, 0x3F7FFFFE, 0x3F7FFFFE, 0x3FFFFFFE)
count = 0
#regression tests
- stimulus_a = [0x22cb525a, 0x40000000, 0x83e73d5c, 0xbf9b1e94, 0x34082401,
+ stimulus_a = [0x80000000, 0x22cb525a, 0x40000000, 0x83e73d5c,
+ 0xbf9b1e94, 0x34082401,
0x5e8ef81, 0x5c75da81, 0x2b017]
- stimulus_b = [0xadd79efa, 0xC0000000, 0x1c800000, 0xc038ed3a, 0xb328cd45,
+ stimulus_b = [0xff800001, 0xadd79efa, 0xC0000000, 0x1c800000,
+ 0xc038ed3a, 0xb328cd45,
0x114f3db, 0x2f642a39, 0xff3807ab]
yield from run_test(dut, stimulus_a, stimulus_b, add)
count += len(stimulus_a)
-from random import randint
-from random import seed
from operator import add
from nmigen import Module, Signal
#yield from check_case(dut, 0x8000, 0x7c8c, 0x7e8c)
#yield from check_case(dut, 0x8000, 0xfc55, 0xfe55)
#yield from check_case(dut, 0x8000, 0x7e1a, 0x7e1a)
- #yield from check_case(dut, 0xfc00, 0x7c00, 0xfe00)
+
+ #yield from check_case(dut, 0x8000, 0xfc01, 0x7e00)
+ yield from check_case(dut, 0xfc00, 0x7c00, 0x7e00)
yield from check_case(dut, 0x8000, 0, 0)
yield from check_case(dut, 0, 0, 0)
count = 0
#regression tests
- stimulus_a = [ 0x8000 ]
- stimulus_b = [ 0x0000 ]
+ stimulus_a = [ 0x8000, 0x8000 ]
+ stimulus_b = [ 0x0000, 0xfc01 ]
yield from run_test(dut, stimulus_a, stimulus_b, add)
count += len(stimulus_a)
print (count, "vectors passed")
def run_edge_cases(dut, count, op):
+ maxint16 = 1<<16
+ maxcount = 10
#edge cases
- stimulus_a = [0x8000 for i in range(1000)]
- stimulus_b = [randint(0, 1<<16) for i in range(1000)]
+ 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)
count += len(stimulus_a)
print (count, "vectors passed")
- stimulus_a = [0x0000 for i in range(1000)]
- stimulus_b = [randint(0, 1<<16) for i in range(1000)]
+ 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)
count += len(stimulus_a)
print (count, "vectors passed")
- stimulus_b = [0x8000 for i in range(1000)]
- stimulus_a = [randint(0, 1<<16) for i in range(1000)]
+ 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)
count += len(stimulus_a)
print (count, "vectors passed")
- stimulus_b = [0x0000 for i in range(1000)]
- stimulus_a = [randint(0, 1<<16) for i in range(1000)]
+ 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)
count += len(stimulus_a)
print (count, "vectors passed")
- stimulus_a = [0x7800 for i in range(1000)]
- stimulus_b = [randint(0, 1<<16) for i in range(1000)]
+ 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)
count += len(stimulus_a)
print (count, "vectors passed")
- stimulus_a = [0xF800 for i in range(1000)]
- stimulus_b = [randint(0, 1<<16) for i in range(1000)]
+ 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)
count += len(stimulus_a)
print (count, "vectors passed")
- stimulus_b = [0x7800 for i in range(1000)]
- stimulus_a = [randint(0, 1<<16) for i in range(1000)]
+ 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)
count += len(stimulus_a)
print (count, "vectors passed")
- stimulus_b = [0xF800 for i in range(1000)]
- stimulus_a = [randint(0, 1<<16) for i in range(1000)]
+ 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)
count += len(stimulus_a)
print (count, "vectors passed")
- stimulus_a = [0x7C00 for i in range(1000)]
- stimulus_b = [randint(0, 1<<16) for i in range(1000)]
+ 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)
count += len(stimulus_a)
print (count, "vectors passed")
- stimulus_a = [0xFC00 for i in range(1000)]
- stimulus_b = [randint(0, 1<<16) for i in range(1000)]
+ 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)
count += len(stimulus_a)
print (count, "vectors passed")
- stimulus_b = [0x7C00 for i in range(1000)]
- stimulus_a = [randint(0, 1<<16) for i in range(1000)]
+ 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)
count += len(stimulus_a)
print (count, "vectors passed")
- stimulus_b = [0xFC00 for i in range(1000)]
- stimulus_a = [randint(0, 1<<16) for i in range(1000)]
+ 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)
count += len(stimulus_a)
print (count, "vectors passed")
#seed(0)
for i in range(100000):
- stimulus_a = [randint(0, 1<<16) for i in range(1000)]
- stimulus_b = [randint(0, 1<<16) for i in range(1000)]
+ 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)
- count += 1000
+ count += maxcount
print (count, "random vectors passed")