OpenCores
URL https://opencores.org/ocsvn/lpffir/lpffir/trunk

Subversion Repositories lpffir

[/] [lpffir/] [trunk/] [uvm/] [rca_uvm/] [generated_tb/] [tb/] [top/] [sv/] [top_env.sv] - Blame information for rev 5

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 vladimirar
// You can insert code here by setting file_header_inc in file common.tpl
2
 
3
//=============================================================================
4
// Project  : generated_tb
5
//
6
// File Name: top_env.sv
7
//
8
//
9
// Version:   1.0
10
//
11
// Code created by Easier UVM Code Generator version 2016-04-18-EP on Tue Mar 19 21:50:30 2019
12
//=============================================================================
13
// Description: Environment for top
14
//=============================================================================
15
 
16
`ifndef TOP_ENV_SV
17
`define TOP_ENV_SV
18
 
19
// You can insert code here by setting top_env_inc_before_class in file common.tpl
20
 
21
class top_env extends uvm_env;
22
 
23
  `uvm_component_utils(top_env)
24
 
25
  extern function new(string name, uvm_component parent);
26
 
27
 
28
  // Child agents
29
  rca_config    m_rca_config;
30
  rca_agent     m_rca_agent;
31
  rca_coverage  m_rca_coverage;
32
 
33
  top_config    m_config;
34
 
35
  // You can remove build/connect/run_phase by setting top_env_generate_methods_inside_class = no in file common.tpl
36
 
37
  extern function void build_phase(uvm_phase phase);
38
  extern function void connect_phase(uvm_phase phase);
39
  extern function void end_of_elaboration_phase(uvm_phase phase);
40
  extern task          run_phase(uvm_phase phase);
41
 
42
  // You can insert code here by setting top_env_inc_inside_class in file common.tpl
43
 
44
endclass : top_env
45
 
46
 
47
function top_env::new(string name, uvm_component parent);
48
  super.new(name, parent);
49
endfunction : new
50
 
51
 
52
// You can remove build/connect/run_phase by setting top_env_generate_methods_after_class = no in file common.tpl
53
 
54
function void top_env::build_phase(uvm_phase phase);
55
  `uvm_info(get_type_name(), "In build_phase", UVM_HIGH)
56
 
57
  // You can insert code here by setting top_env_prepend_to_build_phase in file common.tpl
58
 
59
  if (!uvm_config_db #(top_config)::get(this, "", "config", m_config))
60
    `uvm_error(get_type_name(), "Unable to get top_config")
61
 
62
  m_rca_config                 = new("m_rca_config");
63
  m_rca_config.vif             = m_config.rca_vif;
64
  m_rca_config.is_active       = m_config.is_active_rca;
65
  m_rca_config.checks_enable   = m_config.checks_enable_rca;
66
  m_rca_config.coverage_enable = m_config.coverage_enable_rca;
67
 
68
  // You can insert code here by setting agent_copy_config_vars in file rca.tpl
69
 
70
  uvm_config_db #(rca_config)::set(this, "m_rca_agent", "config", m_rca_config);
71
  if (m_rca_config.is_active == UVM_ACTIVE )
72
    uvm_config_db #(rca_config)::set(this, "m_rca_agent.m_sequencer", "config", m_rca_config);
73
  uvm_config_db #(rca_config)::set(this, "m_rca_coverage", "config", m_rca_config);
74
 
75
 
76
  m_rca_agent    = rca_agent   ::type_id::create("m_rca_agent", this);
77
  m_rca_coverage = rca_coverage::type_id::create("m_rca_coverage", this);
78
 
79
  // You can insert code here by setting top_env_append_to_build_phase in file common.tpl
80
 
81
endfunction : build_phase
82
 
83
 
84
function void top_env::connect_phase(uvm_phase phase);
85
  `uvm_info(get_type_name(), "In connect_phase", UVM_HIGH)
86
 
87
  m_rca_agent.analysis_port.connect(m_rca_coverage.analysis_export);
88
 
89
 
90
  // You can insert code here by setting top_env_append_to_connect_phase in file common.tpl
91
 
92
endfunction : connect_phase
93
 
94
 
95
// You can remove end_of_elaboration_phase by setting top_env_generate_end_of_elaboration = no in file common.tpl
96
 
97
function void top_env::end_of_elaboration_phase(uvm_phase phase);
98
  uvm_factory factory = uvm_factory::get();
99
  `uvm_info(get_type_name(), "Information printed from top_env::end_of_elaboration_phase method", UVM_MEDIUM)
100
  `uvm_info(get_type_name(), $sformatf("Verbosity threshold is %d", get_report_verbosity_level()), UVM_MEDIUM)
101
  uvm_top.print_topology();
102
  factory.print();
103
endfunction : end_of_elaboration_phase
104
 
105
 
106
// You can remove run_phase by setting top_env_generate_run_phase = no in file common.tpl
107
 
108
task top_env::run_phase(uvm_phase phase);
109
  top_default_seq vseq;
110
  vseq = top_default_seq::type_id::create("vseq");
111
  vseq.set_item_context(null, null);
112
  if ( !vseq.randomize() )
113
    `uvm_fatal(get_type_name(), "Failed to randomize virtual sequence")
114
  vseq.m_rca_agent = m_rca_agent;
115
  vseq.set_starting_phase(phase);
116
  vseq.start(null);
117
 
118
  // You can insert code here by setting top_env_append_to_run_phase in file common.tpl
119
 
120
endtask : run_phase
121
 
122
 
123
// You can insert code here by setting top_env_inc_after_class in file common.tpl
124
 
125
`endif // TOP_ENV_SV
126
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.