Class uvm_pkg::uvm_reg_field
Name |
Type |
Description |
---|---|---|
value |
Variable value Mirrored field value. This value can be sampled in a functional coverage model or constrained when randomized. Mirrored after randomize() |
Name |
Description |
---|---|
uvm_reg_field_valid |
Constructors
- new(string name = "uvm_reg_field")
Function
new
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
- Parameters:
name (string)
Functions
- 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)
Function
configure
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
- Parameters:
parent (uvm_reg)
size (int unsigned)
lsb_pos (int unsigned)
access (string)
volatile (bit)
reset (uvm_reg_data_t)
has_reset (bit)
is_rand (bit)
individually_accessible (bit)
- get_full_name()
Function
get_full_name
Get the hierarchical name
Return the hierarchal name of this field The base of the hierarchical name is the root block. Get_full_name
- get_parent()
Function
get_parent
Get the parent register. Get_parent
- Return type:
- get_register()
Get_register
- Return type:
- get_lsb_pos()
Function
get_lsb_pos
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
- get_n_bits()
Function
get_n_bits
Returns the width, in number of bits, of the field. Get_n_bits
- get_max_size()
FUNCTION
get_max_size
Returns the width, in number of bits, of the largest field. Get_max_size
- set_access(string mode)
Function
set_access
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
- Parameters:
mode (string)
-
- define_access(string name)
Function
define_access
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
- Parameters:
name (string)
- get_access(uvm_reg_map map = null)
Function
get_access
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
- Parameters:
map (uvm_reg_map)
- is_known_access(uvm_reg_map map = null)
Function
is_known_access
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
- Parameters:
map (uvm_reg_map)
- set_volatility(bit volatile)
Function
set_volatility
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
- Parameters:
volatile (bit)
- is_volatile()
Function
is_volatile
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
- set(uvm_reg_data_t value, string fname = "", int lineno = 0)
Function
set
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
- Parameters:
value (uvm_reg_data_t)
fname (string)
lineno (int)
- get(string fname = "", int lineno = 0)
Function
get
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
- Parameters:
fname (string)
lineno (int)
- Return type:
- get_mirrored_value(string fname = "", int lineno = 0)
Function
get_mirrored_value
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
- Parameters:
fname (string)
lineno (int)
- Return type:
- reset(string kind = "HARD")
Function
reset
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
- Parameters:
kind (string)
- get_reset(string kind = "HARD")
Function
get_reset
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
- Parameters:
kind (string)
- Return type:
- has_reset(string kind = "HARD", bit delete = 0)
Function
has_reset
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
- Parameters:
kind (string)
delete (bit)
- set_reset(uvm_reg_data_t value, string kind = "HARD")
Function
set_reset
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
- Parameters:
value (uvm_reg_data_t)
kind (string)
- needs_update()
Function
needs_update
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
- set_compare(uvm_check_e check = UVM_CHECK)
Function
set_compare
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
. Set_compare - Parameters:
check (uvm_check_e)
- get_compare()
Function
get_compare
Returns the compare policy for this field. Get_compare
- Return type:
- is_indv_accessible(uvm_path_e path, uvm_reg_map local_map)
Function
is_indv_accessible
Check if this field can be written individually, i.e. without affecting other fields in the containing register. Is_indv_accessible
- Parameters:
path (uvm_path_e)
local_map (uvm_reg_map)
- 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)
Function
predict
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
, the value was observed in a read transaction on the specified address map or backdoor (if path is ). If kind is specified as , the value was observed in a write transaction on the specified address map or backdoor (if path is ). If kind is specified as , 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 . 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
- Parameters:
value (uvm_reg_data_t)
be (uvm_reg_byte_en_t)
kind (uvm_predict_e)
path (uvm_path_e)
map (uvm_reg_map)
fname (string)
lineno (int)
- XpredictX(uvm_reg_data_t cur_val, uvm_reg_data_t wr_val, uvm_reg_map map)
Local. XpredictX
- Parameters:
cur_val (uvm_reg_data_t)
wr_val (uvm_reg_data_t)
map (uvm_reg_map)
- Return type:
- XupdateX()
Local. XupdateX
- Return type:
- Xcheck_accessX(uvm_reg_item rw, uvm_reg_map_info map_info, string caller)
Local. Xcheck_accessX
- Parameters:
rw (uvm_reg_item)
map_info (uvm_reg_map_info)
caller (string)
- do_predict(uvm_reg_item rw, uvm_predict_e kind = UVM_PREDICT_DIRECT, uvm_reg_byte_en_t be = -1)
Do_predict
- Parameters:
rw (uvm_reg_item)
kind (uvm_predict_e)
be (uvm_reg_byte_en_t)
- do_print(uvm_printer printer)
Do_print
- Parameters:
printer (uvm_printer)
- convert2string()
Convert2string
- clone()
Clone
- Return type:
- do_copy(uvm_object rhs)
Do_copy
- Parameters:
rhs (uvm_object)
- do_compare(uvm_object rhs, uvm_comparer comparer)
Do_compare
- Parameters:
rhs (uvm_object)
comparer (uvm_comparer)
- do_pack(uvm_packer packer)
Do_pack
- Parameters:
packer (uvm_packer)
- do_unpack(uvm_packer packer)
Do_unpack
- Parameters:
packer (uvm_packer)
Tasks
- write(uvm_status_e status, uvm_reg_data_t value, uvm_path_e path = UVM_DEFAULT_PATH, uvm_reg_map map = null, uvm_sequence_base parent = null, int prior = -1, uvm_object extension = null, string fname = "", int lineno = 0)
Task
write
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
- Parameters:
status (uvm_status_e)
value (uvm_reg_data_t)
path (uvm_path_e)
map (uvm_reg_map)
parent (uvm_sequence_base)
prior (int)
extension (uvm_object)
fname (string)
lineno (int)
- read(uvm_status_e status, uvm_reg_data_t value, uvm_path_e path = UVM_DEFAULT_PATH, uvm_reg_map map = null, uvm_sequence_base parent = null, int prior = -1, uvm_object extension = null, string fname = "", int lineno = 0)
Task
read
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
- Parameters:
status (uvm_status_e)
value (uvm_reg_data_t)
path (uvm_path_e)
map (uvm_reg_map)
parent (uvm_sequence_base)
prior (int)
extension (uvm_object)
fname (string)
lineno (int)
- poke(uvm_status_e status, uvm_reg_data_t value, string kind = "", uvm_sequence_base parent = null, uvm_object extension = null, string fname = "", int lineno = 0)
Task
poke
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
- Parameters:
status (uvm_status_e)
value (uvm_reg_data_t)
kind (string)
parent (uvm_sequence_base)
extension (uvm_object)
fname (string)
lineno (int)
- peek(uvm_status_e status, uvm_reg_data_t value, string kind = "", uvm_sequence_base parent = null, uvm_object extension = null, string fname = "", int lineno = 0)
Task
peek
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
- Parameters:
status (uvm_status_e)
value (uvm_reg_data_t)
kind (string)
parent (uvm_sequence_base)
extension (uvm_object)
fname (string)
lineno (int)
- mirror(uvm_status_e status, uvm_check_e check = UVM_NO_CHECK, uvm_path_e path = UVM_DEFAULT_PATH, uvm_reg_map map = null, uvm_sequence_base parent = null, int prior = -1, uvm_object extension = null, string fname = "", int lineno = 0)
Task
mirror
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
. The mirrored value will be updated using the predict() method based on the readback value. The path argument specifies whether to mirror using the
(read) or (peek()). If check is specified as
, 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
- Parameters:
status (uvm_status_e)
check (uvm_check_e)
path (uvm_path_e)
map (uvm_reg_map)
parent (uvm_sequence_base)
prior (int)
extension (uvm_object)
fname (string)
lineno (int)
- do_write(uvm_reg_item rw)
Do_write
- Parameters:
rw (uvm_reg_item)
- do_read(uvm_reg_item rw)
Do_read
- Parameters:
rw (uvm_reg_item)
- pre_write(uvm_reg_item rw)
Task
pre_write
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
, 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.
- Parameters:
rw (uvm_reg_item)
- post_write(uvm_reg_item rw)
Task
post_write
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.
- Parameters:
rw (uvm_reg_item)
- pre_read(uvm_reg_item rw)
Task
pre_read
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
, 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.
- Parameters:
rw (uvm_reg_item)
- post_read(uvm_reg_item rw)
Task
post_read
Called after field read.
If the specified readback data or
statusin 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.
- Parameters:
rw (uvm_reg_item)
CLASS
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).