OBI Agent and assertions integration (#2257)

This commit is contained in:
Anouar 2024-06-14 10:13:15 +01:00 committed by GitHub
parent c279302e0a
commit 58aee0327e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 101 additions and 0 deletions

View file

@ -43,6 +43,7 @@ class uvme_cva6_cfg_c extends uvma_core_cntrl_cfg_c;
rand uvma_clknrst_cfg_c clknrst_cfg;
rand uvma_cvxif_cfg_c cvxif_cfg;
rand uvma_axi_cfg_c axi_cfg;
rand uvma_obi_memory_cfg_c obi_cfg;
rand uvma_rvfi_cfg_c#(ILEN,XLEN) rvfi_cfg;
rand uvma_isacov_cfg_c isacov_cfg;
@ -74,6 +75,8 @@ class uvme_cva6_cfg_c extends uvma_core_cntrl_cfg_c;
`uvm_field_object(axi_cfg, UVM_DEFAULT)
`uvm_field_object(obi_cfg, UVM_DEFAULT)
`uvm_field_object(rvfi_cfg, UVM_DEFAULT)
`uvm_field_object(isacov_cfg, UVM_DEFAULT)
@ -189,6 +192,26 @@ class uvme_cva6_cfg_c extends uvma_core_cntrl_cfg_c;
rvfi_cfg.nret == CVA6Cfg.NrCommitPorts;
unified_traps == 0;
axi_cfg.rand_channel_delay_enabled == 0;
obi_cfg.drv_mode == UVMA_OBI_MEMORY_MODE_SLV;
obi_cfg.version == UVMA_OBI_MEMORY_VERSION_1P2;
//AZ: Issue in CVA6Cfg.ObiFetchbusCfg values, to be fixed
//obi_cfg.auser_width == CVA6Cfg.ObiFetchbusCfg.OptionalCfg.AUserWidth;
//obi_cfg.wuser_width == CVA6Cfg.ObiFetchbusCfg.OptionalCfg.WUserWidth;
//obi_cfg.ruser_width == CVA6Cfg.ObiFetchbusCfg.OptionalCfg.RUserWidth;
//obi_cfg.addr_width == CVA6Cfg.ObiFetchbusCfg.AddrWidth ;
//obi_cfg.data_width == CVA6Cfg.ObiFetchbusCfg.DataWidth ;
//obi_cfg.id_width == CVA6Cfg.ObiFetchbusCfg.IdWidth ;
//obi_cfg.achk_width == CVA6Cfg.ObiFetchbusCfg.OptionalCfg.AChkWidth ;
//obi_cfg.rchk_width == CVA6Cfg.ObiFetchbusCfg.OptionalCfg.RChkWidth ;
obi_cfg.auser_width == 1;
obi_cfg.wuser_width == 32;
obi_cfg.ruser_width == 32;
obi_cfg.addr_width == 34;
obi_cfg.data_width == 32;
obi_cfg.id_width == 4;
obi_cfg.achk_width == 1;
obi_cfg.rchk_width == 1;
if (is_active == UVM_ACTIVE) {
clknrst_cfg.is_active == UVM_ACTIVE;
@ -199,6 +222,7 @@ class uvme_cva6_cfg_c extends uvma_core_cntrl_cfg_c;
if (trn_log_enabled) {
clknrst_cfg.trn_log_enabled == 0;
axi_cfg.trn_log_enabled == 1;
obi_cfg.trn_log_enabled == 1;
rvfi_cfg.trn_log_enabled == 1;
isacov_cfg.trn_log_enabled == 1;
}
@ -207,6 +231,7 @@ class uvme_cva6_cfg_c extends uvma_core_cntrl_cfg_c;
cvxif_cfg.cov_model_enabled == 1;
isacov_cfg.cov_model_enabled == 1;
axi_cfg.cov_model_enabled == 1;
obi_cfg.cov_model_enabled == 1;
//env coverage models
cov_cvxif_model_enabled == 1;
cov_isa_model_enabled == 1;
@ -239,6 +264,7 @@ function uvme_cva6_cfg_c::new(string name="uvme_cva6_cfg");
clknrst_cfg = uvma_clknrst_cfg_c::type_id::create("clknrst_cfg");
cvxif_cfg = uvma_cvxif_cfg_c::type_id::create("cvxif_cfg");
axi_cfg = uvma_axi_cfg_c::type_id::create("axi_cfg");
obi_cfg = uvma_obi_memory_cfg_c::type_id::create("obi_cfg");
rvfi_cfg = uvma_rvfi_cfg_c#(ILEN,XLEN)::type_id::create("rvfi_cfg");
isacov_cfg = uvma_isacov_cfg_c::type_id::create("isacov_cfg");

View file

@ -31,6 +31,7 @@ class uvme_cva6_cntxt_c extends uvm_object;
uvma_clknrst_cntxt_c clknrst_cntxt;
uvma_cvxif_cntxt_c cvxif_cntxt;
uvma_axi_cntxt_c axi_cntxt;
uvma_obi_memory_cntxt_c obi_cntxt;
uvma_cva6_core_cntrl_cntxt_c core_cntrl_cntxt;
uvma_rvfi_cntxt_c rvfi_cntxt;
@ -45,6 +46,7 @@ class uvme_cva6_cntxt_c extends uvm_object;
`uvm_object_utils_begin(uvme_cva6_cntxt_c)
`uvm_field_object(clknrst_cntxt, UVM_DEFAULT)
`uvm_field_object(axi_cntxt, UVM_DEFAULT)
`uvm_field_object(obi_cntxt, UVM_DEFAULT)
`uvm_field_object(core_cntrl_cntxt, UVM_DEFAULT)
`uvm_field_object(rvfi_cntxt, UVM_DEFAULT)
`uvm_field_event(sample_cfg_e , UVM_DEFAULT)
@ -71,6 +73,7 @@ function uvme_cva6_cntxt_c::new(string name="uvme_cva6_cntxt");
clknrst_cntxt = uvma_clknrst_cntxt_c::type_id::create("clknrst_cntxt");
core_cntrl_cntxt = uvma_cva6_core_cntrl_cntxt_c::type_id::create("core_cntrl_cntxt");
axi_cntxt = uvma_axi_cntxt_c::type_id::create("axi_cntxt");
obi_cntxt = uvma_obi_memory_cntxt_c::type_id::create("obi_cntxt");
mem = uvml_mem_c#()::type_id::create("mem");
rvfi_cntxt = uvma_rvfi_cntxt_c#()::type_id::create("rvfi_cntxt");

View file

@ -44,6 +44,7 @@ class uvme_cva6_env_c extends uvm_env;
uvma_clknrst_agent_c clknrst_agent;
uvma_cvxif_agent_c cvxif_agent;
uvma_axi_agent_c axi_agent;
uvma_obi_memory_agent_c obi_agent;
uvma_cva6_core_cntrl_agent_c core_cntrl_agent;
uvma_rvfi_agent_c#(ILEN,XLEN) rvfi_agent;
uvma_isacov_agent_c#(ILEN,XLEN) isacov_agent;
@ -247,6 +248,8 @@ function void uvme_cva6_env_c::assign_cfg();
uvm_config_db#(uvma_axi_cfg_c)::set(this, "*axi_agent", "cfg", cfg.axi_cfg);
uvm_config_db#(uvma_obi_memory_cfg_c)::set(this, "*obi_agent", "cfg", cfg.obi_cfg);
uvm_config_db#(uvma_core_cntrl_cfg_c)::set(this, "core_cntrl_agent", "cfg", cfg);
uvm_config_db#(uvma_rvfi_cfg_c#(ILEN,XLEN))::set(this, "*rvfi_agent", "cfg", cfg.rvfi_cfg);
@ -264,6 +267,7 @@ function void uvme_cva6_env_c::assign_cntxt();
uvm_config_db#(uvme_cva6_cntxt_c)::set(this, "*", "cntxt", cntxt);
uvm_config_db#(uvma_clknrst_cntxt_c)::set(this, "clknrst_agent", "cntxt", cntxt.clknrst_cntxt);
uvm_config_db#(uvma_axi_cntxt_c)::set(this, "axi_agent", "cntxt", cntxt.axi_cntxt);
uvm_config_db#(uvma_obi_memory_cntxt_c)::set(this, "obi_agent", "cntxt", cntxt.obi_cntxt);
uvm_config_db#(uvma_rvfi_cntxt_c)::set(this, "rvfi_agent", "cntxt", cntxt.rvfi_cntxt);
endfunction: assign_cntxt
@ -274,6 +278,7 @@ function void uvme_cva6_env_c::create_agents();
clknrst_agent = uvma_clknrst_agent_c::type_id::create("clknrst_agent", this);
cvxif_agent = uvma_cvxif_agent_c::type_id::create("cvxif_agent", this);
axi_agent = uvma_axi_agent_c::type_id::create("axi_agent", this);
obi_agent = uvma_obi_memory_agent_c::type_id::create("obi_agent", this);
core_cntrl_agent = uvma_cva6_core_cntrl_agent_c::type_id::create("core_cntrl_agent", this);
rvfi_agent = uvma_rvfi_agent_c#(ILEN,XLEN)::type_id::create("rvfi_agent", this);
isacov_agent = uvma_isacov_agent_c#(ILEN,XLEN)::type_id::create("isacov_agent", this);

View file

@ -46,6 +46,7 @@ package uvme_cva6_pkg;
import uvma_clknrst_pkg::*;
import uvma_cvxif_pkg::*;
import uvma_axi_pkg::*;
import uvma_obi_memory_pkg::*;
import uvml_mem_pkg ::*;
import uvma_core_cntrl_pkg::*;
import uvma_rvfi_pkg::*;

View file

@ -174,6 +174,7 @@ export DV_UVML_TRN_PATH = $(CORE_V_VERIF)/lib/uvm_libs/uvml_trn
export DV_UVML_MEM_PATH = $(CORE_V_VERIF)/lib/uvm_libs/uvml_mem
export DV_UVML_LOGS_PATH = $(CORE_V_VERIF)/lib/uvm_libs/uvml_logs
export DV_UVML_SB_PATH = $(CORE_V_VERIF)/lib/uvm_libs/uvml_sb
export DV_UVMA_OBI_MEMORY_PATH= $(CORE_V_VERIF)/lib/uvm_agents/uvma_obi_memory
export CV_CORE_PKG = $(CORE_V_VERIF)/core-v-cores/$(CV_CORE_LC)
export DESIGN_RTL_DIR = $(CV_CORE_PKG)/rtl

View file

@ -59,6 +59,7 @@ module cva6_tb_wrapper import uvmt_cva6_pkg::*; #(
input cvxif_pkg::cvxif_resp_t cvxif_resp,
output cvxif_pkg::cvxif_req_t cvxif_req,
uvma_axi_intf axi_slave,
uvma_obi_memory_if obi_slave,
uvmt_axi_switch_intf axi_switch_vif,
uvmt_default_inputs_intf default_inputs_vif
);
@ -214,6 +215,36 @@ module cva6_tb_wrapper import uvmt_cva6_pkg::*; #(
assign axi_slave.ar_region = axi_ariane_req.ar.region;
assign axi_slave.ar_user = 0;
//Obi Interface
assign obi_slave.req = i_cva6.obi_fetch_req_if_cache.req;
assign obi_slave.gnt = i_cva6.obi_fetch_rsp_cache_if.gnt;
assign obi_slave.addr = i_cva6.obi_fetch_req_if_cache.a.addr;
assign obi_slave.we = i_cva6.obi_fetch_req_if_cache.a.we;
assign obi_slave.be = i_cva6.obi_fetch_req_if_cache.a.be;
assign obi_slave.wdata = i_cva6.obi_fetch_req_if_cache.a.wdata;
assign obi_slave.auser = i_cva6.obi_fetch_req_if_cache.a.a_optional.auser;
assign obi_slave.wuser = i_cva6.obi_fetch_req_if_cache.a.a_optional.wuser;
assign obi_slave.aid = i_cva6.obi_fetch_req_if_cache.a.aid;
assign obi_slave.atop = i_cva6.obi_fetch_req_if_cache.a.a_optional.atop;
assign obi_slave.memtype = i_cva6.obi_fetch_req_if_cache.a.a_optional.memtype;
assign obi_slave.prot = i_cva6.obi_fetch_req_if_cache.a.a_optional.prot;
assign obi_slave.reqpar = i_cva6.obi_fetch_req_if_cache.reqpar;
assign obi_slave.gntpar = i_cva6.obi_fetch_rsp_cache_if.gntpar;
assign obi_slave.achk = i_cva6.obi_fetch_req_if_cache.a.a_optional.achk;
assign obi_slave.rvalid = i_cva6.obi_fetch_rsp_cache_if.rvalid;
assign obi_slave.rready = i_cva6.obi_fetch_req_if_cache.rready;
assign obi_slave.rdata = i_cva6.obi_fetch_rsp_cache_if.r.rdata;
assign obi_slave.err = i_cva6.obi_fetch_rsp_cache_if.r.err;
assign obi_slave.ruser = i_cva6.obi_fetch_rsp_cache_if.r.r_optional.ruser;
assign obi_slave.rid = i_cva6.obi_fetch_rsp_cache_if.r.rid;
assign obi_slave.exokay = i_cva6.obi_fetch_rsp_cache_if.r.r_optional.exokay;
assign obi_slave.rvalidpar = i_cva6.obi_fetch_rsp_cache_if.rvalidpar;
assign obi_slave.rreadypar = i_cva6.obi_fetch_req_if_cache.rreadypar;
assign obi_slave.rchk = i_cva6.obi_fetch_rsp_cache_if.r.r_optional.rchk;
///assign obi_slave.mid = i_cva6.obi_fetch_rsp_cache_if.a.a_optional.mid;
///assign obi_slave.dbg = i_cva6.obi_fetch_rsp_cache_if.a.a_optional.dbg;
AXI_BUS #(
.AXI_ADDR_WIDTH ( CVA6Cfg.AxiAddrWidth ),

View file

@ -30,6 +30,7 @@
-f ${DV_UVMA_ISACOV_PATH}/uvma_isacov_pkg.flist
-f ${DV_UVMC_RVFI_REFERENCE_MODEL_PATH}/uvmc_rvfi_reference_model_pkg.flist
-f ${DV_UVMC_RVFI_SCOREBOARD_PATH}/uvmc_rvfi_scoreboard_pkg.flist
-f ${DV_UVMA_OBI_MEMORY_PATH}/src/uvma_obi_memory_pkg.flist
// Environments
-f ${CVA6_UVME_PATH}/uvme_cva6_pkg.flist

View file

@ -31,6 +31,7 @@ module uvmt_cva6_dut_wrap # (
uvma_clknrst_if clknrst_if,
uvma_cvxif_intf cvxif_if,
uvma_axi_intf axi_if,
uvma_obi_memory_if obi_if,
uvmt_axi_switch_intf axi_switch_vif,
uvmt_default_inputs_intf default_inputs_vif,
uvme_cva6_core_cntrl_if core_cntrl_if,
@ -61,6 +62,7 @@ module uvmt_cva6_dut_wrap # (
.cvxif_resp ( cvxif_if.cvxif_resp_o ),
.cvxif_req ( cvxif_if.cvxif_req_i ),
.axi_slave ( axi_if ),
.obi_slave ( obi_if ),
.axi_switch_vif ( axi_switch_vif ),
.default_inputs_vif ( default_inputs_vif ),
.tb_exit_o ( tb_exit_o ),

View file

@ -30,6 +30,7 @@
`include "uvmt_axi_switch_intf.sv"
`include "uvmt_default_inputs_intf.sv"
`include "uvma_axi_intf.sv"
`include "uvma_obi_memory_if.sv"
/**
* Encapsulates all the types and test cases for the verification of an

View file

@ -67,6 +67,34 @@ module uvmt_cva6_tb;
.clk(clknrst_if.clk),
.rst_n(clknrst_if.reset_n)
);
//OBI in monitor mode
uvma_obi_memory_if #(.AUSER_WIDTH(CVA6Cfg.ObiFetchbusCfg.OptionalCfg.AUserWidth),
.WUSER_WIDTH(CVA6Cfg.ObiFetchbusCfg.OptionalCfg.WUserWidth),
.RUSER_WIDTH(CVA6Cfg.ObiFetchbusCfg.OptionalCfg.RUserWidth),
.ADDR_WIDTH(CVA6Cfg.ObiFetchbusCfg.AddrWidth),
.DATA_WIDTH(CVA6Cfg.ObiFetchbusCfg.DataWidth),
.ID_WIDTH(CVA6Cfg.ObiFetchbusCfg.IdWidth),
.ACHK_WIDTH(CVA6Cfg.ObiFetchbusCfg.OptionalCfg.AChkWidth),
.RCHK_WIDTH(CVA6Cfg.ObiFetchbusCfg.OptionalCfg.RChkWidth)
) obi_if (
.clk(clknrst_if.clk),
.reset_n(clknrst_if.reset_n)
);
//bind assertion module for obi interface
bind uvmt_cva6_dut_wrap uvma_obi_memory_assert_if_wrp #(
.AUSER_WIDTH(CVA6Cfg.ObiFetchbusCfg.OptionalCfg.AUserWidth),
.WUSER_WIDTH(CVA6Cfg.ObiFetchbusCfg.OptionalCfg.WUserWidth),
.RUSER_WIDTH(CVA6Cfg.ObiFetchbusCfg.OptionalCfg.RUserWidth),
.ADDR_WIDTH(CVA6Cfg.ObiFetchbusCfg.AddrWidth),
.DATA_WIDTH(CVA6Cfg.ObiFetchbusCfg.DataWidth),
.ID_WIDTH(CVA6Cfg.ObiFetchbusCfg.IdWidth),
.ACHK_WIDTH(CVA6Cfg.ObiFetchbusCfg.OptionalCfg.AChkWidth),
.RCHK_WIDTH(CVA6Cfg.ObiFetchbusCfg.OptionalCfg.RChkWidth),
.IS_1P2(1)) obi_assert(.obi(obi_if));
uvmt_axi_switch_intf axi_switch_vif();
uvme_cva6_core_cntrl_if core_cntrl_if();
uvma_rvfi_instr_if #(
@ -119,6 +147,7 @@ module uvmt_cva6_tb;
.clknrst_if(clknrst_if),
.cvxif_if (cvxif_if),
.axi_if (axi_if),
.obi_if (obi_if),
.axi_switch_vif (axi_switch_vif),
.default_inputs_vif (default_inputs_vif),
.core_cntrl_if(core_cntrl_if),
@ -371,6 +400,7 @@ module uvmt_cva6_tb;
uvm_config_db#(virtual uvmt_rvfi_if#( .CVA6Cfg(CVA6Cfg), .rvfi_instr_t(rvfi_instr_t), .rvfi_csr_t (rvfi_csr_t)))::set(.cntxt(null), .inst_name("*"), .field_name("rvfi_vif"), .value(rvfi_if));
uvm_config_db#(virtual uvme_cva6_core_cntrl_if)::set(.cntxt(null), .inst_name("*"), .field_name("core_cntrl_vif"), .value(core_cntrl_if));
uvm_config_db#(virtual uvmt_tb_exit_if)::set(.cntxt(null), .inst_name("*"), .field_name("tb_exit_vif"), .value(tb_exit_if));
uvm_config_db#(virtual uvma_obi_memory_if)::set(.cntxt(null), .inst_name("*"), .field_name("vif"), .value(obi_if));
// DUT and ENV parameters
uvm_config_db#(int)::set(.cntxt(null), .inst_name("*"), .field_name("ENV_PARAM_INSTR_ADDR_WIDTH"), .value(ENV_PARAM_INSTR_ADDR_WIDTH) );