Class uvm_phase
Name |
Type |
Description |
---|---|---|
max_ready_to_end_iter |
int unsigned |
|
phase_done |
phase done objection |
Constructors
- function new ( string name, uvm_phase_type phase_type, uvm_phase parent ) [source]
Create a new phase node, with a name and a note of its type
name
name of this phase
type
a value in uvm_phase_type. New
Functions
- function uvm_phase_type get_phase_type ( ) [source]
Returns the phase type as defined by uvm_phase_type. Get_phase_type
- function uvm_phase_state get_state ( ) [source]
Accessor to return current state of this phase. Get_state
- virtual function void exec_func ( uvm_component comp, uvm_phase phase ) [source]
Implements the functor/delegate functionality for a function phase type
comp
the component to execute the functionality upon
phase
the phase schedule that originated this phase call
- function void add ( uvm_phase phase, uvm_phase with_phase, uvm_phase after_phase, uvm_phase before_phase ) [source]
Build up a schedule structure inserting phase by phase, specifying linkage
Phases can be added anywhere, in series or parallel with existing nodes
phase
handle of singleton derived imp containing actual functor. by default the new phase is appended to the schedule
with_phase
specify to add the new phase in parallel with this one
after_phase
specify to add the new phase as successor to this one
before_phase
specify to add the new phase as predecessor to this one. Add
TBD error checks if param nodes are actually in this schedule or not
- function uvm_domain get_domain ( ) [source]
Returns the enclosing domain. Get_domain
- function void get_adjacent_predecessor_nodes ( uvm_phase pred ) [source]
Provides an array of nodes which are predecessors to this phase node. A 'predecessor node' is defined as any phase node which lies prior to this node in the phase graph, with no nodes between this node and the predecessor node.
- function uvm_objection get_objection ( ) [source]
Return the uvm_objection that gates the termination of the phase.
- virtual function void raise_objection ( uvm_object obj, string description, int count ) [source]
Raise an objection to ending this phase Provides components with greater control over the phase flow for processes which are not implicit objectors to the phase.
while(1) begin some_phase.raise_objection(this); ... some_phase.drop_objection(this); end ... Raise_objection
- virtual function void drop_objection ( uvm_object obj, string description, int count ) [source]
Drop an objection to ending this phase
The drop is expected to be matched with an earlier raise. Drop_objection
- virtual function int get_objection_count ( uvm_object obj ) [source]
Returns the current number of objections to ending this phase raised by the given object . Get_objection_count
- function void sync ( uvm_domain target, uvm_phase phase, uvm_phase with_phase ) [source]
Synchronize two domains, fully or partially
target
handle of target domain to synchronize this one to
phase
optional single phase in this domain to synchronize, otherwise sync all
with_phase
optional different target-domain phase to synchronize with, otherwise use phase in the target domain. Sync
- function void unsync ( uvm_domain target, uvm_phase phase, uvm_phase with_phase ) [source]
Remove synchronization between two domains, fully or partially
target
handle of target domain to remove synchronization from
phase
optional single phase in this domain to un-synchronize, otherwise unsync all
with_phase
optional different target-domain phase to un-synchronize with, otherwise use phase in the target domain. Unsync
- function void jump ( uvm_phase phase ) [source]
Jump to a specified phase . If the destination phase is within the current phase schedule, a simple local jump takes place. If the jump-to phase is outside of the current schedule then the jump affects other schedules which share the phase. Jump
Note that this function does not directly alter flow of control. That is, the new phase is not initiated in this function. Rather, flags are set which execute_phase() uses to determine that a jump has been requested and performs the jump.
- function void set_jump_phase ( uvm_phase phase ) [source]
Specify a phase to transition to when phase is complete. Note that this function is part of what jump() does; unlike jump() it does not set the flag to terminate the phase prematurely. Set_jump_phase
Specify a phase to transition to when phase is complete.
- virtual function void traverse ( uvm_component comp, uvm_phase phase, uvm_phase_state state ) [source]
Implementation
Callbacks
Provide the required component traversal behavior. Called by execute()
- virtual function void execute ( uvm_component comp, uvm_phase phase ) [source]
Provide the required per-component execution flow. Called by traverse()
- function void clear ( uvm_phase_state state ) [source]
Clear
for internal graph maintenance after a forward jump
- function void clear_successors ( uvm_phase_state state, uvm_phase end_state ) [source]
Clear_successors
for internal graph maintenance after a forward jump called only by execute_phase() depth-first traversal of the DAG, calliing clear() on each node do not clear the end phase or beyond
Tasks
- virtual function exec_task ( uvm_component comp, uvm_phase phase ) [source]
Implements the functor/delegate functionality for a task phase type
comp
the component to execute the functionality upon
phase
the phase schedule that originated this phase call
- function wait_for_state ( uvm_phase_state state, uvm_wait_op op ) [source]
Wait until this phase compares with the given state and op operand. For <UVM_EQ> and <UVM_NE> operands, several uvm_phase_states can be supplied by ORing their enum constants, in which case the caller will wait until the phase state is any of (UVM_EQ) or none of (UVM_NE) the provided states.
To wait for the phase to be at the started state or after
wait_for_state(UVM_PHASE_STARTED, UVM_GTE);
To wait for the phase to be either started or executing
wait_for_state(UVM_PHASE_STARTED | UVM_PHASE_EXECUTING, UVM_EQ);. Wait_for_state
This base class defines everything about a phase
behavior, state, and context.
To define behavior, it is extended by UVM or the user to create singleton objects which capture the definition of what the phase does and how it does it. These are then cloned to produce multiple nodes which are hooked up in a graph structure to provide context: which phases follow which, and to hold the state of the phase throughout its lifetime. UVM provides default extensions of this class for the standard runtime phases. VIP Providers can likewise extend this class to define the phase functor for a particular component context as required.
This base class defines everything about a phase
behavior, state, and context.
To define behavior, it is extended by UVM or the user to create singleton objects which capture the definition of what the phase does and how it does it. These are then cloned to produce multiple nodes which are hooked up in a graph structure to provide context: which phases follow which, and to hold the state of the phase throughout its lifetime. UVM provides default extensions of this class for the standard runtime phases. VIP Providers can likewise extend this class to define the phase functor for a particular component context as required.
Phase Definition
Singleton instances of those extensions are provided as package variables. These instances define the attributes of the phase (not what state it is in) They are then cloned into schedule nodes which point back to one of these implementations, and calls its virtual task or function methods on each participating component. It is the base class for phase functors, for both predefined and user-defined phases. Per-component overrides can use a customized imp.
To create custom phases, do not extend uvm_phase directly
see the
three predefined extended classes below which encapsulate behavior for different phase types: task, bottom-up function and top-down function.
Extend the appropriate one of these to create a uvm_YOURNAME_phase class (or YOURPREFIX_NAME_phase class) for each phase, containing the default implementation of the new phase, which must be a uvm_component-compatible delegate, and which may be a null implementation. Instantiate a singleton instance of that class for your code to use when a phase handle is required. If your custom phase depends on methods that are not in uvm_component, but are within an extended class, then extend the base YOURPREFIX_NAME_phase class with parameterized component class context as required, to create a specialized functor which calls your extended component class methods. This scheme ensures compile-safety for your extended component classes while providing homogeneous base types for APIs and underlying data structures.
Phase Context
A schedule is a coherent group of one or mode phase/state nodes linked together by a graph structure, allowing arbitrary linear/parallel relationships to be specified, and executed by stepping through them in the graph order. Each schedule node points to a phase and holds the execution state of that phase, and has optional links to other nodes for synchronization.
The main operations are
construct, add phases, and instantiate
hierarchically within another schedule.
Structure is a DAG (Directed Acyclic Graph). Each instance is a node connected to others to form the graph. Hierarchy is overlaid with m_parent. Each node in the graph has zero or more successors, and zero or more predecessors. No nodes are completely isolated from others. Exactly one node has zero predecessors. This is the root node. Also the graph is acyclic, meaning for all nodes in the graph, by following the forward arrows you will never end up back where you started but you will eventually reach a node that has no successors.
Phase State
A given phase may appear multiple times in the complete phase graph, due to the multiple independent domain feature, and the ability for different VIP to customize their own phase schedules perhaps reusing existing phases. Each node instance in the graph maintains its own state of execution.
Phase Handle
Handles of this type uvm_phase are used frequently in the API, both by the user, to access phasing-specific API, and also as a parameter to some APIs. In many cases, the singleton phase handles can be used (eg. uvm_run_phase::get()) in APIs. For those APIs that need to look up that phase in the graph, this is done automatically.