mirror of
https://github.com/openhwgroup/cva6.git
synced 2025-04-23 13:47:13 -04:00
parent
fa2cea2d65
commit
bfff84eaeb
4 changed files with 59 additions and 80 deletions
121
verif/env/uvme/cov/uvme_cva6_config_covg.sv
vendored
121
verif/env/uvme/cov/uvme_cva6_config_covg.sv
vendored
|
@ -16,147 +16,102 @@
|
|||
//
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH SHL-2.0
|
||||
|
||||
covergroup cg_cva6_config(string name) with function sample();
|
||||
covergroup cg_cva6_config(string name) with function sample(cva6_cfg_t CVA6Cfg);
|
||||
|
||||
option.per_instance = 1;
|
||||
option.name = name;
|
||||
|
||||
cp_Xlen : coverpoint cva6_config_pkg::CVA6ConfigXlen {
|
||||
cp_Xlen : coverpoint CVA6Cfg.XLEN {
|
||||
bins Xlen ={32};
|
||||
}
|
||||
cp_FpuEn : coverpoint cva6_config_pkg::CVA6ConfigFpuEn {
|
||||
cp_FpuEn : coverpoint CVA6Cfg.FpuEn {
|
||||
bins FpuEn ={0};
|
||||
}
|
||||
cp_F16En : coverpoint cva6_config_pkg::CVA6ConfigF16En {
|
||||
cp_F16En : coverpoint CVA6Cfg.XF16 {
|
||||
bins F16En ={0};
|
||||
}
|
||||
cp_F16AltEn : coverpoint cva6_config_pkg::CVA6ConfigF16AltEn {
|
||||
cp_F16AltEn : coverpoint CVA6Cfg.XF16ALT {
|
||||
bins F16AltEn ={0};
|
||||
}
|
||||
cp_F8En : coverpoint cva6_config_pkg::CVA6ConfigF8En {
|
||||
cp_F8En : coverpoint CVA6Cfg.XF8 {
|
||||
bins F8En ={0};
|
||||
}
|
||||
cp_FVecEn : coverpoint cva6_config_pkg::CVA6ConfigFVecEn {
|
||||
cp_FVecEn : coverpoint CVA6Cfg.XFVec {
|
||||
bins FVecEn ={0};
|
||||
}
|
||||
cp_CvxifEn : coverpoint cva6_config_pkg::CVA6ConfigCvxifEn {
|
||||
cp_CvxifEn : coverpoint CVA6Cfg.CvxifEn {
|
||||
bins CvxifEn ={1};
|
||||
}
|
||||
cp_CExtEn : coverpoint cva6_config_pkg::CVA6ConfigCExtEn {
|
||||
cp_CExtEn : coverpoint CVA6Cfg.RVC {
|
||||
bins CExtEn ={1};
|
||||
}
|
||||
cp_AExtEn : coverpoint cva6_config_pkg::CVA6ConfigAExtEn {
|
||||
cp_AExtEn : coverpoint CVA6Cfg.RVA {
|
||||
bins AExtEn ={0};
|
||||
}
|
||||
cp_BExtEn : coverpoint cva6_config_pkg::CVA6ConfigBExtEn {
|
||||
cp_BExtEn : coverpoint CVA6Cfg.RVB {
|
||||
bins BExtEn ={1};
|
||||
}
|
||||
cp_VExtEn : coverpoint cva6_config_pkg::CVA6ConfigVExtEn {
|
||||
cp_VExtEn : coverpoint CVA6Cfg.RVV {
|
||||
bins VExtEn ={0};
|
||||
}
|
||||
cp_RVZiCond : coverpoint cva6_config_pkg::CVA6ConfigRVZiCond {
|
||||
cp_RVZiCond : coverpoint CVA6Cfg.RVZiCond {
|
||||
bins RVZiCond ={0};
|
||||
}
|
||||
cp_AxiIdWidth : coverpoint cva6_config_pkg::CVA6ConfigAxiIdWidth {
|
||||
cp_AxiIdWidth : coverpoint CVA6Cfg.AxiIdWidth {
|
||||
bins AxiIdWidth ={4};
|
||||
}
|
||||
cp_AxiAddrWidth : coverpoint cva6_config_pkg::CVA6ConfigAxiAddrWidth {
|
||||
cp_AxiAddrWidth : coverpoint CVA6Cfg.AxiAddrWidth {
|
||||
bins AxiAddrWidth ={64};
|
||||
}
|
||||
cp_AxiDataWidth : coverpoint cva6_config_pkg::CVA6ConfigAxiDataWidth {
|
||||
cp_AxiDataWidth : coverpoint CVA6Cfg.AxiDataWidth {
|
||||
bins AxiDataWidth ={64};
|
||||
}
|
||||
cp_FetchUserEn : coverpoint cva6_config_pkg::CVA6ConfigFetchUserEn {
|
||||
cp_FetchUserEn : coverpoint CVA6Cfg.FETCH_USER_EN {
|
||||
bins FetchUserEn ={0};
|
||||
}
|
||||
cp_FetchUserWidth : coverpoint cva6_config_pkg::CVA6ConfigFetchUserWidth {
|
||||
cp_FetchUserWidth : coverpoint CVA6Cfg.FETCH_USER_WIDTH {
|
||||
bins FetchUserWidth ={32};
|
||||
}
|
||||
cp_DataUserEn : coverpoint cva6_config_pkg::CVA6ConfigDataUserEn {
|
||||
cp_DataUserEn : coverpoint CVA6Cfg.DATA_USER_EN {
|
||||
bins DataUserEn ={0};
|
||||
}
|
||||
cp_DataUserWidth : coverpoint cva6_config_pkg::CVA6ConfigDataUserWidth {
|
||||
bins DataUserWidth ={32};
|
||||
}
|
||||
cp_IcacheByteSize : coverpoint cva6_config_pkg::CVA6ConfigIcacheByteSize {
|
||||
bins IcacheByteSize ={16384};
|
||||
}
|
||||
cp_IcacheSetAssoc : coverpoint cva6_config_pkg::CVA6ConfigIcacheSetAssoc {
|
||||
cp_IcacheSetAssoc : coverpoint CVA6Cfg.ICACHE_SET_ASSOC {
|
||||
bins IcacheSetAssoc ={4};
|
||||
}
|
||||
cp_IcacheLineWidth : coverpoint cva6_config_pkg::CVA6ConfigIcacheLineWidth {
|
||||
cp_IcacheLineWidth : coverpoint CVA6Cfg.ICACHE_LINE_WIDTH {
|
||||
bins IcacheLineWidth ={128};
|
||||
}
|
||||
cp_DcacheByteSize : coverpoint cva6_config_pkg::CVA6ConfigDcacheByteSize {
|
||||
bins DcacheByteSize ={32768};
|
||||
}
|
||||
cp_DcacheSetAssoc : coverpoint cva6_config_pkg::CVA6ConfigDcacheSetAssoc {
|
||||
cp_DcacheSetAssoc : coverpoint CVA6Cfg.DCACHE_SET_ASSOC {
|
||||
bins DcacheSetAssoc ={8};
|
||||
}
|
||||
cp_DcacheLineWidth : coverpoint cva6_config_pkg::CVA6ConfigDcacheLineWidth {
|
||||
cp_DcacheLineWidth : coverpoint CVA6Cfg.DCACHE_LINE_WIDTH {
|
||||
bins DcacheLineWidth ={128};
|
||||
}
|
||||
cp_DcacheIdWidth : coverpoint cva6_config_pkg::CVA6ConfigDcacheIdWidth {
|
||||
bins DcacheIdWidth ={1};
|
||||
}
|
||||
cp_MemTidWidth : coverpoint cva6_config_pkg::CVA6ConfigMemTidWidth {
|
||||
bins MemTidWidth ={2};
|
||||
}
|
||||
cp_WtDcacheWbufDepth : coverpoint cva6_config_pkg::CVA6ConfigWtDcacheWbufDepth {
|
||||
bins WtDcacheWbufDepth ={2};
|
||||
}
|
||||
cp_NrCommitPorts : coverpoint cva6_config_pkg::CVA6ConfigNrCommitPorts {
|
||||
cp_NrCommitPorts : coverpoint CVA6Cfg.NrCommitPorts {
|
||||
bins NrCommitPorts ={1};
|
||||
}
|
||||
cp_NrScoreboardEntries : coverpoint cva6_config_pkg::CVA6ConfigNrScoreboardEntries {
|
||||
bins NrScoreboardEntries ={4};
|
||||
}
|
||||
cp_FpgaEn : coverpoint cva6_config_pkg::CVA6ConfigFpgaEn {
|
||||
cp_FpgaEn : coverpoint CVA6Cfg.FpgaEn {
|
||||
bins FpgaEn ={0};
|
||||
}
|
||||
cp_NrLoadPipeRegs : coverpoint cva6_config_pkg::CVA6ConfigNrLoadPipeRegs {
|
||||
bins NrLoadPipeRegs ={0};
|
||||
}
|
||||
cp_NrStorePipeRegs : coverpoint cva6_config_pkg::CVA6ConfigNrStorePipeRegs {
|
||||
bins NrStorePipeRegs ={0};
|
||||
}
|
||||
cp_NrLoadBufEntries : coverpoint cva6_config_pkg::CVA6ConfigNrLoadBufEntries {
|
||||
cp_NrLoadBufEntries : coverpoint CVA6Cfg.NrLoadBufEntries {
|
||||
bins NrLoadBufEntries ={1};
|
||||
}
|
||||
cp_InstrTlbEntries : coverpoint cva6_config_pkg::CVA6ConfigInstrTlbEntries {
|
||||
bins InstrTlbEntries ={2};
|
||||
}
|
||||
cp_DataTlbEntries : coverpoint cva6_config_pkg::CVA6ConfigDataTlbEntries {
|
||||
bins DataTlbEntries ={2};
|
||||
}
|
||||
cp_RASDepth : coverpoint cva6_config_pkg::CVA6ConfigRASDepth {
|
||||
cp_RASDepth : coverpoint CVA6Cfg.RASDepth {
|
||||
bins RASDepth ={2};
|
||||
}
|
||||
cp_BTBEntries : coverpoint cva6_config_pkg::CVA6ConfigBTBEntries {
|
||||
cp_BTBEntries : coverpoint CVA6Cfg.BTBEntries {
|
||||
bins BTBEntries ={0};
|
||||
}
|
||||
cp_BHTEntries : coverpoint cva6_config_pkg::CVA6ConfigBHTEntries {
|
||||
cp_BHTEntries : coverpoint CVA6Cfg.BHTEntries {
|
||||
bins BHTEntries ={32};
|
||||
}
|
||||
cp_NrPMPEntries : coverpoint cva6_config_pkg::CVA6ConfigNrPMPEntries {
|
||||
cp_NrPMPEntries : coverpoint CVA6Cfg.NrPMPEntries {
|
||||
bins NrPMPEntries ={8};
|
||||
}
|
||||
cp_PerfCounterEn : coverpoint cva6_config_pkg::CVA6ConfigPerfCounterEn {
|
||||
bins PerfCounterEn ={0};
|
||||
}
|
||||
cp_DcacheType : coverpoint cva6_config_pkg::CVA6ConfigDcacheType {
|
||||
bins DcacheType ={config_pkg::WT};
|
||||
}
|
||||
cp_MmuPresent : coverpoint cva6_config_pkg::CVA6ConfigMmuPresent {
|
||||
bins MmuPresent ={0};
|
||||
}
|
||||
cp_RvfiTrace : coverpoint cva6_config_pkg::CVA6ConfigRvfiTrace {
|
||||
bins RvfiTrace ={1};
|
||||
}
|
||||
cp_HaltAddress : coverpoint cva6_config_pkg::cva6_cfg.HaltAddress {
|
||||
cp_HaltAddress : coverpoint CVA6Cfg.HaltAddress {
|
||||
bins HaltAddress ={64'h800};
|
||||
}
|
||||
cp_ExceptionAddress : coverpoint cva6_config_pkg::cva6_cfg.ExceptionAddress {
|
||||
cp_ExceptionAddress : coverpoint CVA6Cfg.ExceptionAddress {
|
||||
bins ExceptionAddress ={64'h808};
|
||||
}
|
||||
endgroup: cg_cva6_config
|
||||
|
@ -207,7 +162,10 @@ class uvme_cva6_config_covg_c extends uvm_component;
|
|||
// Objects
|
||||
uvme_cva6_cfg_c cfg ;
|
||||
uvme_cva6_cntxt_c cntxt ;
|
||||
|
||||
|
||||
// Handle to RTL configuration
|
||||
cva6_cfg_t CVA6Cfg;
|
||||
|
||||
`uvm_analysis_imp_decl(_reset)
|
||||
uvm_analysis_imp_reset #(uvma_clknrst_mon_trn_c, uvme_cva6_config_covg_c) reset_imp;
|
||||
|
||||
|
@ -240,6 +198,11 @@ function void uvme_cva6_config_covg_c::build_phase(uvm_phase phase);
|
|||
|
||||
super.build_phase(phase);
|
||||
|
||||
void'(uvm_config_db#(cva6_cfg_t)::get(this, "", "CVA6Cfg", CVA6Cfg));
|
||||
if (!CVA6Cfg) begin
|
||||
`uvm_fatal("CVA6Cfg", "RTL Configuration handle is null")
|
||||
end
|
||||
|
||||
void'(uvm_config_db#(uvme_cva6_cfg_c)::get(this, "", "cfg", cfg));
|
||||
if (!cfg) begin
|
||||
`uvm_fatal("CFG", "Configuration handle is null")
|
||||
|
@ -259,7 +222,7 @@ endfunction : build_phase
|
|||
|
||||
function void uvme_cva6_config_covg_c::sample_cva6_config();
|
||||
|
||||
config_cg.sample();
|
||||
config_cg.sample(CVA6Cfg);
|
||||
boot_addr_cg.sample(cfg.boot_addr);
|
||||
clock_period_cg.sample(cfg.sys_clk_period);
|
||||
|
||||
|
|
13
verif/env/uvme/uvme_cva6_env.sv
vendored
13
verif/env/uvme/uvme_cva6_env.sv
vendored
|
@ -32,6 +32,9 @@ class uvme_cva6_env_c extends uvm_env;
|
|||
uvme_cva6_cfg_c cfg;
|
||||
uvme_cva6_cntxt_c cntxt;
|
||||
|
||||
// Handle to RTL configuration
|
||||
cva6_cfg_t CVA6Cfg;
|
||||
|
||||
// Components
|
||||
uvme_cva6_prd_c predictor;
|
||||
uvme_cva6_sb_c sb;
|
||||
|
@ -163,6 +166,14 @@ function void uvme_cva6_env_c::build_phase(uvm_phase phase);
|
|||
`uvm_info("CFG", $sformatf("Found configuration handle:\n%s", cfg.sprint()), UVM_DEBUG)
|
||||
end
|
||||
|
||||
void'(uvm_config_db#(cva6_cfg_t)::get(this, "", "CVA6Cfg", CVA6Cfg));
|
||||
if (!CVA6Cfg) begin
|
||||
`uvm_fatal("CVA6Cfg", "RTL Configuration handle is null")
|
||||
end
|
||||
else begin
|
||||
`uvm_info("CVA6Cfg", $sformatf("Found RTL configuration handle:\n%p", CVA6Cfg), UVM_DEBUG)
|
||||
end
|
||||
|
||||
if (cfg.enabled) begin
|
||||
void'(uvm_config_db#(uvme_cva6_cntxt_c)::get(this, "", "cntxt", cntxt));
|
||||
if (!cntxt) begin
|
||||
|
@ -235,6 +246,8 @@ function void uvme_cva6_env_c::assign_cfg();
|
|||
|
||||
uvm_config_db#(uvme_cva6_cfg_c)::set(this, "*", "cfg", cfg);
|
||||
|
||||
uvm_config_db#(cva6_cfg_t)::set(this, "*", "CVA6Cfg", CVA6Cfg);
|
||||
|
||||
uvm_config_db#(uvma_clknrst_cfg_c)::set(this, "*clknrst_agent", "cfg", cfg.clknrst_cfg);
|
||||
|
||||
uvm_config_db#(uvma_cvxif_cfg_c)::set(this, "*cvxif_agent", "cfg", cfg.cvxif_cfg);
|
||||
|
|
2
verif/env/uvme/uvme_cva6_pkg.sv
vendored
2
verif/env/uvme/uvme_cva6_pkg.sv
vendored
|
@ -39,7 +39,6 @@
|
|||
*/
|
||||
package uvme_cva6_pkg;
|
||||
|
||||
import cva6_config_pkg ::*;
|
||||
import uvm_pkg ::*;
|
||||
import uvml_hrtbt_pkg ::*;
|
||||
import uvml_sb_pkg ::*;
|
||||
|
@ -53,6 +52,7 @@ package uvme_cva6_pkg;
|
|||
import uvmc_rvfi_scoreboard_pkg::*;
|
||||
import uvmc_rvfi_reference_model_pkg::*;
|
||||
import uvma_isacov_pkg::*;
|
||||
import config_pkg::*;
|
||||
import "DPI-C" function void read_elf(input string filename);
|
||||
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[]);
|
||||
|
|
|
@ -379,6 +379,9 @@ module uvmt_cva6_tb;
|
|||
uvm_config_db#(int)::set(.cntxt(null), .inst_name("*"), .field_name("ENV_PARAM_INSTR_DATA_WIDTH"), .value(ENV_PARAM_INSTR_DATA_WIDTH) );
|
||||
uvm_config_db#(int)::set(.cntxt(null), .inst_name("*"), .field_name("ENV_PARAM_RAM_ADDR_WIDTH"), .value(ENV_PARAM_RAM_ADDR_WIDTH) );
|
||||
|
||||
// Set RTL parameters
|
||||
uvm_config_db#(config_pkg::cva6_cfg_t)::set(.cntxt(null), .inst_name("*.env"), .field_name("CVA6Cfg"), .value(CVA6Cfg) );
|
||||
|
||||
// Run test
|
||||
uvm_top.enable_print_topology = 0; // ENV coders enable this as a debug aid
|
||||
uvm_top.finish_on_completion = 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue