uvm_tr_database¶
- class uvm.base.uvm_tr_database.UVMTrDatabase(name='unnamed-UVMTrDatabase')[source]¶
Bases:
UVMObject
- open_db()[source]¶
Group: Database API
Function: open_db Open the backend connection to the database.
If the database is already open, then this method will return 1.
Otherwise, the method will call
do_open_db
, and return the result.Returns:
- close_db()[source]¶
Function: close_db Closes the backend connection to the database.
Closing a database implicitly closes and frees all
uvm_tr_streams
within the database.If the database is already closed, then this method will return 1.
Otherwise, this method will trigger a
do_close_db
call, and return the result.Returns:
- is_open()[source]¶
Function: is_open Returns the open/closed status of the database.
This method returns 1 if the database has been successfully opened, but not yet closed.
Returns:
- open_stream(name, scope='', type_name='')[source]¶
Function: open_stream Provides a reference to a
stream
within the database.- Parameters:
- name - A string name for the stream. This is the name associated
with the stream in the database.
scope - An optional scope for the stream. type_name - An optional name describing the type of records which
will be created in this stream.
The method returns a reference to a
UVMTrStream
object if successful,null
otherwise.This method will trigger a
do_open_stream
call, and if a nonnull
stream is returned, then <UVMTrStream::do_open> will be called.Streams can only be opened if the database is open (per
is_open
). Otherwise the request will be ignored, andnull
will be returned.- function UVMTrStream open_stream(string name,
string scope=””, string type_name=””)
- Parameters
name –
scope –
type_name –
Returns:
- m_free_stream(stream)[source]¶
Function- m_free_stream Removes stream from the internal array
- Parameters
stream –
- establish_link(link)[source]¶
Function: establish_link Establishes a
link
between two elements in the databaseLinks are only supported between
streams
andrecords
within a single database.This method will trigger a
do_establish_link
call.- Parameters
link –
- class uvm.base.uvm_tr_database.UVMTextTrDatabase(name='unnamed-UVMTextTrDatabase')[source]¶
Bases:
UVMTrDatabase
CLASS: UVMTextTrDatabase
The ~UVMTextTrDatabase~ is the default implementation for the <UVMTrDatabase>. It provides the ability to store recording information into a textual log file.
- do_open_db() bool [source]¶
Group: Implementation Agnostic API
Function: do_open_db Open the backend connection to the database.
Text-Backend implementation of <UVMTrDatabase::open_db>.
The text-backend will open a text file to dump all records in to. The name of this text file is controlled via
set_file_name
.This will also lock the
file_name
, so that it cannot be modified while the connection is open.Returns:
- do_close_db() int [source]¶
Function: do_close_db Close the backend connection to the database.
Text-Backend implementation of <UVMTrDatabase::close_db>.
The text-backend will close the text file used to dump all records in to, if it is currently opened.
This unlocks the
file_name
, allowing it to be modified again.Returns:
- do_open_stream(name: str, scope: str, typename: str) UVMTextTrStream [source]¶
Function: do_open_stream Provides a reference to a
stream
within the database.Text-Backend implementation of <UVMTrDatabase::open_stream>
- protected virtual function UVMTrStream do_open_stream(string name,
string scope, string type_name)
- Parameters
name –
scope –
typename –
Returns:
- do_establish_link(link) None [source]¶
Function: do_establish_link Establishes a
link
between two elements in the databaseText-Backend implementation of <UVMTrDatabase::establish_link>.
- Parameters
link –
- 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 = 'UVMTextTrDatabase'¶