Combinin fcov and fcovpriv

This commit is contained in:
Huda-10xe 2024-10-16 09:44:34 -07:00
parent 0429058bef
commit 7bed187e8d
3 changed files with 9 additions and 39 deletions

View File

@ -366,7 +366,6 @@ defaultsim = "verilator" # Default simulator for all other tests
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument("--ccov", help="Code Coverage", action="store_true") parser.add_argument("--ccov", help="Code Coverage", action="store_true")
parser.add_argument("--fcov", help="Functional Coverage", action="store_true") parser.add_argument("--fcov", help="Functional Coverage", action="store_true")
parser.add_argument("--fcovpriv", help="Privilege Functional Coverage", action="store_true")
parser.add_argument("--nightly", help="Run large nightly regression", action="store_true") parser.add_argument("--nightly", help="Run large nightly regression", action="store_true")
parser.add_argument("--buildroot", help="Include Buildroot Linux boot test (takes many hours, done along with --nightly)", action="store_true") 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("--testfloat", help="Include Testfloat floating-point unit tests", action="store_true")
@ -385,8 +384,6 @@ if (args.ccov): # only run RV64GC tests in coverage mode
coverStr = '--ccov' coverStr = '--ccov'
elif (args.fcov): # only run RV64GC tests in lockstep in coverage mode elif (args.fcov): # only run RV64GC tests in lockstep in coverage mode
coverStr = '--fcov' coverStr = '--fcov'
elif (args.fcovpriv): # only run RV64GC tests in lockstep in coverage mode
coverStr = '--fcovpriv'
else: else:
coverStr = '' coverStr = ''
@ -415,8 +412,7 @@ if (args.ccov): # only run RV64GC tests on Questa in code coverage mode
elif (args.fcov): # only run RV64GC tests on Questa in lockstep in functional coverage mode elif (args.fcov): # only run RV64GC tests on Questa in lockstep in functional coverage mode
addLockstepTestsByDir(WALLY+"/addins/cvw-arch-verif/tests/rv32/", "rv32gc", coveragesim, 1) addLockstepTestsByDir(WALLY+"/addins/cvw-arch-verif/tests/rv32/", "rv32gc", coveragesim, 1)
addLockstepTestsByDir(WALLY+"/addins/cvw-arch-verif/tests/rv64/", "rv64gc", coveragesim, 1) addLockstepTestsByDir(WALLY+"/addins/cvw-arch-verif/tests/rv64/", "rv64gc", coveragesim, 1)
elif (args.fcovpriv): # only run RV64GC tests on Questa in lockstep in functional coverage mode #addLockstepTestsByDir(WALLY+"/tests/riscof/work/wally-riscv-arch-test/rv64i_m/privilege/src/", "rv64gc", coveragesim, 0)
addLockstepTestsByDir(WALLY+"/tests/riscof/work/wally-riscv-arch-test/rv64i_m/privilege/src/", "rv64gc", coveragesim, 0)
else: else:
for sim in sims: for sim in sims:
@ -511,10 +507,7 @@ def main():
os.system('rm -f questa/cov/*.ucdb') os.system('rm -f questa/cov/*.ucdb')
elif args.fcov: elif args.fcov:
TIMEOUT_DUR = 2*60 TIMEOUT_DUR = 2*60
os.system('rm -f questa/fcov_ucdb/*.elf.ucdb questa/fcov_logs/* questa/fcov/*') os.system('rm -f questa/fcov_ucdb/* questa/fcov_logs/* questa/fcov/*')
elif args.fcovpriv:
TIMEOUT_DUR = 2*60
os.system('rm -f questa/fcov_ucdb/*.elf.priv.ucdb questa/fcov_logs/* questa/fcov/*')
elif args.buildroot: elif args.buildroot:
TIMEOUT_DUR = 60*1440 # 1 day TIMEOUT_DUR = 60*1440 # 1 day
elif args.testfloat: elif args.testfloat:
@ -527,7 +520,7 @@ def main():
# Scale the number of concurrent processes to the number of test cases, but # Scale the number of concurrent processes to the number of test cases, but
# max out at a limited number of concurrent processes to not overwhelm the system # max out at a limited number of concurrent processes to not overwhelm the system
# right now fcov, ccov, nightly all use Imperas # right now fcov, ccov, nightly all use Imperas
if (args.ccov or args.fcov or args.fcovpriv or args.nightly): if (args.ccov or args.fcov or args.nightly):
ImperasDVLicenseCount = 8 # limit number of concurrent processes to avoid overloading ImperasDV licenses ImperasDVLicenseCount = 8 # limit number of concurrent processes to avoid overloading ImperasDV licenses
else: else:
ImperasDVLicenseCount = 10000 # effectively no license limit for non-lockstep tests ImperasDVLicenseCount = 10000 # effectively no license limit for non-lockstep tests
@ -546,7 +539,7 @@ def main():
# Coverage report # Coverage report
if args.ccov: if args.ccov:
os.system('make QuestaCodeCoverage') os.system('make QuestaCodeCoverage')
if args.fcov or args.fcovpriv: if args.fcov:
os.system('make -f '+WALLY+'/addins/cvw-arch-verif/Makefile merge') os.system('make -f '+WALLY+'/addins/cvw-arch-verif/Makefile merge')
# Count the number of failures # Count the number of failures
if num_fail: if num_fail:

View File

@ -29,7 +29,6 @@ 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("--fcovimp", "-f2", help="Functional Coverage with Imperas licensed riscvISACOV, implies lockstep", action="store_true") parser.add_argument("--fcovimp", "-f2", help="Functional Coverage with Imperas licensed riscvISACOV, implies lockstep", action="store_true")
parser.add_argument("--fcov", "-f", help="Functional Coverage with cvw-arch-verif, implies lockstep", action="store_true") parser.add_argument("--fcov", "-f", help="Functional Coverage with cvw-arch-verif, implies lockstep", action="store_true")
parser.add_argument("--fcovpriv", "-fpriv", help="Privileged Functional Coverage with cvw-arch-verif, 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("--params", "-p", help="Optional top-level parameter overrides of the form param=value", default="") parser.add_argument("--params", "-p", help="Optional top-level parameter overrides of the form param=value", 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")
@ -71,7 +70,7 @@ if(args.lockstep and not args.testsuite.endswith('.elf')):
exit(1) exit(1)
# Validate arguments # Validate arguments
if (args.gui or args.ccov or args.fcov or args.fcovimp or args.fcovpriv or args.lockstep or args.lockstepverbose): if (args.gui or args.ccov or args.fcov or args.fcovimp or args.lockstep or args.lockstepverbose):
if args.sim not in ["questa", "vcs"]: if args.sim not in ["questa", "vcs"]:
print("Option only supported for Questa and VCS") print("Option only supported for Questa and VCS")
exit(1) exit(1)
@ -89,7 +88,7 @@ if (args.tb == "testbench_fp"):
if(int(args.locksteplog) >= 1): EnableLog = 1 if(int(args.locksteplog) >= 1): EnableLog = 1
else: EnableLog = 0 else: EnableLog = 0
prefix = "" prefix = ""
if (args.lockstep or args.lockstepverbose or args.fcov or args.fcovimp or args.fcovpriv): if (args.lockstep or args.lockstepverbose or args.fcov or args.fcovimp):
if (args.sim == "questa" or args.sim == "vcs"): if (args.sim == "questa" or args.sim == "vcs"):
prefix = "IMPERAS_TOOLS=" + WALLY + "/config/"+args.config+"/imperas.ic" prefix = "IMPERAS_TOOLS=" + WALLY + "/config/"+args.config+"/imperas.ic"
if (args.sim == "questa"): if (args.sim == "questa"):
@ -104,7 +103,7 @@ if (args.lockstep or args.lockstepverbose):
else: EnableLog = 0 else: EnableLog = 0
ImperasPlusArgs = " +IDV_TRACE2COV=" + str(EnableLog) + " +TRACE2LOG_AFTER=" + str(args.covlog) + " +TRACE2COV_ENABLE=" + CovEnableStr ImperasPlusArgs = " +IDV_TRACE2COV=" + str(EnableLog) + " +TRACE2LOG_AFTER=" + str(args.covlog) + " +TRACE2COV_ENABLE=" + CovEnableStr
suffix = "" suffix = ""
if(args.fcov or args.fcovpriv): if(args.fcov):
CovEnableStr = "1" if int(args.covlog) > 0 else "0"; CovEnableStr = "1" if int(args.covlog) > 0 else "0";
if(args.covlog >= 1): EnableLog = 1 if(args.covlog >= 1): EnableLog = 1
else: EnableLog = 0 else: EnableLog = 0
@ -129,8 +128,6 @@ if (args.fcov):
flags += " --fcov" flags += " --fcov"
if (args.fcovimp): if (args.fcovimp):
flags += " --fcovimp" flags += " --fcovimp"
if (args.fcovpriv):
flags += "--fcovpriv"
# create the output sub-directories. # create the output sub-directories.
regressionDir = WALLY + '/sim/' regressionDir = WALLY + '/sim/'

View File

@ -61,7 +61,6 @@ set CoverageVoptArg ""
set CoverageVsimArg "" set CoverageVsimArg ""
set FunctCoverage 0 set FunctCoverage 0
set FCpriv 0
set FCvlog "" set FCvlog ""
set FCvopt "" set FCvopt ""
set FCdefineCOVER_EXTS {} set FCdefineCOVER_EXTS {}
@ -104,20 +103,6 @@ if {[lcheck lst "--ccov"]} {
set CoverageVsimArg "-coverage" set CoverageVsimArg "-coverage"
} }
# if --fcovpriv found set flag and remove from list
if {[lcheck lst "--fcovpriv"]} {
set FunctCoverage 1
set FCpriv 1
set FCvlog "+define+INCLUDE_TRACE2COV \
+define+IDV_INCLUDE_TRACE2COV \
+define+COVER_BASE_RV32I \
+define+COVER_PRIV \
+incdir+$env(WALLY)/addins/riscvISACOV/source \
"
set FCvopt "+TRACE2COV_ENABLE=1 +IDV_TRACE2COV=1"
}
# if --fcovimp found set flag and remove from list # if --fcovimp found set flag and remove from list
if {[lcheck lst "--fcovimp"]} { if {[lcheck lst "--fcovimp"]} {
set FunctCoverage 1 set FunctCoverage 1
@ -220,13 +205,8 @@ if { ${GUI} } {
} }
if {$FunctCoverage} { if {$FunctCoverage} {
if {$FCpriv} { set UCDB ${WALLY}/sim/questa/fcov_ucdb/${CFG}_${TESTSUITE}.ucdb
set UCDB ${WALLY}/sim/questa/fcov_ucdb/${CFG}_${TESTSUITE}.priv.ucdb coverage save -onexit ${UCDB}
coverage save -onexit ${UCDB}
} else {
set UCDB ${WALLY}/sim/questa/fcov_ucdb/${CFG}_${TESTSUITE}.ucdb
coverage save -onexit ${UCDB}
}
} }
run -all run -all