Skip to content

Commit

Permalink
Combinin fcov and fcovpriv
Browse files Browse the repository at this point in the history
  • Loading branch information
Huda-10xe committed Oct 16, 2024
1 parent 0429058 commit 7bed187
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 39 deletions.
15 changes: 4 additions & 11 deletions bin/regression-wally
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,6 @@ defaultsim = "verilator" # Default simulator for all other tests
parser = argparse.ArgumentParser()
parser.add_argument("--ccov", help="Code 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("--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")
Expand All @@ -385,8 +384,6 @@ if (args.ccov): # only run RV64GC tests in coverage mode
coverStr = '--ccov'
elif (args.fcov): # only run RV64GC tests in lockstep in coverage mode
coverStr = '--fcov'
elif (args.fcovpriv): # only run RV64GC tests in lockstep in coverage mode
coverStr = '--fcovpriv'
else:
coverStr = ''

Expand Down Expand Up @@ -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
addLockstepTestsByDir(WALLY+"/addins/cvw-arch-verif/tests/rv32/", "rv32gc", 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:
for sim in sims:
Expand Down Expand Up @@ -511,10 +507,7 @@ def main():
os.system('rm -f questa/cov/*.ucdb')
elif args.fcov:
TIMEOUT_DUR = 2*60
os.system('rm -f questa/fcov_ucdb/*.elf.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/*')
os.system('rm -f questa/fcov_ucdb/* questa/fcov_logs/* questa/fcov/*')
elif args.buildroot:
TIMEOUT_DUR = 60*1440 # 1 day
elif args.testfloat:
Expand All @@ -527,7 +520,7 @@ def main():
# 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
# 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
else:
ImperasDVLicenseCount = 10000 # effectively no license limit for non-lockstep tests
Expand All @@ -546,7 +539,7 @@ def main():
# Coverage report
if args.ccov:
os.system('make QuestaCodeCoverage')
if args.fcov or args.fcovpriv:
if args.fcov:
os.system('make -f '+WALLY+'/addins/cvw-arch-verif/Makefile merge')
# Count the number of failures
if num_fail:
Expand Down
9 changes: 3 additions & 6 deletions bin/wsim
Original file line number Diff line number Diff line change
Expand Up @@ -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("--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("--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("--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")
Expand Down Expand Up @@ -71,7 +70,7 @@ if(args.lockstep and not args.testsuite.endswith('.elf')):
exit(1)

# 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"]:
print("Option only supported for Questa and VCS")
exit(1)
Expand All @@ -89,7 +88,7 @@ if (args.tb == "testbench_fp"):
if(int(args.locksteplog) >= 1): EnableLog = 1
else: EnableLog = 0
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"):
prefix = "IMPERAS_TOOLS=" + WALLY + "/config/"+args.config+"/imperas.ic"
if (args.sim == "questa"):
Expand All @@ -104,7 +103,7 @@ if (args.lockstep or args.lockstepverbose):
else: EnableLog = 0
ImperasPlusArgs = " +IDV_TRACE2COV=" + str(EnableLog) + " +TRACE2LOG_AFTER=" + str(args.covlog) + " +TRACE2COV_ENABLE=" + CovEnableStr
suffix = ""
if(args.fcov or args.fcovpriv):
if(args.fcov):
CovEnableStr = "1" if int(args.covlog) > 0 else "0";
if(args.covlog >= 1): EnableLog = 1
else: EnableLog = 0
Expand All @@ -129,8 +128,6 @@ if (args.fcov):
flags += " --fcov"
if (args.fcovimp):
flags += " --fcovimp"
if (args.fcovpriv):
flags += "--fcovpriv"

# create the output sub-directories.
regressionDir = WALLY + '/sim/'
Expand Down
24 changes: 2 additions & 22 deletions sim/questa/wally.do
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ set CoverageVoptArg ""
set CoverageVsimArg ""

set FunctCoverage 0
set FCpriv 0
set FCvlog ""
set FCvopt ""
set FCdefineCOVER_EXTS {}
Expand Down Expand Up @@ -104,20 +103,6 @@ if {[lcheck lst "--ccov"]} {
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 {[lcheck lst "--fcovimp"]} {
set FunctCoverage 1
Expand Down Expand Up @@ -220,13 +205,8 @@ if { ${GUI} } {
}
if {$FunctCoverage} {
if {$FCpriv} {
set UCDB ${WALLY}/sim/questa/fcov_ucdb/${CFG}_${TESTSUITE}.priv.ucdb
coverage save -onexit ${UCDB}
} else {
set UCDB ${WALLY}/sim/questa/fcov_ucdb/${CFG}_${TESTSUITE}.ucdb
coverage save -onexit ${UCDB}
}
set UCDB ${WALLY}/sim/questa/fcov_ucdb/${CFG}_${TESTSUITE}.ucdb
coverage save -onexit ${UCDB}
}
run -all
Expand Down

0 comments on commit 7bed187

Please sign in to comment.