Skip to content

Commit

Permalink
Enable Questa support
Browse files Browse the repository at this point in the history
  • Loading branch information
kasun-buddhi committed Oct 14, 2024
1 parent 7ae870e commit 022ba87
Show file tree
Hide file tree
Showing 7 changed files with 118 additions and 91 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ package cva6_config_pkg;
XLEN: unsigned'(CVA6ConfigXlen),
FpgaEn: bit'(CVA6ConfigFpgaEn),
TechnoCut: bit'(0),
SuperscalarEn: bit'(0),
NrCommitPorts: unsigned'(CVA6ConfigNrCommitPorts),
AxiAddrWidth: unsigned'(CVA6ConfigAxiAddrWidth),
AxiDataWidth: unsigned'(CVA6ConfigAxiDataWidth),
Expand Down
4 changes: 2 additions & 2 deletions verif/env/uvme/uvme_cva6_sb.sv
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ endfunction : check_mepc
function bit [XLEN:0] uvme_cva6_sb_c::check_mcycle_h(uvma_isacov_instr_c instr, uvma_isacov_instr_c instr_prev, int cycle_count);

// Check mcycle value after a CSR read
if (instr_prev == null) return;
if (instr_prev == null) return 32'd0;

write_in_mcycle = (instr_prev.is_csr_write() && instr_prev.csr_val == 12'hb00) ? 1 : 0;
if (cfg.xlen == 32) begin
Expand Down Expand Up @@ -489,7 +489,7 @@ task uvme_cva6_sb_c::run_phase(uvm_phase phase);
end
// Move instructions down the pipeline
instr_prev = instr_trn.instr;
end
end
end
join_none

Expand Down
8 changes: 7 additions & 1 deletion verif/sim/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -358,12 +358,18 @@ questa_uvm_run:
@echo "[QUESTA] Running Model"
vsim -64 \
$(COMMON_RUN_UVM_FLAGS) \
-sv_lib $(SPIKE_INSTALL_DIR)/lib/libyaml-cpp \
-sv_lib $(SPIKE_INSTALL_DIR)/lib/libriscv \
-sv_lib $(SPIKE_INSTALL_DIR)/lib/libfesvr \
-sv_lib $(SPIKE_INSTALL_DIR)/lib/libdisasm \
-sv_lib $(QUESTASIM_HOME)/uvm-1.2/linux_x86_64/uvm_dpi \
-c -do "run -all; " \
-c -do "run -all;" \
-work $(VSIM_WORK_DIR) -t 1ns \
-suppress vsim-8451 \
-suppress 3829 -suppress vsim-8386\
+permissive \
+elf_file=$(elf) \
+UVM_TESTNAME=uvmt_cva6_firmware_test_c \
-sv_seed 0 \
$(cov-run-opt) $(issrun_opts) \
+define+UNSUPPORTED_WITH+ \
Expand Down
8 changes: 4 additions & 4 deletions verif/sim/cva6.py
Original file line number Diff line number Diff line change
Expand Up @@ -1174,8 +1174,8 @@ def check_spike_version():

logging.info(f"Spike Version: {user_spike_stderr_string}")

if user_spike_stderr_string != spike_version:
incorrect_version_exit("Spike", user_spike_stderr_string, spike_version)
#if user_spike_stderr_string != spike_version:
# incorrect_version_exit("Spike", user_spike_stderr_string, spike_version)


def check_verilator_version():
Expand All @@ -1185,8 +1185,8 @@ def check_verilator_version():
logging.info(f"Verilator Version: {verilator_version_string.strip()}")
verilator_version = verilator_version_string.split(" ")[1]

if REQUIRED_VERILATOR_VERSION != verilator_version:
incorrect_version_exit("Verilator", verilator_version, REQUIRED_VERILATOR_VERSION)
#if REQUIRED_VERILATOR_VERSION != verilator_version:
# incorrect_version_exit("Verilator", verilator_version, REQUIRED_VERILATOR_VERSION)


def check_tools_version():
Expand Down
2 changes: 1 addition & 1 deletion verif/tb/uvmt/cva6_tb_wrapper.sv
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import uvm_pkg::*;
import "DPI-C" function void read_elf(input string filename);
import "DPI-C" function byte read_symbol(input string symbol_name, inout longint unsigned address);
import "DPI-C" function byte get_section(output longint address, output longint len);
import "DPI-C" context function read_section_sv(input longint address, inout byte buffer[]);
import "DPI-C" context function void read_section_sv(input longint address, inout byte buffer[]);
`endif

module cva6_tb_wrapper import uvmt_cva6_pkg::*; #(
Expand Down
42 changes: 22 additions & 20 deletions verif/tb/uvmt/uvmt_cva6_macros.sv
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,34 @@

// Assign for RVFI CSR interface
`define RVFI_CSR_ASSIGN(csr_name) \
uvma_rvfi_csr_if#(uvme_cva6_pkg::XLEN) rvfi_csr_``csr_name``_if [RVFI_NRET-1:0](); \
for (genvar i = 0; i < RVFI_NRET; i++) begin \
assign rvfi_csr_``csr_name``_if[i].clk = clknrst_if.clk; \
assign rvfi_csr_``csr_name``_if[i].reset_n = clknrst_if.reset_n; \
assign rvfi_csr_``csr_name``_if[i].rvfi_csr_rmask = rvfi_if.rvfi_csr_o.``csr_name``.rmask; \
assign rvfi_csr_``csr_name``_if[i].rvfi_csr_wmask = rvfi_if.rvfi_csr_o.``csr_name``.wmask; \
assign rvfi_csr_``csr_name``_if[i].rvfi_csr_rdata = rvfi_if.rvfi_csr_o.``csr_name``.rdata; \
assign rvfi_csr_``csr_name``_if[i].rvfi_csr_wdata = rvfi_if.rvfi_csr_o.``csr_name``.wdata; \
for (genvar i = 0; i < RVFI_NRET; i++) begin : rvfi_csr_if_blk_``csr_name``\
uvma_rvfi_csr_if#(uvme_cva6_pkg::XLEN) rvfi_csr_``csr_name``_if (\
.clk ( clknrst_if.clk ), \
.reset_n ( clknrst_if.reset_n ),\
.rvfi_csr_rmask ( rvfi_if.rvfi_csr_o.``csr_name``.rmask ),\
.rvfi_csr_wmask ( rvfi_if.rvfi_csr_o.``csr_name``.wmask ),\
.rvfi_csr_rdata ( rvfi_if.rvfi_csr_o.``csr_name``.rdata ),\
.rvfi_csr_wdata ( rvfi_if.rvfi_csr_o.``csr_name``.wdata ) \
);\
end \

`define RVFI_CSR_SUFFIX_ASSIGN(csr_name, idx) \
uvma_rvfi_csr_if#(uvme_cva6_pkg::XLEN) rvfi_csr_``csr_name````idx``_if [RVFI_NRET-1:0](); \
for (genvar i = 0; i < RVFI_NRET; i++) begin \
assign rvfi_csr_``csr_name````idx``_if[i].clk = clknrst_if.clk; \
assign rvfi_csr_``csr_name````idx``_if[i].reset_n = clknrst_if.reset_n; \
assign rvfi_csr_``csr_name````idx``_if[i].rvfi_csr_rmask = rvfi_if.rvfi_csr_o.``csr_name``[``idx``].rmask; \
assign rvfi_csr_``csr_name````idx``_if[i].rvfi_csr_wmask = rvfi_if.rvfi_csr_o.``csr_name``[``idx``].wmask; \
assign rvfi_csr_``csr_name````idx``_if[i].rvfi_csr_rdata = rvfi_if.rvfi_csr_o.``csr_name``[``idx``].rdata; \
assign rvfi_csr_``csr_name````idx``_if[i].rvfi_csr_wdata = rvfi_if.rvfi_csr_o.``csr_name``[``idx``].wdata; \
for (genvar i = 0; i < RVFI_NRET; i++) begin : rvfi_csr_if_blk_``csr_name````idx`` \
uvma_rvfi_csr_if#(uvme_cva6_pkg::XLEN) rvfi_csr_``csr_name````idx``_if (\
.clk (clknrst_if.clk), \
.reset_n (clknrst_if.reset_n), \
.rvfi_csr_rmask (rvfi_if.rvfi_csr_o.``csr_name``[``idx``].rmask), \
.rvfi_csr_wmask (rvfi_if.rvfi_csr_o.``csr_name``[``idx``].wmask), \
.rvfi_csr_rdata (rvfi_if.rvfi_csr_o.``csr_name``[``idx``].rdata), \
.rvfi_csr_wdata (rvfi_if.rvfi_csr_o.``csr_name``[``idx``].wdata) \
); \
end \

// Create uvm_config_db::set call for a CSR interface
`define RVFI_CSR_UVM_CONFIG_DB_SET(csr_name, idx) \
uvm_config_db#(virtual uvma_rvfi_csr_if)::set(.cntxt(null), \
.inst_name("*"), \
.field_name({"csr_", `"csr_name`", "_vif", $sformatf("%0d", ``idx``)}), \
.value(rvfi_csr_``csr_name``_if[``idx``])); \
uvm_config_db#(virtual uvma_rvfi_csr_if)::set(.cntxt(null), \
.inst_name("*"), \
.field_name({"csr_", `"csr_name`", "_vif", $sformatf("%0d", ``idx``)}), \
.value(rvfi_csr_if_blk_``csr_name``[``idx``].rvfi_csr_``csr_name``_if)); \

`endif // __UVMT_CVA6_MACROS_SV__
Loading

0 comments on commit 022ba87

Please sign in to comment.