[source]

Class uvm_vreg

uvm_pkg::uvm_vreg + XatomicX() + Xlock_modelX(): void + add_field(): void + allocate(): uvm_mem_region + clone(): uvm_object + configure(): void + convert2string(): string + do_compare(): bit + do_copy(): void + do_pack(): void + do_print(): void + do_unpack(): void + get_access(): string + get_address(): uvm_reg_addr_t + get_block(): uvm_reg_block + get_field_by_name(): uvm_vreg_field + get_fields(): void + get_full_name(): string + get_incr(): int unsigned + get_maps(): void + get_memory(): uvm_mem + get_n_bytes(): int unsigned + get_n_maps(): int + get_n_memlocs(): int unsigned + get_offset_in_memory(): uvm_reg_addr_t + get_parent(): uvm_reg_block + get_region(): uvm_mem_region + get_rights(): string + get_size(): int unsigned + implement(): bit + is_in_map(): bit + peek() + poke() + post_read() + post_write() + pre_read() + pre_write() + read() + release_region(): void + reset(): void + set_parent(): void + write()

Inheritance Diagram of 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.

Constructors

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

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

Functions

function void configure ( uvm_reg_block parent, uvm_mem mem, longint unsigned size, uvm_reg_addr_t offset, int unsigned incr ) [source]

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.

virtual function bit implement ( longint unsigned n, uvm_mem mem, uvm_reg_addr_t offset, int unsigned incr ) [source]

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.

virtual function uvm_mem_region allocate ( longint unsigned n, uvm_mem_mam mam, uvm_mem_mam_policy alloc ) [source]

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.

virtual function uvm_mem_region get_region ( ) [source]

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.

virtual function void release_region ( ) [source]

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.

virtual function void set_parent ( uvm_reg_block parent ) [source]

function void Xlock_modelX ( ) [source]

local

function void add_field ( uvm_vreg_field field ) [source]

virtual function string get_full_name ( ) [source]

Get the hierarchical name

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

virtual function uvm_reg_block get_parent ( ) [source]

Get the parent block

virtual function uvm_reg_block get_block ( ) [source]

virtual function uvm_mem get_memory ( ) [source]

Get the memory where the virtual register array is implemented

virtual function int get_n_maps ( ) [source]

Returns the number of address maps this virtual register array is mapped in

function bit is_in_map ( uvm_reg_map map ) [source]

Return TRUE if this virtual register array is in the specified address map

virtual function void get_maps ( uvm_reg_map maps ) [source]

Returns all of the address maps where this virtual register array is mapped

virtual function string get_rights ( uvm_reg_map map ) [source]

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.

virtual function string get_access ( uvm_reg_map map ) [source]

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

virtual function int unsigned get_size ( ) [source]

Returns the size of the virtual register array.

virtual function int unsigned get_n_bytes ( ) [source]

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.

virtual function int unsigned get_n_memlocs ( ) [source]

Returns the number of memory locations used by a single virtual register.

virtual function int unsigned get_incr ( ) [source]

Returns the number of memory locations between two individual virtual registers in the same array.

virtual function void get_fields ( uvm_vreg_field fields ) [source]

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.

virtual function uvm_vreg_field get_field_by_name ( string name ) [source]

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 .

virtual function uvm_reg_addr_t get_offset_in_memory ( longint unsigned idx ) [source]

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.

virtual function uvm_reg_addr_t get_address ( longint unsigned idx, uvm_reg_map map ) [source]

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.

function void reset ( string kind ) [source]

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

virtual function void do_print ( uvm_printer printer ) [source]

virtual function string convert2string ( ) [source]

virtual function uvm_object clone ( ) [source]

TODO

add fatal messages

virtual function void do_copy ( uvm_object rhs ) [source]

virtual function bit do_compare ( uvm_object rhs, uvm_comparer comparer ) [source]

virtual function void do_pack ( uvm_packer packer ) [source]

virtual function void do_unpack ( uvm_packer packer ) [source]

Tasks

function XatomicX ( bit on ) [source]

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

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.

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

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.

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

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.

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

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.

virtual function pre_write ( longint unsigned idx, uvm_reg_data_t wdat, uvm_path_e path, uvm_reg_map map ) [source]

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

virtual function post_write ( longint unsigned idx, uvm_reg_data_t wdat, uvm_path_e path, uvm_reg_map map, uvm_status_e status ) [source]

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

virtual function pre_read ( longint unsigned idx, uvm_path_e path, uvm_reg_map map ) [source]

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

virtual function post_read ( longint unsigned idx, uvm_reg_data_t rdat, uvm_path_e path, uvm_reg_map map, uvm_status_e status ) [source]

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