# avt_tlm2channel

Use this class to connect an OVM sequencer to a VMM driver via vmm_channel. Drivers can implement many different response-delivery models:

- does not return a response
- embeds a response in the original request transaction, which is available to a requester that holds a handle to the original request.
- returns a response in a separate vmm_channel

The adapter can accommodate all such drivers.

Communication is established by connecting the adapter to any of the above OVM producer types using the appropriate ports and exports.

To use this adapter, the integrator instantiates an OVM producer, a VMM consumer, and an avt_tlm2channel adapter whose parameter values correspond to the OVM and VMM data types used by the producer and consumer and the converter types used to translate in one or both directions.

If the default vmm_channels created by the VMM consumer or adapter are not used, then the integrator must also instantiate a request vmm_channel and a response vmm_channel, if the VMM consumer uses one.

Integrators of VMM-on-top environments need to instantiate the OVM consumer and adapter via an OVM container, or wrapper component. This wrapper component serves to provide the connect method needed to bind the OVM ports and exports.

See also avt_tlm2channel example and avt_tlm2channel seq_item example.

Summary

avt_tlm2channel
Use this class to connect an OVM sequencer to a VMM driver via vmm_channel.
Class Hierarchy
ovm_component
avt_tlm2channel
Class Declaration
> class avt_tlm2channel #(
> | type | OVM_REQ | = | int,
> |  | VMM_REQ | = | int,
> |  | OVM2VMM_REQ | = | int,
> |  | VMM_RSP | = | VMM_REQ,
> |  | OVM_RSP | = | OVM_REQ,
> |  | VMM2OVM_RSP | = | avt_converter #(VMM_RSP,OVM_RSP)
> ) extends ovm_component
Ports |
seq_item_port | This bidirectional port is used to connect to an ovm_sequencer or any other component providing an ovm_seq_item_export.
put_export | This export is used to receive transactions from an OVM producer that utilizes a blocking or non-blocking put interface.
master_export | This bidirectional export is used to receive requests from and deliver responses to an OVM producer that utilizes a blocking or non-blocking master interface.
blocking_transport_export | This bidirectional export is used to receive requests from and deliver responses to an OVM producer that utilizes a blocking transport interface.
blocking_get_peek_port | This unidirectional port is used to retrieve responses from a passive OVM producer with a blocking get_peek export.
blocking_put_port | This port is used to deliver responses to an OVM producer that expects responses from a blocking put interface.
blocking_slave_port | This bidirectional port is used to request transactions from and deliver responses to a passive OVM producer utilizing a blocking slave interface.
request_ap | All transaction requests received from any of the interface ports and exports in this adapter are broadcast out this analysis port to any OVM subscribers.
response_ap | All transaction responses received from any of the interface ports and exports in this adapter are broadcast out this analysis port to any OVM subscribers.
Methods |
new | Creates a new avt_tlm2channel adapter given four optional arguments.
build | Called as part of a predefined test flow, this function will retrieve the configuration setting for the wait_for_req_ended flag.
end_of_elaboration | Called as part of a predefined test flow, this function will check that this component’s req_chan variable has been configured with a non-null instance of a vmm_channel #(VMM).
get_type_name | Returns the type name, i.e.
run | Called as part of a predefined test flow, the run task forks a process for getting requests from the seq_item_port and sending them to the req_chan vmm_channel.
wait_for_ended | Used to support VMM non-blocking completion models that indicate and return response status via each transaction’s ENDED notification.
get_requests | This task continually gets request transactions from the connected sequencer, converts them to an equivalent VMM transaction, and puts to the underlying req_chan vmm_channel.
put_responses | This task handles getting responses from the rsp_chan vmm_channel and putting them to the appropriate OVM response port.
put | Converts an OVM request to a VMM request and puts it into the req_chan vmm_channel.
can_put | Returns 1 if the req_chan can accept a new request.
try_put | If the req_chan can accept new requests, converts o_req to its VMM equivalent, injects it into the channel, and returns 1.
get | Gets a response from the rsp_chan, converts, and returns in the o_rsp output argument.
can_get | Returns 1 if a response is available to get, 0 otherwise.
try_get | If a response is available in the rsp_chan, gets and returns the response in the o_rsp output argument and returns 1.
peek | Peeks (does not consume) and converts a response from the rsp_chan.
can_peek | Returns 1 if a transaction is available in the rsp_chan, 0 otherwise.
try_peek | If a response is available to peek from the rsp_chan, this function peeks (does not consume) the transaction from the channel, converts, and returns via the o_req output argument.
transport | Blocking transport is used to atomically execute the geiven request transaction, req, and return the response in rsp.
Variables |
req_chan | Handle to the request vmm_channel #(VMM) instance being adapted.
rsp_chan | Handle to the response vmm_channel #(VMM) instance being adapted.
wait_for_req_ended | When the VMM consumer does not use a separate response channel, this bit specifies whether the response, which is annotated into the original request, is available after a get from the request channel (wait_for_req_ended=0) or after the original request’s ENDED status is indicated (wait_for_req_ended=1).

### Ports

### seq_item_port

This bidirectional port is used to connect to an ovm_sequencer or any other component providing an ovm_seq_item_export. The ovm_seq_item port and export communicate using the interface, <sqr_if_base #(REQ,RSP)>, which, in part, defines the following methods:

>     virtual task get  (output REQ request);
>     virtual task peek (output REQ request);
>     virtual task put  (RSP response);

See <sqr_if_base #(REQ,RSP)> for information about this interface.

### put_export

This export is used to receive transactions from an OVM producer that utilizes a blocking or non-blocking put interface.

### master_export

This bidirectional export is used to receive requests from and deliver responses to an OVM producer that utilizes a blocking or non-blocking master interface.

### blocking_transport_export

This bidirectional export is used to receive requests from and deliver responses to an OVM producer that utilizes a blocking transport interface.

### blocking_get_peek_port

This unidirectional port is used to retrieve responses from a passive OVM producer with a blocking get_peek export.

### blocking_put_port

This port is used to deliver responses to an OVM producer that expects responses from a blocking put interface.

### blocking_slave_port

This bidirectional port is used to request transactions from and deliver responses to a passive OVM producer utilizing a blocking slave interface.

### request_ap

All transaction requests received from any of the interface ports and exports in this adapter are broadcast out this analysis port to any OVM subscribers.

### response_ap

All transaction responses received from any of the interface ports and exports in this adapter are broadcast out this analysis port to any OVM subscribers. OVM producers that expect responses from an analysis export may be connected to this port.

### Methods

### new

> function new ( |  | string | name | = | "avt_tlm2channel",
> |  | ovm_component | parent | = | null,
> | vmm_channel_typed | #(VMM_REQ) | req_chan | = | null,
> | vmm_channel_typed | #(VMM_RSP) | rsp_chan | = | null,
> |  | bit | wait_for_req_ended | = | 0 | )

Creates a new avt_tlm2channel adapter given four optional arguments.

name | specifies the instance name. Default is “avt_tlm2channel”.
parent | specfies the parent ovm_component, if any. When null, the parent becomes the implicit ovm_top.
req_chan | the request vmm_channel instance. If not specified, it must be assigned directory to the req_chan variable before end_of_elaboration.
req_chan | the request vmm_channel instance. If not specified, it must be assigned directory to the req_chan variable before end_of_elaboration.

### build

> virtual function void build()

Called as part of a predefined test flow, this function will retrieve the configuration setting for the wait_for_req_ended flag.

### end_of_elaboration

> virtual function void end_of_elaboration()

Called as part of a predefined test flow, this function will check that this component’s req_chan variable has been configured with a non-null instance of a vmm_channel #(VMM).

### get_type_name

> virtual function string get_type_name()

Returns the type name, i.e. “vmm_tlm2channel”, of this adapter.

### run

> virtual task run()

Called as part of a predefined test flow, the run task forks a process for getting requests from the seq_item_port and sending them to the req_chan vmm_channel. If configured, it will also fork an independent process for getting responses from the separate rsp_chan vmm_channel and putting them back out the seq_item_port.

### wait_for_ended

> virtual task wait_for_ended( | VMM_REQ | v_req | )

Used to support VMM non-blocking completion models that indicate and return response status via each transaction’s ENDED notification. For each transaction outstanding, this task is forked to wait for the ENDED status. When that happens, the response is converted and sent into the rsp_chan.

The wait_for_req_ended bit, set in the constructor, determines whether this task is used.

### get_requests

> virtual task get_requests()

This task continually gets request transactions from the connected sequencer, converts them to an equivalent VMM transaction, and puts to the underlying req_chan vmm_channel.

If wait_for_req_ended is set and the req_chan’s full-level is 1, and no rsp_chan is being used, it is assumed the put to req_chan will not return until the transaction has been executed and the response contained within the original request descriptor. In this case, the modified VMM request is converted back to the original OVM request object, which is then sent as a response to both the seq_item_port and response_ap ports.

This task is forked as a process from the run task.

### put_responses

> virtual task put_responses()

This task handles getting responses from the rsp_chan vmm_channel and putting them to the appropriate OVM response port. The converters will handle the transfer of (data_id,scenario_id) to (transaction_id/sequence_id) information so responses can be matched to their originating requests.

This task is forked as a process from the run task.

### put

> virtual task put ( | OVM_REQ | o_req | )

Converts an OVM request to a VMM request and puts it into the req_chan vmm_channel. Upon return, if wait_for_req_ended is set, the VMM request is put to the rsp_chan for response-path processing. The original OVM request is also written to the request_ap analysis port.

### can_put

> virtual function bit can_put ()

Returns 1 if the req_chan can accept a new request.

### try_put

> virtual function bit try_put ( | OVM_REQ | o_req | )

If the req_chan can accept new requests, converts o_req to its VMM equivalent, injects it into the channel, and returns 1. Otherwise, returns 0.

### get

> virtual task get( | output | OVM_RSP | o_rsp | )

Gets a response from the rsp_chan, converts, and returns in the o_rsp output argument.

### can_get

> virtual function bit can_get()

Returns 1 if a response is available to get, 0 otherwise.

### try_get

> virtual function bit try_get( | output | OVM_RSP | o_rsp | )

If a response is available in the rsp_chan, gets and returns the response in the o_rsp output argument and returns 1. Returns 0 otherwise.

### peek

> virtual task peek( | output | OVM_RSP | o_rsp | )

Peeks (does not consume) and converts a response from the rsp_chan.

### can_peek

> virtual function bit can_peek()

Returns 1 if a transaction is available in the rsp_chan, 0 otherwise.

### try_peek

> virtual function bit try_peek( | output | OVM_RSP | o_rsp | )

If a response is available to peek from the rsp_chan, this function peeks (does not consume) the transaction from the channel, converts, and returns via the o_req output argument. Otherwise, returns 0.

### transport

> task transport ( |  | OVM_REQ | o_req,
> | output | OVM_RSP | o_rsp | )

Blocking transport is used to atomically execute the geiven request transaction, req, and return the response in rsp.

### Variables

### req_chan

> vmm_channel_typed #( | VMM_REQ | ) req_chan

Handle to the request vmm_channel #(VMM) instance being adapted.

### rsp_chan

> vmm_channel_typed #( | VMM_RSP | ) rsp_chan

Handle to the response vmm_channel #(VMM) instance being adapted. The adapter uses a response channel regardless of whether the VMM consumer uses it directly. This keeps the request and response paths on the TLM side separate.

### wait_for_req_ended

> protected bit wait_for_req_ended = 0

When the VMM consumer does not use a separate response channel, this bit specifies whether the response, which is annotated into the original request, is available after a get from the request channel (wait_for_req_ended=0) or after the original request’s ENDED status is indicated (wait_for_req_ended=1). The latter case enables interconnecting with pipelined VMM consumers at the cost of two additional processes for each outstanding request transaction.

This variable can be specified in a new constructor argument, or set via a set_config_int(“wait_for_req_ended”,value) call targeting this component.

> class avt_tlm2channel #( | type | OVM_REQ | = | int,
> |  | VMM_REQ | = | int,
> |  | OVM2VMM_REQ | = | int,
> |  | VMM_RSP | = | VMM_REQ,
> |  | OVM_RSP | = | OVM_REQ,
> |  | VMM2OVM_RSP | = | avt_converter #(VMM_RSP,OVM_RSP) | ) extends ovm_component

Use this class to connect an OVM sequencer to a VMM driver via vmm_channel.

> function new ( |  | string | name | = | "avt_tlm2channel",
> |  | ovm_component | parent | = | null,
> | vmm_channel_typed | #(VMM_REQ) | req_chan | = | null,
> | vmm_channel_typed | #(VMM_RSP) | rsp_chan | = | null,
> |  | bit | wait_for_req_ended | = | 0 | )

Creates a new avt_tlm2channel adapter given four optional arguments.

> virtual function void build()

Called as part of a predefined test flow, this function will retrieve the configuration setting for the wait_for_req_ended flag.

> protected bit wait_for_req_ended = 0

When the VMM consumer does not use a separate response channel, this bit specifies whether the response, which is annotated into the original request, is available after a get from the request channel (wait_for_req_ended=0) or after the original request’s ENDED status is indicated (wait_for_req_ended=1).

> virtual function void end_of_elaboration()

Called as part of a predefined test flow, this function will check that this component’s req_chan variable has been configured with a non-null instance of a vmm_channel #(VMM).

> vmm_channel_typed #( | VMM_REQ | ) req_chan

Handle to the request vmm_channel #(VMM) instance being adapted.

> virtual function string get_type_name()

Returns the type name, i.e.

> virtual task run()

Called as part of a predefined test flow, the run task forks a process for getting requests from the seq_item_port and sending them to the req_chan vmm_channel.
This bidirectional port is used to connect to an ovm_sequencer or any other component providing an ovm_seq_item_export.

> virtual task wait_for_ended( | VMM_REQ | v_req | )

Used to support VMM non-blocking completion models that indicate and return response status via each transaction’s ENDED notification.

> virtual task get_requests()

This task continually gets request transactions from the connected sequencer, converts them to an equivalent VMM transaction, and puts to the underlying req_chan vmm_channel.

> virtual task put_responses()

This task handles getting responses from the rsp_chan vmm_channel and putting them to the appropriate OVM response port.

> vmm_channel_typed #( | VMM_RSP | ) rsp_chan

Handle to the response vmm_channel #(VMM) instance being adapted.

> virtual task put ( | OVM_REQ | o_req | )

Converts an OVM request to a VMM request and puts it into the req_chan vmm_channel.

> virtual function bit can_put ()

Returns 1 if the req_chan can accept a new request.

> virtual function bit try_put ( | OVM_REQ | o_req | )

If the req_chan can accept new requests, converts o_req to its VMM equivalent, injects it into the channel, and returns 1.

> virtual task get( | output | OVM_RSP | o_rsp | )

Gets a response from the rsp_chan, converts, and returns in the o_rsp output argument.

> virtual function bit can_get()

Returns 1 if a response is available to get, 0 otherwise.

> virtual function bit try_get( | output | OVM_RSP | o_rsp | )

If a response is available in the rsp_chan, gets and returns the response in the o_rsp output argument and returns 1.

> virtual task peek( | output | OVM_RSP | o_rsp | )

Peeks (does not consume) and converts a response from the rsp_chan.

> virtual function bit can_peek()

Returns 1 if a transaction is available in the rsp_chan, 0 otherwise.

> virtual function bit try_peek( | output | OVM_RSP | o_rsp | )

If a response is available to peek from the rsp_chan, this function peeks (does not consume) the transaction from the channel, converts, and returns via the o_req output argument.

> task transport ( |  | OVM_REQ | o_req,
> | output | OVM_RSP | o_rsp | )

Blocking transport is used to atomically execute the geiven request transaction, req, and return the response in rsp.
This example uses an avt_notify2analysis and an avt_tlm2channel adapter to connect a vmm_notifier_consumer and an ovm_passive_producer.
This example uses the avt_tlm2channel adapter to connect an OVM sequencer to a VMM driver type.
All transaction responses received from any of the interface ports and exports in this adapter are broadcast out this analysis port to any OVM subscribers.
All transaction requests received from any of the interface ports and exports in this adapter are broadcast out this analysis port to any OVM subscribers.