From a3691cc5f7831c62343f53a4f456b5a628b60b18 Mon Sep 17 00:00:00 2001 From: David Harris Date: Thu, 9 Mar 2023 15:59:57 -0800 Subject: [PATCH] Modified regression and wally-batch.do to support -coverage --- sim/regression-wally | 36 +++++++++++++++++++++++++++--------- sim/wally-batch.do | 25 ++++++++++++------------- 2 files changed, 39 insertions(+), 22 deletions(-) diff --git a/sim/regression-wally b/sim/regression-wally index 07603120..ce9387b6 100755 --- a/sim/regression-wally +++ b/sim/regression-wally @@ -27,6 +27,8 @@ from collections import namedtuple regressionDir = os.path.dirname(os.path.abspath(__file__)) os.chdir(regressionDir) +coverage = '-coverage' in sys.argv + TestCase = namedtuple("TestCase", ['name', 'variant', 'cmd', 'grepstr']) # name: the name of this test configuration (used in printing human-readable # output and picking logfile names) @@ -66,14 +68,6 @@ tc = TestCase( configs.append(tc) tests64gcimperas = ["imperas64i", "imperas64f", "imperas64d", "imperas64m", "imperas64c"] # unused -tests64gc = ["arch64f", "arch64d", "arch64i", "arch64priv", "arch64c", "arch64m", "arch64zi", "wally64a", "wally64periph", "wally64priv"] -for test in tests64gc: - tc = TestCase( - name=test, - variant="rv64gc", - cmd="vsim > {} -c < {} -c < {} -c < cov/rv64gc_coverage.rpt') # Count the number of failures if num_fail: print(f"{bcolors.FAIL}Regression failed with %s failed configurations{bcolors.ENDC}" % num_fail) diff --git a/sim/wally-batch.do b/sim/wally-batch.do index 718f3d5a..2adc917e 100644 --- a/sim/wally-batch.do +++ b/sim/wally-batch.do @@ -115,27 +115,26 @@ if {$2 eq "buildroot" || $2 eq "buildroot-checkpoint"} { vlog -lint -work wkdir/work_${1}_${2} +incdir+../config/$1 +incdir+../config/shared ../testbench/testbench.sv ../testbench/common/*.sv ../src/*/*.sv ../src/*/*/*.sv -suppress 2583 -suppress 7063,2596,13286 # start and run simulation # remove +acc flag for faster sim during regressions if there is no need to access internal signals - vopt wkdir/work_${1}_${2}.testbench -work wkdir/work_${1}_${2} -G TEST=$2 -o testbenchopt +cover=sbectf -# vsim -lib wkdir/work_${1}_${2} testbenchopt -fatal 7 -suppress 3829 -coverage - vsim -lib wkdir/work_${1}_${2} testbenchopt -fatal 7 -suppress 3829 - # Adding coverage increases runtime from 2:00 to 4:29. Can't run it all the time - #vopt work_$2.testbench -work work_$2 -o workopt_$2 +cover=sbectf - #vsim -coverage -lib work_$2 workopt_$2 + if {$3 eq "-coverage"} { + vopt wkdir/work_${1}_${2}.testbench -work wkdir/work_${1}_${2} -G TEST=$2 -o testbenchopt +cover=sbectf + vsim -lib wkdir/work_${1}_${2} testbenchopt -fatal 7 -suppress 3829 -coverage + } else { + vopt wkdir/work_${1}_${2}.testbench -work wkdir/work_${1}_${2} -G TEST=$2 -o testbenchopt + vsim -lib wkdir/work_${1}_${2} testbenchopt -fatal 7 -suppress 3829 + } +# vsim -lib wkdir/work_${1}_${2} testbenchopt -fatal 7 -suppress 3829 # power add generates the logging necessary for said generation. # power add -r /dut/core/* run -all # power off -r /dut/core/* } -coverage save -instance /testbench/dut cov/${1}_${2}.ucdb -#vcover merge -out cov/cov.ucdb cov/rv*.ucdb -#vcover merge -out cov/cov.ucdb cov/rv64gc_arch64i.ucdb cov/rv64gc*.ucdb -logfile cov/log +if {$3 eq "-coverage"} { + do coverage-exclusions.do + coverage save -instance /testbench/dut cov/${1}_${2}.ucdb +} -#vcover merge -out cov/cov.ucdb cov -#vcover report cov/cov.ucdb > cov/rpt -#coverage report -file wally-coverage.txt # These aren't doing anything helpful -#coverage report -memory #profile report -calltree -file wally-calltree.rpt -cutoff 2 #power report -all -bsaif power.saif quit