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
), thenclose
will automatically be called, and passed theclose_time
. If the recorder has already been closed, then theclose_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:
- is_closed()[source]¶
Function: is_closed Returns true if this uvm_recorder was closed on its stream, but has not yet been freed.
Returns:
- 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 beenfreed
, 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 thatid
has been freed, thennull
is returned.This method can be used to access the recorder associated with a call to
UVMTransaction.begin_tr
orUVMComponent.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
- 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 –
- 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.
- 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 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 = 'UVMTextRecorder'¶