Allow Verilator to pass extra args at compile time (like -G...)

This commit is contained in:
Jordan Carlin 2024-08-10 12:18:54 -07:00
parent 8b1d49b5d0
commit c19916a1d0
No known key found for this signature in database
2 changed files with 7 additions and 3 deletions

View File

@ -127,7 +127,7 @@ if (args.sim == "questa"):
elif (args.sim == "verilator"):
# PWD=${WALLY}/sim CONFIG=rv64gc TESTSUITE=arch64i
print(f"Running Verilator on {args.config} {args.testsuite}")
os.system(f"/usr/bin/make -C {regressionDir}/verilator WALLYCONF={args.config} TEST={args.testsuite} TESTBENCH={args.tb} EXTRA_ARGS='{args.args}'")
os.system(f"/usr/bin/make -C {regressionDir}/verilator WALLYCONF={args.config} TEST={args.testsuite} TESTBENCH={args.tb} EXTRA_ARGS=\"{args.args}\"")
elif (args.sim == "vcs"):
print(f"Running VCS on " + args.config + " " + args.testsuite)
if (args.gui):
@ -135,7 +135,7 @@ elif (args.sim == "vcs"):
if (args.args == ""):
vcsargs = ""
else:
vcsargs = " --args " + args.args
vcsargs = " --args \"" + args.args + "\""
if (ElfFile != ""):
ElfFile = " --elffile " + ElfFile
cmd = cd + "; " + prefix + " ./run_vcs " + args.config + " " + args.testsuite + vcsargs + ElfFile + " " + flags

View File

@ -12,6 +12,8 @@ NONPROF?=--stats
VERILATOR_DIR=${WALLY}/sim/verilator
SOURCE=${WALLY}/config/shared/*.vh ${WALLY}/config/${WALLYCONF} ${WALLY}/config/deriv/${WALLYCONF} ${WALLY}/src/cvw.sv ${WALLY}/testbench/*.sv ${WALLY}/testbench/common/*.sv ${WALLY}/src/*/*.sv ${WALLY}/src/*/*/*.sv
EXTRA_ARGS=
PLUS_ARGS:=$(filter pattern +%, $(EXTRA_ARGS))
PARAM_ARGS:=$(filter-out pattern +%, $(EXTRA_ARGS))
WALLYCONF?=rv64gc
@ -44,7 +46,7 @@ default: run
run: wkdir/$(WALLYCONF)_$(TEST)/V${TESTBENCH}
mkdir -p $(VERILATOR_DIR)/logs
wkdir/$(WALLYCONF)_$(TEST)/V${TESTBENCH} ${ARGTEST} $(EXTRA_ARGS)
wkdir/$(WALLYCONF)_$(TEST)/V${TESTBENCH} ${ARGTEST} $(PLUS_ARGS)
profile: obj_dir_profiling/V${TESTBENCH}_$(WALLYCONF)
$(VERILATOR_DIR)/obj_dir_profiling/V${TESTBENCH}_$(WALLYCONF) ${ARGTEST}
@ -65,6 +67,7 @@ wkdir/$(WALLYCONF)_$(TEST)/V${TESTBENCH}: $(DEPENDENCIES)
$(INCLUDE_PATH) \
${WRAPPER} \
${GTEST} \
${PARAM_ARGS} \
$(SOURCES)
obj_dir_profiling/V${TESTBENCH}_$(WALLYCONF): $(DEPENDENCIES)
@ -77,6 +80,7 @@ obj_dir_profiling/V${TESTBENCH}_$(WALLYCONF): $(DEPENDENCIES)
$(INCLUDE_PATH) \
${WRAPPER} \
${GTEST} \
${PARAM_ARGS} \
$(SOURCES)
clean: