Callbacks¶
- class uvm.reg.uvm_reg_cbs.UVMRegCbs(name='uvm_reg_cbs')[source]¶
Bases:
UVMCallback- async pre_write(rw)[source]¶
Task: pre_write
Called before a write operation.
All registered
pre_writecallback methods are invoked after the invocation of thepre_writemethod of associated object (Registers, Fields, Memories, or Backdoors). If the element being written is a Registers, allpre_writecallback methods are invoked before the containeduvm_reg_fields.- Backdoor - <uvm_reg_backdoor::pre_write>,
<uvm_reg_cbs::pre_write> cbs for backdoor.
- Register - <uvm_reg::pre_write>,
<uvm_reg_cbs::pre_write> cbs for reg, then foreach field:
<uvm_reg_field::pre_write>, <uvm_reg_cbs::pre_write> cbs for field
- RegField - <uvm_reg_field::pre_write>,
<uvm_reg_cbs::pre_write> cbs for field
- Memory - <uvm_mem::pre_write>,
<uvm_reg_cbs::pre_write> cbs for mem
The
rwargument holds information about the operation.Modifying the
valuemodifies the actual value written.For memories, modifying the
offsetmodifies the offset used in the operation.For non-backdoor operations, modifying the access
pathor addressmapmodifies the actual path or map used in the operation.
If the ~rw.status~ is modified to anything other than
UVM_IS_OK, the operation is aborted.See Generic Register Operation Descriptors for details on
rwinformation.virtual task pre_write(uvm_reg_item rw); endtask
- Parameters
rw –
- async post_write(rw)[source]¶
Task: post_write
Called after a write operation.
All registered
post_writecallback methods are invoked before the invocation of thepost_writemethod of the associated object (Registers, Fields, Memories, or Backdoors). If the element being written is a Registers, allpost_writecallback methods are invoked before the containeduvm_reg_fields.Summary of callback order:
- Backdoor - <uvm_reg_cbs::post_write> cbs for backdoor,
<uvm_reg_backdoor::post_write>
- Register - <uvm_reg_cbs::post_write> cbs for reg,
<uvm_reg::post_write>, then foreach field:
<uvm_reg_cbs::post_write> cbs for field, <uvm_reg_field::post_read>
- RegField - <uvm_reg_cbs::post_write> cbs for field,
<uvm_reg_field::post_write>
- Memory - <uvm_reg_cbs::post_write> cbs for mem,
<uvm_mem::post_write>
The
rwargument holds information about the operation.Modifying the
statusmember modifies the returned status.Modifying the
valueoroffsetmembers has no effect, as the operation has already completed.
See Generic Register Operation Descriptors for details on
rwinformation.virtual task post_write(uvm_reg_item rw); endtask
- Parameters
rw –
- async pre_read(rw)[source]¶
Task: pre_read
Callback called before a read operation.
All registered
pre_readcallback methods are invoked after the invocation of thepre_readmethod of associated object (Registers, Fields, Memories, or Backdoors). If the element being read is a Registers, allpre_readcallback methods are invoked before the containeduvm_reg_fields.- Backdoor - <uvm_reg_backdoor::pre_read>,
<uvm_reg_cbs::pre_read> cbs for backdoor
- Register - <uvm_reg::pre_read>,
<uvm_reg_cbs::pre_read> cbs for reg, then foreach field:
<uvm_reg_field::pre_read>, <uvm_reg_cbs::pre_read> cbs for field
- RegField - <uvm_reg_field::pre_read>,
<uvm_reg_cbs::pre_read> cbs for field
- Memory - <uvm_mem::pre_read>,
<uvm_reg_cbs::pre_read> cbs for mem
The
rwargument holds information about the operation.The
valuemember ofrwis not used has no effect if modified.For memories, modifying the
offsetmodifies the offset used in the operation.For non-backdoor operations, modifying the access
pathor addressmapmodifies the actual path or map used in the operation.
If the ~rw.status~ is modified to anything other than
UVM_IS_OK, the operation is aborted.See Generic Register Operation Descriptors for details on
rwinformation.virtual task pre_read(uvm_reg_item rw); endtask
- Parameters
rw –
- post_read(rw)[source]¶
Task: post_read
Callback called after a read operation.
All registered
post_readcallback methods are invoked before the invocation of thepost_readmethod of the associated object (Registers, Fields, Memories, or Backdoors). If the element being read is a Registers, allpost_readcallback methods are invoked before the containeduvm_reg_fields.- Backdoor - <uvm_reg_cbs::post_read> cbs for backdoor,
<uvm_reg_backdoor::post_read>
- Register - <uvm_reg_cbs::post_read> cbs for reg,
<uvm_reg::post_read>, then foreach field:
<uvm_reg_cbs::post_read> cbs for field, <uvm_reg_field::post_read>
- RegField - <uvm_reg_cbs::post_read> cbs for field,
<uvm_reg_field::post_read>
- Memory - <uvm_reg_cbs::post_read> cbs for mem,
<uvm_mem::post_read>
The
rwargument holds information about the operation.Modifying the readback
valueorstatusmodifies the actual returned value and status.Modifying the
valueoroffsetmembers has no effect, as the operation has already completed.
See Generic Register Operation Descriptors for details on
rwinformation.virtual task post_read(uvm_reg_item rw); endtask
- Parameters
rw –
- encode(data)[source]¶
Function: encode
Data encoder
The registered callback methods are invoked in order of registration after all the
pre_writemethods have been called. The encoded data is passed through each invocation in sequence. This allows thepre_writemethods to deal with clear-text data.By default, the data is not modified.
- Parameters
data –
- decode(data)[source]¶
Function: decode
Data decode
The registered callback methods are invoked in ~reverse order~ of registration before all the
post_readmethods are called. The decoded data is passed through each invocation in sequence. This allows thepost_readmethods to deal with clear-text data.The reversal of the invocation order is to allow the decoding of the data to be performed in the opposite order of the encoding with both operations specified in the same callback extension.
By default, the data is not modified.
- Parameters
data –
- class uvm.reg.uvm_reg_cbs.UVMRegReadOnlyCbs(name='uvm_reg_read_only_cbs')[source]¶
Bases:
UVMRegCbs- m_me = None¶
- create(name='')¶
Group: Creation
The
createmethod 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_typemethod, 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_nameis not registered with the factory, then aNonehandle 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()¶
Returns the type name of this callback object.
- Returns
Type name of this callback object.
- Return type
- type_id = <uvm.base.uvm_registry.UVMObjectRegistry object>¶
- type_name = 'UVMRegReadOnlyCbs'¶
- class uvm.reg.uvm_reg_cbs.UVMRegWriteOnlyCbs(name='UVMRegWriteOnlyCbs')[source]¶
Bases:
UVMRegCbs- m_me = None¶
- create(name='')¶
Group: Creation
The
createmethod 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_typemethod, 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_nameis not registered with the factory, then aNonehandle 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()¶
Returns the type name of this callback object.
- Returns
Type name of this callback object.
- Return type
- type_id = <uvm.base.uvm_registry.UVMObjectRegistry object>¶
- type_name = 'UVMRegWriteOnlyCbs'¶