The UVM Register Base classes reprent functionality for the fields, registers, register files and register maps.
| UVM Register Base Classes | |
| The UVM Register Base classes reprent functionality for the fields, registers, register files and register maps. |
Base class for registers. This class contains access functions and utilities for accessing registers using a base class handle.
| uvm_register_base | ||||
| Base class for registers. | ||||
| Class Hierarchy | ||||
| ||||
| Class Declaration | ||||
| ||||
| register_name | The name of the register; a simple string usually. | |||
| register_type | The type of the register; an optional field. | |||
| register_attribute | Optional field. | |||
| new() | Construct a register base class, providing a name and a parent. | |||
| build() | Match the UVM engine | |||
| build_maps() | ||||
| Field Access By Name | ||||
| find_field | Given a name, return the field info structure for that field. | |||
| find_fields_with_tag | Given a tag name, return ALL the fields for this register that have that tag. | |||
| has_field | Given a name, return 1, if this is a name of a field in this register. | |||
| has_tag | Given a name, return 1, if any field has this tag in this register. | |||
| add_field_tag | Given a field name, add the tag to the list of tags for this field. | |||
| add_field | Define a new field. | |||
| is_field_defined | Like has_field, but spit out an error if not defined. | |||
| print_fields | Dump the field info structure for all the fields. | |||
| m_poke_field_by_name | Provide a current value, passed in as ‘x’. | |||
| m_peek_field_by_name | Provide a current value, passed in as ‘x’. | |||
| m_check_field_by_name | Check to make sure the field as defined can hold the defined reset value. | |||
| Naming and Structure | ||||
| get_full_name() | Return the full pathname of the register. | |||
| get_name() | Return the short name for the register, like “REG1”. | |||
| set_name() | Set the short name for the register, like “REG1”. | |||
| convert2string() | Should be implemented in the extended class. | |||
| get_container() | DEPRECATED: Just use get_parent(). | |||
| get_num_bits() | Return the number of bits this register contains. | |||
| Data Access | ||||
| poke_data32() | Set the data value as a raw 32 bit vector. | |||
| peek_data32() | Return the data value as a raw 32 bit vector. | |||
| poke_data64() | Set the data value as a raw 64 bit vector. | |||
| peek_data64() | Return the data value as a raw 64 bit vector. | |||
| read_data32() | Calls read_data32() in the extended class. | |||
| write_data32() | Calls write_data32() in the extended class. | |||
| read_data64() | Calls read_data64() in the extended class. | |||
| write_data64() | Calls write_data64() in the extended class. | |||
| Data Access (DEPRECATED) | ||||
| set_data32() | DEPRECATED. | |||
| get_data32() | DEPRECATED. | |||
| set_data64() | DEPRECATED. | |||
| get_data64() | DEPRECATED. | |||
| Shadow checking routines (sized bit vector) | ||||
| bus_read32() | Must be implemented in the extended class. | |||
| bus_write32() | Must be implemented in the extended class. | |||
| bus_read() | Must be implemented in the extended class. | |||
| bus_write() | Must be implemented in the extended class. | |||
| set_byte_array() | Return the data value as a list of bytes. | |||
| get_byte_array() | Return the data value as a list of bytes. | |||
| get_byte_array_no_masking() | Return the data value as a list of bytes. | |||
| Coverage | ||||
| sample() | Should be implemented in the extended class. | |||
| reset() | Should be implemented in the extended class. | |||
protected string register_name
The name of the register; a simple string usually. Like “regA” or “r102”
function new( string l_name = "", uvm_named_object p = null )
Construct a register base class, providing a name and a parent.
virtual function void build_maps()
virtual function uvm_register_field_info_t find_field( string name )
Given a name, return the field info structure for that field.
virtual function void find_fields_with_tag( output field_list_t field_list, string tag_name )
Given a tag name, return ALL the fields for this register that have that tag.
virtual function bit has_field( string name )
Given a name, return 1, if this is a name of a field in this register. Return 0 otherwise.
virtual function bit has_tag( string tag_name )
Given a name, return 1, if any field has this tag in this register. Return 0 otherwise.
virtual function void add_field_tag( string name, string tag )
Given a field name, add the tag to the list of tags for this field.
virtual function void add_field( string name, BV resetValue, string access )
Define a new field. Provide the name, the reset value and the access policy. See also: set_access_policy_field_by_name()
”RW” Read-Write “RO” Read-only “WO” Write-only “W1C”, “RW1C” Write-1-to-Clear “W0S”, “RW0S” Write-0-to-Set “R2C”, “RC”, “RCW” Clear-on-Read “R2S”, “RS”, “RSW” Set-on-Read
virtual function bit is_field_defined( string name, string msg = "" )
Like has_field, but spit out an error if not defined.
virtual function void print_fields()
Dump the field info structure for all the fields. Most useful in debug.
virtual function BV m_poke_field_by_name( string name, BV x, BV v )
Provide a current value, passed in as ‘x’. Provide a new value, passed in as ‘v’. Provide the name of the field in ‘name’. The FULL bit vector value, ‘x’, will be treated like a packed struct, and then the named field within the bit vector (packed struct) will be assigned the new value, ‘v’. Note - Returns the WHOLE Bit-vector, not simply the field value.
virtual function BV m_peek_field_by_name( string name, BV x )
Provide a current value, passed in as ‘x’. Provide the name of the field in ‘name’. The FULL bit vector value, ‘x’, will be treated like a packed struct, and then the named field within the bit vector (packed struct) will be returned. Note - Returns the FIELD value only (not the whole Bit-vector).
virtual function void m_check_field_by_name( string name )
Check to make sure the field as defined can hold the defined reset value.
virtual function string deprecated_get_full_name()
Return the full pathname of the register. ie. top.i2.apb.d2.reg3
Return the short name for the register, like “REG1”. virtual function string get_name(); return register_name; endfunction
virtual function void xxx_set_name( string name )
Set the short name for the register, like “REG1”. This function is mostly used when using the factory, since the factory create() call will call the register constructor as new() - since a register is a transaction. Overrides uvm_object::set_name()
virtual function string convert2string()
Should be implemented in the extended class. Return a pretty string representing the register.
virtual function uvm_named_object get_container()
DEPRECATED: Just use get_parent().
Return the uvm_named_object that “contains” this register. This is similar to ‘parent’, but not strictly enforced.
virtual function void write_data32( lv32_t bv )
Calls write_data32() in the extended class.
virtual function void write_data64( lv64_t bv )
Calls write_data64() in the extended class.
pure virtual function void bus_read32( input bv32_t read_data_bv, address_t address = 0 )
Must be implemented in the extended class.
pure virtual function void bus_write32( input bv32_t write_data_bv )
Must be implemented in the extended class.
pure virtual function void bus_read( input bytearray_t read_data, address_t address = 0 )
Must be implemented in the extended class.
pure virtual function void bus_write( input bytearray_t write_data )
Must be implemented in the extended class.
virtual function void set_byte_array( input bytearray_t i )
Return the data value as a list of bytes.
virtual function void get_byte_array( ref bytearray_t o )
Return the data value as a list of bytes. Note : Return value is through the parameter list.
virtual function void get_byte_array_no_masking( ref bytearray_t o )
Return the data value as a list of bytes. Note : Return value is through the parameter list.
virtual function void sample()
Should be implemented in the extended class. The implementation will usually call the covergroup sample function.
virtual function void reset()
Should be implemented in the extended class. Causes the register to take the resetValue.
The register class that a user build registers from. This is a parameterized class which should be parameterized with a packed struct or bit vector which represents the register.
For example, typedef packed struct { bit a[1:0]; bit b[7:0]; } r1_t;
class r1 extends uvm_register#(r1_t); ... endclass
| uvm_register | |||||||||||||||||
| The register class that a user build registers from. | |||||||||||||||||
| Class Hierarchy | |||||||||||||||||
| |||||||||||||||||
| Class Declaration | |||||||||||||||||
| |||||||||||||||||
| data | The register data. | ||||||||||||||||
| resetValue | The reset value. | ||||||||||||||||
| previous_data | The previous value of the register. | ||||||||||||||||
| Bit masks for permission. | |||||||||||||||||
| RMASK | This bit mask defines bits that are readable. | ||||||||||||||||
| WMASK | This bit mask defines bits that are writable. | ||||||||||||||||
| UNPREDICTABLE | This bit mask is used as an additional compare mask. | ||||||||||||||||
| Bit masks for behavior. | |||||||||||||||||
| compare_read_only_bits | If set, then READ-ONLY bits are included in compare operations. | ||||||||||||||||
| compareMask | This bit mask is used to define bits that should not participate in a comparison. | ||||||||||||||||
| set_actual_register | Setup the special mirroring code. | ||||||||||||||||
| UVM Register semaphore | |||||||||||||||||
| put() | Unlock the lock, by “putting back” n keys. | ||||||||||||||||
| get() | Lock the lock, by “getting” n keys. | ||||||||||||||||
| try_get() | Like get() above, but if the lock would fail (block), then a zero is returned instead of actually blocking. | ||||||||||||||||
| get_num_bits() | Return the number of bits in this type. | ||||||||||||||||
| check_width() | Convenience function that makes sure the width you supply (n) will fit into the space of the data. | ||||||||||||||||
| Field By Name Access | |||||||||||||||||
| m_register_field_by_name | This code is NOT implemented in a library base class. | ||||||||||||||||
| set_MASK_field_by_name | Given a mask name and a field name, set the field to value v in that mask. | ||||||||||||||||
| set_access_policy_field_by_name | Given an “access policy”, interrpret it into the proper mask settings. | ||||||||||||||||
| peek_field_by_name | User callable function to return the value of a field. | ||||||||||||||||
| poke_field_by_name | User callable function to set the value of a field. | ||||||||||||||||
| read_field_by_name | User callable function to return the value of a field. | ||||||||||||||||
| write_field_by_name | User callable function to set the value of a field. | ||||||||||||||||
| reset_field_by_name | User callable function to reset a field by name | ||||||||||||||||
| reset_field_by_name_with_tag() | User callable function to reset a field which has the given tag name. | ||||||||||||||||
| peek_data32() | Check to make sure the register can return at least 32 bits. | ||||||||||||||||
| poke_data32() | First check to make sure that there are at least 32 bits, then call poke() to assign data. | ||||||||||||||||
| peek_data64() | Check to make sure the register can return at least 64 bits. | ||||||||||||||||
| poke_data64() | First check to make sure that there are at least 64 bits, then call poke() to assign data. | ||||||||||||||||
| read_data32() | Returns the masked value. | ||||||||||||||||
| write_data32() | Writes the masked value. | ||||||||||||||||
| read_data64() | Returns the masked value. | ||||||||||||||||
| write_data64() | Writes the masked value. | ||||||||||||||||
| Shadow checking routines (Type specific vector) | |||||||||||||||||
| bus_read_bv() | This function is called when a “READ” transaction is detected. | ||||||||||||||||
| bus_write_bv() | This function is called when a “WRITE” transaction is detected. | ||||||||||||||||
| Shadow checking routines (sized bit vector) | |||||||||||||||||
| bus_read32() | First check to make sure that there are at least 32 bits, then call bus_read_bv() to do the real work. | ||||||||||||||||
| bus_write32() | First check to make sure that there are at least 32 bits, then call bus_write_bv() to do the real work. | ||||||||||||||||
| bus_read() | An alias for bus_read_bv() which takes an array of bytes as input. | ||||||||||||||||
| bus_write() | An alias for bus_write_bv() which takes an array of bytes as input. | ||||||||||||||||
| set_byte_array() | This is an alias for bus_write(). | ||||||||||||||||
| get_byte_array() | This is an alias for read(). | ||||||||||||||||
| get_byte_array_no_masking() | This is an alias for get_dataN(). | ||||||||||||||||
| Ports for notification | |||||||||||||||||
| build_ap() | Construct the analysis ports. | ||||||||||||||||
| Construction and reset | |||||||||||||||||
| new() | Construct the register, given a name, a parent and a reset value. | ||||||||||||||||
| reset() | Set the value of the register to the reset value. | ||||||||||||||||
| set_reset_value() | Use this function to set the default reset value. | ||||||||||||||||
| Data Access functions (masked behavior) | |||||||||||||||||
| calc_read() | Calculate the new value, based on the old value, the local mask, and the register masks. | ||||||||||||||||
| calc_write() | Calculate the new value, based on the old value, the new value, the local mask, and the register masks. | ||||||||||||||||
| read_without_notify() | Read the masked data without notify. | ||||||||||||||||
| write_without_notify() | Write masked data without notify. | ||||||||||||||||
| read() | Read masked data with notify. | ||||||||||||||||
| write() | Write masked data with notify. | ||||||||||||||||
| Data Access functions (RAW value) | |||||||||||||||||
| poke() | “Raw” interface to write data. | ||||||||||||||||
| peek() | “Raw” interface to read data. | ||||||||||||||||
| Copy and clone | |||||||||||||||||
| Printing/ Formating | |||||||||||||||||
| Comparison | |||||||||||||||||
| compare_data() | Compare the data field using the compare mask. | ||||||||||||||||
| compare() | Same functionality as compare_data(), but a register is passed in, instead of the register data value. | ||||||||||||||||
| Coverage | |||||||||||||||||
| sample() | Implement this is the design specific register. | ||||||||||||||||
| Register Base Classes | |||||||||||||||||
T RMASK = '1
This bit mask defines bits that are readable. If a bit is a 1, then the bit in the register is readable. If it is a 0, then it is not readable.
T WMASK = '1
This bit mask defines bits that are writable. If a bit is a 1, then the bit in the register is writable. If it is a 0, then it is not writable.
T UNPREDICTABLEMASK = '0
This bit mask is used as an additional compare mask. If a bit is 1 in this mask, then that bit is “unpredictable”. If the bit is 0, then it is “predictable”. A bit which is unpredictible will NOT be compared in the compare_data() function. That unpredictable bit will be ignored.
bit compare_read_only_bits = 0
If set, then READ-ONLY bits are included in compare operations. If NOT set, then READ-ONLY bits are not included in compare operations.
T compareMask = '1
This bit mask is used to define bits that should not participate in a comparison. If a bit is 1, then this bit from the register should be compared. If a bit is 0, then this bit from the register should not be compared. Default = 1 (compare all bits from the register)
function void set_actual_register( this_type s )
Setup the special mirroring code. This assignment causes peek(), poke() and sample() to be re-directed in this register to the register pointed to by ‘s’. See peek(), poke() and sample() implementations below.
function void put( int n = 1 )
Unlock the lock, by “putting back” n keys. put() can be passed an argument, n for the number of keys, but usually no argument is passed, and the default of 1 is used. put() is a function and cannot block. The lock will have the number of keys added back to it.
task get( int n = 1 )
Lock the lock, by “getting” n keys. If there are NOT enough keys available, then this task will not return (it blocks) until there are enough keys available. get() can be passed an argument, n for the number of keys, but usually no argument is passed, and the default of 1 is used.
function int try_get( int n = 1 )
Like get() above, but if the lock would fail (block), then a zero is returned instead of actually blocking. In the failure case, no keys are “gotten” and a 0 is returned. If there are enough keys - if the get() would not block, n keys will be gotten and a 1 returned. try_get() can be passed an argument, n for the number of keys, but usually no argument is passed, and the default of 1 is used.
local function void check_width( string place, int n )
Convenience function that makes sure the width you supply (n) will fit into the space of the data.
This code is NOT implemented in a library base class. This code is implemented in the user’s extended class. This implementation is here in case the user did not implement the by name code, and will never use it. In that case, this function will never be called. If it ever is called, then it is an error.
virtual function void set_MASK_field_by_name( string mask_name, string name, BV v )
Given a mask name and a field name, set the field to value v in that mask.
virtual function void set_access_policy_field_by_name( string name, string access )
Given an “access policy”, interrpret it into the proper mask settings.
virtual function BV peek_field_by_name( string name )
User callable function to return the value of a field.
virtual function void poke_field_by_name( string name, BV v )
User callable function to set the value of a field.
virtual function BV read_field_by_name( string name )
User callable function to return the value of a field.
virtual function void write_field_by_name( string name, BV v )
User callable function to set the value of a field.
virtual function void reset_field_by_name( string name )
User callable function to reset a field by name
virtual function void reset_field_by_name_with_tag( string tag_name )
User callable function to reset a field which has the given tag name.
virtual function lv32_t peek_data32()
Check to make sure the register can return at least 32 bits. Then return 32 bits. Returns the RAW value.
virtual function void poke_data32( lv32_t bv )
First check to make sure that there are at least 32 bits, then call poke() to assign data.
virtual function lv64_t peek_data64()
Check to make sure the register can return at least 64 bits. Then return 64 bits. Returns the RAW value.
virtual function void poke_data64( lv64_t bv )
First check to make sure that there are at least 64 bits, then call poke() to assign data.
virtual function void write_data32( lv32_t bv )
Writes the masked value. Not the RAW value.
virtual function void write_data64( lv64_t bv )
Writes the masked value. Not the RAW value.
virtual function void bus_read_bv( input T read_data_bv, address_t address = 0 )
This function is called when a “READ” transaction is detected. When this function executes, it first checks the data passed in with the current value in the shadow. If the data matches, then the new data is written to the shadow, just in case there are side-effects or other field behavior. This write to the shadow is updating the shadow with the currently read value from the real register. After the compare, if the data didn’t match, then an error message is issued. Before the routine returns, it issues a “register read()” call, which is a trick to have the shadow register publish itself on the read analysis ports. This is done for any monitor that might be monitoring the register and wants to keep track of reads.
virtual function void bus_write_bv( input T write_data_bv )
This function is called when a “WRITE” transaction is detected. When this function executes, it simply ‘writes’ the new value to the shadow.
virtual function void bus_read32( input bv32_t read_data_bv, address_t address = 0 )
First check to make sure that there are at least 32 bits, then call bus_read_bv() to do the real work.
virtual function void bus_write32( input bv32_t write_data_bv )
First check to make sure that there are at least 32 bits, then call bus_write_bv() to do the real work.
virtual function void bus_read( input bytearray_t read_data, address_t address = 0 )
An alias for bus_read_bv() which takes an array of bytes as input.
virtual function void bus_write( input bytearray_t write_data )
An alias for bus_write_bv() which takes an array of bytes as input.
virtual function void set_byte_array( input bytearray_t i )
This is an alias for bus_write().
virtual function void get_byte_array_no_masking( ref bytearray_t o )
This is an alias for get_dataN().
function void build_ap( uvm_named_object container = null )
Construct the analysis ports. This code is separate because there are occasions where the analysis ports are not needed. Note: container is NOT used.
function new( string l_name = "registerName", uvm_named_object p = null, T l_resetVal = 0 )
Construct the register, given a name, a parent and a reset value. The name is normally a full path name of the parent combined with a short name for the register : { p.get_full_name(), “reg1” } The parent can be NULL, in which case no analysis ports will be created.
virtual function void reset()
Set the value of the register to the reset value. Use poke(), so that all masks and behavior are bypassed. No notification is performed.
virtual function void set_reset_value( T resetValue )
Use this function to set the default reset value. TODO: Move into base class (using bit vector) TODO: Allow for N types of reset. (soft and hard)
virtual function T calc_read( T current_value, output T new_register_value,
Calculate the new value, based on the old value, the local mask, and the register masks.
virtual function T calc_write( T current_value, T new_value,
Calculate the new value, based on the old value, the new value, the local mask, and the register masks.
virtual function T read_without_notify(
Read the masked data without notify. This function can be overridden by extended registers to implement new behaviors.
virtual function void write_without_notify( T v,
Write masked data without notify. This function can be overridden by extended registers to implement new behaviors.
virtual function void poke( T v )
”Raw” interface to write data. No masking or notification is performed.
virtual function T peek()
”Raw” interface to read data. No masking or notification is performed.
virtual function bit compare_data( T new_data )
Compare the data field using the compare mask. Return 1 if the new_data matches the existing value. Return 0 otherwise.
virtual function bit compare( this_type b )
Same functionality as compare_data(), but a register is passed in, instead of the register data value. To use custom masks or other fancy compare, override this function.
The shared base class for register files and register maps.
Holds the FLAT address space and the ByName lookup space.
This class knows how to add a register to the address space, and find it either by name, or by address.
| uvm_register_container | ||||
| The shared base class for register files and register maps. | ||||
| Class Hierarchy | ||||
| ||||
| Class Declaration | ||||
| ||||
| Methods | ||||
| build() | Match the UVM engine | |||
| find_register_container() | Given a name, lookup the name from ‘here’. | |||
| get_register_array() | Return the list of all registers in this address map | |||
| get_register_field_by_name() | ||||
| get_register_field_by_name_with_tag() | ||||
| reset() | For all the registers, call the reset() function | |||
| reset_field_by_name() | ||||
| reset_field_by_name_with_tag() | ||||
| print_fields() | Call print_fields() on every register contained in this register_file/register_map. | |||
| display_address_map_by_address() | Print information about the address map, arranged by address | |||
| display_address_map_by_name() | Print information about the address map, arranged by name | |||
| display_address_map() | Print information about the address map. | |||
| add_register_alias() | add_register() maps a register using the full path name. | |||
| delete_mappings() | Delete all the mapping data structures for this register container. | |||
| add_register() | Add a register with ‘name’ and an offset (or address). | |||
| add_register_file() | Add a register file to this register map. | |||
| add_register_map() | Add a register map to this register map. | |||
| add_register_in_range() | Shortcut for adding a register with a large address range. | |||
| lookup_register_addresslist_by_name() | Given a register name, provide ALL the addresses of the register. | |||
| lookup_register_address_by_name() | Given a register name, provide a single mapped address. | |||
| lookup_register_by_name() | Given a register name, return the corresponding register handle. | |||
| lookup_register_by_address() | Given an offset, provide the register mapped there. | |||
function automatic void find_register_container( output mapped_register_container_list list_of_mapped_items, input string name )
Given a name, lookup the name from ‘here’. This name is a name relative to the register container we are in currently - this register map or this register file - for example. The name will normally be a path name containing path separators and names - “rf1.dut2.blkA.blkleaf”
virtual function void get_register_array( output register_list_t register_array )
Return the list of all registers in this address map
virtual function void reset_field_by_name( string field_name )
virtual function void reset_field_by_name_with_tag( string tag_name )
virtual function void print_fields()
Call print_fields() on every register contained in this register_file/register_map.
virtual function void display_address_map_by_address()
Print information about the address map, arranged by address
virtual function void display_address_map_by_name()
Print information about the address map, arranged by name
virtual function void display_address_map()
Print information about the address map.
function void add_register_alias( uvm_register_base register, string alias_name )
add_register() maps a register using the full path name. add_register_alias() allows an additional name, or alias to also be mapped (it is NOT actually a new mapping - the “alias mapping” just points to the existing full name mapping.
virtual function void delete_mappings()
Delete all the mapping data structures for this register container. This is usually only done when you plan to rebuild the mappings - for example when you change some set of constraints which will have the affect of changing the mappings.
1. Delete the mappings. 2. Change the constraints, randomize. 3. Rebuild the mappings.
function void add_register( string name, offset_t offset, uvm_register_base register, string hierarchical_name = "" )
Add a register with ‘name’ and an offset (or address). The register has been previously constructed elsewhere.
Note : ‘name’ is always (should always) be register.get_fullname().
The “mapped_register” construct is entered into two search tables: 1. Search by name. The array ‘nameSpace[]’ is a search by name associative array. 2. Search by address. The array ‘addrSpace[]’ is a search by address associative array.
function void add_register_file( uvm_register_container rf, address_t addr )
Add a register file to this register map. All addresses in the “copied-in” register file are incremented by ‘addr’ before being stored in the address map of this object.
function void add_register_map( uvm_register_container rm, address_t addr )
Add a register map to this register map. All addresses in the “copied-in” map are incremented by ‘addr’ before being stored in the address map of this object.
function void add_register_in_range( string name, offset_t first_offset, offset_t last_offset, offset_t grid, uvm_register_base register, string hierarchical_name = "" )
Shortcut for adding a register with a large address range.
virtual function void lookup_register_addresslist_by_name( output address_list_t list_of_addresses, input string name )
Given a register name, provide ALL the addresses of the register. Returns a list of addresses.
virtual function address_t lookup_register_address_by_name( string name, output bit valid_address )
Given a register name, provide a single mapped address.
virtual function uvm_register_base lookup_register_by_name( string name )
Given a register name, return the corresponding register handle.
virtual function uvm_register_base lookup_register_by_address( offset_t offset )
Given an offset, provide the register mapped there.
A register file contains a list of registers. Each register is associated with one or more offset.
A register file is really just a register map with these special properties: 1. A register file contains only registers. You can only add registers to it. 2. A register file has no “base” address. The addresses or registers in a regfile are really “offsets”.
| uvm_register_file | |||||
| A register file contains a list of registers. | |||||
| Class Hierarchy | |||||
| |||||
| Class Declaration | |||||
| |||||
A register map contains other register maps, register files and registers. A register map models a “global” discontiguous register space.
A register map is used to model bus bridges. Just an extended register file.
| uvm_register_map | ||||||
| A register map contains other register maps, register files and registers. | ||||||
| Class Hierarchy | ||||||
| ||||||
| Class Declaration | ||||||
| ||||||
| Methods | ||||||
| get_register_map() | Return the currently registered register map from the configuration. | |||||
| uvm_register_get_register_map() (DEPRECATED) | Return the currently registered register map from the configuration. | |||||
static function uvm_register_map get_register_map( string config_name = "register_map", uvm_component c = null )
Return the currently registered register map from the configuration.
Pass in a place to go find the config. If the place (variable ‘c’) is NULL, then use uvm_top.
get_register_map() Looks for “register_map” in the top.
get_register_map(.c(my_component)) Looks for “register_map” in my_component.
get_register_map(“map”, my_component); Looks for “map” in my_component.
Return the currently registered register map from the configuration.
The uvm_named_object class is the root base class for UVM components.
virtual class uvm_named_object extends uvm_object
Base class for registers.
virtual class uvm_register_base extends uvm_named_object
The name of the register; a simple string usually.
protected string register_name
The type of the register; an optional field.
string register_type
Optional field.
string register_attribute
Construct a register base class, providing a name and a parent.
function new( string l_name = "", uvm_named_object p = null )
Match the UVM engine
virtual function void build()
virtual function void build_maps()
Given a name, return the field info structure for that field.
virtual function uvm_register_field_info_t find_field( string name )
Given a tag name, return ALL the fields for this register that have that tag.
virtual function void find_fields_with_tag( output field_list_t field_list, string tag_name )
Given a name, return 1, if this is a name of a field in this register.
virtual function bit has_field( string name )
Given a name, return 1, if any field has this tag in this register.
virtual function bit has_tag( string tag_name )
Given a field name, add the tag to the list of tags for this field.
virtual function void add_field_tag( string name, string tag )
Define a new field.
virtual function void add_field( string name, BV resetValue, string access )
Like has_field, but spit out an error if not defined.
virtual function bit is_field_defined( string name, string msg = "" )
Dump the field info structure for all the fields.
virtual function void print_fields()
Provide a current value, passed in as ‘x’.
virtual function BV m_poke_field_by_name( string name, BV x, BV v )
Provide a current value, passed in as ‘x’.
virtual function BV m_peek_field_by_name( string name, BV x )
Check to make sure the field as defined can hold the defined reset value.
virtual function void m_check_field_by_name( string name )
Return the full pathname of the register.
virtual function string deprecated_get_full_name()
Set the short name for the register, like “REG1”.
virtual function void xxx_set_name( string name )
Should be implemented in the extended class.
virtual function string convert2string()
DEPRECATED: Just use get_parent().
virtual function uvm_named_object get_container()
Return the number of bits this register contains.
virtual function int get_num_bits()
Set the data value as a raw 32 bit vector.
virtual function void poke_data32( lv32_t bv )
Return the data value as a raw 32 bit vector.
virtual function lv32_t peek_data32()
Set the data value as a raw 64 bit vector.
virtual function void poke_data64( lv64_t bv )
Return the data value as a raw 64 bit vector.
virtual function lv64_t peek_data64()
Calls read_data32() in the extended class.
virtual function lv32_t read_data32()
Calls write_data32() in the extended class.
virtual function void write_data32( lv32_t bv )
Calls read_data64() in the extended class.
virtual function lv64_t read_data64()
Calls write_data64() in the extended class.
virtual function void write_data64( lv64_t bv )
DEPRECATED.
virtual function void set_data32( lv32_t bv )
DEPRECATED.
virtual function lv32_t get_data32()
DEPRECATED.
virtual function void set_data64( lv64_t bv )
DEPRECATED.
virtual function lv64_t get_data64()
Must be implemented in the extended class.
pure virtual function void bus_read32( input bv32_t read_data_bv, address_t address = 0 )
Must be implemented in the extended class.
pure virtual function void bus_write32( input bv32_t write_data_bv )
Must be implemented in the extended class.
pure virtual function void bus_read( input bytearray_t read_data, address_t address = 0 )
Must be implemented in the extended class.
pure virtual function void bus_write( input bytearray_t write_data )
Return the data value as a list of bytes.
virtual function void set_byte_array( input bytearray_t i )
Return the data value as a list of bytes.
virtual function void get_byte_array( ref bytearray_t o )
Return the data value as a list of bytes.
virtual function void get_byte_array_no_masking( ref bytearray_t o )
Should be implemented in the extended class.
virtual function void sample()
Should be implemented in the extended class.
virtual function void reset()
The register class that a user build registers from.
class uvm_register #( type T = int ) extends uvm_register_base
The register data.
rand T data
The reset value.
T resetValue
The previous value of the register.
T previous_data
This bit mask defines bits that are readable.
T RMASK = '1
This bit mask defines bits that are writable.
T WMASK = '1
This bit mask is used as an additional compare mask.
T UNPREDICTABLEMASK = '0
If set, then READ-ONLY bits are included in compare operations.
bit compare_read_only_bits = 0
This bit mask is used to define bits that should not participate in a comparison.
T compareMask = '1
Setup the special mirroring code.
function void set_actual_register( this_type s )
Unlock the lock, by “putting back” n keys.
function void put( int n = 1 )
Lock the lock, by “getting” n keys.
task get( int n = 1 )
Like get() above, but if the lock would fail (block), then a zero is returned instead of actually blocking.
function int try_get( int n = 1 )
Return the number of bits in this type.
virtual function int get_num_bits()
Convenience function that makes sure the width you supply (n) will fit into the space of the data.
local function void check_width( string place, int n )
Given a mask name and a field name, set the field to value v in that mask.
virtual function void set_MASK_field_by_name( string mask_name, string name, BV v )
Given an “access policy”, interrpret it into the proper mask settings.
virtual function void set_access_policy_field_by_name( string name, string access )
User callable function to return the value of a field.
virtual function BV peek_field_by_name( string name )
User callable function to set the value of a field.
virtual function void poke_field_by_name( string name, BV v )
User callable function to return the value of a field.
virtual function BV read_field_by_name( string name )
User callable function to set the value of a field.
virtual function void write_field_by_name( string name, BV v )
User callable function to reset a field by name
virtual function void reset_field_by_name( string name )
User callable function to reset a field which has the given tag name.
virtual function void reset_field_by_name_with_tag( string tag_name )
Check to make sure the register can return at least 32 bits.
virtual function lv32_t peek_data32()
First check to make sure that there are at least 32 bits, then call poke() to assign data.
virtual function void poke_data32( lv32_t bv )
Check to make sure the register can return at least 64 bits.
virtual function lv64_t peek_data64()
First check to make sure that there are at least 64 bits, then call poke() to assign data.
virtual function void poke_data64( lv64_t bv )
Returns the masked value.
virtual function lv32_t read_data32()
Writes the masked value.
virtual function void write_data32( lv32_t bv )
Returns the masked value.
virtual function lv64_t read_data64()
Writes the masked value.
virtual function void write_data64( lv64_t bv )
This function is called when a “READ” transaction is detected.
virtual function void bus_read_bv( input T read_data_bv, address_t address = 0 )
This function is called when a “WRITE” transaction is detected.
virtual function void bus_write_bv( input T write_data_bv )
First check to make sure that there are at least 32 bits, then call bus_read_bv() to do the real work.
virtual function void bus_read32( input bv32_t read_data_bv, address_t address = 0 )
First check to make sure that there are at least 32 bits, then call bus_write_bv() to do the real work.
virtual function void bus_write32( input bv32_t write_data_bv )
An alias for bus_read_bv() which takes an array of bytes as input.
virtual function void bus_read( input bytearray_t read_data, address_t address = 0 )
An alias for bus_write_bv() which takes an array of bytes as input.
virtual function void bus_write( input bytearray_t write_data )
This is an alias for bus_write().
virtual function void set_byte_array( input bytearray_t i )
This is an alias for read().
virtual function void get_byte_array( ref bytearray_t o )
This is an alias for get_dataN().
virtual function void get_byte_array_no_masking( ref bytearray_t o )
Construct the analysis ports.
function void build_ap( uvm_named_object container = null )
Construct the register, given a name, a parent and a reset value.
function new( string l_name = "registerName", uvm_named_object p = null, T l_resetVal = 0 )
Set the value of the register to the reset value.
virtual function void reset()
Use this function to set the default reset value.
virtual function void set_reset_value( T resetValue )
Calculate the new value, based on the old value, the local mask, and the register masks.
virtual function T calc_read( T current_value, output T new_register_value,
Calculate the new value, based on the old value, the new value, the local mask, and the register masks.
virtual function T calc_write( T current_value, T new_value,
Read the masked data without notify.
virtual function T read_without_notify(
Write masked data without notify.
virtual function void write_without_notify( T v,
Read masked data with notify.
virtual function T read(
Write masked data with notify.
virtual function void write( T v,
“Raw” interface to write data.
virtual function void poke( T v )
“Raw” interface to read data.
virtual function T peek()
Compare the data field using the compare mask.
virtual function bit compare_data( T new_data )
Same functionality as compare_data(), but a register is passed in, instead of the register data value.
virtual function bit compare( this_type b )
Implement this is the design specific register.
virtual function void sample()
The shared base class for register files and register maps.
class uvm_register_container extends uvm_named_object
Match the UVM engine
virtual function void build()
Given a name, lookup the name from ‘here’.
function automatic void find_register_container( output mapped_register_container_list list_of_mapped_items, input string name )
Return the list of all registers in this address map
virtual function void get_register_array( output register_list_t register_array )
For all the registers, call the reset() function
virtual function void reset()
virtual function void reset_field_by_name( string field_name )
virtual function void reset_field_by_name_with_tag( string tag_name )
Call print_fields() on every register contained in this register_file/register_map.
virtual function void print_fields()
Print information about the address map, arranged by address
virtual function void display_address_map_by_address()
Print information about the address map, arranged by name
virtual function void display_address_map_by_name()
Print information about the address map.
virtual function void display_address_map()
add_register() maps a register using the full path name.
function void add_register_alias( uvm_register_base register, string alias_name )
Delete all the mapping data structures for this register container.
virtual function void delete_mappings()
Add a register with ‘name’ and an offset (or address).
function void add_register( string name, offset_t offset, uvm_register_base register, string hierarchical_name = "" )
Add a register file to this register map.
function void add_register_file( uvm_register_container rf, address_t addr )
Add a register map to this register map.
function void add_register_map( uvm_register_container rm, address_t addr )
Shortcut for adding a register with a large address range.
function void add_register_in_range( string name, offset_t first_offset, offset_t last_offset, offset_t grid, uvm_register_base register, string hierarchical_name = "" )
Given a register name, provide ALL the addresses of the register.
virtual function void lookup_register_addresslist_by_name( output address_list_t list_of_addresses, input string name )
Given a register name, provide a single mapped address.
virtual function address_t lookup_register_address_by_name( string name, output bit valid_address )
Given a register name, return the corresponding register handle.
virtual function uvm_register_base lookup_register_by_name( string name )
Given an offset, provide the register mapped there.
virtual function uvm_register_base lookup_register_by_address( offset_t offset )
A register file contains a list of registers.
class uvm_register_file extends uvm_register_container
A register map contains other register maps, register files and registers.
class uvm_register_map extends uvm_register_file
Return the currently registered register map from the configuration.
static function uvm_register_map get_register_map( string config_name = "register_map", uvm_component c = null )