Verilator fulladder example improvmeents

This commit is contained in:
David Harris 2024-04-28 22:08:00 -07:00
parent b50bb4cad8
commit 8f0c68373e
4 changed files with 12 additions and 13 deletions

1
.gitignore vendored
View File

@ -188,6 +188,7 @@ sim/cfi/*
sim/branch/* sim/branch/*
sim/obj_dir sim/obj_dir
examples/verilog/fulladder/obj_dir examples/verilog/fulladder/obj_dir
examples/verilog/fulladder/fulladder.vcd
config/deriv config/deriv
docs/docker/buildroot-config-src docs/docker/buildroot-config-src
docs/docker/testvector-generation docs/docker/testvector-generation

View File

@ -19,6 +19,8 @@ module testbench();
// at start of test, load vectors and pulse reset // at start of test, load vectors and pulse reset
initial initial
begin begin
$dumpfile("fulladder.vcd");
$dumpvars;
$readmemb("fulladder.tv", testvectors); $readmemb("fulladder.tv", testvectors);
cycle = 0; cycle = 0;
vectornum = 0; errors = 0; vectornum = 0; errors = 0;
@ -47,6 +49,7 @@ module testbench();
$finish; $finish;
end end
end end
endmodule endmodule
module fulladder(input logic a, b, c, module fulladder(input logic a, b, c,

View File

@ -1,5 +1,3 @@
#verilator --timescale "1ns/1ns" --timing -cc --exe --build --top-module testbench fulladder.sv verilator --binary --top-module testbench --trace fulladder.sv
#verilator --timescale "1ns/1ns" --timing -cc --exe --top-module testbench fulladder.sv obj_dir/Vtestbench
#verilator --binary --top-module testbench fulladder.sv
verilator --timescale "1ns/1ns" --timing --binary --top-module testbench fulladder.sv

View File

@ -30,6 +30,10 @@ DEPENDENCIES=${WALLY}/config/shared/*.vh $(SOURCES)
default: run default: run
run: wkdir/$(WALLYCONF)_$(TEST)/Vtestbench
mkdir -p $(VERILATOR_DIR)/logs
wkdir/$(WALLYCONF)_$(TEST)/Vtestbench +TEST=$(TEST)
profile: obj_dir_profiling/Vtestbench_$(WALLYCONF) profile: obj_dir_profiling/Vtestbench_$(WALLYCONF)
$(VERILATOR_DIR)/obj_dir_profiling/Vtestbench_$(WALLYCONF) +TEST=$(TEST) $(VERILATOR_DIR)/obj_dir_profiling/Vtestbench_$(WALLYCONF) +TEST=$(TEST)
mv gmon.out gmon_$(WALLYCONF).out mv gmon.out gmon_$(WALLYCONF).out
@ -39,17 +43,13 @@ profile: obj_dir_profiling/Vtestbench_$(WALLYCONF)
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."
run: wkdir/$(WALLYCONF)_$(TEST)/Vtestbench
mkdir -p $(VERILATOR_DIR)/logs
wkdir/$(WALLYCONF)_$(TEST)/Vtestbench +TEST=$(TEST)
wkdir/$(WALLYCONF)_$(TEST)/Vtestbench: $(DEPENDENCIES) wkdir/$(WALLYCONF)_$(TEST)/Vtestbench: $(DEPENDENCIES)
verilator \ verilator \
--Mdir wkdir/$(WALLYCONF)_$(TEST) -o Vtestbench \ --Mdir wkdir/$(WALLYCONF)_$(TEST) -o Vtestbench \
--binary --trace \ --binary --trace \
$(OPT) $(PARAMS) $(NONPROF) \ $(OPT) $(PARAMS) $(NONPROF) \
$(EXTRA_ARGS) \ $(EXTRA_ARGS) \
--timescale "1ns/1ns" --timing --top-module testbench --relative-includes \ --top-module testbench --relative-includes \
$(INCLUDE_PATH) \ $(INCLUDE_PATH) \
${WALLY}/sim/verilator/wrapper.c \ ${WALLY}/sim/verilator/wrapper.c \
$(SOURCES) $(SOURCES)
@ -61,13 +61,10 @@ obj_dir_profiling/Vtestbench_$(WALLYCONF): $(DEPENDENCIES)
--binary \ --binary \
--prof-cfuncs $(OPT) $(PARAMS) \ --prof-cfuncs $(OPT) $(PARAMS) \
$(EXTRA_ARGS) \ $(EXTRA_ARGS) \
--timescale "1ns/1ns" --timing --top-module testbench --relative-includes \ --top-module testbench --relative-includes \
$(INCLUDE_PATH) \ $(INCLUDE_PATH) \
${WALLY}/sim/verilator/wrapper.c \ ${WALLY}/sim/verilator/wrapper.c \
$(SOURCES) $(SOURCES)
questa:
vsim -c -do "do ${WALLY}/sim/wally-batch.do $(WALLYCONF) $(TEST)"
clean: clean:
rm -rf $(VERILATOR_DIR)/wkdir $(VERILATOR_DIR)/obj_dir_profiling $(VERILATOR_DIR)/logs $(VERILATOR_DIR)/logs_profiling rm -rf $(VERILATOR_DIR)/wkdir $(VERILATOR_DIR)/obj_dir_profiling $(VERILATOR_DIR)/logs $(VERILATOR_DIR)/logs_profiling