Skip to content

Commit 18ac026

Browse files
committed
[dv] Add documentation comments to cip_base_env
Also mark some internal variables local and add a typedef to avoid very long lines for EDN pull agents. Signed-off-by: Rupert Swarbrick <rswarbrick@lowrisc.org>
1 parent 653abdf commit 18ac026

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

hw/dv/sv/cip_lib/cip_base_env.sv

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,33 @@ class cip_base_env #(type CFG_T = cip_base_env_cfg,
1010

1111
`uvm_component_param_utils(cip_base_env #(CFG_T, VIRTUAL_SEQUENCER_T, SCOREBOARD_T, COV_T))
1212

13+
// Methods
14+
1315
extern function new (string name="", uvm_component parent=null);
1416

1517
extern virtual function void build_phase(uvm_phase phase);
1618
extern virtual function void connect_phase(uvm_phase phase);
1719
extern virtual function void end_of_elaboration_phase(uvm_phase phase);
1820

19-
tl_agent m_tl_agents[string];
20-
tl_reg_adapter #(tl_seq_item) m_tl_reg_adapters[string];
21-
alert_esc_agent m_alert_agent[string];
22-
push_pull_agent#(.DeviceDataWidth(EDN_DATA_WIDTH)) m_edn_pull_agent[];
21+
// Types to represent a push/pull agent for an EDN interface and its cfg object type.
22+
typedef push_pull_agent#(.DeviceDataWidth(EDN_DATA_WIDTH)) edn_push_pull_agent_t;
23+
typedef push_pull_agent_cfg#(.DeviceDataWidth(EDN_DATA_WIDTH)) edn_push_pull_agent_cfg_t;
24+
25+
// Variables
26+
27+
// An associative array of TileLink agents, keyed by the name of the appropriate RAL model.
28+
tl_agent m_tl_agents[string];
29+
30+
// An associative array of register adapters, keyed by the name of the RAL model whose TileLink
31+
// bus is associated.
32+
local tl_reg_adapter #(tl_seq_item) m_tl_reg_adapters[string];
33+
34+
// An associative array of alert/escalation agents, keyed by the names of the different possible
35+
// alerts (from cfg.list_of_alerts).
36+
local alert_esc_agent m_alert_agent[string];
37+
38+
// A dynamic array of agents for EDN interfaces. This has cfg.num_edn items
39+
local edn_push_pull_agent_t m_edn_pull_agent[];
2340
endclass
2441

2542
function cip_base_env::new (string name="", uvm_component parent=null);
@@ -86,10 +103,9 @@ function void cip_base_env::build_phase(uvm_phase phase);
86103
m_edn_pull_agent = new[cfg.num_edn];
87104
foreach (m_edn_pull_agent[i]) begin
88105
string agent_name = $sformatf("m_edn_pull_agent[%0d]", i);
89-
m_edn_pull_agent[i] = push_pull_agent#(.DeviceDataWidth(EDN_DATA_WIDTH))::
90-
type_id::create(agent_name, this);
91-
uvm_config_db#(push_pull_agent_cfg#(.DeviceDataWidth(EDN_DATA_WIDTH)))::
92-
set(this, agent_name, "cfg", cfg.m_edn_pull_agent_cfgs[i]);
106+
m_edn_pull_agent[i] = edn_push_pull_agent_t::type_id::create(agent_name, this);
107+
uvm_config_db#(edn_push_pull_agent_cfg_t)::set(this, agent_name,
108+
"cfg", cfg.m_edn_pull_agent_cfgs[i]);
93109
cfg.m_edn_pull_agent_cfgs[i].en_cov = cfg.en_cov;
94110
end
95111
if (!uvm_config_db#(virtual clk_rst_if)::get(this, "", "edn_clk_rst_vif",

0 commit comments

Comments
 (0)