Merge pull request #750 from Karl-Han/verilator

Run verilator configurations and testsuites in different folders.
This commit is contained in:
David Harris 2024-04-22 11:36:32 -07:00 committed by GitHub
commit 750fb6bfce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -5,6 +5,10 @@ SHELL := /bin/bash
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
WALLYCONF?=rv64gc
TEST?=arch64i
@ -22,35 +26,36 @@ DEPENDENCIES=${WALLY}/config/shared/*.vh $(SOURCES)
default: run
profile: obj_dir_profiling/Vtestbench_$(WALLYCONF)
$(WORKING_DIR)/obj_dir_profiling/Vtestbench_$(WALLYCONF) +TEST=$(TEST)
$(VERILATOR_DIR)/obj_dir_profiling/Vtestbench_$(WALLYCONF) +TEST=$(TEST)
mv gmon.out gmon_$(WALLYCONF).out
gprof $(WORKING_DIR)/obj_dir_profiling/Vtestbench_$(WALLYCONF) gmon_$(WALLYCONF).out > gmon_$(WALLYCONF).log
gprof $(VERILATOR_DIR)/obj_dir_profiling/Vtestbench_$(WALLYCONF) gmon_$(WALLYCONF).out > gmon_$(WALLYCONF).log
verilator_profcfunc gmon_$(WALLYCONF).log > gmon_$(WALLYCONF).log2
mkdir -p $(WORKING_DIR)/logs_profiling
mv gmon_$(WALLYCONF)* $(WORKING_DIR)/logs_profiling
echo "Please check $(WORKING_DIR)/logs_profiling/gmon_$(WALLYCONF)* for logs and output files."
mkdir -p $(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."
run: obj_dir_non_profiling/Vtestbench_$(WALLYCONF)
mkdir -p $(WORKING_DIR)/logs
time $(WORKING_DIR)/obj_dir_non_profiling/Vtestbench_$(WALLYCONF) +TEST=$(TEST) 2>&1 > $(WORKING_DIR)/logs/$(WALLYCONF)_$(TEST).log
echo "Please check $(WORKING_DIR)/logs/$(WALLYCONF)_$(TEST).log for logs and output files."
run: wkdir/$(WALLYCONF)_$(TEST)/Vtestbench
mkdir -p $(VERILATOR_DIR)/logs
wkdir/$(WALLYCONF)_$(TEST)/Vtestbench +TEST=$(TEST) 2>&1 > $(VERILATOR_DIR)/logs/$(WALLYCONF)_$(TEST).log
echo "Please check $(VERILATOR_DIR)/logs/$(WALLYCONF)_$(TEST).log for logs and output files."
obj_dir_non_profiling/Vtestbench_$(WALLYCONF): $(DEPENDENCIES)
mkdir -p obj_dir_non_profiling
time verilator \
--Mdir obj_dir_non_profiling -o Vtestbench_$(WALLYCONF) \
-cc --binary \
wkdir/$(WALLYCONF)_$(TEST)/Vtestbench: $(SOURCE)
verilator \
--Mdir wkdir/$(WALLYCONF)_$(TEST) -o Vtestbench \
--binary \
$(OPT) $(PARAMS) $(NONPROF) \
--timescale "1ns/1ns" --timing --top-module testbench --relative-includes \
$(INCLUDE_PATH) \
wrapper.c \
$(SOURCES)
"-I${WALLY}/config/shared" "-I${WALLY}/config/$(WALLYCONF)" \
${WALLY}/sim/verilator/wrapper.c \
${WALLY}/src/cvw.sv ${WALLY}/testbench/testbench.sv ${WALLY}/testbench/common/*.sv ${WALLY}/src/*/*.sv ${WALLY}/src/*/*/*.sv
obj_dir_profiling/Vtestbench_$(WALLYCONF): $(DEPENDENCIES)
mkdir -p obj_dir_profiling
time verilator \
verilator \
--Mdir obj_dir_profiling -o Vtestbench_$(WALLYCONF) \
-cc --binary \
--binary \
--prof-cfuncs $(OPT) $(PARAMS) \
--timescale "1ns/1ns" --timing --top-module testbench --relative-includes \
$(INCLUDE_PATH) \
@ -58,7 +63,7 @@ obj_dir_profiling/Vtestbench_$(WALLYCONF): $(DEPENDENCIES)
$(SOURCES)
questa:
time vsim -c -do "do ${WALLY}/sim/wally-batch.do $(WALLYCONF) $(TEST)"
vsim -c -do "do ${WALLY}/sim/wally-batch.do $(WALLYCONF) $(TEST)"
clean:
rm -rf $(WORKING_DIR)/obj_dir_non_profiling $(WORKING_DIR)/obj_dir_profiling $(WORKING_DIR)/logs $(WORKING_DIR)/logs_profiling
rm -rf $(VERILATOR_DIR)/wkdir $(VERILATOR_DIR)/obj_dir_profiling $(VERILATOR_DIR)/logs $(VERILATOR_DIR)/logs_profiling