Virtual Register Field Classes

This section defines the virtual field and callback classes.

A virtual field is set of contiguous bits in one or more memory locations.  The semantics and layout of virtual fields comes from an agreement between the software and the hardware, not any physical structures in the DUT.

Contents
Virtual Register Field ClassesThis section defines the virtual field and callback classes.
uvm_vreg_fieldVirtual field abstraction class
uvm_vreg_field_cbsPre/post read/write callback facade class

uvm_vreg_field

Virtual field abstraction class

A virtual field represents a set of adjacent bits that are logically implemented in consecutive memory locations.

Summary
uvm_vreg_field
Virtual field abstraction class
Class Hierarchy
uvm_vreg_field
Class Declaration
class uvm_vreg_field extends uvm_object
initialization
newCreate a new virtual field instance
configureInstance-specific configuration
Introspection
get_nameGet the simple name
get_full_nameGet the hierarchical name
get_parentGet the parent virtual register
get_lsb_pos_in_registerReturn the position of the virtual field / Returns the index of the least significant bit of the virtual field in the virtual register that instantiates it.
get_n_bitsReturns the width, in bits, of the virtual field.
get_accessReturns the access policy of the virtual field register when written and read via an address map.
HDL Access
writeWrite the specified value in a virtual field
readRead the current value from a virtual field
pokeDeposit the specified value in a virtual field
peekSample the current value from a virtual field
Callbacks
pre_writeCalled before virtual field write.
post_writeCalled after virtual field write
pre_readCalled before virtual field read.
post_readCalled after virtual field read.

new

function new( string  name  =  "uvm_vreg_field" )

Create a new virtual field instance

This method should not be used directly.  The uvm_vreg_field::type_id::create() method should be used instead.

configure

function void configure( uvm_vreg  parent,
int  unsigned  size,
int  unsigned  lsb_pos )

Instance-specific configuration

Specify the parent virtual register of this virtual field, its size in bits, and the position of its least-significant bit within the virtual register relative to the least-significant bit of the virtual register.

get_name

Get the simple name

Return the simple object name of this virtual field

get_full_name

virtual function string get_full_name()

Get the hierarchical name

Return the hierarchal name of this virtual field The base of the hierarchical name is the root block.

get_parent

virtual function uvm_vreg get_parent()

Get the parent virtual register

get_lsb_pos_in_register

virtual function int unsigned get_lsb_pos_in_register()

Return the position of the virtual field / Returns the index of the least significant bit of the virtual field in the virtual register that instantiates it.  An offset of 0 indicates a field that is aligned with the least-significant bit of the register.

get_n_bits

virtual function int unsigned get_n_bits()

Returns the width, in bits, of the virtual field.

get_access

virtual function string get_access( uvm_reg_map  map  =  null )

Returns the access policy of the virtual field register when written and read via an address map.

If the memory implementing the virtual field is mapped in more than one address map, an address map must be specified.  If access restrictions are present when accessing a memory through the specified address map, the access mode returned takes the access restrictions into account.  For example, a read-write memory accessed through an address map with read-only restrictions would return “RO”.

write

virtual task write( input longint  unsigned  idx,   
output  uvm_status_e  status,   
input  uvm_reg_data_t  value,   
input  uvm_path_e  path  =  UVM_DEFAULT_PATH,
input  uvm_reg_map  map  =  null,
input  uvm_sequence_base  parent  =  null,
input  uvm_object  extension  =  null,
input  string  fname  =  "",
input  int  lineno  =  0 )

Write the specified value in a virtual field

Write value in the DUT memory location(s) that implements the virtual field that corresponds to this abstraction class instance using the specified access path.

If the memory implementing the virtual register array containing this virtual field is mapped in more than one address map, an address map must be specified if a physical access is used (front-door access).

The operation is eventually mapped into memory read-modify-write operations at the location where the virtual register specified by idx in the virtual register array is implemented.  If a backdoor is available for the memory implemeting the virtual field, it will be used for the memory-read operation.

read

virtual task read( input longint  unsigned  idx,   
output  uvm_status_e  status,   
output  uvm_reg_data_t  value,   
input  uvm_path_e  path  =  UVM_DEFAULT_PATH,
input  uvm_reg_map  map  =  null,
input  uvm_sequence_base  parent  =  null,
input  uvm_object  extension  =  null,
input  string  fname  =  "",
input  int  lineno  =  0 )

Read the current value from a virtual field

Read from the DUT memory location(s) that implements the virtual field that corresponds to this abstraction class instance using the specified access path, and return the readback value.

If the memory implementing the virtual register array containing this virtual field is mapped in more than one address map, an address map must be specified if a physical access is used (front-door access).

The operation is eventually mapped into memory read operations at the location(s) where the virtual register specified by idx in the virtual register array is implemented.

poke

virtual task poke( input longint  unsigned  idx,   
output  uvm_status_e  status,   
input  uvm_reg_data_t  value,   
input  uvm_sequence_base  parent  =  null,
input  uvm_object  extension  =  null,
input  string  fname  =  "",
input  int  lineno  =  0 )

Deposit the specified value in a virtual field

Deposit value in the DUT memory location(s) that implements the virtual field that corresponds to this abstraction class instance using the specified access path.

The operation is eventually mapped into memory peek-modify-poke operations at the location where the virtual register specified by idx in the virtual register array is implemented.

peek

virtual task peek( input longint  unsigned  idx,   
output  uvm_status_e  status,   
output  uvm_reg_data_t  value,   
input  uvm_sequence_base  parent  =  null,
input  uvm_object  extension  =  null,
input  string  fname  =  "",
input  int  lineno  =  0 )

Sample the current value from a virtual field

Sample from the DUT memory location(s) that implements the virtual field that corresponds to this abstraction class instance using the specified access path, and return the readback value.

If the memory implementing the virtual register array containing this virtual field is mapped in more than one address map, an address map must be specified if a physical access is used (front-door access).

The operation is eventually mapped into memory peek operations at the location(s) where the virtual register specified by idx in the virtual register array is implemented.

pre_write

virtual task pre_write( longint  unsigned  idx,
ref  uvm_reg_data_t  wdat,
ref  uvm_path_e  path,
ref  uvm_reg_map  map )

Called before virtual field write.

If the specified data value, access path or address map are modified, the updated data value, access path or address map will be used to perform the virtual register operation.

The virtual field callback methods are invoked before the callback methods on the containing virtual register.  The registered callback methods are invoked after the invocation of this method.  The pre-write virtual register and field callbacks are executed before the corresponding pre-write memory callbacks

post_write

virtual task post_write( longint  unsigned  idx,
uvm_reg_data_t  wdat,
uvm_path_e  path,
uvm_reg_map  map,
ref  uvm_status_e  status )

Called after virtual field write

If the specified status is modified, the updated status will be returned by the virtual register operation.

The virtual field callback methods are invoked after the callback methods on the containing virtual register.  The registered callback methods are invoked before the invocation of this method.  The post-write virtual register and field callbacks are executed after the corresponding post-write memory callbacks

pre_read

virtual task pre_read( longint  unsigned  idx,
ref  uvm_path_e  path,
ref  uvm_reg_map  map )

Called before virtual field read.

If the specified access path or address map are modified, the updated access path or address map will be used to perform the virtual register operation.

The virtual field callback methods are invoked after the callback methods on the containing virtual register.  The registered callback methods are invoked after the invocation of this method.  The pre-read virtual register and field callbacks are executed before the corresponding pre-read memory callbacks

post_read

virtual task post_read( longint  unsigned  idx,
ref  uvm_reg_data_t  rdat,
uvm_path_e  path,
uvm_reg_map  map,
ref  uvm_status_e  status )

Called after virtual field read.

If the specified readback data rdat or status is modified, the updated readback data or status will be returned by the virtual register operation.

The virtual field callback methods are invoked after the callback methods on the containing virtual register.  The registered callback methods are invoked before the invocation of this method.  The post-read virtual register and field callbacks are executed after the corresponding post-read memory callbacks

uvm_vreg_field_cbs

Pre/post read/write callback facade class

Summary
uvm_vreg_field_cbs
Pre/post read/write callback facade class
Class Hierarchy
uvm_vreg_field_cbs
Class Declaration
class uvm_vreg_field_cbs extends uvm_callback
Methods
pre_writeCallback called before a write operation.
post_writeCalled after a write operation
pre_readCalled before a virtual field read.
post_readCalled after a virtual field read.
Types
uvm_vreg_field_cbConvenience callback type declaration
uvm_vreg_field_cb_iterConvenience callback iterator type declaration

pre_write

virtual task pre_write( uvm_vreg_field  field,
longint  unsigned  idx,
ref  uvm_reg_data_t  wdat,
ref  uvm_path_e  path,
ref  uvm_reg_map  map )

Callback called before a write operation.

The registered callback methods are invoked before the invocation of the virtual register pre-write callbacks and after the invocation of the uvm_vreg_field::pre_write() method.

The written value wdat, access path and address map, if modified, modifies the actual value, access path or address map used in the register operation.

post_write

virtual task post_write( uvm_vreg_field  field,
longint  unsigned  idx,
uvm_reg_data_t  wdat,
uvm_path_e  path,
uvm_reg_map  map,
ref  uvm_status_e  status )

Called after a write operation

The registered callback methods are invoked after the invocation of the virtual register post-write callbacks and before the invocation of the uvm_vreg_field::post_write() method.

The status of the operation, if modified, modifies the actual returned status.

pre_read

virtual task pre_read( uvm_vreg_field  field,
longint  unsigned  idx,
ref  uvm_path_e  path,
ref  uvm_reg_map  map )

Called before a virtual field read.

The registered callback methods are invoked after the invocation of the virtual register pre-read callbacks and after the invocation of the uvm_vreg_field::pre_read() method.

The access path and address map, if modified, modifies the actual access path or address map used in the register operation.

post_read

virtual task post_read( uvm_vreg_field  field,
longint  unsigned  idx,
ref  uvm_reg_data_t  rdat,
uvm_path_e  path,
uvm_reg_map  map,
ref  uvm_status_e  status )

Called after a virtual field read.

The registered callback methods are invoked after the invocation of the virtual register post-read callbacks and before the invocation of the uvm_vreg_field::post_read() method.

The readback value rdat and the status of the operation, if modified, modifies the actual returned readback value and status.

uvm_vreg_field_cb

Convenience callback type declaration

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

uvm_vreg_field_cb_iter

Convenience callback iterator type declaration

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

class uvm_vreg_field extends uvm_object
Virtual field abstraction class
class uvm_vreg_field_cbs extends uvm_callback
Pre/post read/write callback facade class
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.
function new( string  name  =  "uvm_vreg_field" )
Create a new virtual field instance
function void configure( uvm_vreg  parent,
int  unsigned  size,
int  unsigned  lsb_pos )
Instance-specific configuration
virtual function string get_full_name()
Get the hierarchical name
virtual function uvm_vreg get_parent()
Get the parent virtual register
virtual function int unsigned get_lsb_pos_in_register()
Return the position of the virtual field / Returns the index of the least significant bit of the virtual field in the virtual register that instantiates it.
virtual function int unsigned get_n_bits()
Returns the width, in bits, of the virtual field.
virtual function string get_access( uvm_reg_map  map  =  null )
Returns the access policy of the virtual field register when written and read via an address map.
virtual task write( input longint  unsigned  idx,   
output  uvm_status_e  status,   
input  uvm_reg_data_t  value,   
input  uvm_path_e  path  =  UVM_DEFAULT_PATH,
input  uvm_reg_map  map  =  null,
input  uvm_sequence_base  parent  =  null,
input  uvm_object  extension  =  null,
input  string  fname  =  "",
input  int  lineno  =  0 )
Write the specified value in a virtual field
virtual task read( input longint  unsigned  idx,   
output  uvm_status_e  status,   
output  uvm_reg_data_t  value,   
input  uvm_path_e  path  =  UVM_DEFAULT_PATH,
input  uvm_reg_map  map  =  null,
input  uvm_sequence_base  parent  =  null,
input  uvm_object  extension  =  null,
input  string  fname  =  "",
input  int  lineno  =  0 )
Read the current value from a virtual field
virtual task poke( input longint  unsigned  idx,   
output  uvm_status_e  status,   
input  uvm_reg_data_t  value,   
input  uvm_sequence_base  parent  =  null,
input  uvm_object  extension  =  null,
input  string  fname  =  "",
input  int  lineno  =  0 )
Deposit the specified value in a virtual field
virtual task peek( input longint  unsigned  idx,   
output  uvm_status_e  status,   
output  uvm_reg_data_t  value,   
input  uvm_sequence_base  parent  =  null,
input  uvm_object  extension  =  null,
input  string  fname  =  "",
input  int  lineno  =  0 )
Sample the current value from a virtual field
virtual task pre_write( longint  unsigned  idx,
ref  uvm_reg_data_t  wdat,
ref  uvm_path_e  path,
ref  uvm_reg_map  map )
Called before virtual field write.
virtual task post_write( longint  unsigned  idx,
uvm_reg_data_t  wdat,
uvm_path_e  path,
uvm_reg_map  map,
ref  uvm_status_e  status )
Called after virtual field write
virtual task pre_read( longint  unsigned  idx,
ref  uvm_path_e  path,
ref  uvm_reg_map  map )
Called before virtual field read.
virtual task post_read( longint  unsigned  idx,
ref  uvm_reg_data_t  rdat,
uvm_path_e  path,
uvm_reg_map  map,
ref  uvm_status_e  status )
Called after virtual field read.
class uvm_callback extends uvm_object
The uvm_callback class is the base class for user-defined callback classes.
virtual task pre_write( uvm_vreg_field  field,
longint  unsigned  idx,
ref  uvm_reg_data_t  wdat,
ref  uvm_path_e  path,
ref  uvm_reg_map  map )
Callback called before a write operation.
virtual task post_write( uvm_vreg_field  field,
longint  unsigned  idx,
uvm_reg_data_t  wdat,
uvm_path_e  path,
uvm_reg_map  map,
ref  uvm_status_e  status )
Called after a write operation
virtual task pre_read( uvm_vreg_field  field,
longint  unsigned  idx,
ref  uvm_path_e  path,
ref  uvm_reg_map  map )
Called before a virtual field read.
virtual task post_read( uvm_vreg_field  field,
longint  unsigned  idx,
ref  uvm_reg_data_t  rdat,
uvm_path_e  path,
uvm_reg_map  map,
ref  uvm_status_e  status )
Called after a virtual field read.