Address Maps

class uvm.reg.uvm_reg_map.UVMRegMapInfo[source]

Bases: object

convert2string()[source]
class uvm.reg.uvm_reg_map.UVMRegTransactionOrderPolicy(name='policy')[source]

Bases: UVMObject

order(q)[source]

the order() function may reorder the sequence of bus transactions produced by a single uvm_reg transaction (read/write). This can be used in scenarios when the register width differs from the bus width and one register access results in a series of bus transactions. the first item (0) of the queue will be the first bus transaction (the last($) will be the final transaction

Parameters

q

Raises:

class uvm.reg.uvm_reg_map.UVMRegMap(name='uvm_reg_map')[source]

Bases: UVMObject

Class: UVMRegMap

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 UVMRegBlock.create_map() method.

Xinit_address_mapX()[source]
m_backdoor = None
classmethod backdoor()[source]

Function: backdoor Return the backdoor pseudo-map singleton

This pseudo-map is used to specify or configure the backdoor instead of a real address map.

Returns:

configure(parent, base_addr, n_bytes, endian, byte_addressing=1)[source]

Function: configure

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.

Parameters
  • parent

  • base_addr

  • n_bytes

  • endian

  • byte_addressing

add_reg(rg, offset, rights='RW', unmapped=0, frontdoor=None)[source]

Function: add_reg

Add a register

Add the specified register instance rg to this address map.

The register is located at the specified address offset from this maps configured base address.

The rights specify the register’s accessibility via this map. Valid values are “RW”, “RO”, and “WO”. Whether a register field can be read or written depends on both the field’s configured access policy (see <uvm_reg_field::configure> and the register’s rights in the map being used to access the field.

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.

Parameters
  • rg

  • offset

  • rights

  • unmapped

  • frontdoor

add_mem(mem, offset, rights='RW', unmapped=0, frontdoor=None)[source]

Function: add_mem

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 memories 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.

extern virtual function void add_mem (uvm_mem mem,

uvm_reg_addr_t offset, string rights = “RW”, bit unmapped=0, uvm_reg_frontdoor frontdoor=None)

Parameters
  • mem

  • offset

  • rights

  • unmapped

  • frontdoor

add_submap(child_map, offset)[source]

Function: add_submap

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.

extern virtual function void add_submap (uvm_reg_map child_map,

uvm_reg_addr_t offset)

Parameters
  • child_map

  • offset

set_sequencer(sequencer, adapter=None)[source]

Function: set_sequencer

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

extern virtual function void set_sequencer (uvm_sequencer_base sequencer,

uvm_reg_adapter adapter=None)

Parameters
  • sequencer

  • adapter

set_submap_offset(submap, offset)[source]

Function: set_submap_offset

Set the offset of the given submap to offset.

extern virtual function void set_submap_offset (uvm_reg_map submap,

uvm_reg_addr_t offset)

Parameters
  • submap

  • offset

get_submap_offset(submap)[source]

Function: get_submap_offset

Return the offset of the given submap.

extern virtual function uvm_reg_addr_t get_submap_offset (uvm_reg_map submap)

Parameters

submap

Returns:

reset(kind='SOFT')[source]

Function: reset

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”.

extern virtual function void reset(string kind = “SOFT”)

Parameters

kind

add_parent_map(parent_map, offset)[source]
/local/ extern virtual function void add_parent_map(uvm_reg_map parent_map,

uvm_reg_addr_t offset)

Parameters
  • parent_map

  • offset

m_set_reg_offset(rg, offset, unmapped)[source]

Args: rg: offset: unmapped:

get_full_name()[source]

Function: 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.

extern virtual function string get_full_name()

Returns:

get_root_map()[source]

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.

Returns

Root map for this address map.

Return type

UVMRegMap

get_parent()[source]

Function: get_parent

Get the parent block

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

Returns:

get_parent_map()[source]

Function: get_parent_map Get the higher-level address map

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

extern virtual function uvm_reg_map get_parent_map()

Returns:

get_base_addr(hier=1)[source]

Function: get_base_addr

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.

extern virtual function uvm_reg_addr_t get_base_addr (uvm_hier_e hier=UVM_HIER)

Parameters
  • hier

  • UVM_HIER

Returns:

get_n_bytes(hier=1)[source]

Function: get_n_bytes

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.

extern virtual function int unsigned get_n_bytes (uvm_hier_e hier=UVM_HIER)

Parameters
  • hier

  • UVM_HIER

Returns:

get_addr_unit_bytes()[source]

Function: get_addr_unit_bytes

Get the number of bytes in the smallest addressable unit in the map. Returns 1 if the address map was configured using byte-level addressing. Returns <get_n_bytes()> otherwise.

extern virtual function int unsigned get_addr_unit_bytes()

Returns:

get_endian(hier=1)[source]

Function: 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.

extern virtual function uvm_endianness_e get_endian (uvm_hier_e hier=UVM_HIER)

Parameters
  • hier

  • UVM_HIER

Returns:

get_sequencer(hier=1)[source]

Function: get_sequencer

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.

extern virtual function uvm_sequencer_base get_sequencer (uvm_hier_e hier=UVM_HIER)

Parameters
  • hier

  • UVM_HIER

Returns:

get_adapter(hier=1)[source]

Function: get_adapter

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.

extern virtual function uvm_reg_adapter get_adapter (uvm_hier_e hier=UVM_HIER)

Parameters
  • hier

  • UVM_HIER

Returns:

get_submaps(maps, hier=1)[source]

Function: get_submaps

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.

extern virtual function void get_submaps (ref uvm_reg_map maps[$],

input uvm_hier_e hier=UVM_HIER)

Parameters
  • maps

  • hier

  • UVM_HIER

get_registers(regs, hier=1)[source]

Function: get_registers

Get the registers

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

extern virtual function void get_registers (ref uvm_reg regs[$],

input uvm_hier_e hier=UVM_HIER)

Parameters
  • regs

  • hier

  • UVM_HIER

get_reg_map_info(rg, error=1)[source]
Parameters
  • rg

  • error

Returns:

get_mem_map_info(mem, error=1)[source]

extern virtual function UVMRegMapInfo get_mem_map_info(uvm_mem mem, bit error=1)

Parameters
  • mem

  • error

Returns:

get_physical_addresses(base_addr, mem_offset, n_bytes, addr: List)[source]

Function: get_physical_addresses

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.

extern 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[])

Parameters
  • base_addr

  • mem_offset

  • n_bytes

  • addr

Returns:

get_reg_by_offset(offset: int, read=True)[source]

Function: get_reg_by_offset

Get register mapped at offset

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

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

extern virtual function uvm_reg get_reg_by_offset(uvm_reg_addr_t offset,

bit read = 1)

Parameters
  • offset

  • read

Returns:

set_auto_predict(on=True)[source]

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 UVMReg.write or UVMReg.read operation returns, the register’s UVMReg.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 Explicit Register Predictor instance to the bus monitor. The predictor takes observed bus transactions from the bus monitor, looks up the associated UVMReg register given the address, then calls that register’s UVMReg.predict method. While more complex, this mode will capture all register read/write activity, including that not directly descendant from calls to UVMReg.write and UVMReg.read.

By default, auto-prediction is turned off.

Parameters

on

get_auto_predict() bool[source]

Gets the auto-predict mode setting for this map.

Returns

True if auto-predict enabled, False otherwise.

Return type

bool

set_check_on_read(on=1) None[source]

Sets the check-on-read mode for his map and all of its submaps.

When on is TRUE, the register model will automatically check any value read back from a register or field against the current value in its mirror and report any discrepancy. This effectively combines the functionality of the <uvm_reg::read()> and ~uvm_reg::mirror(UVM_CHECK)~ method. This mode is useful when the register model is used passively.

When on is FALSE, no check is made against the mirrored value.

At the end of the read operation, the mirror value is updated based on the value that was read regardless of this mode setting.

By default, auto-prediction is turned off.

Parameters

on

get_check_on_read() bool[source]

Gets the check-on-read mode setting for this map.

Returns

True if checking on read enabled, False otherwise

Return type

bool

async do_bus_write(rw: UVMRegItem, sequencer, adapter) None[source]

Perform a bus write operation.

Parameters
async do_bus_read(rw: UVMRegItem, sequencer, adapter) None[source]

Perform a bus read operation.

Parameters
async do_write(rw: UVMRegItem) None[source]

Perform a write operation.

Parameters

rw (UVMRegItem) – Register item for the write op.

async do_read(rw: UVMRegItem) None[source]

Perform a read operation.

Parameters

rw (UVMRegItem) – Register item for the read op.

Xget_bus_infoX(rw, map_info, size, lsb, addr_skip) [<class 'uvm.reg.uvm_reg_map.UVMRegMapInfo'>, <class 'int'>, <class 'int'>, <class 'int'>][source]

Returns bus info based on given register item.

Parameters
Returns

[UVMRegMapInfo, int, int, int]

Raises:

create(name='')

Group: Creation

The create method 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 of uvm_object_wrapper. This method, if implemented, can be used as convenient means of supplying those arguments. This method is the same as the static get_type method, 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 by get_type_name is not registered with the factory, then a None handle 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 of uvm_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()

This function returns the type name of the object, which is typically the type identifier enclosed in quotes. It is used for various debugging functions in the library, and it is used by the factory for creating objects.

This function must be defined in every derived class.

A typical implementation is as follows:

class mytype (UVMObject):
  ...
  type_name = "mytype"

  def get_type_name(self):
    return my_type.type_name

We define the type_name static variable to enable access to the type name without need of an object of the class, i.e., to enable access via the scope operator, ~mytype::type_name~.

Returns

Type name of the object.

Return type

str

type_id = <uvm.base.uvm_registry.UVMObjectRegistry object>
type_name = 'UVMRegMap'