From 975a6eb9274153c08bd296dcd57f0547273c74b8 Mon Sep 17 00:00:00 2001 From: Rupert Swarbrick Date: Fri, 24 Nov 2023 11:53:56 +0000 Subject: [PATCH] [adc_ctrl,dv] Tidy up access to intr_state in env_cfg files This code was duplicated in lots of places: I think probably from a template file in the first place. In each case, if the code compiles, then ${MY_BLOCK}_reg_block must have a field called intr_state. In that situation get_reg_by_name() will always return something that is not null, so the test in the if statement will always be true. Use the shorter, more direct, form each time. Signed-off-by: Rupert Swarbrick --- hw/ip/adc_ctrl/dv/env/adc_ctrl_env_cfg.sv | 7 +------ hw/ip/aon_timer/dv/env/aon_timer_env_cfg.sv | 7 +------ hw/ip/csrng/dv/env/csrng_env_cfg.sv | 7 +------ hw/ip/edn/dv/env/edn_env_cfg.sv | 7 +------ hw/ip/entropy_src/dv/env/entropy_src_env_cfg.sv | 7 +------ hw/ip/flash_ctrl/dv/env/flash_ctrl_env_cfg.sv | 8 ++------ hw/ip/keymgr/dv/env/keymgr_env_cfg.sv | 7 +------ hw/ip/kmac/dv/env/kmac_env_cfg.sv | 7 +------ hw/ip/otp_ctrl/dv/env/otp_ctrl_env_cfg.sv | 7 +------ hw/ip/pattgen/dv/env/pattgen_env_cfg.sv | 11 +++-------- hw/ip/spi_host/dv/env/spi_host_env_cfg.sv | 7 +------ hw/ip/sysrst_ctrl/dv/env/sysrst_ctrl_env_cfg.sv | 7 +------ hw/ip/usbdev/dv/env/usbdev_env_cfg.sv | 7 +------ .../alert_handler/dv/env/alert_handler_env_cfg.sv | 7 +------ .../alert_handler/dv/env/alert_handler_env_cfg.sv | 7 +------ 15 files changed, 18 insertions(+), 92 deletions(-) diff --git a/hw/ip/adc_ctrl/dv/env/adc_ctrl_env_cfg.sv b/hw/ip/adc_ctrl/dv/env/adc_ctrl_env_cfg.sv index 42b46431de799..9f6919056b086 100644 --- a/hw/ip/adc_ctrl/dv/env/adc_ctrl_env_cfg.sv +++ b/hw/ip/adc_ctrl/dv/env/adc_ctrl_env_cfg.sv @@ -77,12 +77,7 @@ class adc_ctrl_env_cfg extends cip_base_env_cfg #( end // set num_interrupts & num_alerts - begin - uvm_reg rg = ral.get_reg_by_name("intr_state"); - if (rg != null) begin - num_interrupts = ral.intr_state.get_n_used_bits(); - end - end + num_interrupts = ral.intr_state.get_n_used_bits(); // only support 1 outstanding TL item m_tl_agent_cfg.max_outstanding_req = 1; diff --git a/hw/ip/aon_timer/dv/env/aon_timer_env_cfg.sv b/hw/ip/aon_timer/dv/env/aon_timer_env_cfg.sv index a7e486c563f1c..336cef77a7bf3 100644 --- a/hw/ip/aon_timer/dv/env/aon_timer_env_cfg.sv +++ b/hw/ip/aon_timer/dv/env/aon_timer_env_cfg.sv @@ -28,12 +28,7 @@ class aon_timer_env_cfg extends cip_base_env_cfg #(.RAL_T(aon_timer_reg_block)); m_tl_agent_cfg.max_outstanding_req = 1; // set num_interrupts & num_alerts - begin - uvm_reg rg = ral.get_reg_by_name("intr_state"); - if (rg != null) begin - num_interrupts = ral.intr_state.get_n_used_bits(); - end - end + num_interrupts = ral.intr_state.get_n_used_bits(); endfunction endclass diff --git a/hw/ip/csrng/dv/env/csrng_env_cfg.sv b/hw/ip/csrng/dv/env/csrng_env_cfg.sv index 06da191ab37b0..18b0ec5981805 100644 --- a/hw/ip/csrng/dv/env/csrng_env_cfg.sv +++ b/hw/ip/csrng/dv/env/csrng_env_cfg.sv @@ -220,12 +220,7 @@ class csrng_env_cfg extends cip_base_env_cfg #(.RAL_T(csrng_reg_block)); end // set num_interrupts & num_alerts - begin - uvm_reg rg = ral.get_reg_by_name("intr_state"); - if (rg != null) begin - num_interrupts = ral.intr_state.get_n_used_bits(); - end - end + num_interrupts = ral.intr_state.get_n_used_bits(); // get csrng assert interface handle if (!uvm_config_db#(virtual csrng_assert_if):: diff --git a/hw/ip/edn/dv/env/edn_env_cfg.sv b/hw/ip/edn/dv/env/edn_env_cfg.sv index e0257ab5d3207..3222d79ec5d77 100644 --- a/hw/ip/edn/dv/env/edn_env_cfg.sv +++ b/hw/ip/edn/dv/env/edn_env_cfg.sv @@ -115,12 +115,7 @@ class edn_env_cfg extends cip_base_env_cfg #(.RAL_T(edn_reg_block)); end // set num_interrupts & num_alerts - begin - uvm_reg rg = ral.get_reg_by_name("intr_state"); - if (rg != null) begin - num_interrupts = ral.intr_state.get_n_used_bits(); - end - end + num_interrupts = ral.intr_state.get_n_used_bits(); // get edn assert interface handle if (!uvm_config_db#(virtual edn_assert_if):: diff --git a/hw/ip/entropy_src/dv/env/entropy_src_env_cfg.sv b/hw/ip/entropy_src/dv/env/entropy_src_env_cfg.sv index ac692b7399b84..68a072b398877 100644 --- a/hw/ip/entropy_src/dv/env/entropy_src_env_cfg.sv +++ b/hw/ip/entropy_src/dv/env/entropy_src_env_cfg.sv @@ -229,12 +229,7 @@ class entropy_src_env_cfg extends cip_base_env_cfg #(.RAL_T(entropy_src_reg_bloc m_xht_agent_cfg = entropy_src_xht_agent_cfg::type_id::create("m_xht_agent_cfg"); // set num_interrupts & num_alerts - begin - uvm_reg rg = ral.get_reg_by_name("intr_state"); - if (rg != null) begin - num_interrupts = ral.intr_state.get_n_used_bits(); - end - end + num_interrupts = ral.intr_state.get_n_used_bits(); // get entropy_src assert interface handle if (!uvm_config_db#(virtual entropy_src_assert_if):: diff --git a/hw/ip/flash_ctrl/dv/env/flash_ctrl_env_cfg.sv b/hw/ip/flash_ctrl/dv/env/flash_ctrl_env_cfg.sv index 92e2a0e2ec150..e13c4d5f0d6a1 100644 --- a/hw/ip/flash_ctrl/dv/env/flash_ctrl_env_cfg.sv +++ b/hw/ip/flash_ctrl/dv/env/flash_ctrl_env_cfg.sv @@ -307,12 +307,8 @@ class flash_ctrl_env_cfg extends cip_base_env_cfg #( m_fpp_agent_cfg.en_cov = 0; // set num_interrupts & num_alerts - begin - uvm_reg rg = ral.get_reg_by_name("intr_state"); - if (rg != null) begin - num_interrupts = ral.intr_state.get_n_used_bits(); - end - end + num_interrupts = ral.intr_state.get_n_used_bits(); + m_tl_agent_cfg.max_outstanding_req = 1; m_tl_agent_cfgs[flash_ral_name].max_outstanding_req = 2; m_tl_agent_cfgs[prim_ral_name].max_outstanding_req = 1; diff --git a/hw/ip/keymgr/dv/env/keymgr_env_cfg.sv b/hw/ip/keymgr/dv/env/keymgr_env_cfg.sv index 665c71cb24718..cdd285614fbba 100644 --- a/hw/ip/keymgr/dv/env/keymgr_env_cfg.sv +++ b/hw/ip/keymgr/dv/env/keymgr_env_cfg.sv @@ -33,12 +33,7 @@ class keymgr_env_cfg extends cip_base_env_cfg #(.RAL_T(keymgr_reg_block)); m_edn_pull_agent_cfgs[0].ok_to_end_delay_ns = 0; // set num_interrupts & num_alerts - begin - uvm_reg rg = ral.get_reg_by_name("intr_state"); - if (rg != null) begin - num_interrupts = ral.intr_state.get_n_used_bits(); - end - end + num_interrupts = ral.intr_state.get_n_used_bits(); // only support 1 outstanding TL item m_tl_agent_cfg.max_outstanding_req = 1; diff --git a/hw/ip/kmac/dv/env/kmac_env_cfg.sv b/hw/ip/kmac/dv/env/kmac_env_cfg.sv index 3030bfa4a958e..f0a7cd4a6c53c 100644 --- a/hw/ip/kmac/dv/env/kmac_env_cfg.sv +++ b/hw/ip/kmac/dv/env/kmac_env_cfg.sv @@ -59,12 +59,7 @@ class kmac_env_cfg extends cip_base_env_cfg #(.RAL_T(kmac_reg_block)); void'($value$plusargs("test_vectors_shake_variant=%0d", shake_variant)); // set num_interrupts & num_alerts - begin - uvm_reg rg = ral.get_reg_by_name("intr_state"); - if (rg != null) begin - num_interrupts = ral.intr_state.get_n_used_bits(); - end - end + num_interrupts = ral.intr_state.get_n_used_bits(); // only support 1 outstanding TL items in tlul_adapter m_tl_agent_cfg.max_outstanding_req = 1; diff --git a/hw/ip/otp_ctrl/dv/env/otp_ctrl_env_cfg.sv b/hw/ip/otp_ctrl/dv/env/otp_ctrl_env_cfg.sv index 21403ca049d08..dc825293f374c 100644 --- a/hw/ip/otp_ctrl/dv/env/otp_ctrl_env_cfg.sv +++ b/hw/ip/otp_ctrl/dv/env/otp_ctrl_env_cfg.sv @@ -91,12 +91,7 @@ class otp_ctrl_env_cfg extends cip_base_env_cfg #(.RAL_T(otp_ctrl_core_reg_block m_lc_prog_pull_agent_cfg.agent_type = PullAgent; // set num_interrupts & num_alerts - begin - uvm_reg rg = ral.get_reg_by_name("intr_state"); - if (rg != null) begin - num_interrupts = ral.intr_state.get_n_used_bits(); - end - end + num_interrupts = ral.intr_state.get_n_used_bits(); // only support 1 outstanding TL items in tlul_adapter m_tl_agent_cfg.max_outstanding_req = 1; diff --git a/hw/ip/pattgen/dv/env/pattgen_env_cfg.sv b/hw/ip/pattgen/dv/env/pattgen_env_cfg.sv index f38dffe12b9db..6c664095547b2 100644 --- a/hw/ip/pattgen/dv/env/pattgen_env_cfg.sv +++ b/hw/ip/pattgen/dv/env/pattgen_env_cfg.sv @@ -8,14 +8,14 @@ class pattgen_env_cfg extends cip_base_env_cfg #(.RAL_T(pattgen_reg_block)); // pattgen_agent_cfg rand pattgen_agent_cfg m_pattgen_agent_cfg; - + // seq cfg pattgen_seq_cfg seq_cfg; `uvm_object_utils_begin(pattgen_env_cfg) `uvm_field_object(m_pattgen_agent_cfg, UVM_DEFAULT) `uvm_object_utils_end - + `uvm_object_new virtual function void initialize(bit [TL_AW-1:0] csr_base_addr = '1); @@ -30,11 +30,6 @@ class pattgen_env_cfg extends cip_base_env_cfg #(.RAL_T(pattgen_reg_block)); seq_cfg = pattgen_seq_cfg::type_id::create("seq_cfg"); // set num_interrupts & num_alerts - begin - uvm_reg rg = ral.get_reg_by_name("intr_state"); - if (rg != null) begin - num_interrupts = ral.intr_state.get_n_used_bits(); - end - end + num_interrupts = ral.intr_state.get_n_used_bits(); endfunction endclass : pattgen_env_cfg diff --git a/hw/ip/spi_host/dv/env/spi_host_env_cfg.sv b/hw/ip/spi_host/dv/env/spi_host_env_cfg.sv index 6aab01f70e31a..3f3ca8a1048dd 100644 --- a/hw/ip/spi_host/dv/env/spi_host_env_cfg.sv +++ b/hw/ip/spi_host/dv/env/spi_host_env_cfg.sv @@ -66,12 +66,7 @@ class spi_host_env_cfg extends cip_base_env_cfg #(.RAL_T(spi_host_reg_block)); seq_cfg = spi_host_seq_cfg::type_id::create("seq_cfg"); // set num_interrupts & num_alerts - begin - uvm_reg rg = ral.get_reg_by_name("intr_state"); - if (rg != null) begin - num_interrupts = ral.intr_state.get_n_used_bits(); - end - end + num_interrupts = ral.intr_state.get_n_used_bits(); endfunction // clk_core_freq_mhz is set by diff --git a/hw/ip/sysrst_ctrl/dv/env/sysrst_ctrl_env_cfg.sv b/hw/ip/sysrst_ctrl/dv/env/sysrst_ctrl_env_cfg.sv index d663cfaa3ce7e..bf5031fdf1f5d 100644 --- a/hw/ip/sysrst_ctrl/dv/env/sysrst_ctrl_env_cfg.sv +++ b/hw/ip/sysrst_ctrl/dv/env/sysrst_ctrl_env_cfg.sv @@ -18,12 +18,7 @@ class sysrst_ctrl_env_cfg extends cip_base_env_cfg #(.RAL_T(sysrst_ctrl_reg_bloc super.initialize(csr_base_addr); // set num_interrupts - begin - uvm_reg rg = ral.get_reg_by_name("intr_state"); - if (rg != null) begin - num_interrupts = ral.intr_state.get_n_used_bits(); - end - end + num_interrupts = ral.intr_state.get_n_used_bits(); // only support 1 outstanding TL item m_tl_agent_cfg.max_outstanding_req = 1; diff --git a/hw/ip/usbdev/dv/env/usbdev_env_cfg.sv b/hw/ip/usbdev/dv/env/usbdev_env_cfg.sv index 759fcf515cc17..b07ad8b6f464a 100644 --- a/hw/ip/usbdev/dv/env/usbdev_env_cfg.sv +++ b/hw/ip/usbdev/dv/env/usbdev_env_cfg.sv @@ -41,12 +41,7 @@ class usbdev_env_cfg extends cip_base_env_cfg #(.RAL_T(usbdev_reg_block)); m_usb20_agent_cfg = usb20_agent_cfg::type_id::create("m_usb20_agent_cfg"); // set num_interrupts & num_alerts - begin - uvm_reg rg = ral.get_reg_by_name("intr_state"); - if (rg != null) begin - num_interrupts = ral.intr_state.get_n_used_bits(); - end - end + num_interrupts = ral.intr_state.get_n_used_bits(); endfunction // ral flow is limited in terms of setting correct field access policies and reset values diff --git a/hw/ip_templates/alert_handler/dv/env/alert_handler_env_cfg.sv b/hw/ip_templates/alert_handler/dv/env/alert_handler_env_cfg.sv index c55befae28982..6119c02805267 100644 --- a/hw/ip_templates/alert_handler/dv/env/alert_handler_env_cfg.sv +++ b/hw/ip_templates/alert_handler/dv/env/alert_handler_env_cfg.sv @@ -25,12 +25,7 @@ class alert_handler_env_cfg extends cip_base_env_cfg #(.RAL_T(alert_handler_reg_ shadow_storage_err_status_fields[ral.loc_alert_cause[LocalShadowRegStorageErr].la] = 1; // set num_interrupts & num_alerts - begin - uvm_reg rg = ral.get_reg_by_name("intr_state"); - if (rg != null) begin - num_interrupts = ral.intr_state.get_n_used_bits(); - end - end + num_interrupts = ral.intr_state.get_n_used_bits(); alert_host_cfg = new[NUM_ALERTS]; esc_device_cfg = new[NUM_ESCS]; diff --git a/hw/top_earlgrey/ip_autogen/alert_handler/dv/env/alert_handler_env_cfg.sv b/hw/top_earlgrey/ip_autogen/alert_handler/dv/env/alert_handler_env_cfg.sv index c55befae28982..6119c02805267 100644 --- a/hw/top_earlgrey/ip_autogen/alert_handler/dv/env/alert_handler_env_cfg.sv +++ b/hw/top_earlgrey/ip_autogen/alert_handler/dv/env/alert_handler_env_cfg.sv @@ -25,12 +25,7 @@ class alert_handler_env_cfg extends cip_base_env_cfg #(.RAL_T(alert_handler_reg_ shadow_storage_err_status_fields[ral.loc_alert_cause[LocalShadowRegStorageErr].la] = 1; // set num_interrupts & num_alerts - begin - uvm_reg rg = ral.get_reg_by_name("intr_state"); - if (rg != null) begin - num_interrupts = ral.intr_state.get_n_used_bits(); - end - end + num_interrupts = ral.intr_state.get_n_used_bits(); alert_host_cfg = new[NUM_ALERTS]; esc_device_cfg = new[NUM_ESCS];