# avt_channel2tlm

Use this class to connect a VMM producer to an OVM consumer. Consumers can implement many different response-delivery models:

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

The adapter can accommodate these consumer types.

To use this adapter, the integrator instantiates a VMM producer, an OVM consumer, and an avt_channel2tlm adapter whose parameter values correspond to the VMM and OVM 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 producer or adapter are not used, then the integrator must also instantiate a request vmm_channel and possibly a response vmm_channel, if the VMM producer 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_channel2tlm example and avt_channel2tlm seq_item example.

Summary

avt_channel2tlm
Use this class to connect a VMM producer to an OVM consumer.
Class Hierarchy
ovm_component
avt_channel2tlm
Class Declaration
> class avt_channel2tlm #(
> | type | VMM_REQ | = | int,
> |  | OVM_REQ | = | int,
> |  | VMM2OVM_REQ | = | int,
> |  | OVM_RSP | = | OVM_REQ,
> |  | VMM_RSP | = | VMM_REQ,
> |  | OVM2VMM_RSP | = | avt_converter #(OVM_RSP,VMM_RSP),
> |  | OVM_MATCH_REQ_RSP | = | avt_match_ovm_id
> ) extends ovm_component
Ports |
seq_item_export | Used by OVM driver consumers using the sequencer interface to process transactions.
get_peek_export | For OVM consumers getting requests via peek/get
response_export | For OVM consumers returning responses via analysis write
put_export | For OVM consumers returning responses via blocking put
slave_export | For sending requests to passive OVM consumers via blocking put
blocking_put_port | For sending requests to passive OVM consumers via blocking put
blocking_transport_port | For atomic execution with passive OVM consumers via blocking transport
blocking_master_port | For driving a passive OVM consumers via blocking master interface
request_ap | All requests are broadcast out this analysis port after successful extraction from the request vmm_channel.
response_ap | All responses sent to the response channel are broadcast out this analysis port.
Methods |
new | Creates an instance of a avt_channel2tlm adaptor, with four optional arguments.
build | Called as part of a predefined test flow, this function will retrieve the configuration setting for the rsp_is_req that this component’s req_chan variable has been configured with a non-null
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).
run | Called as part of a predefined test flow, the run task forks a process for getting requests from the request channel and sending them to the OVM consumer connection via the blocking put port.
get_type_name | Returns the type name, i.e.
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.
rsp_is_req | Indicates whether a response is the same object as the request with the status and/or read data filled in.
max_pending_requests | Specifies the maximum number of requests that can be outstanding.
Methods |
auto_put | Used by this adapter to send transactions to passive OVM consumers.
auto_transport | Used by this adapter to send transactions to passive OVM consumers.
auto_blocking_master | Used by this adapter to send transactions to passive OVM consumers.
get | Gets and converts a request from the req_chan vmm_channel.
can_get | Returns 1 if a transactions is available to get, 0 otherwise.
try_get | If a transactions is available to get, returns the transaction in the o_req output argument, else returns 0.
peek | Peeks (does not consume) and converts a request from the req_chan vmm_channel.
can_peek | Returns 1 if a transaction is available in the req_chan, 0 otherwise.
try_peek | If a request is available to peek from the req_chan, this function peeks (does not consume) the transaction from the channel, converts, and returns via the o_req output argument.
put | Converts and sneaks a response to the rsp_chan vmm_channel, if defined.
can_put | Always returns 1 (true) because responses are sneaked into the channel.
try_put | Sneak the given response to the response channel, or copy the response to the corresponding request if rsp_is_req is set.
write | Used by active OVM consumers to send back responses.
get_next_item | Peeks and converts a request from the req_chan vmm_channel.
try_next_item | Waits a number of delta cycles waiting for a request transaction to arrive in the req_chan vmm_channel.
put_response | A non-blocking version of put, this function converts and sneaks the given response into the rsp_chan vmm_channel.
item_done | A non-blocking function indicating an OVM driver is done with the transaction retrieved with a get_next_item or get.
has_do_available | Named for its association with OVM sequencer operation, this function will return 1 if there is a transaction available to get from the vmm_channel, req_chan.
wait_for_sequences | Used in the try_next_item method, this method waits a variable number of #0 delays.

### Ports

### seq_item_export

Used by OVM driver consumers using the sequencer interface to process transactions. See <sqr_if_base #(REQ,RSP)> for information about this interface.

### get_peek_export

For OVM consumers getting requests via peek/get

### response_export

For OVM consumers returning responses via analysis write

### put_export

For OVM consumers returning responses via blocking put

### slave_export

For sending requests to passive OVM consumers via blocking put

### blocking_put_port

For sending requests to passive OVM consumers via blocking put

### blocking_transport_port

For atomic execution with passive OVM consumers via blocking transport

### blocking_master_port

For driving a passive OVM consumers via blocking master interface

### request_ap

All requests are broadcast out this analysis port after successful extraction from the request vmm_channel.

### response_ap

All responses sent to the response channel are broadcast out this analysis port.

### Methods

### new

> function new ( |  | string | name | = | "avt_channel2tlm",
> |  | ovm_component | parent | = | null,
> | vmm_channel_typed | #(VMM_REQ) | req_chan | = | null,
> | vmm_channel_typed | #(VMM_RSP) | rsp_chan | = | null,
> |  | bit | rsp_is_req | = | 1,
> | int | unsigned | max_pending_req | = | 100 | )

Creates an instance of a avt_channel2tlm adaptor, with four optional arguments.

name | specifies the instance name. Default is “avt_channel2tlm”.
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 rsp_is_req that this component’s req_chan variable has been configured with a non-null

### 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).

### run

> virtual task run()

Called as part of a predefined test flow, the run task forks a process for getting requests from the request channel and sending them to the OVM consumer connection via the blocking put port.

### get_type_name

> virtual function string get_type_name()

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

### Variables

### req_chan

> vmm_channel_typed #( | VMM_REQ | ) req_chan

Handle to the request vmm_channel #(VMM) instance being adapted. All puts and gets via the TLM exports will be delegated to this channel.

### rsp_chan

> vmm_channel_typed #( | VMM_RSP | ) rsp_chan

Handle to the response vmm_channel #(VMM) instance being adapted. All puts and gets via the TLM exports will be delegated to this channel.

### rsp_is_req

> protected bit rsp_is_req = 1

Indicates whether a response is the same object as the request with the status and/or read data filled in. When set, and the rsp_chan is null, the request process will, after returning from a put to the request channel, copy the VMM request into the orginal OVM request object and send it as the OVM response to the seq_item_port’s put method.check

In certain vmm_channel/driver completion models, the channel full level is 1 and the connected driver does not consume the transaction until it has been fully executed. In this mode, the driver peeks the transaction from the channel, executes it, fills in the response in fields of the same request object, then finally pops (gets) the transaction off the channel. This then frees the put process, which was waiting for the transaction to leave the the channel.

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

### max_pending_requests

Specifies the maximum number of requests that can be outstanding. The adapter holds all outgoing requests in a queue for later matching with incoming responses. A maximum exists to prevent this queue from growing too large.

TODO: implement a user-settable timeout for all transactions held in the pending queue.

### Methods

### auto_put

> virtual task auto_put()

Used by this adapter to send transactions to passive OVM consumers.

### auto_transport

> virtual task auto_transport()

Used by this adapter to send transactions to passive OVM consumers.

### auto_blocking_master

> virtual task auto_blocking_master()

Used by this adapter to send transactions to passive OVM consumers.

### get

> virtual task get( | output | OVM_REQ | o_req | )

Gets and converts a request from the req_chan vmm_channel.

### can_get

> virtual function bit can_get()

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

### try_get

> virtual function bit try_get( | output | OVM_REQ | o_req | )

If a transactions is available to get, returns the transaction in the o_req output argument, else returns 0.

### peek

> virtual task peek( | output | OVM_REQ | o_req | )

Peeks (does not consume) and converts a request from the req_chan vmm_channel.

TO DISCUSS- cached transaction can change between peeks.

### can_peek

> virtual function bit can_peek()

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

### try_peek

> virtual function bit try_peek( | output | OVM_REQ | o_req | )

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

TO DISCUSS- cached transaction can change between peeks.

### put

> virtual task put ( | OVM_RSP | o_rsp | )

Converts and sneaks a response to the rsp_chan vmm_channel, if defined. If the rsp_chan is null, the response is dropped.

### can_put

> virtual function bit can_put ()

Always returns 1 (true) because responses are sneaked into the channel.

### try_put

> virtual function bit try_put ( | OVM_RSP | o_rsp | )

Sneak the given response to the response channel, or copy the response to the corresponding request if rsp_is_req is set.

### write

> virtual function void write( | OVM_RSP | o_rsp | )

Used by active OVM consumers to send back responses.

### get_next_item

> virtual task get_next_item( | output | OVM_REQ | t | )

Peeks and converts a request from the req_chan vmm_channel. This task behaves like a blocking peek operation; it blocks until an item is available in the channel. When available, the transaction is peeked and not consumed from the channel. The request is consumed upon a call get or item_done.

A call to get_next_item must always be followed by a call to get or item_done before calling get_next_item again.

### try_next_item

> virtual task try_next_item ( | output | OVM_REQ | t | )

Waits a number of delta cycles waiting for a request transaction to arrive in the req_chan vmm_channel. If a request is available after this time, it is peeked from the channel, converted, and returned. If after this time a request is not yet available, the task sets t to null and returns. This behavior is similar to a blocking peek with a variable delta-cycle timeout.

### put_response

> virtual function void put_response ( | OVM_RSP | o_rsp | )

A non-blocking version of put, this function converts and sneaks the given response into the rsp_chan vmm_channel. If the rsp_chan is null, the response is dropped.

### item_done

> virtual function void item_done( | OVM_RSP | o_rsp | = | null | )

A non-blocking function indicating an OVM driver is done with the transaction retrieved with a get_next_item or get. The item_done method pops the request off the req_chan vmm_channel, converts the response argument, if provided, and sneaks converted response into the rsp_chan vmm_channel. If the rsp_chan is null and rsp_is_req is 0, the response, if provided, is dropped. If rsp_is_req is 1, then the response is converted back into the original VMM request and the transaction’s ENDED notification is indicated.

### has_do_available

> virtual function bit has_do_available()

Named for its association with OVM sequencer operation, this function will return 1 if there is a transaction available to get from the vmm_channel, req_chan.

### wait_for_sequences

> virtual task wait_for_sequences()

Used in the try_next_item method, this method waits a variable number of #0 delays. This give the generator, which may not have resumed from waiting for a previous call to get or item_done, a chance to wake up and generate and put a new request into the req_chan. This allows the driver to execute back-to-back tranasctions and the generator to just-in-time request generation.

> class avt_channel2tlm #(
> | type | VMM_REQ | = | int,
> |  | OVM_REQ | = | int,
> |  | VMM2OVM_REQ | = | int,
> |  | OVM_RSP | = | OVM_REQ,
> |  | VMM_RSP | = | VMM_REQ,
> |  | OVM2VMM_RSP | = | avt_converter #(OVM_RSP,VMM_RSP),
> |  | OVM_MATCH_REQ_RSP | = | avt_match_ovm_id
> ) extends ovm_component

Use this class to connect a VMM producer to an OVM consumer.

> function new ( |  | string | name | = | "avt_channel2tlm",
> |  | ovm_component | parent | = | null,
> | vmm_channel_typed | #(VMM_REQ) | req_chan | = | null,
> | vmm_channel_typed | #(VMM_RSP) | rsp_chan | = | null,
> |  | bit | rsp_is_req | = | 1,
> | int | unsigned | max_pending_req | = | 100 | )

Creates an instance of a avt_channel2tlm adaptor, with four optional arguments.

> virtual function void build()

Called as part of a predefined test flow, this function will retrieve the configuration setting for the rsp_is_req that this component’s req_chan variable has been configured with a non-null

> protected bit rsp_is_req = 1

Indicates whether a response is the same object as the request with the status and/or read data filled in.

> vmm_channel_typed #( | VMM_REQ | ) req_chan

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

> 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).

> virtual task run()

Called as part of a predefined test flow, the run task forks a process for getting requests from the request channel and sending them to the OVM consumer connection via the blocking put port.

> virtual function string get_type_name()

Returns the type name, i.e.

> vmm_channel_typed #( | VMM_RSP | ) rsp_chan

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

> virtual task auto_put()

Used by this adapter to send transactions to passive OVM consumers.

> virtual task auto_transport()

Used by this adapter to send transactions to passive OVM consumers.

> virtual task auto_blocking_master()

Used by this adapter to send transactions to passive OVM consumers.

> virtual task get( | output | OVM_REQ | o_req | )

Gets and converts a request from the req_chan vmm_channel.

> virtual function bit can_get()

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

> virtual function bit try_get( | output | OVM_REQ | o_req | )

If a transactions is available to get, returns the transaction in the o_req output argument, else returns 0.

> virtual task peek( | output | OVM_REQ | o_req | )

Peeks (does not consume) and converts a request from the req_chan vmm_channel.

> virtual function bit can_peek()

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

> virtual function bit try_peek( | output | OVM_REQ | o_req | )

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

> virtual task put ( | OVM_RSP | o_rsp | )

Converts and sneaks a response to the rsp_chan vmm_channel, if defined.

> virtual function bit can_put ()

Always returns 1 (true) because responses are sneaked into the channel.

> virtual function bit try_put ( | OVM_RSP | o_rsp | )

Sneak the given response to the response channel, or copy the response to the corresponding request if rsp_is_req is set.

> virtual function void write( | OVM_RSP | o_rsp | )

Used by active OVM consumers to send back responses.

> virtual task get_next_item( | output | OVM_REQ | t | )

Peeks and converts a request from the req_chan vmm_channel.

> virtual task try_next_item ( | output | OVM_REQ | t | )

Waits a number of delta cycles waiting for a request transaction to arrive in the req_chan vmm_channel.

> virtual function void put_response ( | OVM_RSP | o_rsp | )

A non-blocking version of put, this function converts and sneaks the given response into the rsp_chan vmm_channel.

> virtual function void item_done( | OVM_RSP | o_rsp | = | null | )

A non-blocking function indicating an OVM driver is done with the transaction retrieved with a get_next_item or get.

> virtual function bit has_do_available()

Named for its association with OVM sequencer operation, this function will return 1 if there is a transaction available to get from the vmm_channel, req_chan.

> virtual task wait_for_sequences()

Used in the try_next_item method, this method waits a variable number of #0 delays.
This example uses an avt_channel2tlm to connect an VMM producer (generator) to an OVM consumer.
This example uses the avt_channel2tlm adapter to connect an VMM producer to an OVM sequence item driver.
Transactions are fetched from this port.