mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-03 02:05:21 +00:00
Converted regression-wally to use argparse
This commit is contained in:
parent
46538e3dac
commit
464b6ff72f
@ -11,6 +11,7 @@
|
|||||||
#
|
#
|
||||||
##################################
|
##################################
|
||||||
import sys,os,shutil
|
import sys,os,shutil
|
||||||
|
import argparse
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
from multiprocessing import Pool, TimeoutError
|
from multiprocessing import Pool, TimeoutError
|
||||||
@ -320,13 +321,16 @@ coveragesim = "questa" # Questa is required for code/functional coverage
|
|||||||
#defaultsim = "questa" # Default simulator for all other tests; change to Verilator when flow is ready
|
#defaultsim = "questa" # Default simulator for all other tests; change to Verilator when flow is ready
|
||||||
defaultsim = "verilator" # Default simulator for all other tests
|
defaultsim = "verilator" # Default simulator for all other tests
|
||||||
|
|
||||||
ccov = '--ccov' in sys.argv
|
parser = argparse.ArgumentParser()
|
||||||
fp = '--fp' in sys.argv
|
parser.add_argument("--ccov", help="Code Coverage", action="store_true")
|
||||||
nightly = '--nightly' in sys.argv
|
parser.add_argument("--fcov", help="Functional Coverage", action="store_true")
|
||||||
testfloat = '--testfloat' in sys.argv
|
parser.add_argument("--nightly", help="Run large nightly regression", action="store_true")
|
||||||
buildroot = '--buildroot' in sys.argv
|
parser.add_argument("--buildroot", help="Include Buildroot Linux boot test (takes many hours, done along with --nightly)", action="store_true")
|
||||||
|
parser.add_argument("--testfloat", help="Include Testfloat floating-point unit tests", action="store_true")
|
||||||
|
parser.add_argument("--fp", help="Include floating-point tests in coverage (slower runtime)", action="store_true")
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
if (nightly):
|
if (args.nightly):
|
||||||
nightMode = "--nightly";
|
nightMode = "--nightly";
|
||||||
# sims = [defaultsim] # uncomment to use only the default simulator
|
# sims = [defaultsim] # uncomment to use only the default simulator
|
||||||
sims = ["questa", "verilator", "vcs"] # uncomment to exercise all simulators
|
sims = ["questa", "verilator", "vcs"] # uncomment to exercise all simulators
|
||||||
@ -334,7 +338,7 @@ else:
|
|||||||
nightMode = ""
|
nightMode = ""
|
||||||
sims = [defaultsim]
|
sims = [defaultsim]
|
||||||
|
|
||||||
if (ccov): # only run RV64GC tests in coverage mode
|
if (args.ccov): # only run RV64GC tests in coverage mode
|
||||||
coverStr = '--ccov'
|
coverStr = '--ccov'
|
||||||
else:
|
else:
|
||||||
coverStr = ''
|
coverStr = ''
|
||||||
@ -353,24 +357,24 @@ configs = [
|
|||||||
|
|
||||||
|
|
||||||
# run full buildroot boot simulation (slow) if buildroot flag is set. Start it early to overlap with other tests
|
# run full buildroot boot simulation (slow) if buildroot flag is set. Start it early to overlap with other tests
|
||||||
if (buildroot):
|
if (args.buildroot):
|
||||||
# addTests(tests_buildrootboot, defaultsim) # non-lockstep with Verilator runs in about 2 hours
|
# addTests(tests_buildrootboot, defaultsim) # non-lockstep with Verilator runs in about 2 hours
|
||||||
addTests(tests_buildrootbootlockstep, "questa") # lockstep with Questa and ImperasDV runs overnight
|
addTests(tests_buildrootbootlockstep, "questa") # lockstep with Questa and ImperasDV runs overnight
|
||||||
|
|
||||||
if (ccov): # only run RV64GC tests on Questa in code coverage mode
|
if (args.ccov): # only run RV64GC tests on Questa in code coverage mode
|
||||||
addTests(tests64gc_nofp, "questa")
|
addTests(tests64gc_nofp, "questa")
|
||||||
if (fp):
|
if (args.fp):
|
||||||
addTests(tests64gc_fp, "questa")
|
addTests(tests64gc_fp, "questa")
|
||||||
else:
|
else:
|
||||||
for sim in sims:
|
for sim in sims:
|
||||||
if (not (buildroot and sim == defaultsim)): # skip shot buildroot sim if running long one
|
if (not (args.buildroot and sim == defaultsim)): # skip short buildroot sim if running long one
|
||||||
addTests(tests_buildrootshort, sim)
|
addTests(tests_buildrootshort, sim)
|
||||||
addTests(tests, sim)
|
addTests(tests, sim)
|
||||||
addTests(tests64gc_nofp, sim)
|
addTests(tests64gc_nofp, sim)
|
||||||
addTests(tests64gc_fp, sim)
|
addTests(tests64gc_fp, sim)
|
||||||
|
|
||||||
# run derivative configurations and lockstep tests in nightly regression
|
# run derivative configurations and lockstep tests in nightly regression
|
||||||
if (nightly):
|
if (args.nightly):
|
||||||
addTests(derivconfigtests, defaultsim)
|
addTests(derivconfigtests, defaultsim)
|
||||||
sim_log = WALLY + "/sim/questa/logs/lockstep_coverage.log"
|
sim_log = WALLY + "/sim/questa/logs/lockstep_coverage.log"
|
||||||
tc = TestCase(
|
tc = TestCase(
|
||||||
@ -391,9 +395,9 @@ if (nightly):
|
|||||||
configs.append(tc)
|
configs.append(tc)
|
||||||
|
|
||||||
# testfloat tests
|
# testfloat tests
|
||||||
if (testfloat): # for testfloat alone, just run testfloat tests
|
if (args.testfloat): # for testfloat alone, just run testfloat tests
|
||||||
configs = []
|
configs = []
|
||||||
if (testfloat or nightly): # for nightly, run testfloat along with others
|
if (args.testfloat or args.nightly): # for nightly, run testfloat along with others
|
||||||
testfloatsim = "questa" # change to Verilator when Issue #707 about testfloat not running Verilator is resolved
|
testfloatsim = "questa" # change to Verilator when Issue #707 about testfloat not running Verilator is resolved
|
||||||
testfloatconfigs = ["fdqh_ieee_rv64gc", "fdq_ieee_rv64gc", "fdh_ieee_rv64gc", "fd_ieee_rv64gc", "fh_ieee_rv64gc", "f_ieee_rv64gc", "fdqh_ieee_rv32gc", "f_ieee_rv32gc"]
|
testfloatconfigs = ["fdqh_ieee_rv64gc", "fdq_ieee_rv64gc", "fdh_ieee_rv64gc", "fd_ieee_rv64gc", "fh_ieee_rv64gc", "f_ieee_rv64gc", "fdqh_ieee_rv32gc", "f_ieee_rv32gc"]
|
||||||
for config in testfloatconfigs:
|
for config in testfloatconfigs:
|
||||||
@ -458,7 +462,7 @@ if (testfloat or nightly): # for nightly, run testfloat along with others
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
"""Run the tests and count the failures"""
|
"""Run the tests and count the failures"""
|
||||||
global configs, ccov
|
global configs, args
|
||||||
os.chdir(regressionDir)
|
os.chdir(regressionDir)
|
||||||
dirs = ["questa/logs", "questa/wkdir", "verilator/logs", "verilator/wkdir", "vcs/logs", "vcs/wkdir"]
|
dirs = ["questa/logs", "questa/wkdir", "verilator/logs", "verilator/wkdir", "vcs/logs", "vcs/wkdir"]
|
||||||
for d in dirs:
|
for d in dirs:
|
||||||
@ -467,17 +471,12 @@ def main():
|
|||||||
os.mkdir(d)
|
os.mkdir(d)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
if args.ccov:
|
||||||
if '--makeTests' in sys.argv:
|
|
||||||
os.chdir(regressionDir)
|
|
||||||
os.system('./make-tests.sh | tee ./logs/make-tests.log')
|
|
||||||
|
|
||||||
elif '--ccov' in sys.argv:
|
|
||||||
TIMEOUT_DUR = 20*60 # seconds
|
TIMEOUT_DUR = 20*60 # seconds
|
||||||
os.system('rm -f questa/cov/*.ucdb')
|
os.system('rm -f questa/cov/*.ucdb')
|
||||||
elif '--nightly' in sys.argv:
|
elif args.nightly in sys.argv:
|
||||||
TIMEOUT_DUR = 60*1440 # 1 day
|
TIMEOUT_DUR = 60*1440 # 1 day
|
||||||
elif '--testfloat' in sys.argv:
|
elif args.testfloat in sys.argv:
|
||||||
TIMEOUT_DUR = 30*60 # seconds
|
TIMEOUT_DUR = 30*60 # seconds
|
||||||
else:
|
else:
|
||||||
TIMEOUT_DUR = 10*60 # seconds
|
TIMEOUT_DUR = 10*60 # seconds
|
||||||
@ -497,7 +496,7 @@ def main():
|
|||||||
print(f"{bcolors.FAIL}%s_%s: Timeout - runtime exceeded %d seconds{bcolors.ENDC}" % (config.variant, config.name, TIMEOUT_DUR))
|
print(f"{bcolors.FAIL}%s_%s: Timeout - runtime exceeded %d seconds{bcolors.ENDC}" % (config.variant, config.name, TIMEOUT_DUR))
|
||||||
|
|
||||||
# Coverage report
|
# Coverage report
|
||||||
if ccov:
|
if args.ccov:
|
||||||
os.system('make QuestaCodeCoverage')
|
os.system('make QuestaCodeCoverage')
|
||||||
# Count the number of failures
|
# Count the number of failures
|
||||||
if num_fail:
|
if num_fail:
|
||||||
|
2
bin/wsim
2
bin/wsim
@ -27,7 +27,7 @@ parser.add_argument("--sim", "-s", help="Simulator", choices=["questa", "verilat
|
|||||||
parser.add_argument("--tb", "-t", help="Testbench", choices=["testbench", "testbench_fp"], default="testbench")
|
parser.add_argument("--tb", "-t", help="Testbench", choices=["testbench", "testbench_fp"], default="testbench")
|
||||||
parser.add_argument("--gui", "-g", help="Simulate with GUI", action="store_true")
|
parser.add_argument("--gui", "-g", help="Simulate with GUI", action="store_true")
|
||||||
parser.add_argument("--ccov", "-c", help="Code Coverage", action="store_true")
|
parser.add_argument("--ccov", "-c", help="Code Coverage", action="store_true")
|
||||||
parser.add_argument("--fcov", "-f", help="Functional Coverage", action="store_true")
|
parser.add_argument("--fcov", "-f", help="Functional Coverage, implies lockstep", action="store_true")
|
||||||
parser.add_argument("--args", "-a", help="Optional arguments passed to simulator via $value$plusargs", default="")
|
parser.add_argument("--args", "-a", help="Optional arguments passed to simulator via $value$plusargs", default="")
|
||||||
parser.add_argument("--vcd", "-v", help="Generate testbench.vcd", action="store_true")
|
parser.add_argument("--vcd", "-v", help="Generate testbench.vcd", action="store_true")
|
||||||
parser.add_argument("--lockstep", "-l", help="Run ImperasDV lock, step, and compare.", action="store_true")
|
parser.add_argument("--lockstep", "-l", help="Run ImperasDV lock, step, and compare.", action="store_true")
|
||||||
|
Loading…
Reference in New Issue
Block a user