Skip to content

Commit

Permalink
Add Verdi option and memory preloading for VCS simulator (openhwgroup…
Browse files Browse the repository at this point in the history
…#772)

* miss_handler.sv: critical_word signals connection explicit to compile with VCS

Signed-off-by: Guillaume Chauvon <[email protected]>

* Makefile: add verdi support and move gen files to vcs_result directory

Signed-off-by: Guillaume Chauvon <[email protected]>

* VCS-32 Preloading

Signed-off-by: Guillaume Chauvon <[email protected]>
  • Loading branch information
Gchauvon authored Dec 3, 2021
1 parent 43b3608 commit 42aa48a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
24 changes: 15 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
library ?= work
# verilator lib
ver-library ?= work-ver
# vcs lib
vcs-library ?= work-vcs
# library for DPI
dpi-library ?= work-dpi
# Top level module to compile
Expand Down Expand Up @@ -243,6 +245,8 @@ fpga_src := $(addprefix $(root-dir), $(fpga_src))

# look for testbenches
tbs := corev_apu/tb/ariane_tb.sv corev_apu/tb/ariane_testharness.sv
tbs := $(addprefix $(root-dir), $(tbs))

# RISCV asm tests and benchmark setup (used for CI)
# there is a definesd test-list with selected CI tests
riscv-test-dir := tmp/riscv-tests/build/isa/
Expand Down Expand Up @@ -303,16 +307,18 @@ else
endif

vcs_build: $(dpi-library)/ariane_dpi.so
vlogan -full64 -nc -sverilog -ntb_opts uvm-1.2
vlogan -full64 -nc -sverilog -ntb_opts uvm-1.2 +define+WT_CACHE +define+RVFI_TRACE $(filter %.sv,$(ariane_pkg)) +incdir+core/include/+$(VCS_HOME)/etc/uvm-1.2/dpi
vlogan -full64 -nc -sverilog -ntb_opts uvm-1.2 +define+WT_CACHE +define+RVFI_TRACE $(filter %.sv,$(util)) +incdir+common/local/util+core/include/+src/util/+$(VCS_HOME)/etc/uvm-1.2/dpi
vhdlan -full64 $(filter %.vhd,$(uart_src))
vlogan -full64 -nc -sverilog -ntb_opts uvm-1.2 -assert svaext +define+WT_CACHE +define+RVFI_TRACE $(filter %.sv,$(src)) +incdir+core/include/+common/submodules/common_cells/include/+common/local/util/+$(VCS_HOME)/etc/uvm-1.2/dpi
vlogan -full64 -nc -sverilog -ntb_opts uvm-1.2 $(tbs) +define+RVFI_TRACE
vcs -full64 -timescale=1ns/1ns -ntb_opts uvm-1.2 work.ariane_tb
mkdir -p $(vcs-library)
cd $(vcs-library) &&\
vlogan $(if $(VERDI), -kdb,) -full64 -nc -sverilog -ntb_opts uvm-1.2 &&\
vlogan $(if $(VERDI), -kdb,) -full64 -nc -sverilog -ntb_opts uvm-1.2 +define+WT_CACHE +define+RVFI_TRACE $(filter %.sv,$(ariane_pkg)) +incdir+core/include/+$(VCS_HOME)/etc/uvm-1.2/dpi &&\
vlogan $(if $(VERDI), -kdb,) -full64 -nc -sverilog -ntb_opts uvm-1.2 +define+WT_CACHE +define+RVFI_TRACE $(filter %.sv,$(util)) +incdir+../common/local/util+../core/include/+src/util/+$(VCS_HOME)/etc/uvm-1.2/dpi &&\
vhdlan $(if $(VERDI), -kdb,) -full64 -nc $(filter %.vhd,$(uart_src)) &&\
vlogan $(if $(VERDI), -kdb,) -full64 -nc -sverilog -ntb_opts uvm-1.2 -assert svaext +define+WT_CACHE +define+RVFI_TRACE $(filter %.sv,$(src)) +incdir+../core/include/+../common/submodules/common_cells/include/+../common/local/util/+$(VCS_HOME)/etc/uvm-1.2/dpi &&\
vlogan $(if $(VERDI), -kdb,) -full64 -nc -sverilog -ntb_opts uvm-1.2 $(tbs) +define+RVFI_TRACE &&\
vcs $(if $(VERDI), -kdb -debug_access+all -lca,) -full64 -timescale=1ns/1ns -ntb_opts uvm-1.2 work.ariane_tb

vcs: vcs_build
./simv +permissive -sv_lib work-dpi/ariane_dpi +permissive-off ++$(elf-bin) | tee vcs.log
cd $(vcs-library) && ./simv $(if $(VERDI), -verdi,) +permissive -sv_lib ../work-dpi/ariane_dpi +PRELOAD=$(elf-bin) +permissive-off ++$(elf-bin)| tee vcs.log

# Build the TB and module using QuestaSim
build: $(library) $(library)/.build-srcs $(library)/.build-tb $(dpi-library)/ariane_dpi.so
Expand Down Expand Up @@ -763,7 +769,7 @@ build-spike:

clean:
rm -rf $(riscv-torture-dir)/output/test*
rm -rf $(library)/ $(dpi-library)/ $(ver-library)/
rm -rf $(library)/ $(dpi-library)/ $(ver-library)/ $(vcs-library)/
rm -f tmp/*.ucdb tmp/*.log *.wlf *vstf wlft* *.ucdb

.PHONY:
Expand Down
4 changes: 2 additions & 2 deletions core/cache_subsystem/miss_handler.sv
Original file line number Diff line number Diff line change
Expand Up @@ -610,8 +610,8 @@ module miss_handler import ariane_pkg::*; import std_cache_pkg::*; #(
.valid_o ( valid_miss_fsm ),
.rdata_o ( data_miss_fsm ),
.id_o ( ),
.critical_word_o,
.critical_word_valid_o,
.critical_word_o ( critical_word_o ),
.critical_word_valid_o (critical_word_valid_o),
.axi_req_o ( axi_data_o ),
.axi_resp_i ( axi_data_i )
);
Expand Down

0 comments on commit 42aa48a

Please sign in to comment.