TLM Generic Payload & Extensions¶
TLM Generic Payload & Extensions
The Generic Payload transaction represents a generic bus read/write access. It is used as the default transaction in TLM2 blocking and nonblocking transport interfaces.
- class uvm.tlm2.uvm_tlm2_generic_payload.uvm_tlm_command_e(value)[source]¶
Bases:
Enum
Enum uvm_tlm_command_e Command attribute type definition
UVM_TLM_READ_COMMAND - Bus read operation
UVM_TLM_WRITE_COMMAND - Bus write operation
UVM_TLM_IGNORE_COMMAND - No bus operation.
- UVM_TLM_READ_COMMAND = 1¶
- UVM_TLM_WRITE_COMMAND = 2¶
- UVM_TLM_IGNORE_COMMAND = 3¶
- class uvm.tlm2.uvm_tlm2_generic_payload.uvm_tlm_response_status_e(value)[source]¶
Bases:
IntEnum
Enum uvm_tlm_response_status_e Response status attribute type definition
UVM_TLM_OK_RESPONSE - Bus operation completed successfully
UVM_TLM_INCOMPLETE_RESPONSE - Transaction was not delivered to target
UVM_TLM_GENERIC_ERROR_RESPONSE - Bus operation had an error
UVM_TLM_ADDRESS_ERROR_RESPONSE - Invalid address specified
UVM_TLM_COMMAND_ERROR_RESPONSE - Invalid command specified
UVM_TLM_BURST_ERROR_RESPONSE - Invalid burst specified
UVM_TLM_BYTE_ENABLE_ERROR_RESPONSE - Invalid byte enabling specified
- OK_RESPONSE = 1¶
- INCOMPLETE_RESPONSE = 0¶
- GENERIC_ERROR_RESPONSE = -1¶
- ADDRESS_ERROR_RESPONSE = -2¶
- COMMAND_ERROR_RESPONSE = -3¶
- BURST_ERROR_RESPONSE = -4¶
- BYTE_ENABLE_ERROR_RESPONSE = -5¶
- class uvm.tlm2.uvm_tlm2_generic_payload.UVMTLMGenericPayload(name='')[source]¶
Bases:
UVMSequenceItem
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
m_address (int) –
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~.
- convert2string()[source]¶
This virtual function is a user-definable hook, called directly by the user, that allows users to provide object information in the form of a string. Unlike
sprint
, there is no requirement to use auvm_printer
policy object. As such, the format and content of the output is fully customizable, which may be suitable for applications not requiring the consistent formatting offered by theprint
/sprint
/do_print
API.Fields declared in <Utility Macros> macros (`uvm_field_*), if used, will not automatically appear in calls to convert2string.
An example implementation of convert2string follows.
class Base(UVMObject): field = "foo" def convert2string(self): return "base_field=" + self.field class Obj2(UVMObject): field = "bar" def convert2string() convert2string = "child_field=" + self.field class Obj(Base): addr = 0x123 data = 0x456 write = 1 child = Obj2() def convert2string(self): convert2string = super().convert2string() + sv.sformatf(" write=%0d addr=%8h data=%8h ",write,addr,data) + child.convert2string() Then, to display an object, you could write: .. code-block:: python o = Obj() uvm_report_info("BusMaster", "Sending:
” + o.convert2string())
The output will look similar to:
UVM_INFO @ 0: reporter [BusMaster] Sending: base_field=foo write=1 addr=00000123 data=00000456 child_field=bar
- Returns:
str: Object converted into string.
- create(name='')¶
Group: Creation
The
create
method allocates a new object of the same type as this object and returns it via a base uvm_object handle. Every class deriving from uvm_object, directly or indirectly, must implement the create method.A typical implementation is as follows:
class mytype (UVMObject): ... def create(self, name=""): mytype t = mytype(name) return t
- Parameters
name (str) – Name of the created object.
- Returns
New object.
- Return type
obj
- get_object_type()¶
Function: get_object_type
Returns the type-proxy (wrapper) for this object. The
uvm_factory
’s type-based override and creation methods take arguments ofuvm_object_wrapper
. This method, if implemented, can be used as convenient means of supplying those arguments. This method is the same as the staticget_type
method, but uses an already allocated object to determine the type-proxy to access (instead of using the static object).The default implementation of this method does a factory lookup of the proxy using the return value from
get_type_name
. If the type returned byget_type_name
is not registered with the factory, then aNone
handle is returned.For example:
class cmd (UVMObject): type_id = UVMObjectRegistry() @classmethod def type_id get_type(cls): return type_id.get() def get_object_type(self): return cmd.type_id.get()
This function is implemented by the `uvm_*_utils macros, if employed.
Returns:
- classmethod get_type()¶
Returns the type-proxy (wrapper) for this object. The
UVMFactory
’s type-based override and creation methods take arguments ofuvm_object_wrapper
. This method, if implemented, can be used as convenient means of supplying those arguments.The default implementation of this method produces an error and returns
None
. To enable use of this method, a user’s subtype must implement a version that returns the subtype’s wrapper.For example:
class cmd(UVMObject): type_id = None @classmethod def get_type(cls): return cls.type_id.get()
Then, to use:
factory.set_type_override(cmd.get_type(), subcmd.get_type())
This function is implemented by the uvm_*_utils functions, if employed.
Returns:
- get_type_name()¶
This function returns the type name of the object, which is typically the type identifier enclosed in quotes. It is used for various debugging functions in the library, and it is used by the factory for creating objects.
This function must be defined in every derived class.
A typical implementation is as follows:
class mytype (UVMObject): ... type_name = "mytype" def get_type_name(self): return my_type.type_name
We define the
type_name
static variable to enable access to the type name without need of an object of the class, i.e., to enable access via the scope operator, ~mytype::type_name~.- Returns
Type name of the object.
- Return type
- type_id = <uvm.base.uvm_registry.UVMObjectRegistry object>¶
- type_name = 'UVMTLMGenericPayload'¶
- class uvm.tlm2.uvm_tlm2_generic_payload.UVMTLMExtensionBase(name='')[source]¶
Bases:
UVMObject
- do_copy(rhs)[source]¶
The
do_copy
method is the user-definable hook called by thecopy
method. A derived class should override this method to include its fields in acopy
operation.A typical implementation is as follows:
class mytype (UVMObject): ... field_1 = 0 def do_copy(self, rhs): super.do_copy(rhs) # Optionanl type checking field_1 = rhs.field_1
The implementation must call
super().do_copy
, and can optionally do type checking before copying.- Parameters
rhs (UVMObject) – Object to be copied.
- create(name='')[source]¶
Group: Creation
The
create
method allocates a new object of the same type as this object and returns it via a base uvm_object handle. Every class deriving from uvm_object, directly or indirectly, must implement the create method.A typical implementation is as follows:
class mytype (UVMObject): ... def create(self, name=""): mytype t = mytype(name) return t
- Parameters
name (str) – Name of the created object.
- Returns
New object.
- Return type
obj
- class uvm.tlm2.uvm_tlm2_generic_payload.UVMTLMExtension(name='')[source]¶
Bases:
UVMTLMExtensionBase