From 7b5680932397c45b5adecd72fb0c7fec7e37f840 Mon Sep 17 00:00:00 2001 From: David Harris Date: Fri, 5 Apr 2024 19:08:14 -0700 Subject: [PATCH] wsim runs a Questa sim --- sim/questa/wally-batch.do | 20 +++++++++++++------- sim/wsim | 3 ++- testbench/tests.vh | 12 ++++++------ 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/sim/questa/wally-batch.do b/sim/questa/wally-batch.do index f7c449272..f1489b7cb 100644 --- a/sim/questa/wally-batch.do +++ b/sim/questa/wally-batch.do @@ -20,9 +20,10 @@ onbreak {resume} -set CONFIG ${1} +set CFG ${1} set TESTSUITE ${2} -set WKDIR wkdir/work_${CONFIG}_${TESTSUITE} +set WKDIR wkdir/${CFG}_${TESTSUITE} +set WALLY $::env(WALLY) # create library if [file exists ${WKDIR}] { @@ -67,12 +68,16 @@ if {$argc >= 3} { # "Extra checking for conflicts with always_comb done at vopt time" # because vsim will run vopt -vlog -lint -work ${WKDIR} +incdir+../config/$1 +incdir+../config/deriv/$1 +incdir+../config/shared ../src/cvw.sv ../testbench/testbench.sv ../testbench/common/*.sv ../src/*/*.sv ../src/*/*/*.sv -suppress 2583 -suppress 7063,2596,13286 +set CONFIG ${WALLY}/config +set SRC ${WALLY}/src +set TB ${WALLY}/testbench + +vlog -lint -work ${WKDIR} +incdir+${CONFIG}/$1 +incdir+${CONFIG}/deriv/$1 +incdir+${CONFIG}/shared ${SRC}/cvw.sv ${TB}/testbench.sv ${TB}/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 ${configOptions} -o testbenchopt ${CoverageVoptArg} -vsim -lib wkdir/work_${1}_${2} testbenchopt -fatal 7 -suppress 3829 ${CoverageVsimArg} +vopt wkdir/${CFG}_${TESTSUITE}.testbench -work ${WKDIR} -G TEST=$2 ${configOptions} -o testbenchopt ${CoverageVoptArg} +vsim -lib ${WKDIR} testbenchopt -fatal 7 -suppress 3829 ${CoverageVsimArg} # vsim -lib wkdir/work_${1}_${2} testbenchopt -fatal 7 -suppress 3829 # power add generates the logging necessary for said generation. @@ -82,9 +87,10 @@ run -all if {$coverage} { - echo "Saving coverage to ${1}_${2}.ucdb" + set UCDB cov/${CONFIG}_${TESTSUITE}.ucdb + echo "Saving coverage to ${UCDB}" do coverage-exclusions-rv64gc.do # beware: this assumes testing the rv64gc configuration - coverage save -instance /testbench/dut/core cov/${1}_${2}.ucdb + coverage save -instance /testbench/dut/core ${UCDB} } # These aren't doing anything helpful diff --git a/sim/wsim b/sim/wsim index c02b8accd..723fb644b 100755 --- a/sim/wsim +++ b/sim/wsim @@ -11,6 +11,7 @@ # SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1 import argparse +import os # Read arguments parser = argparse.ArgumentParser() @@ -23,7 +24,7 @@ print("Config: " + args.config + " tests " + args.testsuite + " sim " + args.sim if (args.sim == "questa"): cmd = "do wally-batch.do " + args.config + " " + args.testsuite - system("vsim -c -do \"" + cmd + "\"") + os.system("cd questa; vsim -c -do \"" + cmd + "\"") elif (args.sim == "verilator"): print("Running Verilator") elif (args.sim == "vcs"): diff --git a/testbench/tests.vh b/testbench/tests.vh index 6958fc50d..8dfd69415 100644 --- a/testbench/tests.vh +++ b/testbench/tests.vh @@ -35,12 +35,12 @@ string tvpaths[] = '{ "$RISCV/imperas-riscv-tests/work/", - "../tests/riscof/work/riscv-arch-test/", - "../tests/riscof/work/wally-riscv-arch-test/", - "../benchmarks/coremark/work/", - "../addins/embench-iot/", - "../tests/custom/work/", - "../tests/coverage/" + "../../tests/riscof/work/riscv-arch-test/", + "../../tests/riscof/work/wally-riscv-arch-test/", + "../../benchmarks/coremark/work/", + "../../addins/embench-iot/", + "../../tests/custom/work/", + "../../tests/coverage/" }; string coverage64gc[] = '{