Register Callbacks

This section defines the base class used for all register callback extensions.  It also includes pre-defined callback extensions for use on read-only and write-only registers.

Contents
Register CallbacksThis section defines the base class used for all register callback extensions.
uvm_reg_cbsFacade class for field, register, memory and backdoor access callback methods.
Typedefs
uvm_reg_cbConvenience callback type declaration for registers
uvm_reg_cb_iterConvenience callback iterator type declaration for registers
uvm_reg_bd_cbConvenience callback type declaration for backdoor
uvm_reg_bd_cb_iterConvenience callback iterator type declaration for backdoor
uvm_mem_cbConvenience callback type declaration for memories
uvm_mem_cb_iterConvenience callback iterator type declaration for memories
uvm_reg_field_cbConvenience callback type declaration for fields
uvm_reg_field_cb_iterConvenience callback iterator type declaration for fields
Predefined Extensions
uvm_reg_read_only_cbsPre-defined register callback method for read-only registers that will issue an error if a write() operation is attempted.
uvm_reg_write_only_cbsPre-defined register callback method for write-only registers that will issue an error if a read() operation is attempted.

uvm_reg_cbs

Facade class for field, register, memory and backdoor access callback methods.

Summary
uvm_reg_cbs
Facade class for field, register, memory and backdoor access callback methods.
Class Hierarchy
Class Declaration
virtual class uvm_reg_cbs extends uvm_callback
Methods
pre_writeCalled before a write operation.
post_writeCalled after user-defined backdoor register write.
pre_readCallback called before a read operation.
post_readCallback called after a read operation.
post_predictCalled by the uvm_reg_field::predict() method after a successful UVM_PREDICT_READ or UVM_PREDICT_WRITE prediction.
encodeData encoder
decodeData decode

pre_write

virtual task pre_write( uvm_reg_item  rw )

Called before a write operation.

All registered pre_write callback methods are invoked after the invocation of the pre_write method of associated object (uvm_reg, uvm_reg_field, uvm_mem, or uvm_reg_backdoor).  If the element being written is a uvm_reg, all pre_write callback methods are invoked before the contained uvm_reg_fields.

Backdooruvm_reg_backdoor::pre_write, uvm_reg_cbs::pre_write cbs for backdoor.
Registeruvm_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
RegFielduvm_reg_field::pre_write, uvm_reg_cbs::pre_write cbs for field
Memoryuvm_mem::pre_write, uvm_reg_cbs::pre_write cbs for mem

The rw argument holds information about the operation.

  • Modifying the value modifies the actual value written.
  • For memories, modifying the offset modifies the offset used in the operation.
  • For non-backdoor operations, modifying the access path or address map modifies 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 uvm_reg_item for details on rw information.

post_write

virtual task post_write( uvm_reg_item  rw )

Called after user-defined backdoor register write.

All registered post_write callback methods are invoked before the invocation of the post_write method of the associated object (uvm_reg, uvm_reg_field, uvm_mem, or uvm_reg_backdoor).  If the element being written is a uvm_reg, all post_write callback methods are invoked before the contained uvm_reg_fields.

Summary of callback order

Backdooruvm_reg_cbs::post_write cbs for backdoor, uvm_reg_backdoor::post_write
Registeruvm_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
RegFielduvm_reg_cbs::post_write cbs for field, uvm_reg_field::post_write
Memoryuvm_reg_cbs::post_write cbs for mem, uvm_mem::post_write

The rw argument holds information about the operation.

  • Modifying the status member modifies the returned status.
  • Modiying the value or offset members has no effect, as the operation has already completed.

See uvm_reg_item for details on rw information.

pre_read

virtual task pre_read( uvm_reg_item  rw )

Callback called before a read operation.

All registered pre_read callback methods are invoked after the invocation of the pre_read method of associated object (uvm_reg, uvm_reg_field, uvm_mem, or uvm_reg_backdoor).  If the element being read is a uvm_reg, all pre_read callback methods are invoked before the contained uvm_reg_fields.

Backdooruvm_reg_backdoor::pre_read, uvm_reg_cbs::pre_read cbs for backdoor
Registeruvm_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
RegFielduvm_reg_field::pre_read, uvm_reg_cbs::pre_read cbs for field
Memoryuvm_mem::pre_read, uvm_reg_cbs::pre_read cbs for mem

The rw argument holds information about the operation.

  • The value member of rw is not used has no effect if modified.
  • For memories, modifying the offset modifies the offset used in the operation.
  • For non-backdoor operations, modifying the access path or address map modifies 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 uvm_reg_item for details on rw information.

post_read

virtual task post_read( uvm_reg_item  rw )

Callback called after a read operation.

All registered post_read callback methods are invoked before the invocation of the post_read method of the associated object (uvm_reg, uvm_reg_field, uvm_mem, or uvm_reg_backdoor).  If the element being read is a uvm_reg, all post_read callback methods are invoked before the contained uvm_reg_fields.

Backdooruvm_reg_cbs::post_read cbs for backdoor, uvm_reg_backdoor::post_read
Registeruvm_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
RegFielduvm_reg_cbs::post_read cbs for field, uvm_reg_field::post_read
Memoryuvm_reg_cbs::post_read cbs for mem, uvm_mem::post_read

The rw argument holds information about the operation.

  • Modifying the readback value or status modifies the actual returned value and status.
  • Modiying the value or offset members has no effect, as the operation has already completed.

See uvm_reg_item for details on rw information.

post_predict

virtual function void post_predict( input  uvm_reg_field  fld,
input  uvm_reg_data_t  previous,
inout  uvm_reg_data_t  value,
input  uvm_predict_e  kind,
input  uvm_path_e  path,
input  uvm_reg_map  map )

Called by the uvm_reg_field::predict() method after a successful UVM_PREDICT_READ or UVM_PREDICT_WRITE prediction.

previous is the previous value in the mirror and value is the latest predicted value.  Any change to value will modify the predicted mirror value.

encode

virtual function void encode( ref  uvm_reg_data_t  data[] )

Data encoder

The registered callback methods are invoked in order of registration after all the pre_write methods have been called.  The encoded data is passed through each invocation in sequence.  This allows the pre_write methods to deal with clear-text data.

By default, the data is not modified.

decode

virtual function void decode( ref  uvm_reg_data_t  data[] )

Data decode

The registered callback methods are invoked in reverse order of registration before all the post_read methods are called.  The decoded data is passed through each invocation in sequence.  This allows the post_read methods 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.

Typedefs

Summary
Typedefs
uvm_reg_cbConvenience callback type declaration for registers
uvm_reg_cb_iterConvenience callback iterator type declaration for registers
uvm_reg_bd_cbConvenience callback type declaration for backdoor
uvm_reg_bd_cb_iterConvenience callback iterator type declaration for backdoor
uvm_mem_cbConvenience callback type declaration for memories
uvm_mem_cb_iterConvenience callback iterator type declaration for memories
uvm_reg_field_cbConvenience callback type declaration for fields
uvm_reg_field_cb_iterConvenience callback iterator type declaration for fields
Predefined Extensions

uvm_reg_cb

Convenience callback type declaration for registers

Use this declaration to register register callbacks rather than the more verbose parameterized class

uvm_reg_cb_iter

Convenience callback iterator type declaration for registers

Use this declaration to iterate over registered register callbacks rather than the more verbose parameterized class

uvm_reg_bd_cb

Convenience callback type declaration for backdoor

Use this declaration to register register backdoor callbacks rather than the more verbose parameterized class

uvm_reg_bd_cb_iter

Convenience callback iterator type declaration for backdoor

Use this declaration to iterate over registered register backdoor callbacks rather than the more verbose parameterized class

uvm_mem_cb

Convenience callback type declaration for memories

Use this declaration to register memory callbacks rather than the more verbose parameterized class

uvm_mem_cb_iter

Convenience callback iterator type declaration for memories

Use this declaration to iterate over registered memory callbacks rather than the more verbose parameterized class

uvm_reg_field_cb

Convenience callback type declaration for fields

Use this declaration to register field callbacks rather than the more verbose parameterized class

uvm_reg_field_cb_iter

Convenience callback iterator type declaration for fields

Use this declaration to iterate over registered field callbacks rather than the more verbose parameterized class

uvm_reg_read_only_cbs

Pre-defined register callback method for read-only registers that will issue an error if a write() operation is attempted.

Summary
uvm_reg_read_only_cbs
Pre-defined register callback method for read-only registers that will issue an error if a write() operation is attempted.
Class Hierarchy
Class Declaration
class uvm_reg_read_only_cbs extends uvm_reg_cbs
Methods
pre_writeProduces an error message and sets status to UVM_NOT_OK.
addAdd this callback to the specified register and its contained fields.
removeRemove this callback from the specified register and its contained fields.

pre_write

virtual task pre_write( uvm_reg_item  rw )

Produces an error message and sets status to UVM_NOT_OK.

add

static function void add( uvm_reg  rg )

Add this callback to the specified register and its contained fields.

remove

static function void remove( uvm_reg  rg )

Remove this callback from the specified register and its contained fields.

uvm_reg_write_only_cbs

Pre-defined register callback method for write-only registers that will issue an error if a read() operation is attempted.

Summary
uvm_reg_write_only_cbs
Pre-defined register callback method for write-only registers that will issue an error if a read() operation is attempted.
Class Hierarchy
uvm_reg_write_only_cbs
Class Declaration
class uvm_reg_write_only_cbs extends uvm_reg_cbs
Methods
pre_readProduces an error message and sets status to UVM_NOT_OK.
addAdd this callback to the specified register and its contained fields.
removeRemove this callback from the specified register and its contained fields.

pre_read

virtual task pre_read( uvm_reg_item  rw )

Produces an error message and sets status to UVM_NOT_OK.

add

static function void add( uvm_reg  rg )

Add this callback to the specified register and its contained fields.

remove

static function void remove( uvm_reg  rg )

Remove this callback from the specified register and its contained fields.

virtual class uvm_reg_cbs extends uvm_callback
Facade class for field, register, memory and backdoor access callback methods.
class uvm_reg_read_only_cbs extends uvm_reg_cbs
Pre-defined register callback method for read-only registers that will issue an error if a write() operation is attempted.
class uvm_reg_write_only_cbs extends uvm_reg_cbs
Pre-defined register callback method for write-only registers that will issue an error if a read() operation is attempted.
The uvm_void class is the base class for all UVM classes.
virtual class uvm_object extends uvm_void
The uvm_object class is the base class for all UVM data and hierarchical classes.
class uvm_callback extends uvm_object
The uvm_callback class is the base class for user-defined callback classes.
virtual task pre_write( uvm_reg_item  rw )
Called before a write operation.
virtual task post_write( uvm_reg_item  rw )
Called after user-defined backdoor register write.
virtual task pre_read( uvm_reg_item  rw )
Callback called before a read operation.
virtual task post_read( uvm_reg_item  rw )
Callback called after a read operation.
virtual function void post_predict( input  uvm_reg_field  fld,
input  uvm_reg_data_t  previous,
inout  uvm_reg_data_t  value,
input  uvm_predict_e  kind,
input  uvm_path_e  path,
input  uvm_reg_map  map )
Called by the uvm_reg_field::predict() method after a successful UVM_PREDICT_READ or UVM_PREDICT_WRITE prediction.
function bit predict ( uvm_reg_data_t  value,   
uvm_reg_byte_en_t  be  =  -1,
uvm_predict_e  kind  =  UVM_PREDICT_DIRECT,
uvm_path_e  path  =  UVM_FRONTDOOR,
uvm_reg_map  map  =  null,
string  fname  =  "",
int  lineno  =  0 )
Update the mirrored value for this field.
virtual function void encode( ref  uvm_reg_data_t  data[] )
Data encoder
virtual function void decode( ref  uvm_reg_data_t  data[] )
Data decode
virtual class uvm_reg extends uvm_object
Register abstraction base class
class uvm_reg_field extends uvm_object
Field abstraction class
class uvm_mem extends uvm_object
Memory abstraction base class
class uvm_reg_backdoor extends uvm_object
Base class for user-defined back-door register and memory access.
virtual task pre_write( uvm_reg_item  rw )
Called before user-defined backdoor register write.
virtual task pre_write( uvm_reg_item  rw )
Called before register write.
virtual task pre_write ( uvm_reg_item  rw )
Called before field write.
virtual task pre_write( uvm_reg_item  rw )
Called before memory write.
Operation completed successfully
class uvm_reg_item extends uvm_sequence_item
Defines an abstract register transaction item.
virtual task post_write( uvm_reg_item  rw )
Called after user-defined backdoor register write.
virtual task post_write( uvm_reg_item  rw )
Called after register write.
virtual task post_read ( uvm_reg_item  rw )
Called after field read.
virtual task post_write ( uvm_reg_item  rw )
Called after field write.
virtual task post_write( uvm_reg_item  rw )
Called after memory write.
virtual task pre_read( uvm_reg_item  rw )
Called before user-defined backdoor register read.
virtual task pre_read( uvm_reg_item  rw )
Called before register read.
virtual task pre_read ( uvm_reg_item  rw )
Called before field read.
virtual task pre_read( uvm_reg_item  rw )
Called before memory read.
virtual task post_read( uvm_reg_item  rw )
Called after user-defined backdoor register read.
virtual task post_read( uvm_reg_item  rw )
Called after register read.
virtual task post_read( uvm_reg_item  rw )
Called after memory read.
virtual task pre_write( uvm_reg_item  rw )
Produces an error message and sets status to UVM_NOT_OK.
Operation completed with error
static function void add( uvm_reg  rg )
Add this callback to the specified register and its contained fields.
static function void remove( uvm_reg  rg )
Remove this callback from the specified register and its contained fields.
virtual task pre_read( uvm_reg_item  rw )
Produces an error message and sets status to UVM_NOT_OK.
static function void add( uvm_reg  rg )
Add this callback to the specified register and its contained fields.
static function void remove( uvm_reg  rg )
Remove this callback from the specified register and its contained fields.