Class uvm_reg_block
Name |
Type |
Description |
---|---|---|
default_path |
Default access path for the registers and memories in this block. |
|
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
- function new ( string name, int has_coverage ) [source]
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
Functions
- function void configure ( uvm_reg_block parent, string hdl_path ) [source]
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
- 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 ) [source]
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
- function void set_default_map ( uvm_reg_map map ) [source]
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
- function uvm_reg_map get_default_map ( ) [source]
Get_default_map
- virtual function void set_parent ( uvm_reg_block parent ) [source]
Set_parent
- function void add_block ( uvm_reg_block blk ) [source]
Add_block
- function void add_map ( uvm_reg_map map ) [source]
Add_map
- virtual function void lock_model ( ) [source]
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
- virtual function uvm_reg_block get_parent ( ) [source]
Get the parent block
If this a top-level block, returns null . Get_parent
- static function void get_root_blocks ( uvm_reg_block blks ) [source]
Get the all root blocks
Returns an array of all root blocks in the simulation. Get_root_blocks
- static function int find_blocks ( string name, uvm_reg_block blks, uvm_reg_block root, uvm_object accessor ) [source]
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
- static function uvm_reg_block find_block ( string name, uvm_reg_block root, uvm_object accessor ) [source]
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
- virtual function void get_blocks ( uvm_reg_block blks, uvm_hier_e hier ) [source]
Get the sub-blocks
Get the blocks instantiated in this blocks. If hier is TRUE, recursively includes any sub-blocks. Get_blocks
- virtual function void get_maps ( uvm_reg_map maps ) [source]
Get the address maps
Get the address maps instantiated in this block. Get_maps
- virtual function void get_registers ( uvm_reg regs, uvm_hier_e hier ) [source]
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
- virtual function void get_fields ( uvm_reg_field fields, uvm_hier_e hier ) [source]
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
- virtual function void get_memories ( uvm_mem mems, uvm_hier_e hier ) [source]
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
- virtual function void get_virtual_registers ( uvm_vreg regs, uvm_hier_e hier ) [source]
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
- virtual function void get_virtual_fields ( uvm_vreg_field fields, uvm_hier_e hier ) [source]
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
- virtual function uvm_reg_block get_block_by_name ( string name ) [source]
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
- virtual function uvm_reg_map get_map_by_name ( string name ) [source]
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
- virtual function uvm_reg get_reg_by_name ( string name ) [source]
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
- virtual function uvm_reg_field get_field_by_name ( string name ) [source]
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
- virtual function uvm_mem get_mem_by_name ( string name ) [source]
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
- virtual function uvm_vreg get_vreg_by_name ( string name ) [source]
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
- virtual function uvm_vreg_field get_vfield_by_name ( string name ) [source]
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
- virtual function bit has_coverage ( uvm_reg_cvr_t models ) [source]
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
- virtual function uvm_reg_cvr_t set_coverage ( uvm_reg_cvr_t is_on ) [source]
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
- virtual function bit get_coverage ( uvm_reg_cvr_t is_on ) [source]
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
- virtual function void sample_values ( ) [source]
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
- function void XsampleX ( uvm_reg_addr_t addr, bit is_read, uvm_reg_map map ) [source]
XsampleX
- virtual function uvm_path_e get_default_path ( ) [source]
Default access path
Returns the default access path for this block. Get_default_path
- virtual function void reset ( string kind ) [source]
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
- virtual function bit needs_update ( ) [source]
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
- function uvm_reg_backdoor get_backdoor ( bit inherited ) [source]
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
- function void set_backdoor ( uvm_reg_backdoor bkdr, string fname, int lineno ) [source]
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
- function void add_hdl_path ( string path, string kind ) [source]
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
- function bit has_hdl_path ( string kind ) [source]
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
- function void get_hdl_path ( string paths, string kind ) [source]
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
- function void get_full_hdl_path ( string paths, string kind, string separator ) [source]
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
- function string get_default_hdl_path ( ) [source]
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
- function void set_hdl_path_root ( string path, string kind ) [source]
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
- function bit is_hdl_path_root ( string kind ) [source]
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
- virtual function void do_print ( uvm_printer printer ) [source]
Do_print
- virtual function void do_copy ( uvm_object rhs ) [source]
Do_copy
- virtual function bit do_compare ( uvm_object rhs, uvm_comparer comparer ) [source]
Do_compare
- virtual function void do_pack ( uvm_packer packer ) [source]
Do_pack
- virtual function void do_unpack ( uvm_packer packer ) [source]
Do_unpack
- virtual function uvm_object clone ( ) [source]
Clone
Tasks
- virtual function update ( uvm_status_e status, uvm_path_e path, uvm_sequence_base parent, int prior, uvm_object extension, string fname, int lineno ) [source]
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
- virtual function mirror ( uvm_status_e status, uvm_check_e check, uvm_path_e path, uvm_sequence_base parent, int prior, uvm_object extension, string fname, int lineno ) [source]
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 <UVM_CHECK>, 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
- virtual function write_reg_by_name ( uvm_status_e status, string name, uvm_reg_data_t data, uvm_path_e path, uvm_reg_map map, uvm_sequence_base parent, int prior, uvm_object extension, string fname, int lineno ) [source]
Write the named register
Equivalent to get_reg_by_name() followed by uvm_reg::write(). Write_reg_by_name
- virtual function read_reg_by_name ( uvm_status_e status, string name, uvm_reg_data_t data, uvm_path_e path, uvm_reg_map map, uvm_sequence_base parent, int prior, uvm_object extension, string fname, int lineno ) [source]
Read the named register
Equivalent to get_reg_by_name() followed by uvm_reg::read(). Read_reg_by_name
- virtual function 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_reg_map map, uvm_sequence_base parent, int prior, uvm_object extension, string fname, int lineno ) [source]
Write the named memory
Equivalent to get_mem_by_name() followed by uvm_mem::write(). Write_mem_by_name
- virtual function 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_reg_map map, uvm_sequence_base parent, int prior, uvm_object extension, string fname, int lineno ) [source]
Read the named memory
Equivalent to get_mem_by_name() followed by uvm_mem::read(). Read_mem_by_name
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.