Merged wsim changes

This commit is contained in:
David Harris 2024-04-22 13:11:35 -07:00
commit f9eec8c43f
3 changed files with 13 additions and 3 deletions

View file

@ -23,6 +23,7 @@ parser.add_argument("--tb", "-t", help="Testbench", choices=["testbench", "testb
parser.add_argument("--gui", "-g", help="Simulate with GUI", action="store_true")
parser.add_argument("--coverage", "-c", help="Code & Functional Coverage", action="store_true")
parser.add_argument("--args", "-a", help="Optional arguments passed to simulator via $value$plusargs", default="")
parser.add_argument("--vcd", "-v", help="Generate testbench.vcd", action="store_true")
args = parser.parse_args()
print("Config=" + args.config + " tests=" + args.testsuite + " sim=" + args.sim + " gui=" + str(args.gui) + " args='" + args.args + "'")
@ -37,6 +38,8 @@ if (args.coverage):
print("Coverage option only available for Questa")
exit(1)
if (args.vcd):
args.args += " -DMAKEVCD=1"
# create the output sub-directories.
WALLY = os.environ.get('WALLY')
@ -73,7 +76,7 @@ elif (args.sim == "verilator"):
if (args.gui):
print("GUI option not available for Verilator")
exit(1)
os.system(f"/usr/bin/make -C {regressionDir}/verilator WALLYCONF={args.config} TEST={args.testsuite}")
os.system(f"/usr/bin/make -C {regressionDir}/verilator WALLYCONF={args.config} TEST={args.testsuite} EXTRA_ARGS='{args.args}'")
elif (args.sim == "vcs"):
print(f"Running VCS on " + args.config + " " + args.testsuite)
if (args.coverage):

View file

@ -10,7 +10,8 @@ OPT=
PARAMS?=-DVERILATOR=1 --no-trace-top
NONPROF?=--stats
VERILATOR_DIR=${WALLY}/sim/verilator
SOURCE=${WALLY}/config/shared/*.vh ${WALLY}/config/${WALLYCONF} ${WALLY}/src/cvw.sv ${WALLY}/testbench/testbench.sv ${WALLY}/testbench/common/*.sv ${WALLY}/src/*/*.sv ${WALLY}/src/*/*/*.sv
SOURCE=${WALLY}/config/shared/*.vh ${WALLY}/config/${WALLYCONF} ${WALLY}/src/cvw.sv ${WALLY}/testbench/*.sv ${WALLY}/testbench/common/*.sv ${WALLY}/src/*/*.sv ${WALLY}/src/*/*/*.sv
EXTRA_ARGS=
WALLYCONF?=rv64gc
@ -48,8 +49,9 @@ run: wkdir/$(WALLYCONF)_$(TEST)/Vtestbench
wkdir/$(WALLYCONF)_$(TEST)/Vtestbench: $(SOURCE)
verilator \
--Mdir wkdir/$(WALLYCONF)_$(TEST) -o Vtestbench \
--binary \
--binary --trace \
$(OPT) $(PARAMS) $(NONPROF) \
$(EXTRA_ARGS) \
--timescale "1ns/1ns" --timing --top-module testbench --relative-includes \
"-I${WALLY}/config/shared" "-I${WALLY}/config/$(WALLYCONF)" \
${WALLY}/sim/verilator/wrapper.c \
@ -62,6 +64,7 @@ obj_dir_profiling/Vtestbench_$(WALLYCONF): $(DEPENDENCIES)
--Mdir obj_dir_profiling -o Vtestbench_$(WALLYCONF) \
--binary \
--prof-cfuncs $(OPT) $(PARAMS) \
$(EXTRA_ARGS) \
--timescale "1ns/1ns" --timing --top-module testbench --relative-includes \
$(INCLUDE_PATH) \
wrapper.c \

View file

@ -222,6 +222,10 @@ module testbench;
$display("TEST %s not supported in this configuration", TEST);
$finish;
end
`ifdef MAKEVCD
$dumpfile("testbench.vcd");
$dumpvars;
`endif
end // initial begin
// Model the testbench as an fsm.