From 668829de6eb2878fbeb95bdf12847cb09df7d1a8 Mon Sep 17 00:00:00 2001 From: AEzzejjari <110914586+AEzzejjari@users.noreply.github.com> Date: Thu, 29 Aug 2024 17:00:32 +0100 Subject: [PATCH] Set the environment configuration only from env_cfg constraints. (#2408) --- verif/env/uvme/cov/uvme_cva6_config_covg.sv | 2 +- verif/env/uvme/uvme_cva6_cfg.sv | 45 +++------------------ verif/env/uvme/uvme_cva6_env.sv | 8 ---- verif/env/uvme/uvme_cva6_pkg.sv | 2 + verif/tb/core/uvma_cva6pkg_utils.sv | 4 +- verif/tb/uvmt/uvmt_cva6_tb.sv | 3 -- 6 files changed, 11 insertions(+), 53 deletions(-) diff --git a/verif/env/uvme/cov/uvme_cva6_config_covg.sv b/verif/env/uvme/cov/uvme_cva6_config_covg.sv index 364037f863..903b6c381d 100644 --- a/verif/env/uvme/cov/uvme_cva6_config_covg.sv +++ b/verif/env/uvme/cov/uvme_cva6_config_covg.sv @@ -214,7 +214,7 @@ endfunction : build_phase function void uvme_cva6_config_covg_c::sample_cva6_config(); - config_cg.sample(cfg.CVA6Cfg); + config_cg.sample(RTLCVA6Cfg); boot_addr_cg.sample(cfg); clock_period_cg.sample(cfg.sys_clk_period); diff --git a/verif/env/uvme/uvme_cva6_cfg.sv b/verif/env/uvme/uvme_cva6_cfg.sv index 95094c21e5..a602dfd578 100644 --- a/verif/env/uvme/uvme_cva6_cfg.sv +++ b/verif/env/uvme/uvme_cva6_cfg.sv @@ -59,9 +59,6 @@ class uvme_cva6_cfg_c extends uvma_core_cntrl_cfg_c; // MMU support rand bit MmuPresent; - // Handle to RTL configuration - rand cva6_cfg_t CVA6Cfg; - `uvm_object_utils_begin(uvme_cva6_cfg_c) `uvm_field_int ( enabled , UVM_DEFAULT ) `uvm_field_enum(uvm_active_passive_enum, is_active , UVM_DEFAULT ) @@ -99,40 +96,12 @@ class uvme_cva6_cfg_c extends uvma_core_cntrl_cfg_c; } constraint cva6_riscv_cons { - xlen == CVA6Cfg.XLEN; - ilen == 32; - ext_i_supported == 1; - ext_a_supported == CVA6Cfg.RVA; - ext_m_supported == 1; - ext_c_supported == CVA6Cfg.RVC; - ext_p_supported == 0; - ext_v_supported == CVA6Cfg.RVV; - ext_f_supported == CVA6Cfg.RVF; - ext_d_supported == CVA6Cfg.RVD; - ext_zba_supported == CVA6Cfg.RVB; - ext_zbb_supported == CVA6Cfg.RVB; - ext_zbc_supported == CVA6Cfg.RVB; - ext_zbe_supported == 0; - ext_zbf_supported == 0; - ext_zbm_supported == 0; - ext_zbp_supported == 0; - ext_zbr_supported == 0; - ext_zbs_supported == CVA6Cfg.RVB; - ext_zbt_supported == 0; - ext_zifencei_supported == 1; - ext_zicsr_supported == 1; - ext_zicond_supported == CVA6Cfg.RVZiCond; - ext_zcb_supported == CVA6Cfg.RVZCB; - ext_zihpm_supported == 0; - ext_zicntr_supported == 0; + xlen == RTLCVA6Cfg.XLEN; - mode_s_supported == CVA6Cfg.RVS; - mode_u_supported == CVA6Cfg.RVU; - mode_h_supported == CVA6Cfg.RVH; + ext_zihpm_supported == 0; + ext_zicond_supported == RTLCVA6Cfg.RVZiCond; - pmp_supported == (CVA6Cfg.NrPMPEntries > 0); nr_pmp_entries == 64; - debug_supported == CVA6Cfg.DebugEn; unaligned_access_supported == 0; unaligned_access_amo_supported == 0; @@ -146,11 +115,9 @@ class uvme_cva6_cfg_c extends uvma_core_cntrl_cfg_c; dm_halt_addr_valid == 1; dm_exception_addr_valid == 1; nmi_addr_valid == 1; - HPDCache_supported == 1; + HPDCache_supported == (RTLCVA6Cfg.DCacheType == 2); - DirectVecOnly == CVA6Cfg.DirectVecOnly; - TvalEn == CVA6Cfg.TvalEn; - MmuPresent == CVA6Cfg.MmuPresent; + MmuPresent == RTLCVA6Cfg.MmuPresent; } constraint ext_const { @@ -200,7 +167,7 @@ class uvme_cva6_cfg_c extends uvma_core_cntrl_cfg_c; isacov_cfg.seq_instr_x2_enabled == 1; isacov_cfg.reg_crosses_enabled == 0; isacov_cfg.reg_hazards_enabled == 1; - rvfi_cfg.nret == CVA6Cfg.NrCommitPorts; + rvfi_cfg.nret == RTLCVA6Cfg.NrCommitPorts; unified_traps == 0; axi_cfg.rand_channel_delay_enabled == 0; diff --git a/verif/env/uvme/uvme_cva6_env.sv b/verif/env/uvme/uvme_cva6_env.sv index 1a1c72a741..3daf02cbc5 100644 --- a/verif/env/uvme/uvme_cva6_env.sv +++ b/verif/env/uvme/uvme_cva6_env.sv @@ -166,14 +166,6 @@ 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", cfg.CVA6Cfg)); - if (!cfg.CVA6Cfg) begin - `uvm_fatal("CVA6Cfg", "RTL Configuration handle is null") - end - else begin - `uvm_info("CVA6Cfg", $sformatf("Found RTL configuration handle:\n%p", cfg.CVA6Cfg), UVM_DEBUG) - end - cfg.rvfi_cfg.nret = cfg.CVA6Cfg.NrCommitPorts; if (cfg.enabled) begin diff --git a/verif/env/uvme/uvme_cva6_pkg.sv b/verif/env/uvme/uvme_cva6_pkg.sv index 220521afc1..0563e2ec1b 100644 --- a/verif/env/uvme/uvme_cva6_pkg.sv +++ b/verif/env/uvme/uvme_cva6_pkg.sv @@ -75,6 +75,8 @@ package uvme_cva6_pkg; bit [6:0] legal_i_funct7[$] = '{7'b0000000, 7'b0100000}; + parameter config_pkg::cva6_cfg_t RTLCVA6Cfg = build_config_pkg::build_config(cva6_config_pkg::cva6_cfg); + // Constants / Structs / Enums `include "uvme_cva6_constants.sv" `include "uvme_cva6_tdefs.sv" diff --git a/verif/tb/core/uvma_cva6pkg_utils.sv b/verif/tb/core/uvma_cva6pkg_utils.sv index c64c30fd82..0c5c86b460 100644 --- a/verif/tb/core/uvma_cva6pkg_utils.sv +++ b/verif/tb/core/uvma_cva6pkg_utils.sv @@ -19,14 +19,14 @@ function st_core_cntrl_cfg cva6pkg_to_core_cntrl_cfg(st_core_cntrl_cfg cfg); cfg.ext_a_supported = CVA6Cfg.RVA; cfg.ext_m_supported = 1; cfg.ext_c_supported = CVA6Cfg.RVC; - cfg.ext_p_supported = 1; + cfg.ext_p_supported = 0; cfg.ext_v_supported = CVA6Cfg.RVV; cfg.ext_f_supported = CVA6Cfg.RVF; cfg.ext_d_supported = CVA6Cfg.RVD; cfg.ext_zba_supported = CVA6Cfg.RVB; cfg.ext_zbb_supported = CVA6Cfg.RVB; cfg.ext_zbc_supported = CVA6Cfg.RVB; - cfg.ext_zbe_supported = CVA6Cfg.RVB; + cfg.ext_zbe_supported = 0; cfg.ext_zbf_supported = 0; cfg.ext_zbm_supported = 0; cfg.ext_zbp_supported = 0; diff --git a/verif/tb/uvmt/uvmt_cva6_tb.sv b/verif/tb/uvmt/uvmt_cva6_tb.sv index 9768c0a213..39da6022d7 100644 --- a/verif/tb/uvmt/uvmt_cva6_tb.sv +++ b/verif/tb/uvmt/uvmt_cva6_tb.sv @@ -378,9 +378,6 @@ 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;