mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-03 02:05:21 +00:00
Fixed wsim to be able to invoke TestFloat with Verilator. However, TestFloat produces incorrect results with Verilator
This commit is contained in:
parent
a89e064d1d
commit
61e559606e
7
bin/wsim
7
bin/wsim
@ -54,10 +54,7 @@ for d in ["logs", "wkdir", "cov"]:
|
|||||||
cd = "cd $WALLY/sim/" +args.sim
|
cd = "cd $WALLY/sim/" +args.sim
|
||||||
if (args.sim == "questa"):
|
if (args.sim == "questa"):
|
||||||
if (args.tb == "testbench_fp"):
|
if (args.tb == "testbench_fp"):
|
||||||
args.args = " -GTEST=" + args.testsuite + " " + args.args
|
args.args = " -GTEST=\"" + args.testsuite + "\" " + args.args
|
||||||
# cmd = "do wally.do " + args.config + " " + args.testsuite + " " + args.tb + " " + " -GTEST=" + args.testsuite + " " + args.args
|
|
||||||
# else:
|
|
||||||
# cmd = "do wally.do " + args.config + " " + args.testsuite + " " + args.tb + " " + args.args
|
|
||||||
cmd = "do wally.do " + args.config + " " + args.testsuite + " " + args.tb + " " + args.args
|
cmd = "do wally.do " + args.config + " " + args.testsuite + " " + args.tb + " " + args.args
|
||||||
if (args.coverage):
|
if (args.coverage):
|
||||||
cmd += " -coverage"
|
cmd += " -coverage"
|
||||||
@ -76,7 +73,7 @@ elif (args.sim == "verilator"):
|
|||||||
if (args.gui):
|
if (args.gui):
|
||||||
print("GUI option not available for Verilator")
|
print("GUI option not available for Verilator")
|
||||||
exit(1)
|
exit(1)
|
||||||
os.system(f"/usr/bin/make -C {regressionDir}/verilator WALLYCONF={args.config} TEST={args.testsuite} 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"):
|
elif (args.sim == "vcs"):
|
||||||
print(f"Running VCS on " + args.config + " " + args.testsuite)
|
print(f"Running VCS on " + args.config + " " + args.testsuite)
|
||||||
if (args.gui):
|
if (args.gui):
|
||||||
|
@ -16,6 +16,7 @@ EXTRA_ARGS=
|
|||||||
|
|
||||||
WALLYCONF?=rv64gc
|
WALLYCONF?=rv64gc
|
||||||
TEST?=arch64i
|
TEST?=arch64i
|
||||||
|
TESTBENCH?=testbench
|
||||||
|
|
||||||
# constants
|
# constants
|
||||||
# assume WALLY variable is correctly configured in the shell environment
|
# assume WALLY variable is correctly configured in the shell environment
|
||||||
@ -24,47 +25,60 @@ TARGET=$(WORKING_DIR)/target
|
|||||||
# INCLUDE_PATH are pathes that Verilator should search for files it needs
|
# INCLUDE_PATH are pathes that Verilator should search for files it needs
|
||||||
INCLUDE_PATH="-I${WALLY}/config/shared" "-I${WALLY}/config/$(WALLYCONF)" "-I${WALLY}/config/deriv/$(WALLYCONF)"
|
INCLUDE_PATH="-I${WALLY}/config/shared" "-I${WALLY}/config/$(WALLYCONF)" "-I${WALLY}/config/deriv/$(WALLYCONF)"
|
||||||
# SOURCES are source files
|
# SOURCES are source files
|
||||||
SOURCES=${WALLY}/src/cvw.sv ${WALLY}/testbench/testbench.sv ${WALLY}/testbench/common/*.sv ${WALLY}/src/*/*.sv ${WALLY}/src/*/*/*.sv
|
SOURCES=${WALLY}/src/cvw.sv ${WALLY}/testbench/${TESTBENCH}.sv ${WALLY}/testbench/common/*.sv ${WALLY}/src/*/*.sv ${WALLY}/src/*/*/*.sv
|
||||||
# DEPENDENCIES are configuration files and source files, which leads to recompilation of executables
|
# DEPENDENCIES are configuration files and source files, which leads to recompilation of executables
|
||||||
DEPENDENCIES=${WALLY}/config/shared/*.vh $(SOURCES)
|
DEPENDENCIES=${WALLY}/config/shared/*.vh $(SOURCES)
|
||||||
|
|
||||||
|
# regular testbench requires a wrapper defining getenvval
|
||||||
|
ifeq ($(TESTBENCH), testbench)
|
||||||
|
WRAPPER=${WALLY}/sim/verilator/wrapper.c
|
||||||
|
GTEST=
|
||||||
|
ARGTEST=+TEST=$(TEST)
|
||||||
|
else
|
||||||
|
WRAPPER=
|
||||||
|
GTEST=-GTEST="\"${TEST}\""
|
||||||
|
ARGTEST=
|
||||||
|
endif
|
||||||
|
|
||||||
default: run
|
default: run
|
||||||
|
|
||||||
run: wkdir/$(WALLYCONF)_$(TEST)/Vtestbench
|
run: wkdir/$(WALLYCONF)_$(TEST)/V${TESTBENCH}
|
||||||
mkdir -p $(VERILATOR_DIR)/logs
|
mkdir -p $(VERILATOR_DIR)/logs
|
||||||
wkdir/$(WALLYCONF)_$(TEST)/Vtestbench +TEST=$(TEST)
|
wkdir/$(WALLYCONF)_$(TEST)/V${TESTBENCH} ${ARGTEST}
|
||||||
|
|
||||||
profile: obj_dir_profiling/Vtestbench_$(WALLYCONF)
|
profile: obj_dir_profiling/V${TESTBENCH}_$(WALLYCONF)
|
||||||
$(VERILATOR_DIR)/obj_dir_profiling/Vtestbench_$(WALLYCONF) +TEST=$(TEST)
|
$(VERILATOR_DIR)/obj_dir_profiling/V${TESTBENCH}_$(WALLYCONF) ${ARGTEST}
|
||||||
mv gmon.out gmon_$(WALLYCONF).out
|
mv gmon.out gmon_$(WALLYCONF).out
|
||||||
gprof $(VERILATOR_DIR)/obj_dir_profiling/Vtestbench_$(WALLYCONF) gmon_$(WALLYCONF).out > gmon_$(WALLYCONF).log
|
gprof $(VERILATOR_DIR)/obj_dir_profiling/V${TESTBENCH}_$(WALLYCONF) gmon_$(WALLYCONF).out > gmon_$(WALLYCONF).log
|
||||||
verilator_profcfunc gmon_$(WALLYCONF).log > gmon_$(WALLYCONF).log2
|
verilator_profcfunc gmon_$(WALLYCONF).log > gmon_$(WALLYCONF).log2
|
||||||
mkdir -p $(VERILATOR_DIR)/logs_profiling
|
mkdir -p $(VERILATOR_DIR)/logs_profiling
|
||||||
mv gmon_$(WALLYCONF)* $(VERILATOR_DIR)/logs_profiling
|
mv gmon_$(WALLYCONF)* $(VERILATOR_DIR)/logs_profiling
|
||||||
echo "Please check $(VERILATOR_DIR)/logs_profiling/gmon_$(WALLYCONF)* for logs and output files."
|
echo "Please check $(VERILATOR_DIR)/logs_profiling/gmon_$(WALLYCONF)* for logs and output files."
|
||||||
|
|
||||||
wkdir/$(WALLYCONF)_$(TEST)/Vtestbench: $(DEPENDENCIES)
|
wkdir/$(WALLYCONF)_$(TEST)/V${TESTBENCH}: $(DEPENDENCIES)
|
||||||
mkdir -p wkdir/$(WALLYCONF)_$(TEST)
|
mkdir -p wkdir/$(WALLYCONF)_$(TEST)
|
||||||
verilator \
|
verilator \
|
||||||
--Mdir wkdir/$(WALLYCONF)_$(TEST) -o Vtestbench \
|
--Mdir wkdir/$(WALLYCONF)_$(TEST) -o V${TESTBENCH} \
|
||||||
--binary --trace \
|
--binary --trace \
|
||||||
$(OPT) $(PARAMS) $(NONPROF) \
|
$(OPT) $(PARAMS) $(NONPROF) \
|
||||||
$(EXTRA_ARGS) \
|
$(EXTRA_ARGS) \
|
||||||
--top-module testbench --relative-includes \
|
--top-module ${TESTBENCH} --relative-includes \
|
||||||
$(INCLUDE_PATH) \
|
$(INCLUDE_PATH) \
|
||||||
${WALLY}/sim/verilator/wrapper.c \
|
${WRAPPER} \
|
||||||
|
${GTEST} \
|
||||||
$(SOURCES)
|
$(SOURCES)
|
||||||
|
|
||||||
obj_dir_profiling/Vtestbench_$(WALLYCONF): $(DEPENDENCIES)
|
obj_dir_profiling/V${TESTBENCH}_$(WALLYCONF): $(DEPENDENCIES)
|
||||||
mkdir -p obj_dir_profiling
|
mkdir -p obj_dir_profiling
|
||||||
verilator \
|
verilator \
|
||||||
--Mdir obj_dir_profiling -o Vtestbench_$(WALLYCONF) \
|
--Mdir obj_dir_profiling -o V${TESTBENCH}_$(WALLYCONF) \
|
||||||
--binary \
|
--binary \
|
||||||
--prof-cfuncs $(OPT) $(PARAMS) \
|
--prof-cfuncs $(OPT) $(PARAMS) \
|
||||||
$(EXTRA_ARGS) \
|
$(EXTRA_ARGS) \
|
||||||
--top-module testbench --relative-includes \
|
--top-module ${TESTBENCH} --relative-includes \
|
||||||
$(INCLUDE_PATH) \
|
$(INCLUDE_PATH) \
|
||||||
${WALLY}/sim/verilator/wrapper.c \
|
${WRAPPER} \
|
||||||
|
${GTEST} \
|
||||||
$(SOURCES)
|
$(SOURCES)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
Loading…
Reference in New Issue
Block a user