ovm_root

The ovm_root class serves as the implicit top-level and phase controller for all OVM components.  Users do not directly instantiate ovm_root.  The OVM automatically creates a single instance of ovm_root that users can access via the global (ovm_pkg-scope) variable, ovm_top.

The ovm_top instance of ovm_root plays several key roles in the OVM.

Implicit top-levelThe ovm_top serves as an implicit top-level component.  Any component whose parent is specified as NULL becomes a child of ovm_top.  Thus, all OVM components in simulation are descendants of ovm_top.
Phase controlovm_top manages the phasing for all components.  There are eight phases predefined in every component: build, connect, end_of_elaboration, start_of_simulation, run, extract, check, and report.  Of these, only the run phase is a task.  All others are functions.  OVM’s flexible phasing mechanism allows users to insert any number of custom function and task-based phases.  See run_test, insert_phase, and stop_request, and others.
SearchUse ovm_top to search for components based on their hierarchical name.  See find and find_all.
Report configurationUse ovm_top to globally configure report verbosity, log files, and actions.  For example, ovm_top.set_report_verbosity_level_hier(OVM_FULL) would set full verbosity for all components in simulation.
Global reporterBecause ovm_top is globally accessible (in ovm_pkg scope), OVM’s reporting mechanism is accessible from anywhere outside ovm_component, such as in modules and sequences.  See ovm_report_error, ovm_report_warning, and other global methods.
Summary
ovm_root
The ovm_root class serves as the implicit top-level and phase controller for all OVM components.
Class Hierarchy
Class Declaration
class ovm_root extends ovm_component
Methods
run_testPhases all components through all registered phases.
stop_requestCalling this function triggers the process of shutting down the currently running task-based phase.
in_stop_requestThis function returns 1 if a stop request is currently active, and 0 otherwise.
insert_phaseInserts a new phase given by new_phase after the existing phase given by exist_phase.
find
find_allReturns the component handle (find) or list of components handles (find_all) matching a given string.
get_current_phaseReturns the handle of the currently executing phase.
get_phase_by_nameReturns the handle of the phase having the given name.
Variables
phase_timeout
stop_timeoutThese set watchdog timers for task-based phases and stop tasks.
enable_print_topologyIf set, then the entire testbench topology is printed just after completion of the end_of_elaboration phase.
finish_on_completionIf set, then run_test will call $finish after all phases are executed.
ovm_topThis is the top-level that governs phase execution and provides component search interface.
Methods
raised
all_dropped

run_test

virtual task run_test (string test_name = "")

Phases all components through all registered phases.  If the optional test_name argument is provided, or if a command-line plusarg, +OVM_TESTNAME=TEST_NAME, is found, then the specified component is created just prior to phasing.  The test may contain new verification components or the entire testbench, in which case the test and testbench can be chosen from the command line without forcing recompilation.  If the global (package) variable, finish_on_completion, is set, then $finish is called after phasing completes.

stop_request

function void stop_request()

Calling this function triggers the process of shutting down the currently running task-based phase.  This process involves calling all components’ stop tasks for those components whose enable_stop_interrupt bit is set.  Once all stop tasks return, or once the optional global_stop_timeout expires, all components’ kill method is called, effectively ending the current phase.  The ovm_top will then begin execution of the next phase, if any.

in_stop_request

function bit in_stop_request()

This function returns 1 if a stop request is currently active, and 0 otherwise.

insert_phase

function void insert_phase (ovm_phase new_phase,
ovm_phase exist_phase)

Inserts a new phase given by new_phase after the existing phase given by exist_phase.  The ovm_top maintains a queue of phases executed in consecutive order.  If exist_phase is null, then new_phase is inserted at the head of the queue, i.e., it becomes the first phase.

find

function ovm_component find (string comp_match)

find_all

function void find_all (string comp_match,  
ref ovm_component comps[$],  
input ovm_component comp = null)

Returns the component handle (find) or list of components handles (find_all) matching a given string.  The string may contain the wildcards,

  • and ?.  Strings beginning with ‘.’ are absolute path names.  If optional comp arg is provided, then search begins from that component down (default=all components).

get_current_phase

function ovm_phase get_current_phase ()

Returns the handle of the currently executing phase.

get_phase_by_name

function ovm_phase get_phase_by_name (string name)

Returns the handle of the phase having the given name.

phase_timeout

time phase_timeout = `OVM_DEFAULT_TIMEOUT

stop_timeout

time stop_timeout = `OVM_DEFAULT_TIMEOUT

These set watchdog timers for task-based phases and stop tasks.  The timeout is specified in absolute time.  The default timeout is set by the OVM_DEFAULT_TIMEOUT define.  A timeout at this value usually indicates a problem with your testbench, or failure to call global_stop_request.  When set to 0, the timeout is disabled.

enable_print_topology

bit enable_print_topology = 0

If set, then the entire testbench topology is printed just after completion of the end_of_elaboration phase.

finish_on_completion

bit finish_on_completion = 1

If set, then run_test will call $finish after all phases are executed.

ovm_top

`const ovm_root ovm_top = ovm_root::get()

This is the top-level that governs phase execution and provides component search interface.  See ovm_root for more information.

raised

function void ovm_root::raised (ovm_objection objection,
ovm_object source_obj,
int count)

all_dropped

task ovm_root::all_dropped (ovm_objection objection,
ovm_object source_obj,
int count)
virtual class ovm_object extends ovm_void
The ovm_object class is the base class for all OVM data and hierarchical classes.
class ovm_report_object extends ovm_object
The ovm_report_object provides an interface to the OVM reporting facility.
virtual class ovm_component extends ovm_report_object
The ovm_component class is the root base class for OVM components.
class ovm_root extends ovm_component
The ovm_root class serves as the implicit top-level and phase controller for all OVM components.
virtual task run_test (string test_name = "")
Phases all components through all registered phases.
function void stop_request()
Calling this function triggers the process of shutting down the currently running task-based phase.
function bit in_stop_request()
This function returns 1 if a stop request is currently active, and 0 otherwise.
function void insert_phase (ovm_phase new_phase,
ovm_phase exist_phase)
Inserts a new phase given by new_phase after the existing phase given by exist_phase.
function ovm_component find (string comp_match)
function void find_all (string comp_match,  
ref ovm_component comps[$],  
input ovm_component comp = null)
Returns the component handle (find) or list of components handles (find_all) matching a given string.
function ovm_phase get_current_phase ()
Returns the handle of the currently executing phase.
function ovm_phase get_phase_by_name (string name)
Returns the handle of the phase having the given name.
time phase_timeout = `OVM_DEFAULT_TIMEOUT
time stop_timeout = `OVM_DEFAULT_TIMEOUT
These set watchdog timers for task-based phases and stop tasks.
bit enable_print_topology = 0
If set, then the entire testbench topology is printed just after completion of the end_of_elaboration phase.
bit finish_on_completion = 1
If set, then run_test will call $finish after all phases are executed.
`const ovm_root ovm_top = ovm_root::get()
This is the top-level that governs phase execution and provides component search interface.
function void ovm_root::raised (ovm_objection objection,
ovm_object source_obj,
int count)
task ovm_root::all_dropped (ovm_objection objection,
ovm_object source_obj,
int count)
function void ovm_report_error(string id,  
string message,  
int verbosity =  OVM_LOW,
string filename =  "",
int line =  0)
function void ovm_report_warning(string id,  
string message,  
int verbosity =  OVM_MEDIUM,
string filename =  "",
int line =  0)
function void global_stop_request()
Convenience function for ovm_top.stop_request().