uvm_recorder

class uvm.base.uvm_recorder.UVMRecorder(name='uvm_recorder')[source]

Bases: UVMObject

CLASS: UVMRecorder

Abstract class which defines the ~recorder~ API.

m_ids_by_recorder = {}
get_stream()[source]

Group: Configuration API

Function: get_stream Returns a reference to the stream which created this record.

A warning will be asserted if get_stream is called prior to the record being initialized via do_open.

Returns:

close(close_time=0)[source]

Function: close Closes this recorder.

Closing a recorder marks the end of the transaction in the stream.

Parameters: close_time - Optional time to record as the closing time of this transaction.

This method will trigger a do_close call.

Parameters

close_time

free(close_time=0)[source]

Function: free Frees this recorder

Freeing a recorder indicates that the stream and database can release any references to the recorder.

If a recorder has not yet been closed (via a call to close), then close will automatically be called, and passed the close_time. If the recorder has already been closed, then the close_time will be ignored.

This method will trigger a do_free call.

Parameters

close_time (int) – Optional time to record as the closing time of this transaction.

is_open()[source]

Function: is_open Returns true if this uvm_recorder was opened on its stream, but has not yet been closed.

Returns:

get_open_time()[source]

Function: get_open_time Returns the open_time

Returns:

is_closed()[source]

Function: is_closed Returns true if this uvm_recorder was closed on its stream, but has not yet been freed.

Returns:

get_close_time()[source]

Function: get_close_time Returns the close_time

Returns:

m_do_open(stream, open_time, type_name)[source]

Function- m_do_open Initializes the internal state of the recorder.

Parameters: stream - The stream which spawned this recorder

This method will trigger a do_open call.

An error will be asserted if: - m_do_open is called more than once without the

recorder being freed in between.

  • stream is null

Parameters
  • stream

  • open_time

  • type_name

m_recorders_by_id = {}
classmethod m_free_id(id)[source]

Function- m_free_id Frees the id/recorder link (memory cleanup)

Parameters
  • cls

  • id

get_handle()[source]

Function: get_handle Returns a unique ID for this recorder.

A value of 0 indicates that the recorder has been freed, and no longer has a valid ID.

Returns:

classmethod get_recorder_from_handle(id)[source]

Static accessor, returns a recorder reference for a given unique id.

If no recorder exists with the given id, or if the recorder with that id has been freed, then null is returned.

This method can be used to access the recorder associated with a call to UVMTransaction.begin_tr or UVMComponent.begin_tr.

handle = tr.begin_tr()
recorder = UVMRecorder.get_recorder_from_handle(handle)
if recorder is not None:
    recorder.record_string("begin_msg", "Started recording transaction!")
Parameters
  • cls

  • id

Return type

UVMRecorder

record_field(name, value, size, radix=0)[source]
record_field_int(name, value, size, radix=0)[source]
record_object(name, value)[source]
record_string(name, value)[source]
use_record_attribute()[source]
do_open(stream, open_time, type_name)[source]

Function: do_open Callback triggered via <uvm_tr_stream::open_recorder>.

The do_open callback can be used to initialize any internal state within the recorder, as well as providing a location to record any initial information.

Parameters
  • stream

  • open_time

  • type_name

do_close(close_time)[source]
do_free()[source]
class uvm.base.uvm_recorder.UVMTextRecorder(name='unnamed-uvm_text_recorder')[source]

Bases: UVMRecorder

do_open(stream, open_time, type_name)[source]

Group: Implementation Agnostic API

Function: do_open Callback triggered via <uvm_tr_stream::open_recorder>.

Text-backend specific implementation.

Parameters
  • stream

  • open_time

  • type_name

do_close(close_time)[source]

Function: do_close Callback triggered via <uvm_recorder::close>.

Text-backend specific implementation.

Parameters

close_time

do_free()[source]

Function: do_free Callback triggered via <uvm_recorder::free>.

Text-backend specific implementation.

do_record_field(name, value, size, radix)[source]
do_record_field_int(name, value, size, radix)[source]
do_record_object(name, value)[source]
do_record_string(name, value)[source]
do_record_time(name, value)[source]
do_record_generic(name, value, type_name)[source]
write_attribute(nm, value, radix, numbits=32)[source]
write_attribute_int(nm, value, radix, numbits=32)[source]
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 of uvm_object_wrapper. This method, if implemented, can be used as convenient means of supplying those arguments. This method is the same as the static get_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 by get_type_name is not registered with the factory, then a None 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 of uvm_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

str

type_id = <uvm.base.uvm_registry.UVMObjectRegistry object>
type_name = 'UVMTextRecorder'