| 1 |
16 |
HanySalah |
//
|
| 2 |
|
|
//----------------------------------------------------------------------
|
| 3 |
|
|
// Copyright 2007-2011 Mentor Graphics Corporation
|
| 4 |
|
|
// Copyright 2007-2010 Cadence Design Systems, Inc.
|
| 5 |
|
|
// Copyright 2010 Synopsys, Inc.
|
| 6 |
|
|
// All Rights Reserved Worldwide
|
| 7 |
|
|
//
|
| 8 |
|
|
// Licensed under the Apache License, Version 2.0 (the
|
| 9 |
|
|
// "License"); you may not use this file except in
|
| 10 |
|
|
// compliance with the License. You may obtain a copy of
|
| 11 |
|
|
// the License at
|
| 12 |
|
|
//
|
| 13 |
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
| 14 |
|
|
//
|
| 15 |
|
|
// Unless required by applicable law or agreed to in
|
| 16 |
|
|
// writing, software distributed under the License is
|
| 17 |
|
|
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
| 18 |
|
|
// CONDITIONS OF ANY KIND, either express or implied. See
|
| 19 |
|
|
// the License for the specific language governing
|
| 20 |
|
|
// permissions and limitations under the License.
|
| 21 |
|
|
//----------------------------------------------------------------------
|
| 22 |
|
|
|
| 23 |
|
|
typedef class uvm_build_phase;
|
| 24 |
|
|
typedef class uvm_connect_phase;
|
| 25 |
|
|
typedef class uvm_end_of_elaboration_phase;
|
| 26 |
|
|
typedef class uvm_start_of_simulation_phase;
|
| 27 |
|
|
typedef class uvm_run_phase;
|
| 28 |
|
|
typedef class uvm_extract_phase;
|
| 29 |
|
|
typedef class uvm_check_phase;
|
| 30 |
|
|
typedef class uvm_report_phase;
|
| 31 |
|
|
typedef class uvm_final_phase;
|
| 32 |
|
|
|
| 33 |
|
|
typedef class uvm_pre_reset_phase;
|
| 34 |
|
|
typedef class uvm_reset_phase;
|
| 35 |
|
|
typedef class uvm_post_reset_phase;
|
| 36 |
|
|
typedef class uvm_pre_configure_phase;
|
| 37 |
|
|
typedef class uvm_configure_phase;
|
| 38 |
|
|
typedef class uvm_post_configure_phase;
|
| 39 |
|
|
typedef class uvm_pre_main_phase;
|
| 40 |
|
|
typedef class uvm_main_phase;
|
| 41 |
|
|
typedef class uvm_post_main_phase;
|
| 42 |
|
|
typedef class uvm_pre_shutdown_phase;
|
| 43 |
|
|
typedef class uvm_shutdown_phase;
|
| 44 |
|
|
typedef class uvm_post_shutdown_phase;
|
| 45 |
|
|
|
| 46 |
|
|
uvm_phase build_ph;
|
| 47 |
|
|
uvm_phase connect_ph;
|
| 48 |
|
|
uvm_phase end_of_elaboration_ph;
|
| 49 |
|
|
uvm_phase start_of_simulation_ph;
|
| 50 |
|
|
uvm_phase run_ph;
|
| 51 |
|
|
uvm_phase extract_ph;
|
| 52 |
|
|
uvm_phase check_ph;
|
| 53 |
|
|
uvm_phase report_ph;
|
| 54 |
|
|
|
| 55 |
|
|
//------------------------------------------------------------------------------
|
| 56 |
|
|
//
|
| 57 |
|
|
// Class: uvm_domain
|
| 58 |
|
|
//
|
| 59 |
|
|
//------------------------------------------------------------------------------
|
| 60 |
|
|
//
|
| 61 |
|
|
// Phasing schedule node representing an independent branch of the schedule.
|
| 62 |
|
|
// Handle used to assign domains to components or hierarchies in the testbench
|
| 63 |
|
|
//
|
| 64 |
|
|
|
| 65 |
|
|
class uvm_domain extends uvm_phase;
|
| 66 |
|
|
|
| 67 |
|
|
static local uvm_domain m_common_domain;
|
| 68 |
|
|
static local uvm_domain m_uvm_domain; // run-time phases
|
| 69 |
|
|
static local uvm_domain m_domains[string];
|
| 70 |
|
|
static local uvm_phase m_uvm_schedule;
|
| 71 |
|
|
|
| 72 |
|
|
|
| 73 |
|
|
// Function: get_domains
|
| 74 |
|
|
//
|
| 75 |
|
|
// Provides a list of all domains in the provided ~domains~ argument.
|
| 76 |
|
|
//
|
| 77 |
|
|
static function void get_domains(output uvm_domain domains[string]);
|
| 78 |
|
|
domains = m_domains;
|
| 79 |
|
|
endfunction
|
| 80 |
|
|
|
| 81 |
|
|
|
| 82 |
|
|
// Function: get_uvm_schedule
|
| 83 |
|
|
//
|
| 84 |
|
|
// Get the "UVM" schedule, which consists of the run-time phases that
|
| 85 |
|
|
// all components execute when participating in the "UVM" domain.
|
| 86 |
|
|
//
|
| 87 |
|
|
static function uvm_phase get_uvm_schedule();
|
| 88 |
|
|
void'(get_uvm_domain());
|
| 89 |
|
|
return m_uvm_schedule;
|
| 90 |
|
|
endfunction
|
| 91 |
|
|
|
| 92 |
|
|
|
| 93 |
|
|
// Function: get_common_domain
|
| 94 |
|
|
//
|
| 95 |
|
|
// Get the "common" domain, which consists of the common phases that
|
| 96 |
|
|
// all components execute in sync with each other. Phases in the "common"
|
| 97 |
|
|
// domain are build, connect, end_of_elaboration, start_of_simulation, run,
|
| 98 |
|
|
// extract, check, report, and final.
|
| 99 |
|
|
//
|
| 100 |
|
|
static function uvm_domain get_common_domain();
|
| 101 |
|
|
|
| 102 |
|
|
uvm_domain domain;
|
| 103 |
|
|
uvm_phase schedule;
|
| 104 |
|
|
|
| 105 |
|
|
if (m_common_domain != null)
|
| 106 |
|
|
return m_common_domain;
|
| 107 |
|
|
|
| 108 |
|
|
domain = new("common");
|
| 109 |
|
|
domain.add(uvm_build_phase::get());
|
| 110 |
|
|
domain.add(uvm_connect_phase::get());
|
| 111 |
|
|
domain.add(uvm_end_of_elaboration_phase::get());
|
| 112 |
|
|
domain.add(uvm_start_of_simulation_phase::get());
|
| 113 |
|
|
domain.add(uvm_run_phase::get());
|
| 114 |
|
|
domain.add(uvm_extract_phase::get());
|
| 115 |
|
|
domain.add(uvm_check_phase::get());
|
| 116 |
|
|
domain.add(uvm_report_phase::get());
|
| 117 |
|
|
domain.add(uvm_final_phase::get());
|
| 118 |
|
|
m_domains["common"] = domain;
|
| 119 |
|
|
|
| 120 |
|
|
// for backward compatibility, make common phases visible;
|
| 121 |
|
|
// same as uvm__phase::get().
|
| 122 |
|
|
build_ph = domain.find(uvm_build_phase::get());
|
| 123 |
|
|
connect_ph = domain.find(uvm_connect_phase::get());
|
| 124 |
|
|
end_of_elaboration_ph = domain.find(uvm_end_of_elaboration_phase::get());
|
| 125 |
|
|
start_of_simulation_ph = domain.find(uvm_start_of_simulation_phase::get());
|
| 126 |
|
|
run_ph = domain.find(uvm_run_phase::get());
|
| 127 |
|
|
extract_ph = domain.find(uvm_extract_phase::get());
|
| 128 |
|
|
check_ph = domain.find(uvm_check_phase::get());
|
| 129 |
|
|
report_ph = domain.find(uvm_report_phase::get());
|
| 130 |
|
|
m_common_domain = domain;
|
| 131 |
|
|
|
| 132 |
|
|
domain = get_uvm_domain();
|
| 133 |
|
|
m_common_domain.add(domain,
|
| 134 |
|
|
.with_phase(m_common_domain.find(uvm_run_phase::get())));
|
| 135 |
|
|
|
| 136 |
|
|
|
| 137 |
|
|
return m_common_domain;
|
| 138 |
|
|
|
| 139 |
|
|
endfunction
|
| 140 |
|
|
|
| 141 |
|
|
|
| 142 |
|
|
// Function: add_uvm_phases
|
| 143 |
|
|
//
|
| 144 |
|
|
// Appends to the given ~schedule~ the built-in UVM phases.
|
| 145 |
|
|
//
|
| 146 |
|
|
static function void add_uvm_phases(uvm_phase schedule);
|
| 147 |
|
|
|
| 148 |
|
|
schedule.add(uvm_pre_reset_phase::get());
|
| 149 |
|
|
schedule.add(uvm_reset_phase::get());
|
| 150 |
|
|
schedule.add(uvm_post_reset_phase::get());
|
| 151 |
|
|
schedule.add(uvm_pre_configure_phase::get());
|
| 152 |
|
|
schedule.add(uvm_configure_phase::get());
|
| 153 |
|
|
schedule.add(uvm_post_configure_phase::get());
|
| 154 |
|
|
schedule.add(uvm_pre_main_phase::get());
|
| 155 |
|
|
schedule.add(uvm_main_phase::get());
|
| 156 |
|
|
schedule.add(uvm_post_main_phase::get());
|
| 157 |
|
|
schedule.add(uvm_pre_shutdown_phase::get());
|
| 158 |
|
|
schedule.add(uvm_shutdown_phase::get());
|
| 159 |
|
|
schedule.add(uvm_post_shutdown_phase::get());
|
| 160 |
|
|
|
| 161 |
|
|
endfunction
|
| 162 |
|
|
|
| 163 |
|
|
|
| 164 |
|
|
// Function: get_uvm_domain
|
| 165 |
|
|
//
|
| 166 |
|
|
// Get a handle to the singleton ~uvm~ domain
|
| 167 |
|
|
//
|
| 168 |
|
|
static function uvm_domain get_uvm_domain();
|
| 169 |
|
|
|
| 170 |
|
|
if (m_uvm_domain == null) begin
|
| 171 |
|
|
m_uvm_domain = new("uvm");
|
| 172 |
|
|
m_uvm_schedule = new("uvm_sched", UVM_PHASE_SCHEDULE);
|
| 173 |
|
|
add_uvm_phases(m_uvm_schedule);
|
| 174 |
|
|
m_uvm_domain.add(m_uvm_schedule);
|
| 175 |
|
|
end
|
| 176 |
|
|
return m_uvm_domain;
|
| 177 |
|
|
endfunction
|
| 178 |
|
|
|
| 179 |
|
|
|
| 180 |
|
|
// Function: new
|
| 181 |
|
|
//
|
| 182 |
|
|
// Create a new instance of a phase domain.
|
| 183 |
|
|
function new(string name);
|
| 184 |
|
|
super.new(name,UVM_PHASE_DOMAIN);
|
| 185 |
|
|
if (m_domains.exists(name))
|
| 186 |
|
|
`uvm_error("UNIQDOMNAM", $sformatf("Domain created with non-unique name '%s'", name))
|
| 187 |
|
|
m_domains[name] = this;
|
| 188 |
|
|
endfunction
|
| 189 |
|
|
|
| 190 |
|
|
// Function: jump
|
| 191 |
|
|
//
|
| 192 |
|
|
// jumps all active phases of this domain to to-phase if
|
| 193 |
|
|
// there is a path between active-phase and to-phase
|
| 194 |
|
|
function void jump(uvm_phase phase);
|
| 195 |
|
|
uvm_phase phases[$];
|
| 196 |
|
|
|
| 197 |
|
|
m_get_transitive_children(phases);
|
| 198 |
|
|
|
| 199 |
|
|
phases = phases.find(item) with (item.get_state() inside {[UVM_PHASE_STARTED:UVM_PHASE_CLEANUP]});
|
| 200 |
|
|
|
| 201 |
|
|
foreach(phases[idx])
|
| 202 |
|
|
if(phases[idx].is_before(phase) || phases[idx].is_after(phase))
|
| 203 |
|
|
phases[idx].jump(phase);
|
| 204 |
|
|
|
| 205 |
|
|
endfunction
|
| 206 |
|
|
|
| 207 |
|
|
// jump_all
|
| 208 |
|
|
// --------
|
| 209 |
|
|
static function void jump_all(uvm_phase phase);
|
| 210 |
|
|
uvm_domain domains[string];
|
| 211 |
|
|
|
| 212 |
|
|
uvm_domain::get_domains(domains);
|
| 213 |
|
|
|
| 214 |
|
|
foreach(domains[idx])
|
| 215 |
|
|
domains[idx].jump(phase);
|
| 216 |
|
|
|
| 217 |
|
|
endfunction
|
| 218 |
|
|
endclass
|