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.

Summary
uvm_reg
Register abstraction base class
Class Hierarchy
Class Declaration
virtual class uvm_reg extends uvm_object
Initialization
newCreate a new instance and type-specific configuration
configureInstance-specific configuration
set_offsetModify the offset of the register
Introspection
get_nameGet the simple name
get_full_nameGet the hierarchical name
get_parentGet the parent block
get_regfileGet the parent register file
get_n_mapsReturns the number of address maps this register is mapped in
is_in_mapReturns 1 if this register is in the specified address map
get_mapsReturns all of the address maps where this register is mapped
get_rightsReturns the accessibility (“RW, “RO”, or “WO”) of this register in the given map.
get_n_bitsReturns the width, in bits, of this register.
get_n_bytesReturns the width, in bytes, of this register.
get_max_sizeReturns the maximum width, in bits, of all registers.
get_fieldsReturn the fields in this register
get_field_by_nameReturn the named field in this register
get_offsetReturns the offset of this register
get_addressReturns the base external physical address of this register
get_addressesIdentifies the external physical address(es) of this register
Access
setSet the desired value for this register
getReturn the desired value of the fields in the register.
get_mirrored_valueReturn the mirrored value of the fields in the register.
needs_updateReturns 1 if any of the fields need updating
resetReset the desired/mirrored value for this register.
get_resetGet the specified reset value for this register
has_resetCheck if any field in the register has a reset value specified for the specified reset kind.
set_resetSpecify or modify the reset value for this register
writeWrite the specified value in this register
readRead the current value from this register
pokeDeposit the specified value in this register
peekRead the current value from this register
updateUpdates the content of the register in the design to match the desired value
mirrorRead the register and update/check its mirror value
predictUpdate the mirrored and desired value for this register.
is_busyReturns 1 if register is currently being read or written.
Frontdoor
set_frontdoorSet a user-defined frontdoor for this register
get_frontdoorReturns the user-defined frontdoor for this register
Backdoor
set_backdoorSet a user-defined backdoor for this register
get_backdoorReturns the user-defined backdoor for this register
clear_hdl_pathDelete HDL paths
add_hdl_pathAdd an HDL path
add_hdl_path_sliceAppend the specified HDL slice to the HDL path of the register instance for the specified design abstraction.
has_hdl_pathCheck if a HDL path is specified
get_hdl_pathGet the incremental HDL path(s)
get_hdl_path_kindsGet design abstractions for which HDL paths have been defined
get_full_hdl_pathGet the full hierarchical HDL path(s)
backdoor_readUser-define backdoor read access
backdoor_writeUser-defined backdoor read access
backdoor_read_funcUser-defined backdoor read access
backdoor_watchUser-defined DUT register change monitor
Coverage
include_coverageSpecify which coverage model that must be included in various block, register or memory abstraction class instances.
build_coverageCheck if all of the specified coverage models must be built.
add_coverageSpecify that additional coverage models are available.
has_coverageCheck if register has coverage model(s)
set_coverageTurns on coverage measurement.
get_coverageCheck if coverage measurement is on.
sampleFunctional coverage measurement method
sample_valuesFunctional coverage measurement method for field values
Callbacks
pre_writeCalled before register write.
post_writeCalled after register write.
pre_readCalled before register read.
post_readCalled after register read.

new

function new (
    string  name  =  "",
    int  unsigned  n_bits,   
    int  has_coverage   
)

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.

configure

function void configure (
    uvm_reg_block  blk_parent,   
    uvm_reg_file  regfile_parent  =  null,
    string  hdl_path  =  ""
)

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.

set_offset

virtual function void set_offset (
    uvm_reg_map  map,   
    uvm_reg_addr_t  offset,   
    bit  unmapped  =  0
)

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.

get_name

Get the simple name

Return the simple object name of this register.

get_full_name

virtual function string get_full_name()

Get the hierarchical name

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

get_parent

virtual function uvm_reg_block get_parent ()

Get the parent block

get_regfile

virtual function uvm_reg_file get_regfile ()

Get the parent register file

Returns null if this register is instantiated in a block.

get_n_maps

virtual function int get_n_maps ()

Returns the number of address maps this register is mapped in

is_in_map

function bit is_in_map (
    uvm_reg_map  map
)

Returns 1 if this register is in the specified address map

get_maps

virtual function void get_maps (
    ref  uvm_reg_map  maps[$]
)

Returns all of the address maps where this register is mapped

get_rights

virtual function string get_rights (
    uvm_reg_map  map  =  null
)

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_n_bits

virtual function int unsigned get_n_bits ()

Returns the width, in bits, of this register.

get_n_bytes

virtual function int unsigned get_n_bytes()

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

get_max_size

static function int unsigned get_max_size()

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

get_fields

virtual function void get_fields (
    ref  uvm_reg_field  fields[$]
)

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_field_by_name

virtual function uvm_reg_field get_field_by_name(
    string  name
)

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_offset

virtual function uvm_reg_addr_t get_offset (
    uvm_reg_map  map  =  null
)

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_address

virtual function uvm_reg_addr_t get_address (
    uvm_reg_map  map  =  null
)

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_addresses

virtual function int get_addresses (
    uvm_reg_map  map  =  null,
    ref  uvm_reg_addr_t  addr[]   
)

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.

set

virtual function void set (
    uvm_reg_data_t  value,   
    string  fname  =  "",
    int  lineno  =  0
)

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.

get

virtual function uvm_reg_data_t get(
    string  fname  =  "",
    int  lineno  =  0
)

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_mirrored_value

virtual function uvm_reg_data_t get_mirrored_value(
    string  fname  =  "",
    int  lineno  =  0
)

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.

needs_update

virtual function bit needs_update()

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.

reset

virtual function void reset(
    string  kind  =  "HARD"
)

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

get_reset

virtual function uvm_reg_data_t get_reset(
    string  kind  =  "HARD"
)

Get the specified reset value for this register

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

has_reset

virtual function bit has_reset(
    string  kind  =  "HARD",
    bit  delete  =  0
)

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.

set_reset

virtual function void set_reset(
    uvm_reg_data_t  value,   
    string  kind  =  "HARD"
)

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.

write

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
)

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.

read

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
)

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.

poke

virtual task poke(
    output  uvm_status_e  status,   
    input  uvm_reg_data_t  value,   
    input  string  kind  =  "",
    input  uvm_sequence_base  parent  =  null,
    input  uvm_object  extension  =  null,
    input  string  fname  =  "",
    input  int  lineno  =  0
)

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.

peek

virtual task peek(
    output  uvm_status_e  status,   
    output  uvm_reg_data_t  value,   
    input  string  kind  =  "",
    input  uvm_sequence_base  parent  =  null,
    input  uvm_object  extension  =  null,
    input  string  fname  =  "",
    input  int  lineno  =  0
)

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.

update

virtual task update(
    output  uvm_status_e  status,   
    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
)

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.

mirror

virtual task mirror(
    output  uvm_status_e  status,   
    input  uvm_check_e  check  =  UVM_NO_CHECK,
    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 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.

predict

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
)

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.

is_busy

function bit is_busy()

Returns 1 if register is currently being read or written.

set_frontdoor

function void set_frontdoor(
    uvm_reg_frontdoor  ftdr,   
    uvm_reg_map  map  =  null,
    string  fname  =  "",
    int  lineno  =  0
)

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.

get_frontdoor

function uvm_reg_frontdoor get_frontdoor(
    uvm_reg_map  map  =  null
)

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.

set_backdoor

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

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.

get_backdoor

function uvm_reg_backdoor get_backdoor(
    bit  inherited  =  1
)

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.

clear_hdl_path

function void clear_hdl_path (
    string  kind  =  "RTL"
)

Delete HDL paths

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

add_hdl_path

function void add_hdl_path (
    uvm_hdl_path_slice  slices[],   
    string  kind  =  "RTL"
)

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_slice

function void add_hdl_path_slice(
    string  name,   
    int  offset,   
    int  size,   
    bit  first  =  0,
    string  kind  =  "RTL"
)

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.

has_hdl_path

function bit has_hdl_path (
    string  kind  =  ""
)

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.

get_hdl_path

function void get_hdl_path (
    ref  uvm_hdl_path_concat  paths[$],   
    input  string  kind  =  ""
)

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_kinds

function void get_hdl_path_kinds (
    ref  string  kinds[$]
)

Get design abstractions for which HDL paths have been defined

get_full_hdl_path

function void get_full_hdl_path (
    ref  uvm_hdl_path_concat  paths[$],   
    input  string  kind  =  "",
    input  string  separator  =  "."
)

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.

backdoor_read

virtual task backdoor_read(
    uvm_reg_item  rw
)

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_write

virtual task backdoor_write(
    uvm_reg_item  rw
)

User-defined backdoor read access

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

backdoor_read_func

virtual function uvm_status_e backdoor_read_func(
    uvm_reg_item  rw
)

User-defined backdoor read access

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

backdoor_watch

virtual task backdoor_watch()

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.

include_coverage

static function void include_coverage(
    string  scope,   
    uvm_reg_cvr_t  models,   
    uvm_object  accessor  =  null
)

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("*", 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.

build_coverage

protected function uvm_reg_cvr_t build_coverage(
    uvm_reg_cvr_t  models
)

Check if all of the specified coverage models must be built.

Check which of the specified coverage model must be built in this instance of the register abstraction class, as specified by calls to uvm_reg::include_coverage().

Models are specified by adding the symbolic value of individual coverage model as defined in uvm_coverage_model_e.  Returns the sum of all coverage models to be built in the register model.

add_coverage

virtual protected function void add_coverage(
    uvm_reg_cvr_t  models
)

Specify that additional coverage models are available.

Add the specified coverage model to the coverage models available in this class.  Models are specified by adding the symbolic value of individual coverage model as defined in uvm_coverage_model_e.

This method shall be called only in the constructor of subsequently derived classes.

has_coverage

virtual function bit has_coverage(
    uvm_reg_cvr_t  models
)

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.

set_coverage

virtual function uvm_reg_cvr_t set_coverage(
    uvm_reg_cvr_t  is_on
)

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.

get_coverage

virtual function bit get_coverage(
    uvm_reg_cvr_t  is_on
)

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.

sample

protected virtual function void sample(
    uvm_reg_data_t  data,
    uvm_reg_data_t  byte_en,
    bit  is_read,
    uvm_reg_map  map
)

Functional coverage measurement method

This method is invoked by the register abstraction class whenever it is read or written with the specified data via the specified address map.  It is invoked after the read or write operation has completed but before the mirror has been updated.

Empty by default, this method may be extended by the abstraction class generator to perform the required sampling in any provided functional coverage model.

sample_values

virtual function void 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 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.

pre_write

virtual task pre_write(
    uvm_reg_item  rw
)

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

post_write

virtual task post_write(
    uvm_reg_item  rw
)

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

pre_read

virtual task pre_read(
    uvm_reg_item  rw
)

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

post_read

virtual task post_read(
    uvm_reg_item  rw
)

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

virtual class uvm_void
The uvm_void class is the base class for all UVM classes.
virtual class uvm_object extends uvm_void
The uvm_object class is the base class for all UVM data and hierarchical classes.
virtual class uvm_reg extends uvm_object
Register abstraction base class
function new (
    string  name  =  "",
    int  unsigned  n_bits,   
    int  has_coverage   
)
Create a new instance and type-specific configuration
function void configure (
    uvm_reg_block  blk_parent,   
    uvm_reg_file  regfile_parent  =  null,
    string  hdl_path  =  ""
)
Instance-specific configuration
virtual function void set_offset (
    uvm_reg_map  map,   
    uvm_reg_addr_t  offset,   
    bit  unmapped  =  0
)
Modify the offset of the register
virtual function string get_full_name()
Get the hierarchical name
virtual function uvm_reg_block get_parent ()
Get the parent block
virtual function uvm_reg_file get_regfile ()
Get the parent register file
virtual function int get_n_maps ()
Returns the number of address maps this register is mapped in
function bit is_in_map (
    uvm_reg_map  map
)
Returns 1 if this register is in the specified address map
virtual function void get_maps (
    ref  uvm_reg_map  maps[$]
)
Returns all of the address maps where this register is mapped
virtual function string get_rights (
    uvm_reg_map  map  =  null
)
Returns the accessibility (“RW, “RO”, or “WO”) of this register in the given map.
virtual function int unsigned get_n_bits ()
Returns the width, in bits, of this register.
virtual function int unsigned get_n_bytes()
Returns the width, in bytes, of this register.
static function int unsigned get_max_size()
Returns the maximum width, in bits, of all registers.
virtual function void get_fields (
    ref  uvm_reg_field  fields[$]
)
Return the fields in this register
virtual function uvm_reg_field get_field_by_name(
    string  name
)
Return the named field in this register
virtual function uvm_reg_addr_t get_offset (
    uvm_reg_map  map  =  null
)
Returns the offset of this register
virtual function uvm_reg_addr_t get_address (
    uvm_reg_map  map  =  null
)
Returns the base external physical address of this register
virtual function int get_addresses (
    uvm_reg_map  map  =  null,
    ref  uvm_reg_addr_t  addr[]   
)
Identifies the external physical address(es) of this register
virtual function void set (
    uvm_reg_data_t  value,   
    string  fname  =  "",
    int  lineno  =  0
)
Set the desired value for this register
virtual function uvm_reg_data_t get(
    string  fname  =  "",
    int  lineno  =  0
)
Return the desired value of the fields in the register.
virtual function uvm_reg_data_t get_mirrored_value(
    string  fname  =  "",
    int  lineno  =  0
)
Return the mirrored value of the fields in the register.
virtual function bit needs_update()
Returns 1 if any of the fields need updating
virtual function void reset(
    string  kind  =  "HARD"
)
Reset the desired/mirrored value for this register.
virtual function uvm_reg_data_t get_reset(
    string  kind  =  "HARD"
)
Get the specified reset value for this register
virtual function bit has_reset(
    string  kind  =  "HARD",
    bit  delete  =  0
)
Check if any field in the register has a reset value specified for the specified reset kind.
virtual function void set_reset(
    uvm_reg_data_t  value,   
    string  kind  =  "HARD"
)
Specify or modify the reset value for 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
)
Write the specified value in 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
)
Read the current value from this register
virtual task poke(
    output  uvm_status_e  status,   
    input  uvm_reg_data_t  value,   
    input  string  kind  =  "",
    input  uvm_sequence_base  parent  =  null,
    input  uvm_object  extension  =  null,
    input  string  fname  =  "",
    input  int  lineno  =  0
)
Deposit the specified value in this register
virtual task peek(
    output  uvm_status_e  status,   
    output  uvm_reg_data_t  value,   
    input  string  kind  =  "",
    input  uvm_sequence_base  parent  =  null,
    input  uvm_object  extension  =  null,
    input  string  fname  =  "",
    input  int  lineno  =  0
)
Read the current value from this register
virtual task update(
    output  uvm_status_e  status,   
    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
)
Updates the content of the register in the design to match the desired value
virtual task mirror(
    output  uvm_status_e  status,   
    input  uvm_check_e  check  =  UVM_NO_CHECK,
    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 register and update/check its mirror value
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
)
Update the mirrored and desired value for this register.
function bit is_busy()
Returns 1 if register is currently being read or written.
function void set_frontdoor(
    uvm_reg_frontdoor  ftdr,   
    uvm_reg_map  map  =  null,
    string  fname  =  "",
    int  lineno  =  0
)
Set a user-defined frontdoor for this register
function uvm_reg_frontdoor get_frontdoor(
    uvm_reg_map  map  =  null
)
Returns the user-defined frontdoor for this register
function void set_backdoor(
    uvm_reg_backdoor  bkdr,   
    string  fname  =  "",
    int  lineno  =  0
)
Set a user-defined backdoor for this register
function uvm_reg_backdoor get_backdoor(
    bit  inherited  =  1
)
Returns the user-defined backdoor for this register
function void clear_hdl_path (
    string  kind  =  "RTL"
)
Delete HDL paths
function void add_hdl_path (
    uvm_hdl_path_slice  slices[],   
    string  kind  =  "RTL"
)
Add an HDL path
function void add_hdl_path_slice(
    string  name,   
    int  offset,   
    int  size,   
    bit  first  =  0,
    string  kind  =  "RTL"
)
Append the specified HDL slice to the HDL path of the register instance for the specified design abstraction.
function bit has_hdl_path (
    string  kind  =  ""
)
Check if a HDL path is specified
function void get_hdl_path (
    ref  uvm_hdl_path_concat  paths[$],   
    input  string  kind  =  ""
)
Get the incremental HDL path(s)
function void get_hdl_path_kinds (
    ref  string  kinds[$]
)
Get design abstractions for which HDL paths have been defined
function void get_full_hdl_path (
    ref  uvm_hdl_path_concat  paths[$],   
    input  string  kind  =  "",
    input  string  separator  =  "."
)
Get the full hierarchical HDL path(s)
virtual task backdoor_read(
    uvm_reg_item  rw
)
User-define backdoor read access
virtual task backdoor_write(
    uvm_reg_item  rw
)
User-defined backdoor read access
virtual function uvm_status_e backdoor_read_func(
    uvm_reg_item  rw
)
User-defined backdoor read access
virtual task backdoor_watch()
User-defined DUT register change monitor
static function void include_coverage(
    string  scope,   
    uvm_reg_cvr_t  models,   
    uvm_object  accessor  =  null
)
Specify which coverage model that must be included in various block, register or memory abstraction class instances.
protected function uvm_reg_cvr_t build_coverage(
    uvm_reg_cvr_t  models
)
Check if all of the specified coverage models must be built.
virtual protected function void add_coverage(
    uvm_reg_cvr_t  models
)
Specify that additional coverage models are available.
virtual function bit has_coverage(
    uvm_reg_cvr_t  models
)
Check if register has coverage model(s)
virtual function uvm_reg_cvr_t set_coverage(
    uvm_reg_cvr_t  is_on
)
Turns on coverage measurement.
virtual function bit get_coverage(
    uvm_reg_cvr_t  is_on
)
Check if coverage measurement is on.
protected virtual function void sample(
    uvm_reg_data_t  data,
    uvm_reg_data_t  byte_en,
    bit  is_read,
    uvm_reg_map  map
)
Functional coverage measurement method
virtual function void sample_values()
Functional coverage measurement method for field values
virtual task pre_write(
    uvm_reg_item  rw
)
Called before register write.
virtual task post_write(
    uvm_reg_item  rw
)
Called after register write.
virtual task pre_read(
    uvm_reg_item  rw
)
Called before register read.
virtual task post_read(
    uvm_reg_item  rw
)
Called after register read.
Coverage models available or desired.
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
function void configure(
    uvm_reg  parent,
    int  unsigned  size,
    int  unsigned  lsb_pos,
    string  access,
    bit  volatile,
    uvm_reg_data_t  reset,
    bit  has_reset,
    bit  is_rand,
    bit  individually_accessible
)
Instance-specific configuration
virtual function void set(
    uvm_reg_data_t  value,   
    string  fname  =  "",
    int  lineno  =  0
)
Set the desired value for this field
virtual function bit needs_update()
Check if the abstract model contains different desired and mirrored values.
virtual function void reset(
    string  kind  =  "HARD"
)
Reset the desired/mirrored value for this field.
Read and check
function void set_compare(
    uvm_check_e  check  =  UVM_CHECK
)
Sets the compare policy during a mirror update.
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
)
Update the mirrored and desired value for this field.
Each resource has a name, a value and a set of scopes over which it is visible.
Coverage model value set with `UVM_REG_CVR_WIDTH bits.
class uvm_resource_db #(
    type  T  =  uvm_object
)
All of the functions in uvm_resource_db#(T) are static, so they must be called using the :: operator.
virtual function void sample_values()
Functional coverage measurement method for field values
Operation completed successfully