mirror of
https://github.com/openhwgroup/cvw.git
synced 2025-04-20 03:47:20 -04:00
Cleanup quotes
This commit is contained in:
parent
51c3d59605
commit
32b62e9d0c
3 changed files with 32 additions and 33 deletions
41
bin/iterelf
41
bin/iterelf
|
@ -13,15 +13,15 @@ from multiprocessing import Pool, TimeoutError as MPTimeoutError
|
|||
TIMEOUT_DUR = 60 # 1` minute
|
||||
|
||||
class bcolors:
|
||||
HEADER = '\033[95m'
|
||||
OKBLUE = '\033[94m'
|
||||
OKCYAN = '\033[96m'
|
||||
OKGREEN = '\033[92m'
|
||||
WARNING = '\033[93m'
|
||||
FAIL = '\033[91m'
|
||||
ENDC = '\033[0m'
|
||||
BOLD = '\033[1m'
|
||||
UNDERLINE = '\033[4m'
|
||||
HEADER = "\033[95m"
|
||||
OKBLUE = "\033[94m"
|
||||
OKCYAN = "\033[96m"
|
||||
OKGREEN = "\033[92m"
|
||||
WARNING = "\033[93m"
|
||||
FAIL = "\033[91m"
|
||||
ENDC = "\033[0m"
|
||||
BOLD = "\033[1m"
|
||||
UNDERLINE = "\033[4m"
|
||||
|
||||
def search_log_for_mismatches(logfile):
|
||||
"""Search through the given log file for text, returning True if it is found or False if it is not"""
|
||||
|
@ -34,16 +34,16 @@ def search_log_for_mismatches(logfile):
|
|||
|
||||
def run_test_case(elf):
|
||||
"""Run the given test case, and return 0 if the test suceeds and 1 if it fails"""
|
||||
WALLY = os.environ.get('WALLY')
|
||||
fields = elf.rsplit('/', 3)
|
||||
WALLY = os.environ.get("WALLY")
|
||||
fields = elf.rsplit("/", 3)
|
||||
if fields[2] == "ref":
|
||||
shortelf = fields[1] + "_" + fields[3]
|
||||
else:
|
||||
shortelf = fields[2] + "_" + fields[3]
|
||||
# shortelf = fields[1] + "_" + fields[2]
|
||||
# shortelf = fields[1] + "_" + fields[2]
|
||||
logfile = WALLY + "/sim/" + args.sim + "/logs/" + shortelf + ".log"
|
||||
cmd = "wsim " + args.config + " " + shortelf + " --elf " + elf + " --sim " + args.sim + " --lockstep > " + logfile # add coveerage flags if necessary
|
||||
# print("cmd = " + cmd)
|
||||
cmd = "wsim " + args.config + " " + shortelf + " --elf " + elf + " --sim " + args.sim + " --lockstep > " + logfile # add coveerage flags if necessary
|
||||
# print("cmd = " + cmd)
|
||||
os.system(cmd)
|
||||
if search_log_for_mismatches(logfile):
|
||||
print(f"{bcolors.OKGREEN}{cmd}: Success{bcolors.ENDC}")
|
||||
|
@ -78,26 +78,25 @@ if os.path.isdir(args.dir):
|
|||
DirectorMode = 1
|
||||
for dirpath, dirnames, filenames in os.walk(os.path.abspath(args.dir)):
|
||||
for file in filenames:
|
||||
if (file.endswith("elf") and not file.endswith(args.exclude)):
|
||||
if file.endswith("elf") and not file.endswith(args.exclude):
|
||||
ElfList.append(os.path.join(dirpath, file))
|
||||
else:
|
||||
print(args.dir + " is not a directory")
|
||||
sys.exit(1)
|
||||
#print(ElfList)
|
||||
|
||||
# spawn parallel wsim jobs for each ELF file
|
||||
|
||||
ImperasDVLicenseCount = 8
|
||||
with Pool(processes=min(len(ElfList),multiprocessing.cpu_count(), ImperasDVLicenseCount)) as pool:
|
||||
with Pool(processes=min(len(ElfList), multiprocessing.cpu_count(), ImperasDVLicenseCount)) as pool:
|
||||
num_fail = 0
|
||||
results = {}
|
||||
for elf in ElfList:
|
||||
results[elf] = pool.apply_async(run_test_case,(elf,))
|
||||
for (elf,result) in results.items():
|
||||
results[elf] = pool.apply_async(run_test_case, (elf,))
|
||||
for elf, result in results.items():
|
||||
try:
|
||||
num_fail+=result.get(timeout=TIMEOUT_DUR)
|
||||
num_fail += result.get(timeout=TIMEOUT_DUR)
|
||||
except MPTimeoutError:
|
||||
num_fail+=1
|
||||
num_fail += 1
|
||||
print(f"{bcolors.FAIL}{elf}: Timeout - runtime exceeded {TIMEOUT_DUR} seconds{bcolors.ENDC}")
|
||||
|
||||
if num_fail == 0:
|
||||
|
|
14
bin/wsim
14
bin/wsim
|
@ -16,7 +16,7 @@ import os
|
|||
import sys
|
||||
|
||||
# Global variable
|
||||
WALLY = os.environ.get('WALLY')
|
||||
WALLY = os.environ.get("WALLY")
|
||||
|
||||
def parseArgs():
|
||||
parser = argparse.ArgumentParser()
|
||||
|
@ -41,13 +41,13 @@ def validateArgs(args):
|
|||
if not args.testsuite and not args.elf:
|
||||
print("Error: Missing test suite or ELF file")
|
||||
sys.exit(1)
|
||||
if any([args.lockstep, args.lockstepverbose, args.fcov]) and not (args.testsuite.endswith('.elf') or args.elf) and args.testsuite != "buildroot":
|
||||
if any([args.lockstep, args.lockstepverbose, args.fcov]) and not (args.testsuite.endswith(".elf") or args.elf) and args.testsuite != "buildroot":
|
||||
print(f"Invalid Options. Cannot run a testsuite, {args.testsuite} with lockstep or fcov. Must run a single elf or buildroot.")
|
||||
sys.exit(1)
|
||||
elif any([args.gui, args.ccov, args.fcov, args.lockstep, args.lockstepverbose]) and args.sim not in ["questa", "vcs"]:
|
||||
print("Option only supported for Questa and VCS")
|
||||
sys.exit(1)
|
||||
elif (args.tb == "testbench_fp" and args.sim != "questa"):
|
||||
elif args.tb == "testbench_fp" and args.sim != "questa":
|
||||
print("Error: testbench_fp presently only supported by Questa, not VCS or Verilator, because of a touchy testbench")
|
||||
sys.exit(1)
|
||||
|
||||
|
@ -58,19 +58,19 @@ def elfFileCheck(args):
|
|||
elif args.elf:
|
||||
print(f"ELF file not found: {args.elf}")
|
||||
sys.exit(1)
|
||||
elif args.testsuite.endswith('.elf'): # No --elf argument; check if testsuite has a .elf extension and use that instead
|
||||
elif args.testsuite.endswith(".elf"): # No --elf argument; check if testsuite has a .elf extension and use that instead
|
||||
if os.path.isfile(args.testsuite):
|
||||
ElfFile = f"+ElfFile={os.path.abspath(args.testsuite)}"
|
||||
# extract the elf name from the path to be the test suite
|
||||
fields = args.testsuite.rsplit('/', 3)
|
||||
fields = args.testsuite.rsplit("/", 3)
|
||||
# if the name is just ref.elf in a deep path (riscv-arch-test/wally-riscv-arch-test), then use the directory name as the test suite to make it unique; otherwise work directory will have duplicates.
|
||||
if len(fields) > 3:
|
||||
if fields[2] == "ref":
|
||||
args.testsuite = f"{fields[1]}_{fields[3]}"
|
||||
else:
|
||||
args.testsuite = f"{fields[2]}_{fields[3]}"
|
||||
elif '/' in args.testsuite:
|
||||
args.testsuite=args.testsuite.rsplit('/', 1)[1] # strip off path if present
|
||||
elif "/" in args.testsuite:
|
||||
args.testsuite = args.testsuite.rsplit("/", 1)[1] # strip off path if present
|
||||
else:
|
||||
print(f"ELF file not found: {args.testsuite}")
|
||||
sys.exit(1)
|
||||
|
|
|
@ -12,7 +12,7 @@ import subprocess
|
|||
import sys
|
||||
|
||||
# Global variables
|
||||
WALLY = os.environ.get('WALLY')
|
||||
WALLY = os.environ.get("WALLY")
|
||||
simdir = f"{WALLY}/sim/vcs"
|
||||
cfgdir = f"{WALLY}/config"
|
||||
srcdir = f"{WALLY}/src"
|
||||
|
@ -21,7 +21,7 @@ logdir = f"{simdir}/logs"
|
|||
|
||||
# run a Linux command and return the result as a string in a form that VCS can use
|
||||
def runFindCommand(cmd):
|
||||
res = subprocess.check_output(cmd, shell=True, )
|
||||
res = subprocess.check_output(cmd, shell=True)
|
||||
res = str(res)
|
||||
res = res.replace("\\n", " ") # replace newline with space
|
||||
res = res.replace("'", "") # strip off quotation marks
|
||||
|
@ -55,7 +55,7 @@ def generateFileList(testbench):
|
|||
rtlsrc_files = runFindCommand(rtlsrc_cmd)
|
||||
tbcommon_cmd = f'find {tbdir}/common -name "*.sv"'
|
||||
tbcommon_files = runFindCommand(tbcommon_cmd)
|
||||
tb_file = f'{tbdir}/{testbench}.sv'
|
||||
tb_file = f"{tbdir}/{testbench}.sv"
|
||||
return f"{tb_file} {rtlsrc_files} {tbcommon_files}"
|
||||
|
||||
def processArgs(wkdir, args):
|
||||
|
@ -76,7 +76,7 @@ def processArgs(wkdir, args):
|
|||
# if args.gui:
|
||||
# compileOptions.append("-debug_access+all+reverse -kdb +vcs+vcdpluson")
|
||||
compileOptions = " ".join(compileOptions)
|
||||
simvOptions = " ".join(simvOptions)
|
||||
simvOptions = " ".join(simvOptions)
|
||||
return compileOptions, simvOptions
|
||||
|
||||
def setupParamOverrides(wkdir, args):
|
||||
|
@ -89,7 +89,7 @@ def setupParamOverrides(wkdir, args):
|
|||
return f" -parameters {wkdir}/param_overrides.txt "
|
||||
|
||||
def setupCommands(wkdir, rtlFiles, compileOptions, simvOptions, args):
|
||||
includePath=f"+incdir+{cfgdir}/{args.config} +incdir+{cfgdir}/deriv/{args.config} +incdir+{cfgdir}/shared +incdir+$WALLY/tests +incdir+{tbdir} +incdir+{srcdir}"
|
||||
includePath = f"+incdir+{cfgdir}/{args.config} +incdir+{cfgdir}/deriv/{args.config} +incdir+{cfgdir}/shared +incdir+$WALLY/tests +incdir+{tbdir} +incdir+{srcdir}"
|
||||
vcsStandardFlags = "+lint=all,noGCWM,noUI,noSVA-UA,noIDTS,noNS,noULCO,noCAWM-L,noWMIA-L,noSV-PIU,noSTASKW_CO,noSTASKW_CO1,noSTASKW_RMCOF -suppress +warn -sverilog +vc -Mupdate -line -full64 -lca -ntb_opts sensitive_dyn"
|
||||
vcsCMD = f"vcs {vcsStandardFlags} -top {args.tb} {compileOptions} -Mdir={wkdir} {includePath} {srcdir}/cvw.sv {rtlFiles} -o {wkdir}/sim_out -work {wkdir} -Mlib={wkdir} -l {logdir}/{args.config}_{args.testsuite}.log"
|
||||
simvCMD = f"{wkdir}/sim_out +TEST={args.testsuite} {args.args} -no_save {simvOptions}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue