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.
uvm_reg_map | ||||
Class Hierarchy | ||||
| ||||
Class Declaration | ||||
| ||||
Initialization | ||||
new | Create a new instance | |||
configure | Instance-specific configuration | |||
add_reg | Add a register | |||
add_mem | Add a memory | |||
add_submap | Add an address map | |||
set_sequencer | Set the sequencer and adapter associated with this map. | |||
set_submap_offset | Set the offset of the given submap to offset. | |||
get_submap_offset | Return the offset of the given submap. | |||
set_base_addr | Set the base address of this map. | |||
reset | Reset the mirror for all registers in this address map. | |||
Introspection | ||||
get_name | Get the simple name | |||
get_full_name | Get the hierarchical name | |||
get_root_map | Get the externally-visible address map | |||
get_parent | Get the parent block | |||
get_parent_map | Get the higher-level address map | |||
get_base_addr | Get the base offset address for this map. | |||
get_n_bytes | Get the width in bytes of the bus associated with this map. | |||
get_base_addr | Gets the endianness of the bus associated with this map. | |||
get_sequencer | Gets the sequencer for the bus associated with this map. | |||
get_adapter | Gets the bus adapter for the bus associated with this map. | |||
get_submaps | Get the address sub-maps | |||
get_registers | Get the registers | |||
get_fields | Get the fields | |||
get_virtual_registers | Get the virtual registers | |||
get_virtual_fields | Get the virtual fields | |||
get_physical_addresses | Translate a local address into external addresses | |||
get_reg_by_offset | Get register mapped at offset | |||
get_mem_by_offset | Get memory mapped at offset | |||
Bus Access | ||||
set_auto_predict | Sets the auto-predict mode for his map. | |||
get_auto_predict | Gets the auto-predict mode setting for this map. | |||
do_bus_write | Perform a bus write operation. | |||
do_bus_read | Perform a bus read operation. | |||
do_write | Perform a write operation. | |||
do_read | Perform a read operation. |
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.
parent | the block in which this map is created and applied |
base_addr | the base address for this map. All registers, memories, and sub-blocks will be at offsets to this address |
n_bytes | the byte-width of the bus on which this map is used |
endian | the endian format. See uvm_endianness_e for possible values |
byte_addressing | specifies 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. |
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.
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.
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.
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.
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.
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 the simple name
Return the simple object name of this address map.
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.
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.
virtual function uvm_reg_block get_parent()
Get the parent block
Return the block that is the parent of this address 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.
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.
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.
Gets the endianness of the bus associated with this map. If hier is set to UVM_HIER, gets the system-level endianness.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
The uvm_object class is the base class for all UVM data and hierarchical classes.
virtual class uvm_object extends uvm_void
class uvm_reg_map extends uvm_object
Create a new instance
function new( string name = "uvm_reg_map" )
Instance-specific configuration
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 )
Add a register
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 memory
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 an address map
virtual function void add_submap ( uvm_reg_map child_map, uvm_reg_addr_t offset )
Set the sequencer and adapter associated with this map.
virtual function void set_sequencer ( uvm_sequencer_base sequencer, uvm_reg_adapter adapter = null )
Set the offset of the given submap to offset.
virtual function void set_submap_offset ( uvm_reg_map submap, uvm_reg_addr_t offset )
Return the offset of the given submap.
virtual function uvm_reg_addr_t get_submap_offset ( uvm_reg_map submap )
Set the base address of this map.
virtual function void set_base_addr ( uvm_reg_addr_t offset )
Reset the mirror for all registers in this address map.
virtual function void reset( string kind = "SOFT" )
Get the hierarchical name
virtual function string get_full_name()
Get the externally-visible address map
virtual function uvm_reg_map get_root_map()
Get the parent block
virtual function uvm_reg_block get_parent()
Get the higher-level address map
virtual function uvm_reg_map get_parent_map()
Get the base offset address for this map.
virtual function uvm_reg_addr_t get_base_addr ( uvm_hier_e hier = UVM_HIER )
Get the width in bytes of the bus associated with this map.
virtual function int unsigned get_n_bytes ( uvm_hier_e hier = UVM_HIER )
Gets the sequencer for the bus associated with this map.
virtual function uvm_sequencer_base get_sequencer ( uvm_hier_e hier = UVM_HIER )
Gets the bus adapter for the bus associated with this map.
virtual function uvm_reg_adapter get_adapter ( uvm_hier_e hier = UVM_HIER )
Get the address sub-maps
virtual function void get_submaps ( ref uvm_reg_map maps[$], input uvm_hier_e hier = UVM_HIER )
Get the registers
virtual function void get_registers ( ref uvm_reg regs[$], input uvm_hier_e hier = UVM_HIER )
Get the fields
virtual function void get_fields ( ref uvm_reg_field fields[$], input uvm_hier_e hier = UVM_HIER )
Get the virtual registers
virtual function void get_virtual_registers ( ref uvm_vreg regs[$], input uvm_hier_e hier = UVM_HIER )
Get the virtual fields
virtual function void get_virtual_fields ( ref uvm_vreg_field fields[$], input uvm_hier_e hier = UVM_HIER )
Translate a local address into external 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[] )
Get register mapped at offset
virtual function uvm_reg get_reg_by_offset( uvm_reg_addr_t offset, bit read = 1 )
Get memory mapped at offset
virtual function uvm_mem get_mem_by_offset( uvm_reg_addr_t offset )
Sets the auto-predict mode for his map.
function void set_auto_predict( bit on = 1 )
Gets the auto-predict mode setting for this map.
function bit get_auto_predict()
Perform a bus write operation.
virtual task do_bus_write ( uvm_reg_item rw, uvm_sequencer_base sequencer, uvm_reg_adapter adapter )
Perform a bus read operation.
virtual task do_bus_read ( uvm_reg_item rw, uvm_sequencer_base sequencer, uvm_reg_adapter adapter )
Perform a write operation.
virtual task do_write( uvm_reg_item rw )
Perform a read operation.
virtual task do_read( uvm_reg_item rw )
Create an address map in this block
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 = )
Reset the desired/mirrored value for this field.
virtual function void reset( string kind = "HARD" )
Lock a model and build the address map.
virtual function void lock_model()
Write the specified value in this register
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 )
Read the current value from 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 )
Update the mirrored value for 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 )
Updates the register model mirror based on observed bus transactions
class uvm_reg_predictor #( type BUSTYPE = int ) extends uvm_component
Register abstraction base class
virtual class uvm_reg extends uvm_object