[source]

Class uvm_pkg::uvm_tlm_generic_payload

Copyright 2010 Mentor Graphics Corporation Copyright 2010-2011 Synopsys, Inc. All Rights Reserved Worldwide

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Class

uvm_tlm_generic_payload

This class provides a transaction definition commonly used in memory-mapped bus-based systems. It's intended to be a general purpose transaction class that lends itself to many applications. The class is derived from uvm_sequence_item which enables it to be generated in sequences and transported to drivers through sequencers.

Variables

Name

Type

Description

m_address

bit[63:0]

Variable

m_address

Address for the bus operation. Should be set or read using the set_address and get_address methods. The variable should be used only when constraining.

For a read command or a write command, the target shall interpret the current value of the address attribute as the start address in the system memory map of the contiguous block of data being read or written. The address associated with any given byte in the data array is dependent upon the address attribute, the array index, the streaming width attribute, the endianness and the width of the physical bus.

If the target is unable to execute the transaction with the given address attribute (because the address is out-of-range, for example) it shall generate a standard error response. The recommended response status is UVM_TLM_ADDRESS_ERROR_RESPONSE .

m_command

uvm_tlm_command_e

Variable

m_command

Bus operation type. Should be set using the set_command, set_read or set_write methods and read using the get_command, is_read or is_write methods. The variable should be used only when constraining.

If the target is unable to execute a read or write command, it shall generate a standard error response. The recommended response status is UVM_TLM_COMMAND_ERROR_RESPONSE.

On receipt of a generic payload transaction with the command attribute equal to UVM_TLM_IGNORE_COMMAND, the target shall not execute a write command or a read command not modify any data. The target may, however, use the value of any attribute in the generic payload, including any extensions.

The command attribute shall be set by the initiator, and shall not be overwritten by any interconnect

m_data

byte unsigned

Variable

m_data

Data read or to be written. Should be set and read using the set_data or get_data methods The variable should be used only when constraining.

For a read command or a write command, the target shall copy data to or from the data array, respectively, honoring the semantics of the remaining attributes of the generic payload.

For a write command or UVM_TLM_IGNORE_COMMAND, the contents of the data array shall be set by the initiator, and shall not be overwritten by any interconnect component or target. For a read command, the contents of the data array shall be overwritten by the target (honoring the semantics of the byte enable) but by no other component.

Unlike the OSCI TLM-2.0 LRM, there is no requirement on the endiannes of multi-byte data in the generic payload to match the host endianness. Unlike C++, it is not possible in SystemVerilog to cast an arbitrary data type as an array of bytes. Therefore, matching the host endianness is not necessary. In contrast, arbitrary data types may be converted to and from a byte array using the streaming operator and uvm_object objects may be further converted using the uvm_object::pack_bytes() and uvm_object::unpack_bytes() methods. All that is required is that a consistent mechanism is used to fill the payload data array and later extract data from it.

Should a generic payload be transferred to/from a SystemC model, it will be necessary for any multi-byte data in that generic payload to use/be interpreted using the host endianness. However, this process is currently outside the scope of this standard.

m_length

int unsigned

Variable

m_length

The number of bytes to be copied to or from the m_data array, inclusive of any bytes disabled by the m_byte_enable attribute.

The data length attribute shall be set by the initiator, and shall not be overwritten by any interconnect component or target.

The data length attribute shall not be set to 0. In order to transfer zero bytes, the m_command attribute should be set to .

m_response_status

uvm_tlm_response_status_e

Variable

m_response_status

Status of the bus operation. Should be set using the set_response_status method and read using the get_response_status, get_response_string, is_response_ok or is_response_error methods. The variable should be used only when constraining.

The response status attribute shall be set to UVM_TLM_INCOMPLETE_RESPONSE by the initiator, and may be overwritten by the target. The response status attribute should not be overwritten by any interconnect component, because the default value UVM_TLM_INCOMPLETE_RESPONSE indicates that the transaction was not delivered to the target.

The target may set the response status attribute to UVM_TLM_OK_RESPONSE to indicate that it was able to execute the command successfully, or to one of the five error responses to indicate an error. The target should choose the appropriate error response depending on the cause of the error. If a target detects an error but is unable to select a specific error response, it may set the response status to UVM_TLM_GENERIC_ERROR_RESPONSE.

The target shall be responsible for setting the response status attribute at the appropriate point in the lifetime of the transaction. In the case of the blocking transport interface, this means before returning control from b_transport. In the case of the non-blocking transport interface and the base protocol, this means before sending the BEGIN_RESP phase or returning a value of UVM_TLM_COMPLETED.

It is recommended that the initiator should always check the response status attribute on receiving a transition to the BEGIN_RESP phase or after the completion of the transaction. An initiator may choose to ignore the response status if it is known in advance that the value will be UVM_TLM_OK_RESPONSE, perhaps because it is known in advance that the initiator is only connected to targets that always return UVM_TLM_OK_RESPONSE, but in general this will not be the case. In other words, the initiator ignores the response status at its own risk.

m_dmi

bit

Variable

m_dmi

DMI mode is not yet supported in the UVM TLM2 subset. This variable is provided for completeness and interoperability with SystemC.

m_byte_enable

byte unsigned

Variable

m_byte_enable

Indicates valid m_data array elements. Should be set and read using the set_byte_enable or get_byte_enable methods The variable should be used only when constraining.

The elements in the byte enable array shall be interpreted as follows. A value of 8'h00 shall indicate that that corresponding byte is disabled, and a value of 8'hFF shall indicate that the corresponding byte is enabled.

Byte enables may be used to create burst transfers where the address increment between each beat is greater than the number of significant bytes transferred on each beat, or to place words in selected byte lanes of a bus. At a more abstract level, byte enables may be used to create "lacy bursts" where the data array of the generic payload has an arbitrary pattern of holes punched in it.

The byte enable mask may be defined by a small pattern applied repeatedly or by a large pattern covering the whole data array. The byte enable array may be empty, in which case byte enables shall not be used for the current transaction.

The byte enable array shall be set by the initiator and shall not be overwritten by any interconnect component or target.

If the byte enable pointer is not empty, the target shall either implement the semantics of the byte enable as defined below or shall generate a standard error response. The recommended response status is UVM_TLM_BYTE_ENABLE_ERROR_RESPONSE.

In the case of a write command, any interconnect component or target should ignore the values of any disabled bytes in the m_data array. In the case of a read command, any interconnect component or target should not modify the values of disabled bytes in the m_data array.

m_byte_enable_length

int unsigned

Variable

m_byte_enable_length

The number of elements in the m_byte_enable array.

It shall be set by the initiator, and shall not be overwritten by any interconnect component or target.

m_streaming_width

int unsigned

Variable

m_streaming_width

Number of bytes transferred on each beat. Should be set and read using the set_streaming_width or get_streaming_width methods The variable should be used only when constraining.

Streaming affects the way a component should interpret the data array. A stream consists of a sequence of data transfers occurring on successive notional beats, each beat having the same start address as given by the generic payload address attribute. The streaming width attribute shall determine the width of the stream, that is, the number of bytes transferred on each beat. In other words, streaming affects the local address associated with each byte in the data array. In all other respects, the organization of the data array is unaffected by streaming.

The bytes within the data array have a corresponding sequence of local addresses within the component accessing the generic payload transaction. The lowest address is given by the value of the address attribute. The highest address is given by the formula address_attribute + streaming_width - 1. The address to or from which each byte is being copied in the target shall be set to the value of the address attribute at the start of each beat.

With respect to the interpretation of the data array, a single transaction with a streaming width shall be functionally equivalent to a sequence of transactions each having the same address as the original transaction, each having a data length attribute equal to the streaming width of the original, and each with a data array that is a different subset of the original data array on each beat. This subset effectively steps down the original data array maintaining the sequence of bytes.

A streaming width of 0 indicates that a streaming transfer is not required. it is equivalent to a streaming width value greater than or equal to the size of the m_data array.

Streaming may be used in conjunction with byte enables, in which case the streaming width would typically be equal to the byte enable length. It would also make sense to have the streaming width a multiple of the byte enable length. Having the byte enable length a multiple of the streaming width would imply that different bytes were enabled on each beat.

If the target is unable to execute the transaction with the given streaming width, it shall generate a standard error response. The recommended response status is TLM_BURST_ERROR_RESPONSE.

Constructors

new(string name = "")

Function

new

Create a new instance of the generic payload. Initialize all the members to their default values.

Parameters:

name (string)

Functions

do_print(uvm_printer printer)

Function- do_print

Parameters:

printer (uvm_printer)

do_copy(uvm_object rhs)

Function- do_copy

Parameters:

rhs (uvm_object)

do_compare(uvm_object rhs, uvm_comparer comparer)

Function- do_compare

Parameters:
do_pack(uvm_packer packer)

Function- do_pack

We only pack m_length bytes of the m_data array, even if m_data is larger than m_length. Same treatment for the byte-enable array. We do not pack the extensions, if any, as we will be unable to unpack them.

Parameters:

packer (uvm_packer)

do_unpack(uvm_packer packer)

Function- do_unpack

We only reallocate m_data/m_byte_enable if the new size is greater than their current size. We do not unpack extensions because we do not know what object types to allocate before we unpack into them. Extensions must be handled by user code.

Parameters:

packer (uvm_packer)

do_record(uvm_recorder recorder)

Function- do_record

Parameters:

recorder (uvm_recorder)

convert2string()

Function- convert2string

get_command()

Function

get_command

Get the value of the m_command variable

Return type:

uvm_tlm_command_e

set_command(uvm_tlm_command_e command)

Function

set_command

Set the value of the m_command variable

Parameters:

command (uvm_tlm_command_e)

is_read()

Function

is_read

Returns true if the current value of the m_command variable is UVM_TLM_READ_COMMAND .

set_read()

Function

set_read

Set the current value of the m_command variable to UVM_TLM_READ_COMMAND .

is_write()

Function

is_write

Returns true if the current value of the m_command variable is UVM_TLM_WRITE_COMMAND .

set_write()

Function

set_write

Set the current value of the m_command variable to UVM_TLM_WRITE_COMMAND .

set_address(bit[63:0] addr)

Function

set_address

Set the value of the m_address variable

Parameters:

addr (bit[63:0])

get_address()

Function

get_address

Get the value of the m_address variable

get_data(byte unsigned p)

Function

get_data

Return the value of the m_data array

Parameters:

p (byte unsigned)

set_data(byte unsigned p)

Function

set_data

Set the value of the m_data array

Parameters:

p (byte unsigned)

get_data_length()

Function

get_data_length

Return the current size of the m_data array

set_data_length(int unsigned length)

Function

set_data_length

Set the value of the m_length

Parameters:

length (int unsigned)

get_streaming_width()

Function

get_streaming_width

Get the value of the m_streaming_width array

set_streaming_width(int unsigned width)

Function

set_streaming_width

Set the value of the m_streaming_width array

Parameters:

width (int unsigned)

get_byte_enable(byte unsigned p)

Function

get_byte_enable

Return the value of the m_byte_enable array

Parameters:

p (byte unsigned)

set_byte_enable(byte unsigned p)

Function

set_byte_enable

Set the value of the m_byte_enable array

Parameters:

p (byte unsigned)

get_byte_enable_length()

Function

get_byte_enable_length

Return the current size of the m_byte_enable array

set_byte_enable_length(int unsigned length)

Function

set_byte_enable_length

Set the size m_byte_enable_length of the m_byte_enable array i.e. m_byte_enable.size()

Parameters:

length (int unsigned)

set_dmi_allowed(bit dmi)

Function

set_dmi_allowed

DMI hint. Set the internal flag m_dmi to allow dmi access

Parameters:

dmi (bit)

is_dmi_allowed()

Function

is_dmi_allowed

DMI hint. Query the internal flag m_dmi if allowed dmi access

get_response_status()

Function

get_response_status

Return the current value of the m_response_status variable

Return type:

uvm_tlm_response_status_e

set_response_status(uvm_tlm_response_status_e status)

Function

set_response_status

Set the current value of the m_response_status variable

Parameters:

status (uvm_tlm_response_status_e)

is_response_ok()

Function

is_response_ok

Return TRUE if the current value of the m_response_status variable is UVM_TLM_OK_RESPONSE

is_response_error()

Function

is_response_error

Return TRUE if the current value of the m_response_status variable is not UVM_TLM_OK_RESPONSE

get_response_string()

Function

get_response_string

Return the current value of the m_response_status variable as a string

set_extension(uvm_tlm_extension_base ext)

Function

set_extension

Add an instance-specific extension. Only one instance of any given extension type is allowed. If there is an existing extension instance of the type of ext , ext replaces it and its handle is returned. Otherwise, null is returned.

Parameters:

ext (uvm_tlm_extension_base)

Return type:

uvm_tlm_extension_base

get_num_extensions()

Function

get_num_extensions

Return the current number of instance specific extensions.

get_extension(uvm_tlm_extension_base ext_handle)

Function

get_extension

Return the instance specific extension bound under the specified key. If no extension is bound under that key, null is returned.

Parameters:

ext_handle (uvm_tlm_extension_base)

Return type:

uvm_tlm_extension_base

clear_extension(uvm_tlm_extension_base ext_handle)

Function

clear_extension

Remove the instance-specific extension bound under the specified key.

Parameters:

ext_handle (uvm_tlm_extension_base)

clear_extensions()

Function

clear_extensions

Remove all instance-specific extensions