blob: cb2f185342f6f676688003206a5bb7f7978436c6 [file] [log] [blame]
lowRISC Contributors802543a2019-08-31 12:12:56 +01001// Copyright lowRISC contributors.
2// Licensed under the Apache License, Version 2.0, see LICENSE for details.
3// SPDX-License-Identifier: Apache-2.0
4
5% if is_cip:
6class ${name}_env extends cip_base_env #(
7% else:
8class ${name}_env extends dv_base_env #(
9% endif
10 .CFG_T (${name}_env_cfg),
11 .COV_T (${name}_env_cov),
12 .VIRTUAL_SEQUENCER_T(${name}_virtual_sequencer),
13 .SCOREBOARD_T (${name}_scoreboard)
14 );
15 `uvm_component_utils(${name}_env)
16% if env_agents != []:
17
18% for agent in env_agents:
19 ${agent}_agent m_${agent}_agent;
20% endfor
21% endif
22
23 `uvm_component_new
24
25 function void build_phase(uvm_phase phase);
26 super.build_phase(phase);
27% for agent in env_agents:
Srikrishna Iyer627f7822020-01-15 21:39:29 -080028 // create components
lowRISC Contributors802543a2019-08-31 12:12:56 +010029 m_${agent}_agent = ${agent}_agent::type_id::create("m_${agent}_agent", this);
30 uvm_config_db#(${agent}_agent_cfg)::set(this, "m_${agent}_agent*", "cfg", cfg.m_${agent}_agent_cfg);
Srikrishna Iyer04fe8812021-01-21 22:31:05 -080031 cfg.m_${agent}_agent_cfg.en_cov = cfg.en_cov;
lowRISC Contributors802543a2019-08-31 12:12:56 +010032% endfor
33 endfunction
34
35 function void connect_phase(uvm_phase phase);
36 super.connect_phase(phase);
37% if env_agents != []:
38 if (cfg.en_scb) begin
39% endif
40% for agent in env_agents:
41 m_${agent}_agent.monitor.analysis_port.connect(scoreboard.${agent}_fifo.analysis_export);
42% endfor
43% if env_agents != []:
44 end
45% endif
46% for agent in env_agents:
47 if (cfg.is_active && cfg.m_${agent}_agent_cfg.is_active) begin
48 virtual_sequencer.${agent}_sequencer_h = m_${agent}_agent.sequencer;
49 end
50% endfor
51 endfunction
52
53endclass