ovm_port_base #(IF)

Transaction-level communication between components is handled via its ports, exports, and imps, all of which derive from this class.

The ovm_port_base extends IF, which is the type of the interface implemented by derived port, export, or implementation.  IF is also a type parameter to ovm_port_base.

IFThe interface type implemented by the subtype to this base port

The OVM provides a complete set of ports, exports, and imps for the OSCI- standard TLM interfaces.  They can be found in the ../src/tlm/ directory.  For the TLM interfaces, the IF parameter is always tlm_if_base #(T1,T2).

Just before ovm_component::end_of_elaboration, an internal ovm_component::resolve_bindings process occurs, after which each port and export holds a list of all imps connected to it via hierarchical connections to other ports and exports.  In effect, we are collapsing the port’s fanout, which can span several levels up and down the component hierarchy, into a single array held local to the port.  Once the list is determined, the port’s min and max connection settings can be checked and enforced.

ovm_port_base possesses the properties of components in that they have a hierarchical instance path and parent.  Because SystemVerilog does not support multiple inheritance, ovm_port_base can not extend both the interface it implements and ovm_component.  Thus, ovm_port_base contains a local instance of ovm_component, to which it delegates such commands as get_name, get_full_name, and get_parent.

Summary
ovm_port_base #(IF)
Transaction-level communication between components is handled via its ports, exports, and imps, all of which derive from this class.
Class Hierarchy
IF
ovm_port_base#(IF)
Class Declaration
virtual class ovm_port_base #(
   type IF = ovm_void
) extends IF
Methods
newThe first two arguments are the normal ovm_component constructor arguments.
get_nameReturns the leaf name of this port.
get_full_nameReturns the full hierarchical name of this port.
get_parentReturns the handle to this port’s parent, or null if it has no parent.
get_compReturns a handle to the internal proxy component representing this port.
get_type_nameReturns the type name to this port.
min_sizeReturns the mininum number of implementation ports that must be connected to this port by the end_of_elaboration phase.
max_sizeReturns the maximum number of implementation ports that must be connected to this port by the end_of_elaboration phase.
is_unboundedReturns 1 if this port has no maximum on the number of implementation (imp) ports this port can connect to.
is_port
is_export
is_impReturns 1 if this port is of the type given by the method name, 0 otherwise.
sizeGets the number of implementation ports connected to this port.
set_default_indexSets the default implementation port to use when calling an interface method.
connectConnects this port to the given provider port.
debug_connected_toThe debug_connected_to method outputs a visual text display of the port/export/imp network to which this port connects (i.e., the port’s fanout).
debug_provided_toThe debug_provided_to method outputs a visual display of the port/export network that ultimately connect to this port (i.e., the port’s fanin).
resolve_bindingsThis callback is called just before entering the end_of_elaboration phase.
get_ifReturns the implementation (imp) port at the given index from the array of imps this port is connected to.

new

function new (string name,  
ovm_component parent,  
ovm_port_type_e port_type,  
int min_size = 0,
int max_size = 1)

The first two arguments are the normal ovm_component constructor arguments.

The port_type can be one of OVM_PORT, OVM_EXPORT, or OVM_IMPLEMENTATION.

The min_size and max_size specify the minimum and maximum number of implementation (imp) ports that must be connected to this port base by the end of elaboration.  Setting max_size to OVM_UNBOUNDED_CONNECTIONS sets no maximum, i.e., an unlimited number of connections are allowed.

By default, the parent/child relationship of any port being connected to this port is not checked.  This can be overridden by configuring the port’s check_connection_relationships bit via set_config_int.  See connect for more information.

get_name

function string get_name()

Returns the leaf name of this port.

get_full_name

virtual function string get_full_name()

Returns the full hierarchical name of this port.

get_parent

virtual function ovm_component get_parent()

Returns the handle to this port’s parent, or null if it has no parent.

get_comp

virtual function ovm_port_component_base get_comp()

Returns a handle to the internal proxy component representing this port.

Ports are considered components.  However, they do not inherit ovm_component.  Instead, they contain an instance of <ovm_port_component #(PORT)> that serves as a proxy to this port.

get_type_name

virtual function string get_type_name()

Returns the type name to this port.  Derived port classes must implement this method to return the concrete type.  Otherwise, only a generic “ovm_port”, “ovm_export” or “ovm_implementation” is returned.

min_size

Returns the mininum number of implementation ports that must be connected to this port by the end_of_elaboration phase.

max_size

Returns the maximum number of implementation ports that must be connected to this port by the end_of_elaboration phase.

is_unbounded

function bit is_unbounded ()

Returns 1 if this port has no maximum on the number of implementation (imp) ports this port can connect to.  A port is unbounded when the max_size argument in the constructor is specified as OVM_UNBOUNDED_CONNECTIONS.

is_port

function bit is_port ()

is_export

function bit is_export ()

is_imp

function bit is_imp ()

Returns 1 if this port is of the type given by the method name, 0 otherwise.

size

function int size ()

Gets the number of implementation ports connected to this port.  The value is not valid before the end_of_elaboration phase, as port connections have not yet been resolved.

set_default_index

function void set_default_index (int index)

Sets the default implementation port to use when calling an interface method.  This method should only be called on OVM_EXPORT types.  The value must not be set before the end_of_elaboration phase, when port connections have not yet been resolved.

connect

virtual function void connect (this_type provider)

Connects this port to the given provider port.  The ports must be compatible in the following ways

  • Their type parameters must match
  • The provider’s interface type (blocking, non-blocking, analysis, etc.) must be compatible.  Each port has an interface mask that encodes the interface(s) it supports.  If the bitwise AND of these masks is equal to the this port’s mask, the requirement is met and the ports are compatible.  For example, an ovm_blocking_put_port #(T) is compatible with an ovm_put_export #(T) and ovm_blocking_put_imp #(T) because the export and imp provide the interface required by the ovm_blocking_put_port.
  • Ports of type OVM_EXPORT can only connect to other exports or imps.
  • Ports of type OVM_IMPLEMENTATION can not be connected, as they are bound to the component that implements the interface at time of construction.

In addition to type-compatibility checks, the relationship between this port and the provider port will also be checked if the port’s check_connection_relationships configuration has been set.  (See new for more information.)

Relationships, when enabled, are checked are as follows

  • If this port is an OVM_PORT type, the provider can be a parent port, or a sibling export or implementation port.
  • If this port is an OVM_EXPORT type, the provider can be a child export or implementation port.

If any relationship check is violated, a warning is issued.

Note- the ovm_component::connect method is related to but not the same as this method.  The component’s connect method is a phase callback where port’s connect method calls are made.

debug_connected_to

function void debug_connected_to (int level = 0,
int max_level = -1)

The debug_connected_to method outputs a visual text display of the port/export/imp network to which this port connects (i.e., the port’s fanout).

This method must not be called before the end_of_elaboration phase, as port connections are not resolved until then.

debug_provided_to

function void debug_provided_to (int level = 0,
int max_level = -1)

The debug_provided_to method outputs a visual display of the port/export network that ultimately connect to this port (i.e., the port’s fanin).

This method must not be called before the end_of_elaboration phase, as port connections are not resolved until then.

resolve_bindings

virtual function void resolve_bindings()

This callback is called just before entering the end_of_elaboration phase.  It recurses through each port’s fanout to determine all the imp destina- tions.  It then checks against the required min and max connections.  After resolution, size returns a valid value and get_if can be used to access a particular imp.

This method is automatically called just before the start of the end_of_elaboration phase.  Users should not need to call it directly.

get_if

function ovm_port_base #(IF) get_if(int index=0)

Returns the implementation (imp) port at the given index from the array of imps this port is connected to.  Use size to get the valid range for index.  This method can only be called at the end_of_elaboration phase or after, as port connections are not resolved before then.

virtual class ovm_port_base #(type IF = ovm_void) extends IF
Transaction-level communication between components is handled via its ports, exports, and imps, all of which derive from this class.
function new (string name,  
ovm_component parent,  
ovm_port_type_e port_type,  
int min_size = 0,
int max_size = 1)
The first two arguments are the normal ovm_component constructor arguments.
virtual class ovm_component extends ovm_report_object
The ovm_component class is the root base class for OVM components.
function string get_name()
Returns the leaf name of this port.
virtual function string get_full_name()
Returns the full hierarchical name of this port.
virtual function ovm_component get_parent()
Returns the handle to this port’s parent, or null if it has no parent.
virtual function ovm_port_component_base get_comp()
Returns a handle to the internal proxy component representing this port.
virtual function string get_type_name()
Returns the type name to this port.
function bit is_unbounded ()
Returns 1 if this port has no maximum on the number of implementation (imp) ports this port can connect to.
function bit is_port ()
function bit is_export ()
function bit is_imp ()
Returns 1 if this port is of the type given by the method name, 0 otherwise.
function int size ()
Gets the number of implementation ports connected to this port.
function void set_default_index (int index)
Sets the default implementation port to use when calling an interface method.
virtual function void connect (this_type provider)
Connects this port to the given provider port.
function void debug_connected_to (int level = 0,
int max_level = -1)
The debug_connected_to method outputs a visual text display of the port/export/imp network to which this port connects (i.e., the port’s fanout).
function void debug_provided_to (int level = 0,
int max_level = -1)
The debug_provided_to method outputs a visual display of the port/export network that ultimately connect to this port (i.e., the port’s fanin).
virtual function void resolve_bindings()
This callback is called just before entering the end_of_elaboration phase.
function ovm_port_base #(IF) get_if(int index=0)
Returns the implementation (imp) port at the given index from the array of imps this port is connected to.
virtual class tlm_if_base #(type T1 = int,
type T2 = int)
This class declares all of the methods of the TLM API.
virtual function void end_of_elaboration ()
The end_of_elaboration phase callback is one of several methods automatically called during the course of simulation.
virtual function void resolve_bindings ()
Processes all port, export, and imp connections.
The port requires the interface that is its type parameter.
The port provides the interface that is its type parameter via a connection to some other export or implementation.
The port provides the interface that is its type parameter, and it is bound to the component that implements the interface.
function void set_config_int (string inst_name,
string field_name,
ovm_bitstream_t value)
This is the global version of set_config_int in ovm_component.
virtual function void connect ()
The connect phase callback is one of several methods automatically called during the course of simulation.