lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 1 | // 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: |
| 6 | class ${name}_env extends cip_base_env #( |
| 7 | % else: |
| 8 | class ${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 Iyer | 627f782 | 2020-01-15 21:39:29 -0800 | [diff] [blame] | 28 | // create components |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 29 | 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 Iyer | 04fe881 | 2021-01-21 22:31:05 -0800 | [diff] [blame] | 31 | cfg.m_${agent}_agent_cfg.en_cov = cfg.en_cov; |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 32 | % 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 | |
| 53 | endclass |