[source]

Class uvm_pkg::uvm_reg_block

uvm_pkg::uvm_reg_block + default_map : uvm_reg_map + default_path : uvm_path_e + XsampleX(): void + add_block(): void + add_hdl_path(): void + add_map(): void + add_mem(): void + add_reg(): void + add_vreg(): void + clear_hdl_path(): void + clone(): uvm_object + configure(): void + convert2string(): string + create_map(): uvm_reg_map + do_compare(): bit + do_copy(): void + do_pack(): void + do_print(): void + do_unpack(): void + find_block(): uvm_reg_block + find_blocks(): int + get_backdoor(): uvm_reg_backdoor + get_block_by_name(): uvm_reg_block + get_blocks(): void + get_coverage(): bit + get_default_hdl_path(): string + get_default_map(): uvm_reg_map + get_default_path(): uvm_path_e + get_field_by_name(): uvm_reg_field + get_fields(): void + get_full_hdl_path(): void + get_full_name(): string + get_hdl_path(): void + get_map_by_name(): uvm_reg_map + get_maps(): void + get_mem_by_name(): uvm_mem + get_memories(): void + get_parent(): uvm_reg_block + get_reg_by_name(): uvm_reg + get_registers(): void + get_root_blocks(): void + get_vfield_by_name(): uvm_vreg_field + get_virtual_fields(): void + get_virtual_registers(): void + get_vreg_by_name(): uvm_vreg + has_coverage(): bit + has_hdl_path(): bit + is_hdl_path_root(): bit + is_locked(): bit + lock_model(): void + mirror() + needs_update(): bit + read_mem_by_name() + read_reg_by_name() + readmemh() + reset(): void + sample_values(): void + set_backdoor(): void + set_coverage(): uvm_reg_cvr_t + set_default_hdl_path(): void + set_default_map(): void + set_hdl_path_root(): void + set_parent(): void + update() + write_mem_by_name() + write_reg_by_name() + writememh() uvm_pkg::uvm_reg_map default_map

Collaboration Diagram of uvm_reg_block

Class

uvm_reg_block

Block abstraction base class

A block represents a design hierarchy. It can contain registers, register files, memories and sub-blocks.

A block has one or more address maps, each corresponding to a physical interface on the block.

Variables

Name

Type

Description

default_path

uvm_path_e

Variable

default_path

Default access path for the registers and memories in this block.

default_map

uvm_reg_map

Variable

default_map

Default address map

Default address map for this block, to be used when no address map is specified for a register operation and that register is accessible from more than one address map.

It is also the implicit address map for a block with a single, unnamed address map because it has only one physical interface.

Constructors

new(string name = "", int has_coverage = UVM_NO_COVERAGE)

Function

new

Create a new instance and type-specific configuration

Creates an instance of a block abstraction class with the specified name.

has_coverage specifies which functional coverage models are present in the extension of the block abstraction class. Multiple functional coverage models may be specified by adding their symbolic names, as defined by the uvm_coverage_model_e type. New

Parameters:
  • name (string)

  • has_coverage (int)

Functions

configure(uvm_reg_block parent = null, string hdl_path = "")

Function

configure

Instance-specific configuration

Specify the parent block of this block. A block without parent is a root block.

If the block file corresponds to a hierarchical RTL structure, its contribution to the HDL path is specified as the hdl_path . Otherwise, the block does not correspond to a hierarchical RTL structure (e.g. it is physically flattened) and does not contribute to the hierarchical HDL path of any contained registers or memories. Configure

Parameters:
create_map(string name, uvm_reg_addr_t base_addr, int unsigned n_bytes, uvm_endianness_e endian, bit byte_addressing = 1)

Function

create_map

Create an address map in this block

Create an address map with the specified name , then configures it with the following properties.

base_addr

the base address for the map. All registers, memories, and sub-blocks within the map 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 consecutive addresses refer are 1 byte apart (TRUE) or n_bytes apart (FALSE). Default is TRUE.

 APB = create_map("APB", 0, 1, UVM_LITTLE_ENDIAN, 1);. Create_map
Parameters:
Return type:

uvm_reg_map

set_default_map(uvm_reg_map map)

Function

set_default_map

Defines the default address map

Set the specified address map as the default_map for this block. The address map must be a map of this address block. Set_default_map

Parameters:

map (uvm_reg_map)

get_default_map()

Get_default_map

Return type:

uvm_reg_map

set_parent(uvm_reg_block parent)

Set_parent

Parameters:

parent (uvm_reg_block)

add_block(uvm_reg_block blk)

Add_block

Parameters:

blk (uvm_reg_block) --

Local

add_map(uvm_reg_map map)

Add_map

Parameters:

map (uvm_reg_map) --

Local

add_reg(uvm_reg rg)

Add_reg

Parameters:

rg (uvm_reg) --

Local

add_vreg(uvm_vreg vreg)

Add_vreg

Parameters:

vreg (uvm_vreg) --

Local

add_mem(uvm_mem mem)

Add_mem

Parameters:

mem (uvm_mem) --

Local

lock_model()

Function

lock_model

Lock a model and build the address map.

Recursively lock an entire register model and build the address maps to enable the uvm_reg_map::get_reg_by_offset() and uvm_reg_map::get_mem_by_offset() methods.

Once locked, no further structural changes, such as adding registers or memories, can be made.

It is not possible to unlock a model. Lock_model

is_locked()

Function

is_locked

Return TRUE if the model is locked. Is_locked

get_full_name()

Function

get_full_name

Get the hierarchical name

Return the hierarchal name of this block. The base of the hierarchical name is the root block. Get Hierarchical Elements

get_parent()

Function

get_parent

Get the parent block

If this a top-level block, returns null . Get_parent

Return type:

uvm_reg_block

get_root_blocks(uvm_reg_block blks)

Function

get_root_blocks

Get the all root blocks

Returns an array of all root blocks in the simulation. Get_root_blocks

Parameters:

blks (uvm_reg_block)

find_blocks(string name, uvm_reg_block blks, uvm_reg_block root = null, uvm_object accessor = null)

Function

find_blocks

Find the blocks whose hierarchical names match the specified name glob. If a root block is specified, the name of the blocks are relative to that block, otherwise they are absolute.

Returns the number of blocks found. Find_blocks

Parameters:
find_block(string name, uvm_reg_block root = null, uvm_object accessor = null)

Function

find_block

Find the first block whose hierarchical names match the specified name glob. If a root block is specified, the name of the blocks are relative to that block, otherwise they are absolute.

Returns the first block found or null otherwise. A warning is issued if more than one block is found. Find_blocks

Parameters:
Return type:

uvm_reg_block

get_blocks(uvm_reg_block blks, uvm_hier_e hier = UVM_HIER)

Function

get_blocks

Get the sub-blocks

Get the blocks instantiated in this blocks. If hier is TRUE, recursively includes any sub-blocks. Get_blocks

Parameters:
get_maps(uvm_reg_map maps)

Function

get_maps

Get the address maps

Get the address maps instantiated in this block. Get_maps

Parameters:

maps (uvm_reg_map)

get_registers(uvm_reg regs, uvm_hier_e hier = UVM_HIER)

Function

get_registers

Get the registers

Get the registers instantiated in this block. If hier is TRUE, recursively includes the registers in the sub-blocks.

Note that registers may be located in different and/or multiple address maps. To get the registers in a specific address map, use the uvm_reg_map::get_registers() method. Get_registers

Parameters:
get_fields(uvm_reg_field fields, uvm_hier_e hier = UVM_HIER)

Function

get_fields

Get the fields

Get the fields in the registers instantiated in this block. If hier is TRUE, recursively includes the fields of the registers in the sub-blocks. Get_fields

Parameters:
get_memories(uvm_mem mems, uvm_hier_e hier = UVM_HIER)

Function

get_memories

Get the memories

Get the memories instantiated in this block. If hier is TRUE, recursively includes the memories in the sub-blocks.

Note that memories may be located in different and/or multiple address maps. To get the memories in a specific address map, use the uvm_reg_map::get_memories() method. Get_memories

Parameters:
get_virtual_registers(uvm_vreg regs, uvm_hier_e hier = UVM_HIER)

Function

get_virtual_registers

Get the virtual registers

Get the virtual registers instantiated in this block. If hier is TRUE, recursively includes the virtual registers in the sub-blocks. Get_virtual_registers

Parameters:
get_virtual_fields(uvm_vreg_field fields, uvm_hier_e hier = UVM_HIER)

Function

get_virtual_fields

Get the virtual fields

Get the virtual fields from the virtual registers instantiated in this block. If hier is TRUE, recursively includes the virtual fields in the virtual registers in the sub-blocks. Get_virtual_fields

Parameters:
get_block_by_name(string name)

Function

get_block_by_name

Finds a sub-block with the specified simple name.

The name is the simple name of the block, not a hierarchical name. relative to this block. If no block with that name is found in this block, the sub-blocks are searched for a block of that name and the first one to be found is returned.

If no blocks are found, returns null . Get_block_by_name

Parameters:

name (string)

Return type:

uvm_reg_block

get_map_by_name(string name)

Function

get_map_by_name

Finds an address map with the specified simple name.

The name is the simple name of the address map, not a hierarchical name. relative to this block. If no map with that name is found in this block, the sub-blocks are searched for a map of that name and the first one to be found is returned.

If no address maps are found, returns null . Get_map_by_name

Parameters:

name (string)

Return type:

uvm_reg_map

get_reg_by_name(string name)

Function

get_reg_by_name

Finds a register with the specified simple name.

The name is the simple name of the register, not a hierarchical name. relative to this block. If no register with that name is found in this block, the sub-blocks are searched for a register of that name and the first one to be found is returned.

If no registers are found, returns null . Get_reg_by_name

Parameters:

name (string)

Return type:

uvm_reg

get_field_by_name(string name)

Function

get_field_by_name

Finds a field with the specified simple name.

The name is the simple name of the field, not a hierarchical name. relative to this block. If no field with that name is found in this block, the sub-blocks are searched for a field of that name and the first one to be found is returned.

If no fields are found, returns null . Get_field_by_name

Parameters:

name (string)

Return type:

uvm_reg_field

get_mem_by_name(string name)

Function

get_mem_by_name

Finds a memory with the specified simple name.

The name is the simple name of the memory, not a hierarchical name. relative to this block. If no memory with that name is found in this block, the sub-blocks are searched for a memory of that name and the first one to be found is returned.

If no memories are found, returns null . Get_mem_by_name

Parameters:

name (string)

Return type:

uvm_mem

get_vreg_by_name(string name)

Function

get_vreg_by_name

Finds a virtual register with the specified simple name.

The name is the simple name of the virtual register, not a hierarchical name. relative to this block. If no virtual register with that name is found in this block, the sub-blocks are searched for a virtual register of that name and the first one to be found is returned.

If no virtual registers are found, returns null . Get_vreg_by_name

Parameters:

name (string)

Return type:

uvm_vreg

get_vfield_by_name(string name)

Function

get_vfield_by_name

Finds a virtual field with the specified simple name.

The name is the simple name of the virtual field, not a hierarchical name. relative to this block. If no virtual field with that name is found in this block, the sub-blocks are searched for a virtual field of that name and the first one to be found is returned.

If no virtual fields are found, returns null . Get_vfield_by_name

Parameters:

name (string)

Return type:

uvm_vreg_field

has_coverage(uvm_reg_cvr_t models)

Function

has_coverage

Check if block has coverage model(s)

Returns TRUE if the block abstraction class contains a coverage model for all of the models specified. Models are specified by adding the symbolic value of individual coverage model as defined in uvm_coverage_model_e. Has_coverage

Parameters:

models (uvm_reg_cvr_t)

set_coverage(uvm_reg_cvr_t is_on)

Function

set_coverage

Turns on coverage measurement.

Turns the collection of functional coverage measurements on or off for this block and all blocks, registers, fields and memories within it. The functional coverage measurement is turned on for every coverage model specified using uvm_coverage_model_e symbolic identifiers. Multiple functional coverage models can be specified by adding the functional coverage model identifiers. All other functional coverage models are turned off. Returns the sum of all functional coverage models whose measurements were previously on.

This method can only control the measurement of functional coverage models that are present in the various abstraction classes, then enabled during construction. See the uvm_reg_block::has_coverage() method to identify the available functional coverage models. Set_coverage

Parameters:

is_on (uvm_reg_cvr_t)

Return type:

uvm_reg_cvr_t

get_coverage(uvm_reg_cvr_t is_on = UVM_CVR_ALL)

Function

get_coverage

Check if coverage measurement is on.

Returns TRUE if measurement for all of the specified functional coverage models are currently on. Multiple functional coverage models can be specified by adding the functional coverage model identifiers.

See uvm_reg_block::set_coverage() for more details. Get_coverage

Parameters:

is_on (uvm_reg_cvr_t)

sample_values()

Function

sample_values

Functional coverage measurement method for field values

This method is invoked by the user or by the uvm_reg_block::sample_values() method of the parent block to trigger the sampling of the current field values in the block-level functional coverage model. It recursively invokes the uvm_reg_block::sample_values() and uvm_reg::sample_values() methods in the blocks and registers in this block.

This method may be extended by the abstraction class generator to perform the required sampling in any provided field-value functional coverage model. If this method is extended, it MUST call super.sample_values(). Sample_values

XsampleX(uvm_reg_addr_t addr, bit is_read, uvm_reg_map map)

XsampleX

Parameters:
get_default_path()

Function

get_default_path

Default access path

Returns the default access path for this block. Get_default_path

Return type:

uvm_path_e

reset(string kind = "HARD")

Function

reset

Reset the mirror for this block.

Sets the mirror value of all registers in the block and sub-blocks 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. Reset

Parameters:

kind (string)

needs_update()

Function

needs_update

Check if DUT registers need to be written

If a mirror value has been modified in the abstraction model without actually updating the actual register (either through randomization or via the uvm_reg::set() method, the mirror and state of the registers are outdated. The corresponding registers in the DUT need to be updated.

This method returns TRUE if the state of at least one register in the block or sub-blocks needs to be updated to match the mirrored values. The mirror values, or actual content of registers, are not modified. For additional information, see uvm_reg_block::update() method. Needs_update

get_backdoor(bit inherited = 1)

Function

get_backdoor

Get the user-defined backdoor for all registers in this block

Return the user-defined backdoor for all register in this block and all sub-blocks -- unless overridden by a backdoor set in a lower-level block or in the register itself.

If inherited is TRUE, returns the backdoor of the parent block if none have been specified for this block. Get_backdoor

Parameters:

inherited (bit)

Return type:

uvm_reg_backdoor

set_backdoor(uvm_reg_backdoor bkdr, string fname = "", int lineno = 0)

Function

set_backdoor

Set the user-defined backdoor for all registers in this block

Defines the backdoor mechanism for all registers instantiated in this block and sub-blocks, unless overridden by a definition in a lower-level block or register. Set_backdoor

Parameters:
clear_hdl_path(string kind = "RTL")

Function

clear_hdl_path

Delete HDL paths

Remove any previously specified HDL path to the block instance for the specified design abstraction. Clear_hdl_path

Parameters:

kind (string)

add_hdl_path(string path, string kind = "RTL")

Function

add_hdl_path

Add an HDL path

Add the specified HDL path to the block instance for the specified design abstraction. This method may be called more than once for the same design abstraction if the block is physically duplicated in the design abstraction. Add_hdl_path

Parameters:
  • path (string)

  • kind (string)

has_hdl_path(string kind = "")

Function

has_hdl_path

Check if a HDL path is specified

Returns TRUE if the block instance has a HDL path defined for the specified design abstraction. If no design abstraction is specified, uses the default design abstraction specified for this block or the nearest block ancestor with a specified default design abstraction. Has_hdl_path

Parameters:

kind (string)

get_hdl_path(string paths, string kind = "")

Function

get_hdl_path

Get the incremental HDL path(s)

Returns the HDL path(s) defined for the specified design abstraction in the block instance. Returns only the component of the HDL paths that corresponds to the block, not a full hierarchical path

If no design abstraction is specified, the default design abstraction for this block is used. Get_hdl_path

Parameters:
  • paths (string)

  • kind (string)

get_full_hdl_path(string paths, string kind = "", string separator = ".")

Function

get_full_hdl_path

Get the full hierarchical HDL path(s)

Returns the full hierarchical HDL path(s) defined for the specified design abstraction in the block instance. There may be more than one path returned even if only one path was defined for the block instance, if any of the parent components have more than one path defined for the same design abstraction

If no design abstraction is specified, the default design abstraction for each ancestor block is used to get each incremental path. Get_full_hdl_path

Parameters:
  • paths (string)

  • kind (string)

  • separator (string)

set_default_hdl_path(string kind)

Function

set_default_hdl_path

Set the default design abstraction

Set the default design abstraction for this block instance. Set_default_hdl_path

Parameters:

kind (string)

get_default_hdl_path()

Function

get_default_hdl_path

Get the default design abstraction

Returns the default design abstraction for this block instance. If a default design abstraction has not been explicitly set for this block instance, returns the default design abstraction for the nearest block ancestor. Returns "" if no default design abstraction has been specified. Get_default_hdl_path

set_hdl_path_root(string path, string kind = "RTL")

Function

set_hdl_path_root

Specify a root HDL path

Set the specified path as the absolute HDL path to the block instance for the specified design abstraction. This absolute root path is prepended to all hierarchical paths under this block. The HDL path of any ancestor block is ignored. This method overrides any incremental path for the same design abstraction specified using add_hdl_path. Set_hdl_path_root

Parameters:
  • path (string)

  • kind (string)

is_hdl_path_root(string kind = "")

Function

is_hdl_path_root

Check if this block has an absolute path

Returns TRUE if an absolute HDL path to the block instance for the specified design abstraction has been defined. If no design abstraction is specified, the default design abstraction for this block is used. Is_hdl_path_root

Parameters:

kind (string)

do_print(uvm_printer printer)

Do_print

Parameters:

printer (uvm_printer)

do_copy(uvm_object rhs)

Do_copy

Parameters:

rhs (uvm_object)

do_compare(uvm_object rhs, uvm_comparer comparer)

Do_compare

Parameters:
do_pack(uvm_packer packer)

Do_pack

Parameters:

packer (uvm_packer)

do_unpack(uvm_packer packer)

Do_unpack

Parameters:

packer (uvm_packer)

convert2string()

Convert2string

clone()

Clone

Return type:

uvm_object

Tasks

update(uvm_status_e status, uvm_path_e path = UVM_DEFAULT_PATH, uvm_sequence_base parent = null, int prior = -1, uvm_object extension = null, string fname = "", int lineno = 0)

Task

update

Batch update of register.

Using the minimum number of write operations, updates the registers in the design to match the mirrored values in this block and sub-blocks. The update can be performed using the physical interfaces (front-door access) or back-door accesses. This method performs the reverse operation of uvm_reg_block::mirror(). Update

Parameters:
mirror(uvm_status_e status, uvm_check_e check = UVM_NO_CHECK, uvm_path_e path = UVM_DEFAULT_PATH, uvm_sequence_base parent = null, int prior = -1, uvm_object extension = null, string fname = "", int lineno = 0)

Task

mirror

Update the mirrored values

Read all of the registers in this block and sub-blocks and update their mirror values to match their corresponding values in the design. The mirroring can be performed using the physical interfaces (front-door access) or back-door accesses. If the check argument is specified as , an error message is issued if the current mirrored value does not match the actual value in the design. This method performs the reverse operation of uvm_reg_block::update(). Mirror

Parameters:
write_reg_by_name(uvm_status_e status, string name, uvm_reg_data_t data, uvm_path_e path = UVM_DEFAULT_PATH, uvm_reg_map map = null, uvm_sequence_base parent = null, int prior = -1, uvm_object extension = null, string fname = "", int lineno = 0)

Task

write_reg_by_name

Write the named register

Equivalent to get_reg_by_name() followed by uvm_reg::write(). Write_reg_by_name

Parameters:
read_reg_by_name(uvm_status_e status, string name, uvm_reg_data_t data, uvm_path_e path = UVM_DEFAULT_PATH, uvm_reg_map map = null, uvm_sequence_base parent = null, int prior = -1, uvm_object extension = null, string fname = "", int lineno = 0)

Task

read_reg_by_name

Read the named register

Equivalent to get_reg_by_name() followed by uvm_reg::read(). Read_reg_by_name

Parameters:
write_mem_by_name(uvm_status_e status, string name, uvm_reg_addr_t offset, uvm_reg_data_t data, uvm_path_e path = UVM_DEFAULT_PATH, uvm_reg_map map = null, uvm_sequence_base parent = null, int prior = -1, uvm_object extension = null, string fname = "", int lineno = 0)

Task

write_mem_by_name

Write the named memory

Equivalent to get_mem_by_name() followed by uvm_mem::write(). Write_mem_by_name

Parameters:
read_mem_by_name(uvm_status_e status, string name, uvm_reg_addr_t offset, uvm_reg_data_t data, uvm_path_e path = UVM_DEFAULT_PATH, uvm_reg_map map = null, uvm_sequence_base parent = null, int prior = -1, uvm_object extension = null, string fname = "", int lineno = 0)

Task

read_mem_by_name

Read the named memory

Equivalent to get_mem_by_name() followed by uvm_mem::read(). Read_mem_by_name

Parameters:
readmemh(string filename)

Readmemh

Parameters:

filename (string)

writememh(string filename)

Writememh

Parameters:

filename (string)