| 1 |
16 |
HanySalah |
//
|
| 2 |
|
|
//------------------------------------------------------------------------------
|
| 3 |
|
|
// Copyright 2007-2011 Mentor Graphics Corporation
|
| 4 |
|
|
// Copyright 2007-2011 Cadence Design Systems, Inc.
|
| 5 |
|
|
// Copyright 2010-2011 Synopsys, Inc.
|
| 6 |
|
|
// Copyright 2013 NVIDIA Corporation
|
| 7 |
|
|
// All Rights Reserved Worldwide
|
| 8 |
|
|
//
|
| 9 |
|
|
// Licensed under the Apache License, Version 2.0 (the
|
| 10 |
|
|
// "License"); you may not use this file except in
|
| 11 |
|
|
// compliance with the License. You may obtain a copy of
|
| 12 |
|
|
// the License at
|
| 13 |
|
|
//
|
| 14 |
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
| 15 |
|
|
//
|
| 16 |
|
|
// Unless required by applicable law or agreed to in
|
| 17 |
|
|
// writing, software distributed under the License is
|
| 18 |
|
|
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
| 19 |
|
|
// CONDITIONS OF ANY KIND, either express or implied. See
|
| 20 |
|
|
// the License for the specific language governing
|
| 21 |
|
|
// permissions and limitations under the License.
|
| 22 |
|
|
//------------------------------------------------------------------------------
|
| 23 |
|
|
|
| 24 |
|
|
|
| 25 |
|
|
//------------------------------------------------------------------------------
|
| 26 |
|
|
//
|
| 27 |
|
|
// CLASS: uvm_root
|
| 28 |
|
|
//
|
| 29 |
|
|
// The ~uvm_root~ class serves as the implicit top-level and phase controller for
|
| 30 |
|
|
// all UVM components. Users do not directly instantiate ~uvm_root~. The UVM
|
| 31 |
|
|
// automatically creates a single instance of that users can
|
| 32 |
|
|
// access via the global (uvm_pkg-scope) variable, ~uvm_top~.
|
| 33 |
|
|
//
|
| 34 |
|
|
// (see uvm_ref_root.gif)
|
| 35 |
|
|
//
|
| 36 |
|
|
// The ~uvm_top~ instance of ~uvm_root~ plays several key roles in the UVM.
|
| 37 |
|
|
//
|
| 38 |
|
|
// Implicit top-level - The ~uvm_top~ serves as an implicit top-level component.
|
| 39 |
|
|
// Any component whose parent is specified as ~null~ becomes a child of ~uvm_top~.
|
| 40 |
|
|
// Thus, all UVM components in simulation are descendants of ~uvm_top~.
|
| 41 |
|
|
//
|
| 42 |
|
|
// Phase control - ~uvm_top~ manages the phasing for all components.
|
| 43 |
|
|
//
|
| 44 |
|
|
// Search - Use ~uvm_top~ to search for components based on their
|
| 45 |
|
|
// hierarchical name. See and .
|
| 46 |
|
|
//
|
| 47 |
|
|
// Report configuration - Use ~uvm_top~ to globally configure
|
| 48 |
|
|
// report verbosity, log files, and actions. For example,
|
| 49 |
|
|
// ~uvm_top.set_report_verbosity_level_hier(UVM_FULL)~ would set
|
| 50 |
|
|
// full verbosity for all components in simulation.
|
| 51 |
|
|
//
|
| 52 |
|
|
// Global reporter - Because ~uvm_top~ is globally accessible (in uvm_pkg
|
| 53 |
|
|
// scope), UVM's reporting mechanism is accessible from anywhere
|
| 54 |
|
|
// outside ~uvm_component~, such as in modules and sequences.
|
| 55 |
|
|
// See , , and other global
|
| 56 |
|
|
// methods.
|
| 57 |
|
|
//
|
| 58 |
|
|
//
|
| 59 |
|
|
// The ~uvm_top~ instance checks during the end_of_elaboration phase if any errors have
|
| 60 |
|
|
// been generated so far. If errors are found a UVM_FATAL error is being generated as result
|
| 61 |
|
|
// so that the simulation will not continue to the start_of_simulation_phase.
|
| 62 |
|
|
//
|
| 63 |
|
|
|
| 64 |
|
|
//------------------------------------------------------------------------------
|
| 65 |
|
|
|
| 66 |
|
|
typedef class uvm_test_done_objection;
|
| 67 |
|
|
typedef class uvm_cmdline_processor;
|
| 68 |
|
|
typedef class uvm_component_proxy;
|
| 69 |
|
|
typedef class uvm_top_down_visitor_adapter;
|
| 70 |
|
|
|
| 71 |
|
|
class uvm_root extends uvm_component;
|
| 72 |
|
|
|
| 73 |
|
|
// Function: get()
|
| 74 |
|
|
// Static accessor for .
|
| 75 |
|
|
//
|
| 76 |
|
|
// The static accessor is provided as a convenience wrapper
|
| 77 |
|
|
// around retrieving the root via the
|
| 78 |
|
|
// method.
|
| 79 |
|
|
//
|
| 80 |
|
|
// | // Using the uvm_coreservice_t:
|
| 81 |
|
|
// | uvm_coreservice_t cs;
|
| 82 |
|
|
// | uvm_root r;
|
| 83 |
|
|
// | cs = uvm_coreservice_t::get();
|
| 84 |
|
|
// | r = cs.get_root();
|
| 85 |
|
|
// |
|
| 86 |
|
|
// | // Not using the uvm_coreservice_t:
|
| 87 |
|
|
// | uvm_root r;
|
| 88 |
|
|
// | r = uvm_root::get();
|
| 89 |
|
|
//
|
| 90 |
|
|
extern static function uvm_root get();
|
| 91 |
|
|
|
| 92 |
|
|
uvm_cmdline_processor clp;
|
| 93 |
|
|
|
| 94 |
|
|
virtual function string get_type_name();
|
| 95 |
|
|
return "uvm_root";
|
| 96 |
|
|
endfunction
|
| 97 |
|
|
|
| 98 |
|
|
|
| 99 |
|
|
//----------------------------------------------------------------------------
|
| 100 |
|
|
// Group: Simulation Control
|
| 101 |
|
|
//----------------------------------------------------------------------------
|
| 102 |
|
|
|
| 103 |
|
|
|
| 104 |
|
|
// Task: run_test
|
| 105 |
|
|
//
|
| 106 |
|
|
// Phases all components through all registered phases. If the optional
|
| 107 |
|
|
// test_name argument is provided, or if a command-line plusarg,
|
| 108 |
|
|
// +UVM_TESTNAME=TEST_NAME, is found, then the specified component is created
|
| 109 |
|
|
// just prior to phasing. The test may contain new verification components or
|
| 110 |
|
|
// the entire testbench, in which case the test and testbench can be chosen from
|
| 111 |
|
|
// the command line without forcing recompilation. If the global (package)
|
| 112 |
|
|
// variable, finish_on_completion, is set, then $finish is called after
|
| 113 |
|
|
// phasing completes.
|
| 114 |
|
|
|
| 115 |
|
|
extern virtual task run_test (string test_name="");
|
| 116 |
|
|
|
| 117 |
|
|
|
| 118 |
|
|
// Function: die
|
| 119 |
|
|
//
|
| 120 |
|
|
// This method is called by the report server if a report reaches the maximum
|
| 121 |
|
|
// quit count or has a UVM_EXIT action associated with it, e.g., as with
|
| 122 |
|
|
// fatal errors.
|
| 123 |
|
|
//
|
| 124 |
|
|
// Calls the method
|
| 125 |
|
|
// on the entire hierarchy in a bottom-up fashion.
|
| 126 |
|
|
// It then calls and terminates the simulation
|
| 127 |
|
|
// with ~$finish~.
|
| 128 |
|
|
|
| 129 |
|
|
virtual function void die();
|
| 130 |
|
|
uvm_report_server l_rs = uvm_report_server::get_server();
|
| 131 |
|
|
// do the pre_abort callbacks
|
| 132 |
|
|
m_do_pre_abort();
|
| 133 |
|
|
|
| 134 |
|
|
l_rs.report_summarize();
|
| 135 |
|
|
$finish;
|
| 136 |
|
|
endfunction
|
| 137 |
|
|
|
| 138 |
|
|
|
| 139 |
|
|
// Function: set_timeout
|
| 140 |
|
|
//
|
| 141 |
|
|
// Specifies the timeout for the simulation. Default is <`UVM_DEFAULT_TIMEOUT>
|
| 142 |
|
|
//
|
| 143 |
|
|
// The timeout is simply the maximum absolute simulation time allowed before a
|
| 144 |
|
|
// ~FATAL~ occurs. If the timeout is set to 20ns, then the simulation must end
|
| 145 |
|
|
// before 20ns, or a ~FATAL~ timeout will occur.
|
| 146 |
|
|
//
|
| 147 |
|
|
// This is provided so that the user can prevent the simulation from potentially
|
| 148 |
|
|
// consuming too many resources (Disk, Memory, CPU, etc) when the testbench is
|
| 149 |
|
|
// essentially hung.
|
| 150 |
|
|
//
|
| 151 |
|
|
//
|
| 152 |
|
|
|
| 153 |
|
|
extern function void set_timeout(time timeout, bit overridable=1);
|
| 154 |
|
|
|
| 155 |
|
|
|
| 156 |
|
|
// Variable: finish_on_completion
|
| 157 |
|
|
//
|
| 158 |
|
|
// If set, then run_test will call $finish after all phases are executed.
|
| 159 |
|
|
|
| 160 |
|
|
bit finish_on_completion = 1;
|
| 161 |
|
|
|
| 162 |
|
|
|
| 163 |
|
|
//----------------------------------------------------------------------------
|
| 164 |
|
|
// Group: Topology
|
| 165 |
|
|
//----------------------------------------------------------------------------
|
| 166 |
|
|
|
| 167 |
|
|
|
| 168 |
|
|
// Variable: top_levels
|
| 169 |
|
|
//
|
| 170 |
|
|
// This variable is a list of all of the top level components in UVM. It
|
| 171 |
|
|
// includes the uvm_test_top component that is created by as
|
| 172 |
|
|
// well as any other top level components that have been instantiated
|
| 173 |
|
|
// anywhere in the hierarchy.
|
| 174 |
|
|
|
| 175 |
|
|
uvm_component top_levels[$];
|
| 176 |
|
|
|
| 177 |
|
|
|
| 178 |
|
|
// Function: find
|
| 179 |
|
|
|
| 180 |
|
|
extern function uvm_component find (string comp_match);
|
| 181 |
|
|
|
| 182 |
|
|
// Function: find_all
|
| 183 |
|
|
//
|
| 184 |
|
|
// Returns the component handle (find) or list of components handles
|
| 185 |
|
|
// (find_all) matching a given string. The string may contain the wildcards,
|
| 186 |
|
|
// * and ?. Strings beginning with '.' are absolute path names. If the optional
|
| 187 |
|
|
// argument comp is provided, then search begins from that component down
|
| 188 |
|
|
// (default=all components).
|
| 189 |
|
|
|
| 190 |
|
|
extern function void find_all (string comp_match,
|
| 191 |
|
|
ref uvm_component comps[$],
|
| 192 |
|
|
input uvm_component comp=null);
|
| 193 |
|
|
|
| 194 |
|
|
|
| 195 |
|
|
// Function: print_topology
|
| 196 |
|
|
//
|
| 197 |
|
|
// Print the verification environment's component topology. The
|
| 198 |
|
|
// ~printer~ is a object that controls the format
|
| 199 |
|
|
// of the topology printout; a ~null~ printer prints with the
|
| 200 |
|
|
// default output.
|
| 201 |
|
|
|
| 202 |
|
|
extern function void print_topology (uvm_printer printer=null);
|
| 203 |
|
|
|
| 204 |
|
|
|
| 205 |
|
|
// Variable: enable_print_topology
|
| 206 |
|
|
//
|
| 207 |
|
|
// If set, then the entire testbench topology is printed just after completion
|
| 208 |
|
|
// of the end_of_elaboration phase.
|
| 209 |
|
|
|
| 210 |
|
|
bit enable_print_topology = 0;
|
| 211 |
|
|
|
| 212 |
|
|
|
| 213 |
|
|
// Variable- phase_timeout
|
| 214 |
|
|
//
|
| 215 |
|
|
// Specifies the timeout for the run phase. Default is `UVM_DEFAULT_TIMEOUT
|
| 216 |
|
|
|
| 217 |
|
|
|
| 218 |
|
|
time phase_timeout = `UVM_DEFAULT_TIMEOUT;
|
| 219 |
|
|
|
| 220 |
|
|
|
| 221 |
|
|
// PRIVATE members
|
| 222 |
|
|
extern function void m_find_all_recurse(string comp_match,
|
| 223 |
|
|
ref uvm_component comps[$],
|
| 224 |
|
|
input uvm_component comp=null);
|
| 225 |
|
|
|
| 226 |
|
|
extern protected function new ();
|
| 227 |
|
|
extern protected virtual function bit m_add_child (uvm_component child);
|
| 228 |
|
|
extern function void build_phase(uvm_phase phase);
|
| 229 |
|
|
extern local function void m_do_verbosity_settings();
|
| 230 |
|
|
extern local function void m_do_timeout_settings();
|
| 231 |
|
|
extern local function void m_do_factory_settings();
|
| 232 |
|
|
extern local function void m_process_inst_override(string ovr);
|
| 233 |
|
|
extern local function void m_process_type_override(string ovr);
|
| 234 |
|
|
extern local function void m_do_config_settings();
|
| 235 |
|
|
extern local function void m_do_max_quit_settings();
|
| 236 |
|
|
extern local function void m_do_dump_args();
|
| 237 |
|
|
extern local function void m_process_config(string cfg, bit is_int);
|
| 238 |
|
|
extern local function void m_process_default_sequence(string cfg);
|
| 239 |
|
|
extern function void m_check_verbosity();
|
| 240 |
|
|
extern virtual function void report_header(UVM_FILE file = 0);
|
| 241 |
|
|
// singleton handle
|
| 242 |
|
|
static local uvm_root m_inst;
|
| 243 |
|
|
|
| 244 |
|
|
// For error checking
|
| 245 |
|
|
extern virtual task run_phase (uvm_phase phase);
|
| 246 |
|
|
|
| 247 |
|
|
|
| 248 |
|
|
// phase_started
|
| 249 |
|
|
// -------------
|
| 250 |
|
|
// At end of elab phase we need to do tlm binding resolution.
|
| 251 |
|
|
function void phase_started(uvm_phase phase);
|
| 252 |
|
|
if (phase == end_of_elaboration_ph) begin
|
| 253 |
|
|
do_resolve_bindings();
|
| 254 |
|
|
if (enable_print_topology) print_topology();
|
| 255 |
|
|
begin
|
| 256 |
|
|
uvm_report_server srvr;
|
| 257 |
|
|
srvr = uvm_report_server::get_server();
|
| 258 |
|
|
if(srvr.get_severity_count(UVM_ERROR) > 0) begin
|
| 259 |
|
|
uvm_report_fatal("BUILDERR", "stopping due to build errors", UVM_NONE);
|
| 260 |
|
|
end
|
| 261 |
|
|
end
|
| 262 |
|
|
end
|
| 263 |
|
|
endfunction
|
| 264 |
|
|
|
| 265 |
|
|
bit m_phase_all_done;
|
| 266 |
|
|
|
| 267 |
|
|
// internal function not to be used
|
| 268 |
|
|
// get the initialized singleton instance of uvm_root
|
| 269 |
|
|
static function uvm_root m_uvm_get_root();
|
| 270 |
|
|
if (m_inst == null) begin
|
| 271 |
|
|
m_inst = new();
|
| 272 |
|
|
void'(uvm_domain::get_common_domain());
|
| 273 |
|
|
m_inst.m_domain = uvm_domain::get_uvm_domain();
|
| 274 |
|
|
end
|
| 275 |
|
|
return m_inst;
|
| 276 |
|
|
endfunction
|
| 277 |
|
|
|
| 278 |
|
|
`ifndef UVM_NO_DEPRECATED
|
| 279 |
|
|
// stop_request
|
| 280 |
|
|
// ------------
|
| 281 |
|
|
|
| 282 |
|
|
// backward compat only
|
| 283 |
|
|
// call global_stop_request() or uvm_test_done.stop_request() instead
|
| 284 |
|
|
function void stop_request();
|
| 285 |
|
|
uvm_test_done_objection tdo;
|
| 286 |
|
|
tdo = uvm_test_done_objection::get();
|
| 287 |
|
|
tdo.stop_request();
|
| 288 |
|
|
endfunction
|
| 289 |
|
|
`endif
|
| 290 |
|
|
|
| 291 |
|
|
static local bit m_relnotes_done=0;
|
| 292 |
|
|
|
| 293 |
|
|
function void end_of_elaboration_phase(uvm_phase phase);
|
| 294 |
|
|
uvm_component_proxy p = new("proxy");
|
| 295 |
|
|
uvm_top_down_visitor_adapter#(uvm_component) adapter = new("adapter");
|
| 296 |
|
|
uvm_coreservice_t cs = uvm_coreservice_t::get();
|
| 297 |
|
|
uvm_visitor#(uvm_component) v = cs.get_component_visitor();
|
| 298 |
|
|
adapter.accept(this, v, p);
|
| 299 |
|
|
endfunction
|
| 300 |
|
|
|
| 301 |
|
|
endclass
|
| 302 |
|
|
|
| 303 |
|
|
|
| 304 |
|
|
//----------------------------------------------------------------------------
|
| 305 |
|
|
// Group: Global Variables
|
| 306 |
|
|
//----------------------------------------------------------------------------
|
| 307 |
|
|
|
| 308 |
|
|
|
| 309 |
|
|
//------------------------------------------------------------------------------
|
| 310 |
|
|
// Variable: uvm_top
|
| 311 |
|
|
//
|
| 312 |
|
|
// This is the top-level that governs phase execution and provides component
|
| 313 |
|
|
// search interface. See for more information.
|
| 314 |
|
|
//------------------------------------------------------------------------------
|
| 315 |
|
|
const uvm_root uvm_top = uvm_root::get();
|
| 316 |
|
|
|
| 317 |
|
|
//-----------------------------------------------------------------------------
|
| 318 |
|
|
// IMPLEMENTATION
|
| 319 |
|
|
//-----------------------------------------------------------------------------
|
| 320 |
|
|
|
| 321 |
|
|
// get
|
| 322 |
|
|
// ---
|
| 323 |
|
|
|
| 324 |
|
|
function uvm_root uvm_root::get();
|
| 325 |
|
|
uvm_coreservice_t cs = uvm_coreservice_t::get();
|
| 326 |
|
|
return cs.get_root();
|
| 327 |
|
|
endfunction
|
| 328 |
|
|
|
| 329 |
|
|
|
| 330 |
|
|
// new
|
| 331 |
|
|
// ---
|
| 332 |
|
|
|
| 333 |
|
|
function uvm_root::new();
|
| 334 |
|
|
|
| 335 |
|
|
super.new("__top__", null);
|
| 336 |
|
|
|
| 337 |
|
|
m_rh.set_name("reporter");
|
| 338 |
|
|
|
| 339 |
|
|
clp = uvm_cmdline_processor::get_inst();
|
| 340 |
|
|
|
| 341 |
|
|
report_header();
|
| 342 |
|
|
|
| 343 |
|
|
// This sets up the global verbosity. Other command line args may
|
| 344 |
|
|
// change individual component verbosity.
|
| 345 |
|
|
m_check_verbosity();
|
| 346 |
|
|
endfunction
|
| 347 |
|
|
|
| 348 |
|
|
function void uvm_root::report_header(UVM_FILE file = 0);
|
| 349 |
|
|
string q[$];
|
| 350 |
|
|
uvm_report_server srvr;
|
| 351 |
|
|
uvm_cmdline_processor clp;
|
| 352 |
|
|
string args[$];
|
| 353 |
|
|
|
| 354 |
|
|
srvr = uvm_report_server::get_server();
|
| 355 |
|
|
clp = uvm_cmdline_processor::get_inst();
|
| 356 |
|
|
|
| 357 |
|
|
if (clp.get_arg_matches("+UVM_NO_RELNOTES", args)) return;
|
| 358 |
|
|
|
| 359 |
|
|
|
| 360 |
|
|
q.push_back("\n----------------------------------------------------------------\n");
|
| 361 |
|
|
q.push_back({uvm_revision_string(),"\n"});
|
| 362 |
|
|
q.push_back({uvm_mgc_copyright,"\n"});
|
| 363 |
|
|
q.push_back({uvm_cdn_copyright,"\n"});
|
| 364 |
|
|
q.push_back({uvm_snps_copyright,"\n"});
|
| 365 |
|
|
q.push_back({uvm_cy_copyright,"\n"});
|
| 366 |
|
|
q.push_back({uvm_nv_copyright,"\n"});
|
| 367 |
|
|
q.push_back("----------------------------------------------------------------\n");
|
| 368 |
|
|
|
| 369 |
|
|
|
| 370 |
|
|
`ifndef UVM_NO_DEPRECATED
|
| 371 |
|
|
if(!m_relnotes_done)
|
| 372 |
|
|
q.push_back("\n *********** IMPORTANT RELEASE NOTES ************\n");
|
| 373 |
|
|
q.push_back("\n You are using a version of the UVM library that has been compiled\n");
|
| 374 |
|
|
q.push_back(" with `UVM_NO_DEPRECATED undefined.\n");
|
| 375 |
|
|
q.push_back(" See http://www.eda.org/svdb/view.php?id=3313 for more details.\n");
|
| 376 |
|
|
m_relnotes_done=1;
|
| 377 |
|
|
`endif
|
| 378 |
|
|
|
| 379 |
|
|
`ifndef UVM_OBJECT_DO_NOT_NEED_CONSTRUCTOR
|
| 380 |
|
|
if(!m_relnotes_done)
|
| 381 |
|
|
q.push_back("\n *********** IMPORTANT RELEASE NOTES ************\n");
|
| 382 |
|
|
|
| 383 |
|
|
q.push_back("\n You are using a version of the UVM library that has been compiled\n");
|
| 384 |
|
|
q.push_back(" with `UVM_OBJECT_DO_NOT_NEED_CONSTRUCTOR undefined.\n");
|
| 385 |
|
|
q.push_back(" See http://www.eda.org/svdb/view.php?id=3770 for more details.\n");
|
| 386 |
|
|
m_relnotes_done=1;
|
| 387 |
|
|
`endif
|
| 388 |
|
|
|
| 389 |
|
|
if(m_relnotes_done)
|
| 390 |
|
|
q.push_back("\n (Specify +UVM_NO_RELNOTES to turn off this notice)\n");
|
| 391 |
|
|
|
| 392 |
|
|
`uvm_info("UVM/RELNOTES",`UVM_STRING_QUEUE_STREAMING_PACK(q),UVM_LOW)
|
| 393 |
|
|
endfunction
|
| 394 |
|
|
|
| 395 |
|
|
|
| 396 |
|
|
|
| 397 |
|
|
// run_test
|
| 398 |
|
|
// --------
|
| 399 |
|
|
|
| 400 |
|
|
task uvm_root::run_test(string test_name="");
|
| 401 |
|
|
|
| 402 |
|
|
uvm_report_server l_rs;
|
| 403 |
|
|
uvm_coreservice_t cs = uvm_coreservice_t::get();
|
| 404 |
|
|
uvm_factory factory=cs.get_factory();
|
| 405 |
|
|
bit testname_plusarg;
|
| 406 |
|
|
int test_name_count;
|
| 407 |
|
|
string test_names[$];
|
| 408 |
|
|
string msg;
|
| 409 |
|
|
uvm_component uvm_test_top;
|
| 410 |
|
|
|
| 411 |
|
|
process phase_runner_proc; // store thread forked below for final cleanup
|
| 412 |
|
|
|
| 413 |
|
|
testname_plusarg = 0;
|
| 414 |
|
|
|
| 415 |
|
|
// Set up the process that decouples the thread that drops objections from
|
| 416 |
|
|
// the process that processes drop/all_dropped objections. Thus, if the
|
| 417 |
|
|
// original calling thread (the "dropper") gets killed, it does not affect
|
| 418 |
|
|
// drain-time and propagation of the drop up the hierarchy.
|
| 419 |
|
|
// Needs to be done in run_test since it needs to be in an
|
| 420 |
|
|
// initial block to fork a process.
|
| 421 |
|
|
uvm_objection::m_init_objections();
|
| 422 |
|
|
|
| 423 |
|
|
`ifndef UVM_NO_DPI
|
| 424 |
|
|
|
| 425 |
|
|
// Retrieve the test names provided on the command line. Command line
|
| 426 |
|
|
// overrides the argument.
|
| 427 |
|
|
test_name_count = clp.get_arg_values("+UVM_TESTNAME=", test_names);
|
| 428 |
|
|
|
| 429 |
|
|
// If at least one, use first in queue.
|
| 430 |
|
|
if (test_name_count > 0) begin
|
| 431 |
|
|
test_name = test_names[0];
|
| 432 |
|
|
testname_plusarg = 1;
|
| 433 |
|
|
end
|
| 434 |
|
|
|
| 435 |
|
|
// If multiple, provided the warning giving the number, which one will be
|
| 436 |
|
|
// used and the complete list.
|
| 437 |
|
|
if (test_name_count > 1) begin
|
| 438 |
|
|
string test_list;
|
| 439 |
|
|
string sep;
|
| 440 |
|
|
for (int i = 0; i < test_names.size(); i++) begin
|
| 441 |
|
|
if (i != 0)
|
| 442 |
|
|
sep = ", ";
|
| 443 |
|
|
test_list = {test_list, sep, test_names[i]};
|
| 444 |
|
|
end
|
| 445 |
|
|
uvm_report_warning("MULTTST",
|
| 446 |
|
|
$sformatf("Multiple (%0d) +UVM_TESTNAME arguments provided on the command line. '%s' will be used. Provided list: %s.", test_name_count, test_name, test_list), UVM_NONE);
|
| 447 |
|
|
end
|
| 448 |
|
|
|
| 449 |
|
|
`else
|
| 450 |
|
|
|
| 451 |
|
|
// plusarg overrides argument
|
| 452 |
|
|
if ($value$plusargs("UVM_TESTNAME=%s", test_name)) begin
|
| 453 |
|
|
`uvm_info("NO_DPI_TSTNAME", "UVM_NO_DPI defined--getting UVM_TESTNAME directly, without DPI", UVM_NONE)
|
| 454 |
|
|
testname_plusarg = 1;
|
| 455 |
|
|
end
|
| 456 |
|
|
|
| 457 |
|
|
`endif
|
| 458 |
|
|
|
| 459 |
|
|
// if test now defined, create it using common factory
|
| 460 |
|
|
if (test_name != "") begin
|
| 461 |
|
|
uvm_coreservice_t cs = uvm_coreservice_t::get();
|
| 462 |
|
|
uvm_factory factory=cs.get_factory();
|
| 463 |
|
|
|
| 464 |
|
|
if(m_children.exists("uvm_test_top")) begin
|
| 465 |
|
|
uvm_report_fatal("TTINST",
|
| 466 |
|
|
"An uvm_test_top already exists via a previous call to run_test", UVM_NONE);
|
| 467 |
|
|
#0; // forces shutdown because $finish is forked
|
| 468 |
|
|
end
|
| 469 |
|
|
$cast(uvm_test_top, factory.create_component_by_name(test_name,
|
| 470 |
|
|
"", "uvm_test_top", null));
|
| 471 |
|
|
|
| 472 |
|
|
if (uvm_test_top == null) begin
|
| 473 |
|
|
msg = testname_plusarg ? {"command line +UVM_TESTNAME=",test_name} :
|
| 474 |
|
|
{"call to run_test(",test_name,")"};
|
| 475 |
|
|
uvm_report_fatal("INVTST",
|
| 476 |
|
|
{"Requested test from ",msg, " not found." }, UVM_NONE);
|
| 477 |
|
|
end
|
| 478 |
|
|
end
|
| 479 |
|
|
|
| 480 |
|
|
if (m_children.num() == 0) begin
|
| 481 |
|
|
uvm_report_fatal("NOCOMP",
|
| 482 |
|
|
{"No components instantiated. You must either instantiate",
|
| 483 |
|
|
" at least one component before calling run_test or use",
|
| 484 |
|
|
" run_test to do so. To run a test using run_test,",
|
| 485 |
|
|
" use +UVM_TESTNAME or supply the test name in",
|
| 486 |
|
|
" the argument to run_test(). Exiting simulation."}, UVM_NONE);
|
| 487 |
|
|
return;
|
| 488 |
|
|
end
|
| 489 |
|
|
|
| 490 |
|
|
begin
|
| 491 |
|
|
if(test_name=="")
|
| 492 |
|
|
uvm_report_info("RNTST", "Running test ...", UVM_LOW);
|
| 493 |
|
|
else if (test_name == uvm_test_top.get_type_name())
|
| 494 |
|
|
uvm_report_info("RNTST", {"Running test ",test_name,"..."}, UVM_LOW);
|
| 495 |
|
|
else
|
| 496 |
|
|
uvm_report_info("RNTST", {"Running test ",uvm_test_top.get_type_name()," (via factory override for test \"",test_name,"\")..."}, UVM_LOW);
|
| 497 |
|
|
end
|
| 498 |
|
|
|
| 499 |
|
|
// phase runner, isolated from calling process
|
| 500 |
|
|
fork begin
|
| 501 |
|
|
// spawn the phase runner task
|
| 502 |
|
|
phase_runner_proc = process::self();
|
| 503 |
|
|
uvm_phase::m_run_phases();
|
| 504 |
|
|
end
|
| 505 |
|
|
join_none
|
| 506 |
|
|
#0; // let the phase runner start
|
| 507 |
|
|
|
| 508 |
|
|
wait (m_phase_all_done == 1);
|
| 509 |
|
|
|
| 510 |
|
|
// clean up after ourselves
|
| 511 |
|
|
phase_runner_proc.kill();
|
| 512 |
|
|
|
| 513 |
|
|
l_rs = uvm_report_server::get_server();
|
| 514 |
|
|
l_rs.report_summarize();
|
| 515 |
|
|
|
| 516 |
|
|
if (finish_on_completion)
|
| 517 |
|
|
$finish;
|
| 518 |
|
|
|
| 519 |
|
|
endtask
|
| 520 |
|
|
|
| 521 |
|
|
|
| 522 |
|
|
// find_all
|
| 523 |
|
|
// --------
|
| 524 |
|
|
|
| 525 |
|
|
function void uvm_root::find_all(string comp_match, ref uvm_component comps[$],
|
| 526 |
|
|
input uvm_component comp=null);
|
| 527 |
|
|
|
| 528 |
|
|
if (comp==null)
|
| 529 |
|
|
comp = this;
|
| 530 |
|
|
m_find_all_recurse(comp_match, comps, comp);
|
| 531 |
|
|
|
| 532 |
|
|
endfunction
|
| 533 |
|
|
|
| 534 |
|
|
|
| 535 |
|
|
// find
|
| 536 |
|
|
// ----
|
| 537 |
|
|
|
| 538 |
|
|
function uvm_component uvm_root::find (string comp_match);
|
| 539 |
|
|
uvm_component comp_list[$];
|
| 540 |
|
|
|
| 541 |
|
|
find_all(comp_match,comp_list);
|
| 542 |
|
|
|
| 543 |
|
|
if (comp_list.size() > 1)
|
| 544 |
|
|
uvm_report_warning("MMATCH",
|
| 545 |
|
|
$sformatf("Found %0d components matching '%s'. Returning first match, %0s.",
|
| 546 |
|
|
comp_list.size(),comp_match,comp_list[0].get_full_name()), UVM_NONE);
|
| 547 |
|
|
|
| 548 |
|
|
if (comp_list.size() == 0) begin
|
| 549 |
|
|
uvm_report_warning("CMPNFD",
|
| 550 |
|
|
{"Component matching '",comp_match,
|
| 551 |
|
|
"' was not found in the list of uvm_components"}, UVM_NONE);
|
| 552 |
|
|
return null;
|
| 553 |
|
|
end
|
| 554 |
|
|
|
| 555 |
|
|
return comp_list[0];
|
| 556 |
|
|
endfunction
|
| 557 |
|
|
|
| 558 |
|
|
|
| 559 |
|
|
// print_topology
|
| 560 |
|
|
// --------------
|
| 561 |
|
|
|
| 562 |
|
|
function void uvm_root::print_topology(uvm_printer printer=null);
|
| 563 |
|
|
|
| 564 |
|
|
string s;
|
| 565 |
|
|
|
| 566 |
|
|
if (m_children.num()==0) begin
|
| 567 |
|
|
uvm_report_warning("EMTCOMP", "print_topology - No UVM components to print.", UVM_NONE);
|
| 568 |
|
|
return;
|
| 569 |
|
|
end
|
| 570 |
|
|
|
| 571 |
|
|
if (printer==null)
|
| 572 |
|
|
printer = uvm_default_printer;
|
| 573 |
|
|
|
| 574 |
|
|
foreach (m_children[c]) begin
|
| 575 |
|
|
if(m_children[c].print_enabled) begin
|
| 576 |
|
|
printer.print_object("", m_children[c]);
|
| 577 |
|
|
end
|
| 578 |
|
|
end
|
| 579 |
|
|
`uvm_info("UVMTOP",{"UVM testbench topology:\n",printer.emit()},UVM_NONE)
|
| 580 |
|
|
|
| 581 |
|
|
endfunction
|
| 582 |
|
|
|
| 583 |
|
|
|
| 584 |
|
|
// set_timeout
|
| 585 |
|
|
// -----------
|
| 586 |
|
|
|
| 587 |
|
|
function void uvm_root::set_timeout(time timeout, bit overridable=1);
|
| 588 |
|
|
static bit m_uvm_timeout_overridable = 1;
|
| 589 |
|
|
if (m_uvm_timeout_overridable == 0) begin
|
| 590 |
|
|
uvm_report_info("NOTIMOUTOVR",
|
| 591 |
|
|
$sformatf("The global timeout setting of %0d is not overridable to %0d due to a previous setting.",
|
| 592 |
|
|
phase_timeout, timeout), UVM_NONE);
|
| 593 |
|
|
return;
|
| 594 |
|
|
end
|
| 595 |
|
|
m_uvm_timeout_overridable = overridable;
|
| 596 |
|
|
phase_timeout = timeout;
|
| 597 |
|
|
endfunction
|
| 598 |
|
|
|
| 599 |
|
|
|
| 600 |
|
|
|
| 601 |
|
|
// m_find_all_recurse
|
| 602 |
|
|
// ------------------
|
| 603 |
|
|
|
| 604 |
|
|
function void uvm_root::m_find_all_recurse(string comp_match, ref uvm_component comps[$],
|
| 605 |
|
|
input uvm_component comp=null);
|
| 606 |
|
|
string name;
|
| 607 |
|
|
|
| 608 |
|
|
if (comp.get_first_child(name))
|
| 609 |
|
|
do begin
|
| 610 |
|
|
this.m_find_all_recurse(comp_match, comps, comp.get_child(name));
|
| 611 |
|
|
end
|
| 612 |
|
|
while (comp.get_next_child(name));
|
| 613 |
|
|
if (uvm_is_match(comp_match, comp.get_full_name()) &&
|
| 614 |
|
|
comp.get_name() != "") /* uvm_top */
|
| 615 |
|
|
comps.push_back(comp);
|
| 616 |
|
|
|
| 617 |
|
|
endfunction
|
| 618 |
|
|
|
| 619 |
|
|
|
| 620 |
|
|
// m_add_child
|
| 621 |
|
|
// -----------
|
| 622 |
|
|
|
| 623 |
|
|
// Add to the top levels array
|
| 624 |
|
|
function bit uvm_root::m_add_child (uvm_component child);
|
| 625 |
|
|
if(super.m_add_child(child)) begin
|
| 626 |
|
|
if(child.get_name() == "uvm_test_top")
|
| 627 |
|
|
top_levels.push_front(child);
|
| 628 |
|
|
else
|
| 629 |
|
|
top_levels.push_back(child);
|
| 630 |
|
|
return 1;
|
| 631 |
|
|
end
|
| 632 |
|
|
else
|
| 633 |
|
|
return 0;
|
| 634 |
|
|
endfunction
|
| 635 |
|
|
|
| 636 |
|
|
|
| 637 |
|
|
// build_phase
|
| 638 |
|
|
// -----
|
| 639 |
|
|
|
| 640 |
|
|
function void uvm_root::build_phase(uvm_phase phase);
|
| 641 |
|
|
|
| 642 |
|
|
super.build_phase(phase);
|
| 643 |
|
|
|
| 644 |
|
|
m_set_cl_msg_args();
|
| 645 |
|
|
|
| 646 |
|
|
m_do_verbosity_settings();
|
| 647 |
|
|
m_do_timeout_settings();
|
| 648 |
|
|
m_do_factory_settings();
|
| 649 |
|
|
m_do_config_settings();
|
| 650 |
|
|
m_do_max_quit_settings();
|
| 651 |
|
|
m_do_dump_args();
|
| 652 |
|
|
|
| 653 |
|
|
endfunction
|
| 654 |
|
|
|
| 655 |
|
|
|
| 656 |
|
|
// m_do_verbosity_settings
|
| 657 |
|
|
// -----------------------
|
| 658 |
|
|
|
| 659 |
|
|
function void uvm_root::m_do_verbosity_settings();
|
| 660 |
|
|
string set_verbosity_settings[$];
|
| 661 |
|
|
string split_vals[$];
|
| 662 |
|
|
uvm_verbosity tmp_verb;
|
| 663 |
|
|
|
| 664 |
|
|
// Retrieve them all into set_verbosity_settings
|
| 665 |
|
|
void'(clp.get_arg_values("+uvm_set_verbosity=", set_verbosity_settings));
|
| 666 |
|
|
|
| 667 |
|
|
for(int i = 0; i < set_verbosity_settings.size(); i++) begin
|
| 668 |
|
|
uvm_split_string(set_verbosity_settings[i], ",", split_vals);
|
| 669 |
|
|
if(split_vals.size() < 4 || split_vals.size() > 5) begin
|
| 670 |
|
|
uvm_report_warning("INVLCMDARGS",
|
| 671 |
|
|
$sformatf("Invalid number of arguments found on the command line for setting '+uvm_set_verbosity=%s'. Setting ignored.",
|
| 672 |
|
|
set_verbosity_settings[i]), UVM_NONE, "", "");
|
| 673 |
|
|
end
|
| 674 |
|
|
// Invalid verbosity
|
| 675 |
|
|
if(!clp.m_convert_verb(split_vals[2], tmp_verb)) begin
|
| 676 |
|
|
uvm_report_warning("INVLCMDVERB",
|
| 677 |
|
|
$sformatf("Invalid verbosity found on the command line for setting '%s'.",
|
| 678 |
|
|
set_verbosity_settings[i]), UVM_NONE, "", "");
|
| 679 |
|
|
end
|
| 680 |
|
|
end
|
| 681 |
|
|
endfunction
|
| 682 |
|
|
|
| 683 |
|
|
|
| 684 |
|
|
// m_do_timeout_settings
|
| 685 |
|
|
// ---------------------
|
| 686 |
|
|
|
| 687 |
|
|
function void uvm_root::m_do_timeout_settings();
|
| 688 |
|
|
string timeout_settings[$];
|
| 689 |
|
|
string timeout;
|
| 690 |
|
|
string split_timeout[$];
|
| 691 |
|
|
int timeout_count;
|
| 692 |
|
|
time timeout_int;
|
| 693 |
|
|
string override_spec;
|
| 694 |
|
|
timeout_count = clp.get_arg_values("+UVM_TIMEOUT=", timeout_settings);
|
| 695 |
|
|
if (timeout_count == 0)
|
| 696 |
|
|
return;
|
| 697 |
|
|
else begin
|
| 698 |
|
|
timeout = timeout_settings[0];
|
| 699 |
|
|
if (timeout_count > 1) begin
|
| 700 |
|
|
string timeout_list;
|
| 701 |
|
|
string sep;
|
| 702 |
|
|
for (int i = 0; i < timeout_settings.size(); i++) begin
|
| 703 |
|
|
if (i != 0)
|
| 704 |
|
|
sep = "; ";
|
| 705 |
|
|
timeout_list = {timeout_list, sep, timeout_settings[i]};
|
| 706 |
|
|
end
|
| 707 |
|
|
uvm_report_warning("MULTTIMOUT",
|
| 708 |
|
|
$sformatf("Multiple (%0d) +UVM_TIMEOUT arguments provided on the command line. '%s' will be used. Provided list: %s.",
|
| 709 |
|
|
timeout_count, timeout, timeout_list), UVM_NONE);
|
| 710 |
|
|
end
|
| 711 |
|
|
uvm_report_info("TIMOUTSET",
|
| 712 |
|
|
$sformatf("'+UVM_TIMEOUT=%s' provided on the command line is being applied.", timeout), UVM_NONE);
|
| 713 |
|
|
void'($sscanf(timeout,"%d,%s",timeout_int,override_spec));
|
| 714 |
|
|
case(override_spec)
|
| 715 |
|
|
"YES" : set_timeout(timeout_int, 1);
|
| 716 |
|
|
"NO" : set_timeout(timeout_int, 0);
|
| 717 |
|
|
default : set_timeout(timeout_int, 1);
|
| 718 |
|
|
endcase
|
| 719 |
|
|
end
|
| 720 |
|
|
endfunction
|
| 721 |
|
|
|
| 722 |
|
|
|
| 723 |
|
|
// m_do_factory_settings
|
| 724 |
|
|
// ---------------------
|
| 725 |
|
|
|
| 726 |
|
|
function void uvm_root::m_do_factory_settings();
|
| 727 |
|
|
string args[$];
|
| 728 |
|
|
|
| 729 |
|
|
void'(clp.get_arg_matches("/^\\+(UVM_SET_INST_OVERRIDE|uvm_set_inst_override)=/",args));
|
| 730 |
|
|
foreach(args[i]) begin
|
| 731 |
|
|
m_process_inst_override(args[i].substr(23, args[i].len()-1));
|
| 732 |
|
|
end
|
| 733 |
|
|
void'(clp.get_arg_matches("/^\\+(UVM_SET_TYPE_OVERRIDE|uvm_set_type_override)=/",args));
|
| 734 |
|
|
foreach(args[i]) begin
|
| 735 |
|
|
m_process_type_override(args[i].substr(23, args[i].len()-1));
|
| 736 |
|
|
end
|
| 737 |
|
|
endfunction
|
| 738 |
|
|
|
| 739 |
|
|
|
| 740 |
|
|
// m_process_inst_override
|
| 741 |
|
|
// -----------------------
|
| 742 |
|
|
|
| 743 |
|
|
function void uvm_root::m_process_inst_override(string ovr);
|
| 744 |
|
|
string split_val[$];
|
| 745 |
|
|
uvm_coreservice_t cs = uvm_coreservice_t::get();
|
| 746 |
|
|
uvm_factory factory=cs.get_factory();
|
| 747 |
|
|
|
| 748 |
|
|
uvm_split_string(ovr, ",", split_val);
|
| 749 |
|
|
|
| 750 |
|
|
if(split_val.size() != 3 ) begin
|
| 751 |
|
|
uvm_report_error("UVM_CMDLINE_PROC", {"Invalid setting for +uvm_set_inst_override=", ovr,
|
| 752 |
|
|
", setting must specify ,,"}, UVM_NONE);
|
| 753 |
|
|
return;
|
| 754 |
|
|
end
|
| 755 |
|
|
|
| 756 |
|
|
uvm_report_info("INSTOVR", {"Applying instance override from the command line: +uvm_set_inst_override=", ovr}, UVM_NONE);
|
| 757 |
|
|
factory.set_inst_override_by_name(split_val[0], split_val[1], split_val[2]);
|
| 758 |
|
|
endfunction
|
| 759 |
|
|
|
| 760 |
|
|
|
| 761 |
|
|
// m_process_type_override
|
| 762 |
|
|
// -----------------------
|
| 763 |
|
|
|
| 764 |
|
|
function void uvm_root::m_process_type_override(string ovr);
|
| 765 |
|
|
string split_val[$];
|
| 766 |
|
|
int replace=1;
|
| 767 |
|
|
uvm_coreservice_t cs = uvm_coreservice_t::get();
|
| 768 |
|
|
uvm_factory factory=cs.get_factory();
|
| 769 |
|
|
|
| 770 |
|
|
uvm_split_string(ovr, ",", split_val);
|
| 771 |
|
|
|
| 772 |
|
|
if(split_val.size() > 3 || split_val.size() < 2) begin
|
| 773 |
|
|
uvm_report_error("UVM_CMDLINE_PROC", {"Invalid setting for +uvm_set_type_override=", ovr,
|
| 774 |
|
|
", setting must specify ,[,]"}, UVM_NONE);
|
| 775 |
|
|
return;
|
| 776 |
|
|
end
|
| 777 |
|
|
|
| 778 |
|
|
// Replace arg is optional. If set, must be 0 or 1
|
| 779 |
|
|
if(split_val.size() == 3) begin
|
| 780 |
|
|
if(split_val[2]=="0") replace = 0;
|
| 781 |
|
|
else if (split_val[2] == "1") replace = 1;
|
| 782 |
|
|
else begin
|
| 783 |
|
|
uvm_report_error("UVM_CMDLINE_PROC", {"Invalid replace arg for +uvm_set_type_override=", ovr ," value must be 0 or 1"}, UVM_NONE);
|
| 784 |
|
|
return;
|
| 785 |
|
|
end
|
| 786 |
|
|
end
|
| 787 |
|
|
|
| 788 |
|
|
uvm_report_info("UVM_CMDLINE_PROC", {"Applying type override from the command line: +uvm_set_type_override=", ovr}, UVM_NONE);
|
| 789 |
|
|
factory.set_type_override_by_name(split_val[0], split_val[1], replace);
|
| 790 |
|
|
endfunction
|
| 791 |
|
|
|
| 792 |
|
|
|
| 793 |
|
|
// m_process_config
|
| 794 |
|
|
// ----------------
|
| 795 |
|
|
|
| 796 |
|
|
function void uvm_root::m_process_config(string cfg, bit is_int);
|
| 797 |
|
|
uvm_bitstream_t v;
|
| 798 |
|
|
string split_val[$];
|
| 799 |
|
|
uvm_root m_uvm_top;
|
| 800 |
|
|
uvm_coreservice_t cs;
|
| 801 |
|
|
cs = uvm_coreservice_t::get();
|
| 802 |
|
|
m_uvm_top = cs.get_root();
|
| 803 |
|
|
|
| 804 |
|
|
|
| 805 |
|
|
uvm_split_string(cfg, ",", split_val);
|
| 806 |
|
|
if(split_val.size() == 1) begin
|
| 807 |
|
|
uvm_report_error("UVM_CMDLINE_PROC", {"Invalid +uvm_set_config command\"", cfg,
|
| 808 |
|
|
"\" missing field and value: component is \"", split_val[0], "\""}, UVM_NONE);
|
| 809 |
|
|
return;
|
| 810 |
|
|
end
|
| 811 |
|
|
|
| 812 |
|
|
if(split_val.size() == 2) begin
|
| 813 |
|
|
uvm_report_error("UVM_CMDLINE_PROC", {"Invalid +uvm_set_config command\"", cfg,
|
| 814 |
|
|
"\" missing value: component is \"", split_val[0], "\" field is \"", split_val[1], "\""}, UVM_NONE);
|
| 815 |
|
|
return;
|
| 816 |
|
|
end
|
| 817 |
|
|
|
| 818 |
|
|
if(split_val.size() > 3) begin
|
| 819 |
|
|
uvm_report_error("UVM_CMDLINE_PROC",
|
| 820 |
|
|
$sformatf("Invalid +uvm_set_config command\"%s\" : expected only 3 fields (component, field and value).", cfg), UVM_NONE);
|
| 821 |
|
|
return;
|
| 822 |
|
|
end
|
| 823 |
|
|
|
| 824 |
|
|
if(is_int) begin
|
| 825 |
|
|
if(split_val[2].len() > 2) begin
|
| 826 |
|
|
string base, extval;
|
| 827 |
|
|
base = split_val[2].substr(0,1);
|
| 828 |
|
|
extval = split_val[2].substr(2,split_val[2].len()-1);
|
| 829 |
|
|
case(base)
|
| 830 |
|
|
"'b" : v = extval.atobin();
|
| 831 |
|
|
"0b" : v = extval.atobin();
|
| 832 |
|
|
"'o" : v = extval.atooct();
|
| 833 |
|
|
"'d" : v = extval.atoi();
|
| 834 |
|
|
"'h" : v = extval.atohex();
|
| 835 |
|
|
"'x" : v = extval.atohex();
|
| 836 |
|
|
"0x" : v = extval.atohex();
|
| 837 |
|
|
default : v = split_val[2].atoi();
|
| 838 |
|
|
endcase
|
| 839 |
|
|
end
|
| 840 |
|
|
else begin
|
| 841 |
|
|
v = split_val[2].atoi();
|
| 842 |
|
|
end
|
| 843 |
|
|
uvm_report_info("UVM_CMDLINE_PROC", {"Applying config setting from the command line: +uvm_set_config_int=", cfg}, UVM_NONE);
|
| 844 |
|
|
uvm_config_int::set(m_uvm_top, split_val[0], split_val[1], v);
|
| 845 |
|
|
end
|
| 846 |
|
|
else begin
|
| 847 |
|
|
uvm_report_info("UVM_CMDLINE_PROC", {"Applying config setting from the command line: +uvm_set_config_string=", cfg}, UVM_NONE);
|
| 848 |
|
|
uvm_config_string::set(m_uvm_top, split_val[0], split_val[1], split_val[2]);
|
| 849 |
|
|
end
|
| 850 |
|
|
|
| 851 |
|
|
endfunction
|
| 852 |
|
|
|
| 853 |
|
|
// m_process_default_sequence
|
| 854 |
|
|
// ----------------
|
| 855 |
|
|
|
| 856 |
|
|
function void uvm_root::m_process_default_sequence(string cfg);
|
| 857 |
|
|
string split_val[$];
|
| 858 |
|
|
uvm_coreservice_t cs = uvm_coreservice_t::get();
|
| 859 |
|
|
uvm_root m_uvm_top = cs.get_root();
|
| 860 |
|
|
uvm_factory f = cs.get_factory();
|
| 861 |
|
|
uvm_object_wrapper w;
|
| 862 |
|
|
|
| 863 |
|
|
uvm_split_string(cfg, ",", split_val);
|
| 864 |
|
|
if(split_val.size() == 1) begin
|
| 865 |
|
|
uvm_report_error("UVM_CMDLINE_PROC", {"Invalid +uvm_set_default_sequence command\"", cfg,
|
| 866 |
|
|
"\" missing phase and type: sequencer is \"", split_val[0], "\""}, UVM_NONE);
|
| 867 |
|
|
return;
|
| 868 |
|
|
end
|
| 869 |
|
|
|
| 870 |
|
|
if(split_val.size() == 2) begin
|
| 871 |
|
|
uvm_report_error("UVM_CMDLINE_PROC", {"Invalid +uvm_set_default_sequence command\"", cfg,
|
| 872 |
|
|
"\" missing type: sequencer is \"", split_val[0], "\" phase is \"", split_val[1], "\""}, UVM_NONE);
|
| 873 |
|
|
return;
|
| 874 |
|
|
end
|
| 875 |
|
|
|
| 876 |
|
|
if(split_val.size() > 3) begin
|
| 877 |
|
|
uvm_report_error("UVM_CMDLINE_PROC",
|
| 878 |
|
|
$sformatf("Invalid +uvm_set_default_sequence command\"%s\" : expected only 3 fields (sequencer, phase and type).", cfg), UVM_NONE);
|
| 879 |
|
|
return;
|
| 880 |
|
|
end
|
| 881 |
|
|
|
| 882 |
|
|
w = f.find_wrapper_by_name(split_val[2]);
|
| 883 |
|
|
if (w == null) begin
|
| 884 |
|
|
uvm_report_error("UVM_CMDLINE_PROC",
|
| 885 |
|
|
$sformatf("Invalid type '%s' provided to +uvm_set_default_sequence", split_val[2]),
|
| 886 |
|
|
UVM_NONE);
|
| 887 |
|
|
return;
|
| 888 |
|
|
end
|
| 889 |
|
|
else begin
|
| 890 |
|
|
uvm_report_info("UVM_CMDLINE_PROC", {"Setting default sequence from the command line: +uvm_set_default_sequence=", cfg}, UVM_NONE);
|
| 891 |
|
|
uvm_config_db#(uvm_object_wrapper)::set(this, {split_val[0], ".", split_val[1]}, "default_sequence", w);
|
| 892 |
|
|
end
|
| 893 |
|
|
|
| 894 |
|
|
endfunction : m_process_default_sequence
|
| 895 |
|
|
|
| 896 |
|
|
|
| 897 |
|
|
// m_do_config_settings
|
| 898 |
|
|
// --------------------
|
| 899 |
|
|
|
| 900 |
|
|
function void uvm_root::m_do_config_settings();
|
| 901 |
|
|
string args[$];
|
| 902 |
|
|
|
| 903 |
|
|
void'(clp.get_arg_matches("/^\\+(UVM_SET_CONFIG_INT|uvm_set_config_int)=/",args));
|
| 904 |
|
|
foreach(args[i]) begin
|
| 905 |
|
|
m_process_config(args[i].substr(20, args[i].len()-1), 1);
|
| 906 |
|
|
end
|
| 907 |
|
|
void'(clp.get_arg_matches("/^\\+(UVM_SET_CONFIG_STRING|uvm_set_config_string)=/",args));
|
| 908 |
|
|
foreach(args[i]) begin
|
| 909 |
|
|
m_process_config(args[i].substr(23, args[i].len()-1), 0);
|
| 910 |
|
|
end
|
| 911 |
|
|
void'(clp.get_arg_matches("/^\\+(UVM_SET_DEFAULT_SEQUENCE|uvm_set_default_sequence)=/", args));
|
| 912 |
|
|
foreach(args[i]) begin
|
| 913 |
|
|
m_process_default_sequence(args[i].substr(26, args[i].len()-1));
|
| 914 |
|
|
end
|
| 915 |
|
|
endfunction
|
| 916 |
|
|
|
| 917 |
|
|
|
| 918 |
|
|
// m_do_max_quit_settings
|
| 919 |
|
|
// ----------------------
|
| 920 |
|
|
|
| 921 |
|
|
function void uvm_root::m_do_max_quit_settings();
|
| 922 |
|
|
uvm_report_server srvr;
|
| 923 |
|
|
string max_quit_settings[$];
|
| 924 |
|
|
int max_quit_count;
|
| 925 |
|
|
string max_quit;
|
| 926 |
|
|
string split_max_quit[$];
|
| 927 |
|
|
int max_quit_int;
|
| 928 |
|
|
srvr = uvm_report_server::get_server();
|
| 929 |
|
|
max_quit_count = clp.get_arg_values("+UVM_MAX_QUIT_COUNT=", max_quit_settings);
|
| 930 |
|
|
if (max_quit_count == 0)
|
| 931 |
|
|
return;
|
| 932 |
|
|
else begin
|
| 933 |
|
|
max_quit = max_quit_settings[0];
|
| 934 |
|
|
if (max_quit_count > 1) begin
|
| 935 |
|
|
string max_quit_list;
|
| 936 |
|
|
string sep;
|
| 937 |
|
|
for (int i = 0; i < max_quit_settings.size(); i++) begin
|
| 938 |
|
|
if (i != 0)
|
| 939 |
|
|
sep = "; ";
|
| 940 |
|
|
max_quit_list = {max_quit_list, sep, max_quit_settings[i]};
|
| 941 |
|
|
end
|
| 942 |
|
|
uvm_report_warning("MULTMAXQUIT",
|
| 943 |
|
|
$sformatf("Multiple (%0d) +UVM_MAX_QUIT_COUNT arguments provided on the command line. '%s' will be used. Provided list: %s.",
|
| 944 |
|
|
max_quit_count, max_quit, max_quit_list), UVM_NONE);
|
| 945 |
|
|
end
|
| 946 |
|
|
uvm_report_info("MAXQUITSET",
|
| 947 |
|
|
$sformatf("'+UVM_MAX_QUIT_COUNT=%s' provided on the command line is being applied.", max_quit), UVM_NONE);
|
| 948 |
|
|
uvm_split_string(max_quit, ",", split_max_quit);
|
| 949 |
|
|
max_quit_int = split_max_quit[0].atoi();
|
| 950 |
|
|
case(split_max_quit[1])
|
| 951 |
|
|
"YES" : srvr.set_max_quit_count(max_quit_int, 1);
|
| 952 |
|
|
"NO" : srvr.set_max_quit_count(max_quit_int, 0);
|
| 953 |
|
|
default : srvr.set_max_quit_count(max_quit_int, 1);
|
| 954 |
|
|
endcase
|
| 955 |
|
|
end
|
| 956 |
|
|
endfunction
|
| 957 |
|
|
|
| 958 |
|
|
|
| 959 |
|
|
// m_do_dump_args
|
| 960 |
|
|
// --------------
|
| 961 |
|
|
|
| 962 |
|
|
function void uvm_root::m_do_dump_args();
|
| 963 |
|
|
string dump_args[$];
|
| 964 |
|
|
string all_args[$];
|
| 965 |
|
|
string out_string;
|
| 966 |
|
|
if(clp.get_arg_matches("+UVM_DUMP_CMDLINE_ARGS", dump_args)) begin
|
| 967 |
|
|
clp.get_args(all_args);
|
| 968 |
|
|
for (int i = 0; i < all_args.size(); i++) begin
|
| 969 |
|
|
if (all_args[i] == "__-f__")
|
| 970 |
|
|
continue;
|
| 971 |
|
|
out_string = {out_string, all_args[i], " "};
|
| 972 |
|
|
end
|
| 973 |
|
|
uvm_report_info("DUMPARGS", out_string, UVM_NONE);
|
| 974 |
|
|
end
|
| 975 |
|
|
endfunction
|
| 976 |
|
|
|
| 977 |
|
|
|
| 978 |
|
|
// m_check_verbosity
|
| 979 |
|
|
// ----------------
|
| 980 |
|
|
|
| 981 |
|
|
function void uvm_root::m_check_verbosity();
|
| 982 |
|
|
|
| 983 |
|
|
string verb_string;
|
| 984 |
|
|
string verb_settings[$];
|
| 985 |
|
|
int verb_count;
|
| 986 |
|
|
int plusarg;
|
| 987 |
|
|
int verbosity = UVM_MEDIUM;
|
| 988 |
|
|
|
| 989 |
|
|
`ifndef UVM_CMDLINE_NO_DPI
|
| 990 |
|
|
// Retrieve the verbosities provided on the command line.
|
| 991 |
|
|
verb_count = clp.get_arg_values("+UVM_VERBOSITY=", verb_settings);
|
| 992 |
|
|
`else
|
| 993 |
|
|
verb_count = $value$plusargs("UVM_VERBOSITY=%s",verb_string);
|
| 994 |
|
|
if (verb_count)
|
| 995 |
|
|
verb_settings.push_back(verb_string);
|
| 996 |
|
|
`endif
|
| 997 |
|
|
|
| 998 |
|
|
// If none provided, provide message about the default being used.
|
| 999 |
|
|
//if (verb_count == 0)
|
| 1000 |
|
|
// uvm_report_info("DEFVERB", ("No verbosity specified on the command line. Using the default: UVM_MEDIUM"), UVM_NONE);
|
| 1001 |
|
|
|
| 1002 |
|
|
// If at least one, use the first.
|
| 1003 |
|
|
if (verb_count > 0) begin
|
| 1004 |
|
|
verb_string = verb_settings[0];
|
| 1005 |
|
|
plusarg = 1;
|
| 1006 |
|
|
end
|
| 1007 |
|
|
|
| 1008 |
|
|
// If more than one, provide the warning stating how many, which one will
|
| 1009 |
|
|
// be used and the complete list.
|
| 1010 |
|
|
if (verb_count > 1) begin
|
| 1011 |
|
|
string verb_list;
|
| 1012 |
|
|
string sep;
|
| 1013 |
|
|
for (int i = 0; i < verb_settings.size(); i++) begin
|
| 1014 |
|
|
if (i != 0)
|
| 1015 |
|
|
sep = ", ";
|
| 1016 |
|
|
verb_list = {verb_list, sep, verb_settings[i]};
|
| 1017 |
|
|
end
|
| 1018 |
|
|
uvm_report_warning("MULTVERB",
|
| 1019 |
|
|
$sformatf("Multiple (%0d) +UVM_VERBOSITY arguments provided on the command line. '%s' will be used. Provided list: %s.", verb_count, verb_string, verb_list), UVM_NONE);
|
| 1020 |
|
|
end
|
| 1021 |
|
|
|
| 1022 |
|
|
if(plusarg == 1) begin
|
| 1023 |
|
|
case(verb_string)
|
| 1024 |
|
|
"UVM_NONE" : verbosity = UVM_NONE;
|
| 1025 |
|
|
"NONE" : verbosity = UVM_NONE;
|
| 1026 |
|
|
"UVM_LOW" : verbosity = UVM_LOW;
|
| 1027 |
|
|
"LOW" : verbosity = UVM_LOW;
|
| 1028 |
|
|
"UVM_MEDIUM" : verbosity = UVM_MEDIUM;
|
| 1029 |
|
|
"MEDIUM" : verbosity = UVM_MEDIUM;
|
| 1030 |
|
|
"UVM_HIGH" : verbosity = UVM_HIGH;
|
| 1031 |
|
|
"HIGH" : verbosity = UVM_HIGH;
|
| 1032 |
|
|
"UVM_FULL" : verbosity = UVM_FULL;
|
| 1033 |
|
|
"FULL" : verbosity = UVM_FULL;
|
| 1034 |
|
|
"UVM_DEBUG" : verbosity = UVM_DEBUG;
|
| 1035 |
|
|
"DEBUG" : verbosity = UVM_DEBUG;
|
| 1036 |
|
|
default : begin
|
| 1037 |
|
|
verbosity = verb_string.atoi();
|
| 1038 |
|
|
if(verbosity > 0)
|
| 1039 |
|
|
uvm_report_info("NSTVERB", $sformatf("Non-standard verbosity value, using provided '%0d'.", verbosity), UVM_NONE);
|
| 1040 |
|
|
if(verbosity == 0) begin
|
| 1041 |
|
|
verbosity = UVM_MEDIUM;
|
| 1042 |
|
|
uvm_report_warning("ILLVERB", "Illegal verbosity value, using default of UVM_MEDIUM.", UVM_NONE);
|
| 1043 |
|
|
end
|
| 1044 |
|
|
end
|
| 1045 |
|
|
endcase
|
| 1046 |
|
|
end
|
| 1047 |
|
|
|
| 1048 |
|
|
set_report_verbosity_level_hier(verbosity);
|
| 1049 |
|
|
|
| 1050 |
|
|
endfunction
|
| 1051 |
|
|
|
| 1052 |
|
|
// It is required that the run phase start at simulation time 0
|
| 1053 |
|
|
// TBD this looks wrong - taking advantage of uvm_root not doing anything else?
|
| 1054 |
|
|
// TBD move to phase_started callback?
|
| 1055 |
|
|
task uvm_root::run_phase (uvm_phase phase);
|
| 1056 |
|
|
// check that the commandline are took effect
|
| 1057 |
|
|
foreach(m_uvm_applied_cl_action[idx])
|
| 1058 |
|
|
if(m_uvm_applied_cl_action[idx].used==0) begin
|
| 1059 |
|
|
`uvm_warning("INVLCMDARGS",$sformatf("\"+uvm_set_action=%s\" never took effect due to a mismatching component pattern",m_uvm_applied_cl_action[idx].arg))
|
| 1060 |
|
|
end
|
| 1061 |
|
|
foreach(m_uvm_applied_cl_sev[idx])
|
| 1062 |
|
|
if(m_uvm_applied_cl_sev[idx].used==0) begin
|
| 1063 |
|
|
`uvm_warning("INVLCMDARGS",$sformatf("\"+uvm_set_severity=%s\" never took effect due to a mismatching component pattern",m_uvm_applied_cl_sev[idx].arg))
|
| 1064 |
|
|
end
|
| 1065 |
|
|
|
| 1066 |
|
|
if($time > 0)
|
| 1067 |
|
|
`uvm_fatal("RUNPHSTIME", {"The run phase must start at time 0, current time is ",
|
| 1068 |
|
|
$sformatf("%0t", $realtime), ". No non-zero delays are allowed before ",
|
| 1069 |
|
|
"run_test(), and pre-run user defined phases may not consume ",
|
| 1070 |
|
|
"simulation time before the start of the run phase."})
|
| 1071 |
|
|
endtask
|
| 1072 |
|
|
|