Class uvm_pkg::uvm_vreg
Constructors
- new(string name, int unsigned n_bits)
FUNCTION
new
Create a new instance and type-specific configuration
Creates an instance of a virtual register abstraction class with the specified name.
n_bits specifies the total number of bits in a virtual register. Not all bits need to be mapped to a virtual field. This value is usually a multiple of 8. IMPLEMENTATION
- Parameters:
name (string)
n_bits (int unsigned)
Functions
- configure(uvm_reg_block parent, uvm_mem mem = null, longint unsigned size = 0, uvm_reg_addr_t offset = 0, int unsigned incr = 0)
Function
configure
Instance-specific configuration
Specify the parent block of this virtual register array. If one of the other parameters are specified, the virtual register is assumed to be dynamic and can be later (re-)implemented using the uvm_vreg::implement() method.
If mem is specified, then the virtual register array is assumed to be statically implemented in the memory corresponding to the specified memory abstraction class and size , offset and incr must also be specified. Static virtual register arrays cannot be re-implemented.
- Parameters:
parent (uvm_reg_block)
mem (uvm_mem)
size (longint unsigned)
offset (uvm_reg_addr_t)
incr (int unsigned)
- implement(longint unsigned n, uvm_mem mem = null, uvm_reg_addr_t offset = 0, int unsigned incr = 0)
FUNCTION
implement
Dynamically implement, resize or relocate a virtual register array
Implement an array of virtual registers of the specified size , in the specified memory and offset . If an offset increment is specified, each virtual register is implemented at the specified offset increment from the previous one. If an offset increment of 0 is specified, virtual registers are packed as closely as possible in the memory.
If no memory is specified, the virtual register array is in the same memory, at the same base offset using the same offset increment as originally implemented. Only the number of virtual registers in the virtual register array is modified.
The initial value of the newly-implemented or relocated set of virtual registers is whatever values are currently stored in the memory now implementing them.
Returns TRUE if the memory can implement the number of virtual registers at the specified base offset and offset increment. Returns FALSE otherwise.
The memory region used to implement a virtual register array is reserved in the memory allocation manager associated with the memory to prevent it from being allocated for another purpose.
- Parameters:
n (longint unsigned)
mem (uvm_mem)
offset (uvm_reg_addr_t)
incr (int unsigned)
- allocate(longint unsigned n, uvm_mem_mam mam, uvm_mem_mam_policy alloc = null)
FUNCTION
allocate
Randomly implement, resize or relocate a virtual register array
Implement a virtual register array of the specified size in a randomly allocated region of the appropriate size in the address space managed by the specified memory allocation manager. If a memory allocation policy is specified, it is passed to the uvm_mem_mam::request_region() method.
The initial value of the newly-implemented or relocated set of virtual registers is whatever values are currently stored in the memory region now implementing them.
Returns a reference to a uvm_mem_region memory region descriptor if the memory allocation manager was able to allocate a region that can implement the virtual register array with the specified allocation policy. Returns null otherwise.
A region implementing a virtual register array must not be released using the uvm_mem_mam::release_region() method. It must be released using the uvm_vreg::release_region() method.
- Parameters:
n (longint unsigned)
mam (uvm_mem_mam)
alloc (uvm_mem_mam_policy)
- Return type:
- get_region()
FUNCTION
get_region
Get the region where the virtual register array is implemented
Returns a reference to the uvm_mem_region memory region descriptor that implements the virtual register array.
Returns null if the virtual registers array is not currently implemented. A region implementing a virtual register array must not be released using the uvm_mem_mam::release_region() method. It must be released using the uvm_vreg::release_region() method.
- Return type:
- release_region()
FUNCTION
release_region
Dynamically un-implement a virtual register array
Release the memory region used to implement a virtual register array and return it to the pool of available memory that can be allocated by the memory's default allocation manager. The virtual register array is subsequently considered as unimplemented and can no longer be accessed.
Statically-implemented virtual registers cannot be released.
- set_parent(uvm_reg_block parent)
- Parameters:
parent (uvm_reg_block) --
Local
- Xlock_modelX()
Local
- add_field(uvm_vreg_field field)
- Parameters:
field (uvm_vreg_field) --
Local
- get_full_name()
Function
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()
FUNCTION
get_parent
Get the parent block
- Return type:
- get_block()
- Return type:
- get_memory()
FUNCTION
get_memory
Get the memory where the virtual register array is implemented
- Return type:
- get_n_maps()
Function
get_n_maps
Returns the number of address maps this virtual register array is mapped in
- is_in_map(uvm_reg_map map)
Function
is_in_map
Return TRUE if this virtual register array is in the specified address map
- Parameters:
map (uvm_reg_map)
- get_maps(uvm_reg_map maps)
Function
get_maps
Returns all of the address maps where this virtual register array is mapped
- Parameters:
maps (uvm_reg_map)
- get_rights(uvm_reg_map map = null)
FUNCTION
get_rights
Returns the access rights of this virtual register array
Returns "RW", "RO" or "WO". The access rights of a virtual register array is always "RW", unless it is implemented in a shared memory with access restriction in a particular address map.
If no address map is specified and the memory is mapped in only one address map, that address map is used. If the memory 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 memory is not mapped in the specified address map, an error message is issued and "RW" is returned.
- Parameters:
map (uvm_reg_map)
- get_access(uvm_reg_map map = null)
FUNCTION
get_access
Returns the access policy of the virtual register array when written and read via an address map.
If the memory implementing the virtual register array is mapped in more than one address map, an address map must be specified. If access restrictions are present when accessing a memory through the specified address map, the access mode returned takes the access restrictions into account. For example, a read-write memory accessed through an address map with read-only restrictions would return "RO".
- Parameters:
map (uvm_reg_map)
- get_size()
FUNCTION
get_size
Returns the size of the virtual register array.
- get_n_bytes()
FUNCTION
get_n_bytes
Returns the width, in bytes, of a virtual register.
The width of a virtual register is always a multiple of the width of the memory locations used to implement it. For example, a virtual register containing two 1-byte fields implemented in a memory with 4-bytes memory locations is 4-byte wide.
- get_n_memlocs()
FUNCTION
get_n_memlocs
Returns the number of memory locations used by a single virtual register.
- get_incr()
FUNCTION
get_incr
Returns the number of memory locations between two individual virtual registers in the same array.
- get_fields(uvm_vreg_field fields)
FUNCTION
get_fields
Return the virtual fields in this virtual register
Fills the specified array with the abstraction class for all of the virtual fields contained in this virtual register. Fields are ordered from least-significant position to most-significant position within the register.
- Parameters:
fields (uvm_vreg_field)
- get_field_by_name(string name)
FUNCTION
get_field_by_name
Return the named virtual field in this virtual register
Finds a virtual field with the specified name in this virtual register and returns its abstraction class. If no fields are found, returns null .
- Parameters:
name (string)
- Return type:
- get_offset_in_memory(longint unsigned idx)
FUNCTION
get_offset_in_memory
Returns the offset of a virtual register
Returns the base offset of the specified virtual register, in the overall address space of the memory that implements the virtual register array.
- Parameters:
idx (longint unsigned)
- Return type:
- get_address(longint unsigned idx, uvm_reg_map map = null)
FUNCTION
get_address
Returns the base external physical address of a virtual register
Returns the base external physical address of the specified virtual register if accessed through the specified address map .
If no address map is specified and the memory implementing the virtual register array is mapped in only one address map, that address map is used. If the memory 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 memory is not mapped in the specified address map, an error message is issued.
- Parameters:
idx (longint unsigned)
map (uvm_reg_map)
- Return type:
- reset(string kind = "HARD")
Function
reset
Reset the access semaphore
Reset the semaphore that prevents concurrent access to the virtual register. This semaphore must be explicitly reset if a thread accessing this virtual register array was killed in before the access was completed
- Parameters:
kind (string)
- do_print(uvm_printer printer)
- Parameters:
printer (uvm_printer)
- convert2string()
- clone()
-
TODO
-
add fatal messages
- Return type:
-
- do_copy(uvm_object rhs)
- Parameters:
rhs (uvm_object)
- do_compare(uvm_object rhs, uvm_comparer comparer)
- Parameters:
rhs (uvm_object)
comparer (uvm_comparer)
- do_pack(uvm_packer packer)
- Parameters:
packer (uvm_packer)
- do_unpack(uvm_packer packer)
- Parameters:
packer (uvm_packer)
Tasks
- XatomicX(bit on)
- Parameters:
on (bit) --
Local
- write(longint unsigned idx, 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, uvm_object extension = null, string fname = "", int lineno = 0)
TASK
write
Write the specified value in a virtual register
Write value in the DUT memory location(s) that implements the virtual register array that corresponds to this abstraction class instance using the specified access path .
If the memory implementing the virtual register array is mapped in more than one address map, an address map must be specified if a physical access is used (front-door access).
The operation is eventually mapped into set of memory-write operations at the location where the virtual register specified by idx in the virtual register array is implemented.
- Parameters:
idx (longint unsigned)
status (uvm_status_e)
value (uvm_reg_data_t)
path (uvm_path_e)
map (uvm_reg_map)
parent (uvm_sequence_base)
extension (uvm_object)
fname (string)
lineno (int)
- read(longint unsigned idx, 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, uvm_object extension = null, string fname = "", int lineno = 0)
TASK
read
Read the current value from a virtual register
Read from the DUT memory location(s) that implements the virtual register array that corresponds to this abstraction class instance using the specified access path and return the readback value .
If the memory implementing the virtual register array is mapped in more than one address map, an address map must be specified if a physical access is used (front-door access).
The operation is eventually mapped into set of memory-read operations at the location where the virtual register specified by idx in the virtual register array is implemented.
- Parameters:
idx (longint unsigned)
status (uvm_status_e)
value (uvm_reg_data_t)
path (uvm_path_e)
map (uvm_reg_map)
parent (uvm_sequence_base)
extension (uvm_object)
fname (string)
lineno (int)
- poke(longint unsigned idx, uvm_status_e status, uvm_reg_data_t value, uvm_sequence_base parent = null, uvm_object extension = null, string fname = "", int lineno = 0)
TASK
poke
Deposit the specified value in a virtual register
Deposit value in the DUT memory location(s) that implements the virtual register array that corresponds to this abstraction class instance using the memory backdoor access.
The operation is eventually mapped into set of memory-poke operations at the location where the virtual register specified by idx in the virtual register array is implemented.
- Parameters:
idx (longint unsigned)
status (uvm_status_e)
value (uvm_reg_data_t)
parent (uvm_sequence_base)
extension (uvm_object)
fname (string)
lineno (int)
- peek(longint unsigned idx, uvm_status_e status, uvm_reg_data_t value, uvm_sequence_base parent = null, uvm_object extension = null, string fname = "", int lineno = 0)
TASK
peek
Sample the current value in a virtual register
Sample the DUT memory location(s) that implements the virtual register array that corresponds to this abstraction class instance using the memory backdoor access, and return the sampled value .
The operation is eventually mapped into set of memory-peek operations at the location where the virtual register specified by idx in the virtual register array is implemented.
- Parameters:
idx (longint unsigned)
status (uvm_status_e)
value (uvm_reg_data_t)
parent (uvm_sequence_base)
extension (uvm_object)
fname (string)
lineno (int)
- pre_write(longint unsigned idx, uvm_reg_data_t wdat, uvm_path_e path, uvm_reg_map map)
TASK
pre_write
Called before virtual 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 virtual register operation.
The registered callback methods are invoked after the invocation of this method. All register callbacks are executed after the corresponding field callbacks The pre-write virtual register and field callbacks are executed before the corresponding pre-write memory callbacks
- Parameters:
idx (longint unsigned)
wdat (uvm_reg_data_t)
path (uvm_path_e)
map (uvm_reg_map)
- post_write(longint unsigned idx, uvm_reg_data_t wdat, uvm_path_e path, uvm_reg_map map, uvm_status_e status)
TASK
post_write
Called after virtual register write.
If the specified status is modified, the updated status will be returned by the virtual register operation.
The registered callback methods are invoked before the invocation of this method. All register callbacks are executed before the corresponding field callbacks The post-write virtual register and field callbacks are executed after the corresponding post-write memory callbacks
- Parameters:
idx (longint unsigned)
wdat (uvm_reg_data_t)
path (uvm_path_e)
map (uvm_reg_map)
status (uvm_status_e)
- pre_read(longint unsigned idx, uvm_path_e path, uvm_reg_map map)
TASK
pre_read
Called before virtual 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.
The registered callback methods are invoked after the invocation of this method. All register callbacks are executed after the corresponding field callbacks The pre-read virtual register and field callbacks are executed before the corresponding pre-read memory callbacks
- Parameters:
idx (longint unsigned)
path (uvm_path_e)
map (uvm_reg_map)
- post_read(longint unsigned idx, uvm_reg_data_t rdat, uvm_path_e path, uvm_reg_map map, uvm_status_e status)
TASK
post_read
Called after virtual 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 The post-read virtual register and field callbacks are executed after the corresponding post-read memory callbacks
- Parameters:
idx (longint unsigned)
rdat (uvm_reg_data_t)
path (uvm_path_e)
map (uvm_reg_map)
status (uvm_status_e)
Class
uvm_vreg
Virtual register abstraction base class
A virtual register represents a set of fields that are logically implemented in consecutive memory locations.
All virtual register accesses eventually turn into memory accesses.
A virtual register array may be implemented on top of any memory abstraction class and possibly dynamically resized and/or relocated.