uvm_reg_map

Address map abstraction class

This class represents an address map.  An address map is a collection of registers and memories accessible via a specific physical interface.  Address maps can be composed into higher-level address maps.

Address maps are created using the uvm_reg_block::create_map() method.

Summary
uvm_reg_map
Class Hierarchy
uvm_reg_map
Class Declaration
class uvm_reg_map extends uvm_object
Initialization
newCreate a new instance
configureInstance-specific configuration
add_regAdd a register
add_memAdd a memory
add_submapAdd an address map
set_sequencerSet the sequencer and adapter associated with this map.
set_submap_offsetSet the offset of the given submap to offset.
get_submap_offsetReturn the offset of the given submap.
set_base_addrSet the base address of this map.
resetReset the mirror for all registers in this address map.
Introspection
get_nameGet the simple name
get_full_nameGet the hierarchical name
get_root_mapGet the externally-visible address map
get_parentGet the parent block
get_parent_mapGet the higher-level address map
get_base_addrGet the base offset address for this map.
get_n_bytesGet the width in bytes of the bus associated with this map.
get_base_addrGets the endianness of the bus associated with this map.
get_sequencerGets the sequencer for the bus associated with this map.
get_adapterGets the bus adapter for the bus associated with this map.
get_submapsGet the address sub-maps
get_registersGet the registers
get_fieldsGet the fields
get_virtual_registersGet the virtual registers
get_virtual_fieldsGet the virtual fields
get_physical_addressesTranslate a local address into external addresses
get_reg_by_offsetGet register mapped at offset
get_mem_by_offsetGet memory mapped at offset
Bus Access
set_auto_predictSets the auto-predict mode for his map.
get_auto_predictGets the auto-predict mode setting for this map.
do_bus_writePerform a bus write operation.
do_bus_readPerform a bus read operation.
do_writePerform a write operation.
do_readPerform a read operation.

new

function new( string  name  =  "uvm_reg_map" )

Create a new instance

configure

function void configure( uvm_reg_block  parent,   
uvm_reg_addr_t  base_addr,   
int  unsigned  n_bytes,   
uvm_endianness_e  endian,   
bit  byte_addressing  =  1 )

Instance-specific configuration

Configures this map with the following properties.

parentthe block in which this map is created and applied
base_addrthe base address for this map.  All registers, memories, and sub-blocks will be at offsets to this address
n_bytesthe byte-width of the bus on which this map is used
endianthe endian format.  See uvm_endianness_e for possible values
byte_addressingspecifies whether the address increment is on a per-byte basis.  For example, consecutive memory locations with ~n_bytes~=4 (32-bit bus) are 4 apart: 0, 4, 8, and so on.  Default is TRUE.

add_reg

virtual function void add_reg ( uvm_reg  rg,   
uvm_reg_addr_t  offset,   
string  rights  =  "RW",
bit  unmapped  =  0,
uvm_reg_frontdoor  frontdoor  =  null )

Add a register

Add the specified register instance to this address map.  The register is located at the specified base address and has the specified access rights (“RW”, “RO” or “WO”).  The number of consecutive physical addresses occupied by the register depends on the width of the register and the number of bytes in the physical interface corresponding to this address map.

If unmapped is TRUE, the register does not occupy any physical addresses and the base address is ignored.  Unmapped registers require a user-defined frontdoor to be specified.

A register may be added to multiple address maps if it is accessible from multiple physical interfaces.  A register may only be added to an address map whose parent block is the same as the register’s parent block.

add_mem

virtual function void add_mem ( uvm_mem  mem,   
uvm_reg_addr_t  offset,   
string  rights  =  "RW",
bit  unmapped  =  0,
uvm_reg_frontdoor  frontdoor  =  null )

Add a memory

Add the specified memory instance to this address map.  The memory is located at the specified base address and has the specified access rights (“RW”, “RO” or “WO”).  The number of consecutive physical addresses occupied by the memory depends on the width and size of the memory and the number of bytes in the physical interface corresponding to this address map.

If unmapped is TRUE, the memory does not occupy any physical addresses and the base address is ignored.  Unmapped memorys require a user-defined frontdoor to be specified.

A memory may be added to multiple address maps if it is accessible from multiple physical interfaces.  A memory may only be added to an address map whose parent block is the same as the memory’s parent block.

add_submap

virtual function void add_submap ( uvm_reg_map  child_map,
uvm_reg_addr_t  offset )

Add an address map

Add the specified address map instance to this address map.  The address map is located at the specified base address.  The number of consecutive physical addresses occupied by the submap depends on the number of bytes in the physical interface that corresponds to the submap, the number of addresses used in the submap and the number of bytes in the physical interface corresponding to this address map.

An address map may be added to multiple address maps if it is accessible from multiple physical interfaces.  An address map may only be added to an address map in the grand-parent block of the address submap.

set_sequencer

virtual function void set_sequencer ( uvm_sequencer_base  sequencer,   
uvm_reg_adapter  adapter  =  null )

Set the sequencer and adapter associated with this map.  This method must be called before starting any sequences based on uvm_reg_sequence.

set_submap_offset

virtual function void set_submap_offset ( uvm_reg_map  submap,
uvm_reg_addr_t  offset )

Set the offset of the given submap to offset.

get_submap_offset

virtual function uvm_reg_addr_t get_submap_offset ( uvm_reg_map  submap )

Return the offset of the given submap.

set_base_addr

virtual function void set_base_addr ( uvm_reg_addr_t  offset )

Set the base address of this map.

reset

virtual function void reset( string  kind  =  "SOFT" )

Reset the mirror for all registers in this address map.

Sets the mirror value of all registers in this address map and all of its submaps to the reset value corresponding to the specified reset event.  See uvm_reg_field::reset() for more details.  Does not actually set the value of the registers in the design, only the values mirrored in their corresponding mirror.

Note that, unlike the other reset() method, the default reset event for this method is “SOFT”.

get_name

Get the simple name

Return the simple object name of this address map.

get_full_name

virtual function string get_full_name()

Get the hierarchical name

Return the hierarchal name of this address map.  The base of the hierarchical name is the root block.

get_root_map

virtual function uvm_reg_map get_root_map()

Get the externally-visible address map

Get the top-most address map where this address map is instantiated.  It corresponds to the externally-visible address map that can be accessed by the verification environment.

get_parent

virtual function uvm_reg_block get_parent()

Get the parent block

Return the block that is the parent of this address map.

get_parent_map

virtual function uvm_reg_map get_parent_map()

Get the higher-level address map

Return the address map in which this address map is mapped. returns null if this is a top-level address map.

get_base_addr

virtual function uvm_reg_addr_t get_base_addr ( uvm_hier_e  hier  =  UVM_HIER )

Get the base offset address for this map.  If this map is the root map, the base address is that set with the base_addr argument to uvm_reg_block::create_map().  If this map is a submap of a higher-level map, the base address is offset given this submap by the parent map.  See set_submap_offset.

get_n_bytes

virtual function int unsigned get_n_bytes ( uvm_hier_e  hier  =  UVM_HIER )

Get the width in bytes of the bus associated with this map.  If hier is UVM_HIER, then gets the effective bus width relative to the system level.  The effective bus width is the narrowest bus width from this map to the top-level root map.  Each bus access will be limited to this bus width.

get_base_addr

Gets the endianness of the bus associated with this map.  If hier is set to UVM_HIER, gets the system-level endianness.

get_sequencer

virtual function uvm_sequencer_base get_sequencer ( uvm_hier_e  hier  =  UVM_HIER )

Gets the sequencer for the bus associated with this map.  If hier is set to UVM_HIER, gets the sequencer for the bus at the system-level.  See set_sequencer.

get_adapter

virtual function uvm_reg_adapter get_adapter ( uvm_hier_e  hier  =  UVM_HIER )

Gets the bus adapter for the bus associated with this map.  If hier is set to UVM_HIER, gets the adapter for the bus used at the system-level.  See set_sequencer.

get_submaps

virtual function void get_submaps ( ref  uvm_reg_map  maps[$],   
input  uvm_hier_e  hier  =  UVM_HIER )

Get the address sub-maps

Get the address maps instantiated in this address map.  If hier is UVM_HIER, recursively includes the address maps, in the sub-maps.

get_registers

virtual function void get_registers ( ref  uvm_reg  regs[$],   
input  uvm_hier_e  hier  =  UVM_HIER )

Get the registers

Get the registers instantiated in this address map.  If hier is UVM_HIER, recursively includes the registers in the sub-maps.

get_fields

virtual function void get_fields ( ref  uvm_reg_field  fields[$],   
input  uvm_hier_e  hier  =  UVM_HIER )

Get the fields

Get the fields in the registers instantiated in this address map.  If hier is UVM_HIER, recursively includes the fields of the registers in the sub-maps.

get_virtual_registers

virtual function void get_virtual_registers ( ref  uvm_vreg  regs[$],   
input  uvm_hier_e  hier  =  UVM_HIER )

Get the virtual registers

Get the virtual registers instantiated in this address map.  If hier is UVM_HIER, recursively includes the virtual registers in the sub-maps.

get_virtual_fields

virtual function void get_virtual_fields ( ref  uvm_vreg_field  fields[$],   
input  uvm_hier_e  hier  =  UVM_HIER )

Get the virtual fields

Get the virtual fields from the virtual registers instantiated in this address map.  If hier is UVM_HIER, recursively includes the virtual fields in the virtual registers in the sub-maps.

get_physical_addresses

virtual function int get_physical_addresses( uvm_reg_addr_t  base_addr,
uvm_reg_addr_t  mem_offset,
int  unsigned  n_bytes,
ref  uvm_reg_addr_t  addr[] )

Translate a local address into external addresses

Identify the sequence of addresses that must be accessed physically to access the specified number of bytes at the specified address within this address map.  Returns the number of bytes of valid data in each access.

Returns in addr a list of address in little endian order, with the granularity of the top-level address map.

A register is specified using a base address with mem_offset as 0.  A location within a memory is specified using the base address of the memory and the index of the location within that memory.

get_reg_by_offset

virtual function uvm_reg get_reg_by_offset( uvm_reg_addr_t  offset,   
bit  read  =  1 )

Get register mapped at offset

Identify the register located at the specified offset within this address map for the specified type of access.  Returns null if no such register is found.

The model must be locked using uvm_reg_block::lock_model() to enable this functionality.

get_mem_by_offset

virtual function uvm_mem get_mem_by_offset( uvm_reg_addr_t  offset )

Get memory mapped at offset

Identify the memory located at the specified offset within this address map.  The offset may refer to any memory location in that memory.  Returns null if no such memory is found.

The model must be locked using uvm_reg_block::lock_model() to enable this functionality.

set_auto_predict

function void set_auto_predict( bit  on  =  1 )

Sets the auto-predict mode for his map.

When on is TRUE, the register model will automatically update its mirror (what it thinks should be in the DUT) immediately after any bus read or write operation via this map.  Before a uvm_reg::write or uvm_reg::read operation returns, the register’s uvm_reg::predict method is called to update the mirrored value in the register.

When on is FALSE, bus reads and writes via this map do not automatically update the mirror.  For real-time updates to the mirror in this mode, you connect a uvm_reg_predictor instance to the bus monitor.  The predictor takes observed bus transactions from the bus monitor, looks up the associated uvm_reg register given the address, then calls that register’s uvm_reg::predict method.  While more complex, this mode will capture all register read/write activity, including that not directly descendant from calls to uvm_reg::write and uvm_reg::read.

By default, auto-prediction is turned off.

get_auto_predict

function bit get_auto_predict()

Gets the auto-predict mode setting for this map.

do_bus_write

virtual task do_bus_write ( uvm_reg_item  rw,
uvm_sequencer_base  sequencer,
uvm_reg_adapter  adapter )

Perform a bus write operation.

do_bus_read

virtual task do_bus_read ( uvm_reg_item  rw,
uvm_sequencer_base  sequencer,
uvm_reg_adapter  adapter )

Perform a bus read operation.

do_write

virtual task do_write( uvm_reg_item  rw )

Perform a write operation.

do_read

virtual task do_read( uvm_reg_item  rw )

Perform a read operation.

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_reg_map extends uvm_object
function new( string  name  =  "uvm_reg_map" )
Create a new instance
function void configure( uvm_reg_block  parent,   
uvm_reg_addr_t  base_addr,   
int  unsigned  n_bytes,   
uvm_endianness_e  endian,   
bit  byte_addressing  =  1 )
Instance-specific configuration
virtual function void add_reg ( uvm_reg  rg,   
uvm_reg_addr_t  offset,   
string  rights  =  "RW",
bit  unmapped  =  0,
uvm_reg_frontdoor  frontdoor  =  null )
Add a register
virtual function void add_mem ( uvm_mem  mem,   
uvm_reg_addr_t  offset,   
string  rights  =  "RW",
bit  unmapped  =  0,
uvm_reg_frontdoor  frontdoor  =  null )
Add a memory
virtual function void add_submap ( uvm_reg_map  child_map,
uvm_reg_addr_t  offset )
Add an address map
virtual function void set_sequencer ( uvm_sequencer_base  sequencer,   
uvm_reg_adapter  adapter  =  null )
Set the sequencer and adapter associated with this map.
virtual function void set_submap_offset ( uvm_reg_map  submap,
uvm_reg_addr_t  offset )
Set the offset of the given submap to offset.
virtual function uvm_reg_addr_t get_submap_offset ( uvm_reg_map  submap )
Return the offset of the given submap.
virtual function void set_base_addr ( uvm_reg_addr_t  offset )
Set the base address of this map.
virtual function void reset( string  kind  =  "SOFT" )
Reset the mirror for all registers in this address map.
virtual function string get_full_name()
Get the hierarchical name
virtual function uvm_reg_map get_root_map()
Get the externally-visible address map
virtual function uvm_reg_block get_parent()
Get the parent block
virtual function uvm_reg_map get_parent_map()
Get the higher-level address map
virtual function uvm_reg_addr_t get_base_addr ( uvm_hier_e  hier  =  UVM_HIER )
Get the base offset address for this map.
virtual function int unsigned get_n_bytes ( uvm_hier_e  hier  =  UVM_HIER )
Get the width in bytes of the bus associated with this map.
virtual function uvm_sequencer_base get_sequencer ( uvm_hier_e  hier  =  UVM_HIER )
Gets the sequencer for the bus associated with this map.
virtual function uvm_reg_adapter get_adapter ( uvm_hier_e  hier  =  UVM_HIER )
Gets the bus adapter for the bus associated with this map.
virtual function void get_submaps ( ref  uvm_reg_map  maps[$],   
input  uvm_hier_e  hier  =  UVM_HIER )
Get the address sub-maps
virtual function void get_registers ( ref  uvm_reg  regs[$],   
input  uvm_hier_e  hier  =  UVM_HIER )
Get the registers
virtual function void get_fields ( ref  uvm_reg_field  fields[$],   
input  uvm_hier_e  hier  =  UVM_HIER )
Get the fields
virtual function void get_virtual_registers ( ref  uvm_vreg  regs[$],   
input  uvm_hier_e  hier  =  UVM_HIER )
Get the virtual registers
virtual function void get_virtual_fields ( ref  uvm_vreg_field  fields[$],   
input  uvm_hier_e  hier  =  UVM_HIER )
Get the virtual fields
virtual function int get_physical_addresses( uvm_reg_addr_t  base_addr,
uvm_reg_addr_t  mem_offset,
int  unsigned  n_bytes,
ref  uvm_reg_addr_t  addr[] )
Translate a local address into external addresses
virtual function uvm_reg get_reg_by_offset( uvm_reg_addr_t  offset,   
bit  read  =  1 )
Get register mapped at offset
virtual function uvm_mem get_mem_by_offset( uvm_reg_addr_t  offset )
Get memory mapped at offset
function void set_auto_predict( bit  on  =  1 )
Sets the auto-predict mode for his map.
function bit get_auto_predict()
Gets the auto-predict mode setting for this map.
virtual task do_bus_write ( uvm_reg_item  rw,
uvm_sequencer_base  sequencer,
uvm_reg_adapter  adapter )
Perform a bus write operation.
virtual task do_bus_read ( uvm_reg_item  rw,
uvm_sequencer_base  sequencer,
uvm_reg_adapter  adapter )
Perform a bus read operation.
virtual task do_write( uvm_reg_item  rw )
Perform a write operation.
virtual task do_read( uvm_reg_item  rw )
Perform a read operation.
virtual function uvm_reg_map create_map( string  name,   
uvm_reg_addr_t  base_addr,   
int  unsigned  n_bytes,   
uvm_endianness_e  endian,   
bit  byte_addressing  =  )
Create an address map in this block
Specifies byte ordering
virtual function void reset( string  kind  =  "HARD" )
Reset the desired/mirrored value for this field.
virtual function void lock_model()
Lock a model and build the address map.
virtual task write( 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  int  prior  =  -1,
input  uvm_object  extension  =  null,
input  string  fname  =  "",
input  int  lineno  =  0 )
Write the specified value in this register
virtual task read( 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  int  prior  =  -1,
input  uvm_object  extension  =  null,
input  string  fname  =  "",
input  int  lineno  =  0 )
Read the current value from this register
virtual 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 register.
class uvm_reg_predictor #( type  BUSTYPE  =  int ) extends uvm_component
Updates the register model mirror based on observed bus transactions
virtual class uvm_reg extends uvm_object
Register abstraction base class