[source]

Class uvm_reg

uvm_pkg::uvm_reg + m_is_busy : bit + m_is_locked_by_field : bit + XatomicX() + Xcheck_accessX(): bit + Xget_fields_accessX(): string + Xis_locked_by_fieldX(): bit + Xlock_modelX(): void + XreadX() + XsampleX(): void + Xset_busyX(): void + add_field(): void + add_hdl_path(): void + add_hdl_path_slice(): void + add_map(): void + backdoor_read() + backdoor_read_func(): uvm_status_e + backdoor_watch() + backdoor_write() + clear_hdl_path(): void + clone(): uvm_object + configure(): void + convert2string(): string + do_check(): bit + do_compare(): bit + do_copy(): void + do_pack(): void + do_predict(): void + do_print(): void + do_read() + do_unpack(): void + do_write() + get(): uvm_reg_data_t + get_address(): uvm_reg_addr_t + get_addresses(): int + get_backdoor(): uvm_reg_backdoor + get_block(): uvm_reg_block + get_coverage(): bit + get_default_map(): uvm_reg_map + get_field_by_name(): uvm_reg_field + get_fields(): void + get_frontdoor(): uvm_reg_frontdoor + get_full_hdl_path(): void + get_full_name(): string + get_hdl_path(): void + get_hdl_path_kinds(): void + get_local_map(): uvm_reg_map + get_maps(): void + get_max_size(): int unsigned + get_mirrored_value(): uvm_reg_data_t + get_n_bits(): int unsigned + get_n_bytes(): int unsigned + get_n_maps(): int + get_offset(): uvm_reg_addr_t + get_parent(): uvm_reg_block + get_regfile(): uvm_reg_file + get_reset(): uvm_reg_data_t + get_rights(): string + has_coverage(): bit + has_hdl_path(): bit + has_reset(): bit + include_coverage(): void + is_busy(): bit + is_in_map(): bit + mirror() + needs_update(): bit + peek() + poke() + post_read() + post_write() + pre_read() + pre_write() + predict(): bit + read() + reset(): void + sample_values(): void + set(): void + set_backdoor(): void + set_coverage(): uvm_reg_cvr_t + set_frontdoor(): void + set_offset(): void + set_parent(): void + set_reset(): void + update() + write() uvm_pkg::uvm_reg_indirect_data uvm_pkg::uvm_reg_fifo

Inheritance Diagram of uvm_reg

Register abstraction base class

A register represents a set of fields that are accessible as a single entity.

A register may be mapped to one or more address maps, each with different access rights and policy.

Constructors

function new ( string name, int unsigned n_bits, int has_coverage ) [source]

Create a new instance and type-specific configuration

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

n_bits specifies the total number of bits in the register. Not all bits need to be implemented. This value is usually a multiple of 8.

has_coverage specifies which functional coverage models are present in the extension of the register 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 blk_parent, uvm_reg_file regfile_parent, string hdl_path ) [source]

Instance-specific configuration

Specify the parent block of this register. May also set a parent register file for this register,

If the register is implemented in a single HDL variable, its name is specified as the hdl_path . Otherwise, if the register is implemented as a concatenation of variables (usually one per field), then the HDL path must be specified using the add_hdl_path() or add_hdl_path_slice method. Configure

virtual function void set_offset ( uvm_reg_map map, uvm_reg_addr_t offset, bit unmapped ) [source]

Modify the offset of the register

The offset of a register within an address map is set using the uvm_reg_map::add_reg() method. This method is used to modify that offset dynamically.

Modifying the offset of a register will make the register model diverge from the specification that was used to create it. Set_offset

virtual function void set_parent ( uvm_reg_block blk_parent, uvm_reg_file regfile_parent ) [source]

Set_parent

virtual function void add_field ( uvm_reg_field field ) [source]

Add_field

virtual function void add_map ( uvm_reg_map map ) [source]

Add_map

function void Xlock_modelX ( ) [source]

Xlock_modelXlocal

virtual function string get_full_name ( ) [source]

Get the hierarchical name

Return the hierarchal name of this register. The base of the hierarchical name is the root block. Get_full_name

virtual function uvm_reg_block get_parent ( ) [source]

Get the parent block. Get_parent

virtual function uvm_reg_block get_block ( ) [source]

Get_block

virtual function uvm_reg_file get_regfile ( ) [source]

Get the parent register file

Returns null if this register is instantiated in a block. Get_regfile

virtual function int get_n_maps ( ) [source]

Returns the number of address maps this register is mapped in. Get_n_maps

function bit is_in_map ( uvm_reg_map map ) [source]

Returns 1 if this register is in the specified address map . Is_in_map

virtual function void get_maps ( uvm_reg_map maps ) [source]

Returns all of the address maps where this register is mapped. Get_maps

virtual function uvm_reg_map get_local_map ( uvm_reg_map map, string caller ) [source]

Get_local_map

virtual function uvm_reg_map get_default_map ( string caller ) [source]

Get_default_map

virtual function string get_rights ( uvm_reg_map map ) [source]

Returns the accessibility ("RW, "RO", or "WO") of this register in the given map .

If no address map is specified and the register is mapped in only one address map, that address map is used. If the register is mapped in more than one address map, the default address map of the parent block is used.

Whether a register field can be read or written depends on both the field's configured access policy (refer to uvm_reg_field::configure) and the register's accessibility rights in the map being used to access the field.

If an address map is specified and the register is not mapped in the specified address map, an error message is issued and "RW" is returned. Get_rights

virtual function int unsigned get_n_bits ( ) [source]

Returns the width, in bits, of this register. Get_n_bits

virtual function int unsigned get_n_bytes ( ) [source]

Returns the width, in bytes, of this register. Rounds up to next whole byte if register is not a multiple of 8. Get_n_bytes

static function int unsigned get_max_size ( ) [source]

Returns the maximum width, in bits, of all registers. Get_max_size

virtual function void get_fields ( uvm_reg_field fields ) [source]

Return the fields in this register

Fills the specified array with the abstraction class for all of the fields contained in this register. Fields are ordered from least-significant position to most-significant position within the register. Get_fields

virtual function uvm_reg_field get_field_by_name ( string name ) [source]

Return the named field in this register

Finds a field with the specified name in this register and returns its abstraction class. If no fields are found, returns null . Get_field_by_name

function string Xget_fields_accessX ( uvm_reg_map map ) [source]

Xget_field_accessX

Returns "WO" if all of the fields in the registers are write-only Returns "RO" if all of the fields in the registers are read-only Returns "RW" otherwise.

virtual function uvm_reg_addr_t get_offset ( uvm_reg_map map ) [source]

Returns the offset of this register

Returns the offset of this register in an address map .

If no address map is specified and the register is mapped in only one address map, that address map is used. If the register is mapped in more than one address map, the default address map of the parent block is used.

If an address map is specified and the register is not mapped in the specified address map, an error message is issued. Get_offset

virtual function uvm_reg_addr_t get_address ( uvm_reg_map map ) [source]

Returns the base external physical address of this register

Returns the base external physical address of this register if accessed through the specified address map .

If no address map is specified and the register is mapped in only one address map, that address map is used. If the register is mapped in more than one address map, the default address map of the parent block is used.

If an address map is specified and the register is not mapped in the specified address map, an error message is issued. Get_address

virtual function int get_addresses ( uvm_reg_map map, uvm_reg_addr_t addr ) [source]

Identifies the external physical address(es) of this register

Computes all of the external physical addresses that must be accessed to completely read or write this register. The addressed are specified in little endian order. Returns the number of bytes transferred on each access.

If no address map is specified and the register is mapped in only one address map, that address map is used. If the register is mapped in more than one address map, the default address map of the parent block is used.

If an address map is specified and the register is not mapped in the specified address map, an error message is issued. Get_addresses

virtual function void set ( uvm_reg_data_t value, string fname, int lineno ) [source]

Set the desired value for this register

Sets the desired value of the fields in the register to the specified value. Does not actually set the value of the register in the design, only the desired value in its corresponding abstraction class in the RegModel model. Use the uvm_reg::update() method to update the actual register with the mirrored value or the uvm_reg::write() method to set the actual register and its mirrored value.

Unless this method is used, the desired value is equal to the mirrored value.

Refer uvm_reg_field::set() for more details on the effect of setting mirror values on fields with different access policies.

To modify the mirrored field values to a specific value, and thus use the mirrored as a scoreboard for the register values in the DUT, use the uvm_reg::predict() method. Set

virtual function uvm_reg_data_t get ( string fname, int lineno ) [source]

Return the desired value of the fields in the register.

Does not actually read the value of the register in the design, only the desired value in the abstraction class. Unless set to a different value using the uvm_reg::set(), the desired value and the mirrored value are identical.

Use the uvm_reg::read() or uvm_reg::peek() method to get the actual register value.

If the register contains write-only fields, the desired/mirrored value for those fields are the value last written and assumed to reside in the bits implementing these fields. Although a physical read operation would something different for these fields, the returned value is the actual content. Get

virtual function uvm_reg_data_t get_mirrored_value ( string fname, int lineno ) [source]

Return the mirrored value of the fields in the register.

Does not actually read the value of the register in the design

If the register contains write-only fields, the desired/mirrored value for those fields are the value last written and assumed to reside in the bits implementing these fields. Although a physical read operation would something different for these fields, the returned value is the actual content. Get_mirrored_value

virtual function bit needs_update ( ) [source]

Returns 1 if any of the fields need updating

See uvm_reg_field::needs_update() for details. Use the uvm_reg::update() to actually update the DUT register. Needs_update

virtual function void reset ( string kind ) [source]

Reset the desired/mirrored value for this register.

Sets the desired and mirror value of the fields in this register to the reset value for the specified reset kind . See uvm_reg_field.reset() for more details.

Also resets the semaphore that prevents concurrent access to the register. This semaphore must be explicitly reset if a thread accessing this register array was killed in before the access was completed. Reset

virtual function uvm_reg_data_t get_reset ( string kind ) [source]

Get the specified reset value for this register

Return the reset value for this register for the specified reset kind . Get_reset

virtual function bit has_reset ( string kind, bit delete ) [source]

Check if any field in the register has a reset value specified for the specified reset kind . If delete is TRUE, removes the reset value, if any. Has_reset

virtual function void set_reset ( uvm_reg_data_t value, string kind ) [source]

Specify or modify the reset value for this register

Specify or modify the reset value for all the fields in the register corresponding to the cause specified by kind . Set_reset

virtual function bit predict ( uvm_reg_data_t value, uvm_reg_byte_en_t be, uvm_predict_e kind, uvm_path_e path, uvm_reg_map map, string fname, int lineno ) [source]

Update the mirrored and desired value for this register.

Predict the mirror (and desired) value of the fields in the register based on the specified observed value on a specified address map , or based on a calculated value. See uvm_reg_field::predict() for more details.

Returns TRUE if the prediction was successful for each field in the register. Predict

function bit is_busy ( ) [source]

Returns 1 if register is currently being read or written. Is_busy

function void Xset_busyX ( bit busy ) [source]

Xset_busyX

virtual function bit Xcheck_accessX ( uvm_reg_item rw, uvm_reg_map_info map_info, string caller ) [source]

Xcheck_accessXlocal

function bit Xis_locked_by_fieldX ( ) [source]

Xis_loacked_by_fieldXlocal

virtual function bit do_check ( uvm_reg_data_t expected, uvm_reg_data_t actual, uvm_reg_map map ) [source]

Do_check

virtual function void do_predict ( uvm_reg_item rw, uvm_predict_e kind, uvm_reg_byte_en_t be ) [source]

Do_predict

function void set_frontdoor ( uvm_reg_frontdoor ftdr, uvm_reg_map map, string fname, int lineno ) [source]

Set a user-defined frontdoor for this register

By default, registers are mapped linearly into the address space of the address maps that instantiate them. If registers are accessed using a different mechanism, a user-defined access mechanism must be defined and associated with the corresponding register abstraction class

If the register is mapped in multiple address maps, an address map must be specified. Set_frontdoor

function uvm_reg_frontdoor get_frontdoor ( uvm_reg_map map ) [source]

Returns the user-defined frontdoor for this register

If null , no user-defined frontdoor has been defined. A user-defined frontdoor is defined by using the uvm_reg::set_frontdoor() method.

If the register is mapped in multiple address maps, an address map must be specified. Get_frontdoor

function void set_backdoor ( uvm_reg_backdoor bkdr, string fname, int lineno ) [source]

Set a user-defined backdoor for this register

By default, registers are accessed via the built-in string-based DPI routines if an HDL path has been specified using the uvm_reg::configure() or uvm_reg::add_hdl_path() method.

If this default mechanism is not suitable (e.g. because the register is not implemented in pure SystemVerilog) a user-defined access mechanism must be defined and associated with the corresponding register abstraction class

A user-defined backdoor is required if active update of the mirror of this register abstraction class, based on observed changes of the corresponding DUT register, is used. Set_backdoor

function uvm_reg_backdoor get_backdoor ( bit inherited ) [source]

Returns the user-defined backdoor for this register

If null , no user-defined backdoor has been defined. A user-defined backdoor is defined by using the uvm_reg::set_backdoor() method.

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

function void clear_hdl_path ( string kind ) [source]

Delete HDL paths

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

function void add_hdl_path ( uvm_hdl_path_slice slices, string kind ) [source]

Add an HDL path

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

For example, the following register

       1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0
Bits:  5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
      +-+---+-------------+---+-------+
      |A|xxx|      B      |xxx|   C   |
      +-+---+-------------+---+-------+

would be specified using the following literal value:

add_hdl_path('{ '{"A_reg", 15, 1},
                '{"B_reg",  6, 7},
                '{'C_reg",  0, 4} } );

If the register is implemented using a single HDL variable, The array should specify a single slice with its offset and size specified as -1. For example:

r1.add_hdl_path('{ '{"r1", -1, -1} });. Add_hdl_path
function void add_hdl_path_slice ( string name, int offset, int size, bit first, string kind ) [source]

Append the specified HDL slice to the HDL path of the register instance for the specified design abstraction. If first is TRUE, starts the specification of a duplicate HDL implementation of the register. Add_hdl_path_slice

function bit has_hdl_path ( string kind ) [source]

Check if a HDL path is specified

Returns TRUE if the register instance has a HDL path defined for the specified design abstraction. If no design abstraction is specified, uses the default design abstraction specified for the parent block. Has_hdl_path

function void get_hdl_path ( uvm_hdl_path_concat paths, string kind ) [source]

Get the incremental HDL path(s)

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

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

function void get_hdl_path_kinds ( string kinds ) [source]

Get design abstractions for which HDL paths have been defined. Get_hdl_path_kinds

function void get_full_hdl_path ( uvm_hdl_path_concat 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 register instance. There may be more than one path returned even if only one path was defined for the register 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

virtual function uvm_status_e backdoor_read_func ( uvm_reg_item rw ) [source]

User-defined backdoor read access

Override the default string-based DPI backdoor access read for this register type. Backdoor_read_func

static function void include_coverage ( string scope, uvm_reg_cvr_t models, uvm_object accessor ) [source]

Specify which coverage model that must be included in various block, register or memory abstraction class instances.

The coverage models are specified by OR'ing or adding the uvm_coverage_model_e coverage model identifiers corresponding to the coverage model to be included.

The scope specifies a hierarchical name or pattern identifying a block, memory or register abstraction class instances. Any block, memory or register whose full hierarchical name matches the specified scope will have the specified functional coverage models included in them.

The scope can be specified as a POSIX regular expression or simple pattern. See <uvm_resource_base::Scope Interface> for more details.

uvm_reg::include_coverage(&quot;*&quot;, UVM_CVR_ALL);

The specification of which coverage model to include in which abstraction class is stored in a uvm_reg_cvr_t resource in the uvm_resource_db resource database, in the "uvm_reg::" scope namespace. Include_coverage

virtual function bit has_coverage ( uvm_reg_cvr_t models ) [source]

Check if register has coverage model(s)

Returns TRUE if the register 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 register. 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 register abstraction classes, then enabled during construction. See the uvm_reg::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::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 register-level functional coverage model.

This method may be extended by the abstraction class generator to perform the required sampling in any provided field-value functional coverage model.

function void XsampleX ( uvm_reg_data_t data, uvm_reg_data_t byte_en, bit is_read, uvm_reg_map map ) [source]
virtual function void do_print ( uvm_printer printer ) [source]

Do_print

virtual function string convert2string ( ) [source]

Convert2string

virtual function uvm_object clone ( ) [source]

Clone

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

Tasks

virtual function write ( uvm_status_e status, uvm_reg_data_t value, uvm_path_e path, uvm_reg_map map, uvm_sequence_base parent, int prior, uvm_object extension, string fname, int lineno ) [source]

Write the specified value in this register

Write value in the DUT register that corresponds to this abstraction class instance using the specified access path . If the register is mapped in more than one address map, an address map must be specified if a physical access is used (front-door access). If a back-door access path is used, the effect of writing the register through a physical access is mimicked. For example, read-only bits in the registers will not be written.

The mirrored value will be updated using the uvm_reg::predict() method. Write

virtual function read ( uvm_status_e status, uvm_reg_data_t value, uvm_path_e path, uvm_reg_map map, uvm_sequence_base parent, int prior, uvm_object extension, string fname, int lineno ) [source]

Read the current value from this register

Read and return value from the DUT register that corresponds to this abstraction class instance using the specified access path . If the register is mapped in more than one address map, an address map must be specified if a physical access is used (front-door access). If a back-door access path is used, the effect of reading the register through a physical access is mimicked. For example, clear-on-read bits in the registers will be set to zero.

The mirrored value will be updated using the uvm_reg::predict() method. Read

virtual function poke ( uvm_status_e status, uvm_reg_data_t value, string kind, uvm_sequence_base parent, uvm_object extension, string fname, int lineno ) [source]

Deposit the specified value in this register

Deposit the value in the DUT register corresponding to this abstraction class instance, as-is, using a back-door access.

Uses the HDL path for the design abstraction specified by kind .

The mirrored value will be updated using the uvm_reg::predict() method. Poke

virtual function peek ( uvm_status_e status, uvm_reg_data_t value, string kind, uvm_sequence_base parent, uvm_object extension, string fname, int lineno ) [source]

Read the current value from this register

Sample the value in the DUT register corresponding to this abstraction class instance using a back-door access. The register value is sampled, not modified.

Uses the HDL path for the design abstraction specified by kind .

The mirrored value will be updated using the uvm_reg::predict() method. Peek

virtual function update ( uvm_status_e status, uvm_path_e path, uvm_reg_map map, uvm_sequence_base parent, int prior, uvm_object extension, string fname, int lineno ) [source]

Updates the content of the register in the design to match the desired value

This method performs the reverse operation of uvm_reg::mirror(). Write this register if the DUT register is out-of-date with the desired/mirrored value in the abstraction class, as determined by the uvm_reg::needs_update() method.

The update can be performed using the using the physical interfaces (frontdoor) or uvm_reg::poke() (backdoor) access. If the register is mapped in multiple address maps and physical access is used (front-door), an address map must be specified. Update

virtual function mirror ( uvm_status_e status, uvm_check_e check, uvm_path_e path, uvm_reg_map map, uvm_sequence_base parent, int prior, uvm_object extension, string fname, int lineno ) [source]

Read the register and update/check its mirror value

Read the register and optionally compared the readback value with the current mirrored value if check is <UVM_CHECK>. The mirrored value will be updated using the uvm_reg::predict() method based on the readback value.

The mirroring can be performed using the physical interfaces (frontdoor) or uvm_reg::peek() (backdoor).

If check is specified as UVM_CHECK, an error message is issued if the current mirrored value does not match the readback value. Any field whose check has been disabled with uvm_reg_field::set_compare() will not be considered in the comparison.

If the register is mapped in multiple address maps and physical access is used (front-door access), an address map must be specified. If the register contains write-only fields, their content is mirrored and optionally checked only if a UVM_BACKDOOR access path is used to read the register. Mirror

function XreadX ( uvm_status_e status, uvm_reg_data_t value, uvm_path_e path, uvm_reg_map map, uvm_sequence_base parent, int prior, uvm_object extension, string fname, int lineno ) [source]

XreadX

function XatomicX ( bit on ) [source]

XatomicX

virtual function do_write ( uvm_reg_item rw ) [source]

Do_write

virtual function do_read ( uvm_reg_item rw ) [source]

Do_read

virtual function backdoor_read ( uvm_reg_item rw ) [source]

User-define backdoor read access

Override the default string-based DPI backdoor access read for this register type. By default calls uvm_reg::backdoor_read_func(). Backdoor_read

virtual function backdoor_write ( uvm_reg_item rw ) [source]

User-defined backdoor read access

Override the default string-based DPI backdoor access write for this register type. Backdoor_write

virtual function backdoor_watch ( ) [source]

User-defined DUT register change monitor

Watch the DUT register corresponding to this abstraction class instance for any change in value and return when a value-change occurs. This may be implemented a string-based DPI access if the simulation tool provide a value-change callback facility. Such a facility does not exists in the standard SystemVerilog DPI and thus no default implementation for this method can be provided.

virtual function pre_write ( uvm_reg_item rw ) [source]

Called before register write.

If the specified data value, access path or address map are modified, the updated data value, access path or address map will be used to perform the register operation. If the status is modified to anything other than <UVM_IS_OK>, the operation is aborted.

The registered callback methods are invoked after the invocation of this method. All register callbacks are executed before the corresponding field callbacks

virtual function post_write ( uvm_reg_item rw ) [source]

Called after register write.

If the specified status is modified, the updated status will be returned by the register operation.

The registered callback methods are invoked before the invocation of this method. All register callbacks are executed before the corresponding field callbacks

virtual function pre_read ( uvm_reg_item rw ) [source]

Called before register read.

If the specified access path or address map are modified, the updated access path or address map will be used to perform the register operation. If the status is modified to anything other than <UVM_IS_OK>, the operation is aborted.

The registered callback methods are invoked after the invocation of this method. All register callbacks are executed before the corresponding field callbacks

virtual function post_read ( uvm_reg_item rw ) [source]

Called after register read.

If the specified readback data or status is modified, the updated readback data or status will be returned by the register operation.

The registered callback methods are invoked before the invocation of this method. All register callbacks are executed before the corresponding field callbacks