mirror of
https://github.com/YosysHQ/yosys
synced 2025-06-06 06:03:23 +00:00
Add optional SEED=n command line option to Makefile, and -S n command line option to test scripts, for deterministic regression tests.
This commit is contained in:
parent
d8ad889594
commit
f4240cc8a4
14 changed files with 175 additions and 24 deletions
|
@ -1,5 +1,6 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
import random
|
||||
from contextlib import contextmanager
|
||||
|
@ -21,7 +22,16 @@ def maybe_plus_x(expr):
|
|||
else:
|
||||
return expr
|
||||
|
||||
for idx in range(100):
|
||||
parser = argparse.ArgumentParser(formatter_class = argparse.ArgumentDefaultsHelpFormatter)
|
||||
parser.add_argument('-S', '--seed', type = int, help = 'seed for PRNG')
|
||||
parser.add_argument('-c', '--count', type = int, default = 100, help = 'number of test cases to generate')
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.seed is not None:
|
||||
print("PRNG seed: %d" % args.seed)
|
||||
random.seed(args.seed)
|
||||
|
||||
for idx in range(args.count):
|
||||
with open('temp/uut_%05d.v' % idx, 'w') as f:
|
||||
with redirect_stdout(f):
|
||||
if random.choice(['bin', 'uni']) == 'bin':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue