[source]

Class uvm_reg_field

uvm_pkg::uvm_reg_field + type_name : string + value : uvm_reg_data_t + Xcheck_accessX(): bit + XpredictX(): uvm_reg_data_t + XupdateX(): uvm_reg_data_t + __m_uvm_field_automation(): void + clone(): uvm_object + configure(): void + convert2string(): string + create(): uvm_object + define_access(): 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_access(): string + get_compare(): uvm_check_e + get_full_name(): string + get_lsb_pos(): int unsigned + get_max_size(): int unsigned + get_mirrored_value(): uvm_reg_data_t + get_n_bits(): int unsigned + get_object_type(): uvm_object_wrapper + get_parent(): uvm_reg + get_register(): uvm_reg + get_reset(): uvm_reg_data_t + get_type(): type_id + get_type_name(): string + has_reset(): bit + is_indv_accessible(): bit + is_known_access(): bit + is_volatile(): bit + mirror() + needs_update(): bit + peek() + poke() + post_read() + post_write() + pre_read() + pre_write() + predict(): bit + read() + reset(): void + set(): void + set_access(): string + set_compare(): void + set_reset(): void + set_volatility(): void + write()

Inheritance Diagram of uvm_reg_field

Field abstraction class

A field represents a set of bits that behave consistently as a single entity.

A field is contained within a single register, but may have different access policies depending on the address map use the access the register (thus the field).

Variables

Name

Type

Description

value

uvm_reg_data_t

Mirrored field value. This value can be sampled in a functional coverage model or constrained when randomized. Mirrored after randomize()

Constraints

Name

Description

uvm_reg_field_valid

Constructors

function new ( string name ) [source]

Create a new field instance

This method should not be used directly. The uvm_reg_field::type_id::create() factory method should be used instead. New

Functions

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

Instance-specific configuration

Specify the parent register of this field, its size in bits, the position of its least-significant bit within the register relative to the least-significant bit of the register, its access policy, volatility, "HARD" reset value, whether the field value is actually reset (the reset value is ignored if FALSE ), whether the field value may be randomized and whether the field is the only one to occupy a byte lane in the register.

See set_access for a specification of the pre-defined field access policies.

If the field access policy is a pre-defined policy and NOT one of "RW", "WRC", "WRS", "WO", "W1", or "WO1", the value of is_rand is ignored and the rand_mode() for the field instance is turned off since it cannot be written. Configure

virtual function string get_full_name ( ) [source]

Get the hierarchical name

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

virtual function uvm_reg get_parent ( ) [source]

Get the parent register. Get_parent

virtual function uvm_reg get_register ( ) [source]

Get_register

virtual function int unsigned get_lsb_pos ( ) [source]

Return the position of the field

Returns the index of the least significant bit of the field in the register that instantiates it. An offset of 0 indicates a field that is aligned with the least-significant bit of the register. Get_lsb_pos

virtual function int unsigned get_n_bits ( ) [source]

Returns the width, in number of bits, of the field. Get_n_bits

static function int unsigned get_max_size ( ) [source]

Returns the width, in number of bits, of the largest field. Get_max_size

virtual function string set_access ( string mode ) [source]

Modify the access policy of the field

Modify the access policy of the field to the specified one and return the previous access policy.

The pre-defined access policies are as follows. The effect of a read operation are applied after the current value of the field is sampled. The read operation will return the current value, not the value affected by the read operation (if any).

"RO"

W: no effect, R: no effect

"RW"

W: as-is, R: no effect

"RC"

W: no effect, R: clears all bits

"RS"

W: no effect, R: sets all bits

"WRC"

W: as-is, R: clears all bits

"WRS"

W: as-is, R: sets all bits

"WC"

W: clears all bits, R: no effect

"WS"

W: sets all bits, R: no effect

"WSRC"

W: sets all bits, R: clears all bits

"WCRS"

W: clears all bits, R: sets all bits

"W1C"

W: 1/0 clears/no effect on matching bit, R: no effect

"W1S"

W: 1/0 sets/no effect on matching bit, R: no effect

"W1T"

W: 1/0 toggles/no effect on matching bit, R: no effect

"W0C"

W: 1/0 no effect on/clears matching bit, R: no effect

"W0S"

W: 1/0 no effect on/sets matching bit, R: no effect

"W0T"

W: 1/0 no effect on/toggles matching bit, R: no effect

"W1SRC"

W: 1/0 sets/no effect on matching bit, R: clears all bits

"W1CRS"

W: 1/0 clears/no effect on matching bit, R: sets all bits

"W0SRC"

W: 1/0 no effect on/sets matching bit, R: clears all bits

"W0CRS"

W: 1/0 no effect on/clears matching bit, R: sets all bits

"WO"

W: as-is, R: error

"WOC"

W: clears all bits, R: error

"WOS"

W: sets all bits, R: error

"W1"

W: first one after HARD reset is as-is, other W have no effects, R: no effect

"WO1"

W: first one after HARD reset is as-is, other W have no effects, R: error

"NOACCESS"

W: no effect, R: no effect

It is important to remember that modifying the access of a field will make the register model diverge from the specification that was used to create it. Set_access

static function bit define_access ( string name ) [source]

Define a new access policy value

Because field access policies are specified using string values, there is no way for SystemVerilog to verify if a specific access value is valid or not. To help catch typing errors, user-defined access values must be defined using this method to avoid begin reported as an invalid access policy.

The name of field access policies are always converted to all uppercase.

Returns TRUE if the new access policy was not previously defined. Returns FALSE otherwise but does not issue an error message. Define_access

virtual function string get_access ( uvm_reg_map map ) [source]

Get the access policy of the field

Returns the current access policy of the field when written and read through the specified address map . If the register containing the field is mapped in multiple address map, an address map must be specified. The access policy of a field from a specific address map may be restricted by the register's access policy in that address map. For example, a RW field may only be writable through one of the address maps and read-only through all of the other maps. If the field access contradicts the map's access value (field access of WO, and map access value of RO, etc), the method's return value is NOACCESS. Get_access

virtual function bit is_known_access ( uvm_reg_map map ) [source]

Check if access policy is a built-in one.

Returns TRUE if the current access policy of the field, when written and read through the specified address map , is a built-in access policy. Is_known_access

virtual function void set_volatility ( bit volatile ) [source]

Modify the volatility of the field to the specified one.

It is important to remember that modifying the volatility of a field will make the register model diverge from the specification that was used to create it. Set_volatility

virtual function bit is_volatile ( ) [source]

Indicates if the field value is volatile

UVM uses the IEEE 1685-2009 IP-XACT definition of "volatility". If TRUE, the value of the register is not predictable because it may change between consecutive accesses. This typically indicates a field whose value is updated by the DUT. The nature or cause of the change is not specified. If FALSE, the value of the register is not modified between consecutive accesses. Is_volatile

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

Set the desired value for this field

It sets the desired value of the field to the specified value modified by the field access policy. It does not actually set the value of the field in the design, only the desired value in the abstraction class. Use the uvm_reg::update() method to update the actual register with the desired value or the uvm_reg_field::write() method to actually write the field and update its mirrored value.

The final desired value in the mirror is a function of the field access policy and the set value, just like a normal physical write operation to the corresponding bits in the hardware. As such, this method (when eventually followed by a call to uvm_reg::update()) is a zero-time functional replacement for the uvm_reg_field::write() method. For example, the desired value of a read-only field is not modified by this method and the desired value of a write-once field can only be set if the field has not yet been written to using a physical (for example, front-door) write operation.

Use the uvm_reg_field::predict() to modify the mirrored value of the field. Set

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

Return the desired value of the field

It does not actually read the value of the field in the design, only the desired value in the abstraction class. Unless set to a different value using the uvm_reg_field::set(), the desired value and the mirrored value are identical.

Use the uvm_reg_field::read() or uvm_reg_field::peek() method to get the actual field value.

If the field is write-only, the desired/mirrored value is the value last written and assumed to reside in the bits implementing it. Although a physical read operation would something different, 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 field

It does not actually read the value of the field in the design, only the mirrored value in the abstraction class.

If the field is write-only, the desired/mirrored value is the value last written and assumed to reside in the bits implementing it. Although a physical read operation would something different, the returned value is the actual content. Get_mirrored_value

virtual function void reset ( string kind ) [source]

Reset the desired/mirrored value for this field.

It sets the desired and mirror value of the field to the reset event specified by kind . If the field does not have a reset value specified for the specified reset kind the field is unchanged.

It does not actually reset the value of the field in the design, only the value mirrored in the field abstraction class.

Write-once fields can be modified after a "HARD" reset operation. Reset

virtual function uvm_reg_data_t get_reset ( string kind ) [source]

Get the specified reset value for this field

Return the reset value for this field for the specified reset kind . Returns the current field value is no reset value has been specified for the specified reset event. Get_reset

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

Check if the field has a reset value specified

Return TRUE if this field 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 field

Specify or modify the reset value for this field corresponding to the cause specified by kind . Set_reset

virtual function bit needs_update ( ) [source]

Check if the abstract model contains different desired and mirrored values.

If a desired field value has been modified in the abstraction class without actually updating the field in the DUT, the state of the DUT (more specifically what the abstraction class thinks the state of the DUT is) is outdated. This method returns TRUE if the state of the field in the DUT needs to be updated to match the desired value. The mirror values or actual content of DUT field are not modified. Use the uvm_reg::update() to actually update the DUT field. Needs_update

function void set_compare ( uvm_check_e check ) [source]

Sets the compare policy during a mirror update. The field value is checked against its mirror only when both the check argument in uvm_reg_block::mirror, uvm_reg::mirror, or uvm_reg_field::mirror and the compare policy for the field is <UVM_CHECK>. Set_compare

function uvm_check_e get_compare ( ) [source]

Returns the compare policy for this field. Get_compare

function bit is_indv_accessible ( uvm_path_e path, uvm_reg_map local_map ) [source]

Check if this field can be written individually, i.e. without affecting other fields in the containing register. Is_indv_accessible

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

Predict the mirror and desired value of the field based on the specified observed value on a bus using the specified address map .

If kind is specified as <UVM_PREDICT_READ>, the value was observed in a read transaction on the specified address map or backdoor (if path is <UVM_BACKDOOR>). If kind is specified as <UVM_PREDICT_WRITE>, the value was observed in a write transaction on the specified address map or backdoor (if path is <UVM_BACKDOOR>). If kind is specified as <UVM_PREDICT_DIRECT>, the value was computed and is updated as-is, without regard to any access policy. For example, the mirrored value of a read-only field is modified by this method if kind is specified as <UVM_PREDICT_DIRECT>.

This method does not allow an update of the mirror (or desired) when the register containing this field is busy executing a transaction because the results are unpredictable and indicative of a race condition in the testbench.

Returns TRUE if the prediction was successful. Predict

virtual function uvm_reg_data_t XpredictX ( uvm_reg_data_t cur_val, uvm_reg_data_t wr_val, uvm_reg_map map ) [source]

local. XpredictX

virtual function uvm_reg_data_t XupdateX ( ) [source]

local. XupdateX

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

local. Xcheck_accessX

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

Do_predict

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 field

Write value in the DUT field that corresponds to this abstraction class instance using the specified access path . If the register containing this field 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 field through a physical access is mimicked. For example, read-only bits in the field will not be written.

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

If a front-door access is used, and if the field is the only field in a byte lane and if the physical interface corresponding to the address map used to access the field support byte-enabling, then only the field is written. Otherwise, the entire register containing the field is written, and the mirrored values of the other fields in the same register are used in a best-effort not to modify their value.

If a backdoor access is used, a peek-modify-poke process is used. in a best-effort not to modify the value of the other fields in the register. 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 field

Read and return value from the DUT field that corresponds to this abstraction class instance using the specified access path . If the register containing this field 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 field through a physical access is mimicked. For example, clear-on-read bits in the field will be set to zero.

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

If a front-door access is used, and if the field is the only field in a byte lane and if the physical interface corresponding to the address map used to access the field support byte-enabling, then only the field is read. Otherwise, the entire register containing the field is read, and the mirrored values of the other fields in the same register are updated.

If a backdoor access is used, the entire containing register is peeked and the mirrored value of the other fields in the register is updated. 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 field

Deposit the value in the DUT field corresponding to this abstraction class instance, as-is, using a back-door access. A peek-modify-poke process is used in a best-effort not to modify the value of the other fields in the register.

The mirrored value will be updated using the uvm_reg_field::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 field

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

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

The entire containing register is peeked and the mirrored value of the other fields in the register are updated using the uvm_reg_field::predict() method. Peek

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 field and update/check its mirror value

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

The path argument specifies whether to mirror using the <UVM_FRONTDOOR> (read) or <UVM_BACKDOOR> (peek()).

If check is specified as <UVM_CHECK>, an error message is issued if the current mirrored value does not match the readback value, unless set_compare was used disable the check.

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

virtual function do_write ( uvm_reg_item rw ) [source]

Do_write

virtual function do_read ( uvm_reg_item rw ) [source]

Do_read

virtual function pre_write ( uvm_reg_item rw ) [source]

Called before field 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 field callback methods are invoked after the callback methods on the containing register. The registered callback methods are invoked after the invocation of this method.

virtual function post_write ( uvm_reg_item rw ) [source]

Called after field write.

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

The field callback methods are invoked after the callback methods on the containing register. The registered callback methods are invoked before the invocation of this method.

virtual function pre_read ( uvm_reg_item rw ) [source]

Called before field read.

If the access path or address map in the rw argument 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 field callback methods are invoked after the callback methods on the containing register. The registered callback methods are invoked after the invocation of this method.

virtual function post_read ( uvm_reg_item rw ) [source]

Called after field read.

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

The field callback methods are invoked after the callback methods on the containing register. The registered callback methods are invoked before the invocation of this method.