Integrated Phase Control - OVM-on-top

This class is used to wrap a VMM env for use as an ovm_component in an OVM environment.  The avt_ovm_vmm_env component provides default implementations of the OVM phases that delegate to the underlying VMM env’s phases.  Any number of vmm_env’s may be wrapped and reused using the avt_ovm_vmm_env.

All other VMM components, such as the vmm_subenv and vmm_xactor, do not require integrated phase support; they can be instantiated and initialized directly by the parent component using their respective APIs.

Implementation

New phases are added to OVM’s phasing lineup to accommodate VMM env phases that do not have a direct OVM mapping.  These include vmm_gen_cfg, which delegates to the VMM env’s gen_cfg phase, and vmm_report, which delegates to the report phase.  (OVM’s report phase is a function, whereas VMM’s report phase is a task.)  These extra phases are transparent to OVM components.

With VMM_OVM_INTEROP defined, VMM env phasing is controlled by the avt_ovm_vmm_env as follows:

       OVM                  VMM (env)
        |
    vmm_gen_cfg ---------> gen_cfg
        |
      build     --------->  build
        |
     connect
        |
end_of_elaboration
        |
start_of_simulation
        |
       run --------------> reset_dut
        |                  cfg_dut
        |                  start
        |                  wait_for_end
        |  stop
        |  request
        |   |
        |  stop----------> stop
        |   |              cleanup
        |   |
        X<--|
        |
        |
     extract
        |
      check
        |
      report
        |
    vmm_report ----------> report
        |
        *

Per the OVM use model, the user may customize avt_ovm_vmm_env’s default test flow by extending and overriding any or all of the OVM phase callbacks.  You can add functionality before or after calling super.<phase>, or you can completely replace the default implementation by not calling super.  The new avt_ovm_vmm_env subtype can then be selected on a type or instance basis via the ovm_factory.

Summary
Integrated Phase Control - OVM-on-top
This class is used to wrap a VMM env for use as an ovm_component in an OVM environment.

avt_ovm_vmm_env_base

The avt_ovm_vmm_env_base class is used to “wrap” an existing vmm_env subtype so that it may be reused as an ordinary OVM component in an OVM-on-top environment.  If an instance handle to the vmm_env subtype is not provided in the constructor, a new instance will be created and placed in the env public property.

When OVM runs through its phasing lineup, the avt_ovm_vmm_env_base component delegates to the appropriate phase methods in the underlying env object.  Thus, the VMM env phasing is sychronized with OVM phasing.  Although the default mapping between OVM and VMM phases is deemed the best in most applications, users may choose to override the phase methods in a subtype to this class to implement a different phasing scheme.

Summary
avt_ovm_vmm_env_base
The avt_ovm_vmm_env_base class is used to “wrap” an existing vmm_env subtype so that it may be reused as an ordinary OVM component in an OVM-on-top environment.
Class Hierarchy
ovm_component
avt_ovm_vmm_env_base
Class Declaration
class avt_ovm_vmm_env_base extends ovm_component
Variables
ok_to_stopWhen ok_to_stop is clear (default), the avt_ovm_vmm_env’s stop task will wait for the VMM env’s wait_for_end task to return before continuing.
auto_stop_requestWhen set, this bit enables calling an OVM stop_request after the VMM env’s wait_for_end task returns, thus ending OVM’s run phase coincident with VMM’s wait_for_end.
Methods
newCreates the vmm_env proxy class with the given name, parent, and optional vmm_env handle.
insert_vmm_phasesA static function that registers the vmm_gen_cfg phase callback with the OVM.
vmm_gen_cfgCalls the underlying VMM env’s gen_cfg phase.
buildCalls the underlying VMM env’s build phase.
vmm_reset_dutCalls the underlying VMM env’s reset_dut phase, provided this phase was enabled in the new constructor.
vmm_cfg_dutCalls the underlying VMM env’s cfg_dut phase, provided this phase was enabled in the new constructor.
runCalls the underlying VMM env’s reset_dut, cfg_dut, start, and wait_for_end phases, returning when the env’s end-of-test condition has been reached.
stopIf the run phase is being stopped, this task waits for the underlying env’s wait_for_end phase to return, then calls the VMM env’s stop and cleanup tasks.
vmm_reportCalls the underlying VMM env’s report method, then stops the reportvmm phase.

ok_to_stop

bit ok_to_stop = 0

When ok_to_stop is clear (default), the avt_ovm_vmm_env’s stop task will wait for the VMM env’s wait_for_end task to return before continuing.  This bit is automatically set with the underlying VMM env’s wait_for_end task returns, which allows the stop stop task to call the VMM env’s stop and cleanup phases.

If ok_to_stop is set manually, other OVM components will be able to terminate the run phase before the VMM env has returned from wait_for_end.

auto_stop_request

bit auto_stop_request = 0

When set, this bit enables calling an OVM stop_request after the VMM env’s wait_for_end task returns, thus ending OVM’s run phase coincident with VMM’s wait_for_end.  Default is 0.

A wrapped VMM env is now a mere subcomponent of a larger-scale OVM environment (that may incorporate multiple wrapped VMM envs).  A VMM envs’ end-of-test condition is no longer sufficient for determining the overall end-of-test condition.  Thus, the default value for auto_stop_request is 0.  Parent components of the VMM env wrapper may choose to wait on the posedge of ok_to_stop to indicate the VMM env has reached its end-of-test condition.

new

function new (string name,  
ovm_component parent = null,
vmm_env env = null)

Creates the vmm_env proxy class with the given name, parent, and optional vmm_env handle.  If the env handle is null, it is assumed that an extension of this class will be responsible for creating and assigning the m_env internal variable.

insert_vmm_phases

local static function bit insert_vmm_phases()

A static function that registers the vmm_gen_cfg phase callback with the OVM.  It is called as part of static initialization before any env or phasing can begin.  This allows the vmm_env to be created as an OVM component in build phase.

vmm_gen_cfg

virtual function void vmm_gen_cfg()

Calls the underlying VMM env’s gen_cfg phase.

build

virtual function void build()

Calls the underlying VMM env’s build phase.  Disables the underlying env from manually calling into the OVM’s phasing mechanism.

vmm_reset_dut

virtual task vmm_reset_dut()

Calls the underlying VMM env’s reset_dut phase, provided this phase was enabled in the new constructor.

vmm_cfg_dut

virtual task vmm_cfg_dut()

Calls the underlying VMM env’s cfg_dut phase, provided this phase was enabled in the new constructor.

run

virtual task run()

Calls the underlying VMM env’s reset_dut, cfg_dut, start, and wait_for_end phases, returning when the env’s end-of-test condition has been reached.  Extensions of this method may augment or remove certain end-of-test conditions from the underlying env’s consensus object before calling super.run().  When super.run() returns, extensions may choose to call ovm_top.stop_request() if the underlying env is the only governor of end-of-test.

Extensions may completely override this base implementation by not calling super.run().  In such cases, all four VMM phases must still be executed in the prescribed order.

stop

virtual task stop(string ph_name)

If the run phase is being stopped, this task waits for the underlying env’s wait_for_end phase to return, then calls the VMM env’s stop and cleanup tasks.  If the ok_to_stop variable is set at the time stop is called, then stop will not wait for wait_for_end to return.  This allows OVM components to control when the VMM env and its embedded xactors are stopped.

vmm_report

virtual task vmm_report()

Calls the underlying VMM env’s report method, then stops the reportvmm phase.  This phase is called after OVM’s report phase has completed.

avt_ovm_vmm_env

Use this class to wrap (contain) an existing VMM env whose constructor does not have a name argument.  See avt_ovm_vmm_env_base for more information.

Summary
avt_ovm_vmm_env
Use this class to wrap (contain) an existing VMM env whose constructor does not have a name argument.
Class Hierarchy
ovm_component
avt_ovm_vmm_env
Class Declaration
class avt_ovm_vmm_env #(
   type ENV = vmm_env
) extends avt_ovm_vmm_env_base
Methods
newCreates a VMM env container component with the given name and parent.

new

function new (string name,  
ovm_component parent = null,
ENV env = null)

Creates a VMM env container component with the given name and parent.  A new instance of an env of type ENV is created if one is not provided in the env argument.  The env will not be named.

avt_ovm_vmm_env_named

Use this class to wrap (contain) an existing VMM env whose constructor must have a name argument.  See avt_ovm_vmm_env_base for more information.

Summary
avt_ovm_vmm_env_named
Use this class to wrap (contain) an existing VMM env whose constructor must have a name argument.
Class Hierarchy
ovm_component
avt_ovm_vmm_env_named
Class Declaration
class avt_ovm_vmm_env_named #(
   type ENV = vmm_env
) extends avt_ovm_vmm_env_base
Methods
newCreates a VMM env container component with the given name and parent.

new

function new (string name,  
ovm_component parent = null,
ENV env = null)

Creates a VMM env container component with the given name and parent.  A new instance of an env of type ENV is created if one is not provided in the env argument.  The name given the new env is the full name of this component.

class avt_ovm_vmm_env #(type ENV = vmm_env) extends avt_ovm_vmm_env_base
Use this class to wrap (contain) an existing VMM env whose constructor does not have a name argument.
class avt_ovm_vmm_env_base extends ovm_component
The avt_ovm_vmm_env_base class is used to “wrap” an existing vmm_env subtype so that it may be reused as an ordinary OVM component in an OVM-on-top environment.
bit ok_to_stop = 0
When ok_to_stop is clear (default), the avt_ovm_vmm_env’s stop task will wait for the VMM env’s wait_for_end task to return before continuing.
virtual task stop(string ph_name)
If the run phase is being stopped, this task waits for the underlying env’s wait_for_end phase to return, then calls the VMM env’s stop and cleanup tasks.
bit auto_stop_request = 0
When set, this bit enables calling an OVM stop_request after the VMM env’s wait_for_end task returns, thus ending OVM’s run phase coincident with VMM’s wait_for_end.
function new (string name,  
ovm_component parent = null,
vmm_env env = null)
Creates the vmm_env proxy class with the given name, parent, and optional vmm_env handle.
local static function bit insert_vmm_phases()
A static function that registers the vmm_gen_cfg phase callback with the OVM.
virtual function void vmm_gen_cfg()
Calls the underlying VMM env’s gen_cfg phase.
virtual function void build()
Calls the underlying VMM env’s build phase.
virtual task vmm_reset_dut()
Calls the underlying VMM env’s reset_dut phase, provided this phase was enabled in the new constructor.
virtual task vmm_cfg_dut()
Calls the underlying VMM env’s cfg_dut phase, provided this phase was enabled in the new constructor.
virtual task run()
Calls the underlying VMM env’s reset_dut, cfg_dut, start, and wait_for_end phases, returning when the env’s end-of-test condition has been reached.
virtual task vmm_report()
Calls the underlying VMM env’s report method, then stops the reportvmm phase.
function new (string name,  
ovm_component parent = null,
ENV env = null)
Creates a VMM env container component with the given name and parent.
class avt_ovm_vmm_env_named #(type ENV = vmm_env) extends avt_ovm_vmm_env_base
Use this class to wrap (contain) an existing VMM env whose constructor must have a name argument.
function new (string name,  
ovm_component parent = null,
ENV env = null)
Creates a VMM env container component with the given name and parent.