UVM Register Base Classes

The UVM Register Base classes reprent functionality for the fields, registers, register files and register maps.

Summary
UVM Register Base Classes
The UVM Register Base classes reprent functionality for the fields, registers, register files and register maps.

uvm_register_base

Base class for registers.  This class contains access functions and utilities for accessing registers using a base class handle.

Summary
uvm_register_base
Base class for registers.
Class Hierarchy
uvm_object
uvm_register_base
Class Declaration
virtual class uvm_register_base extends uvm_named_object
register_nameThe name of the register; a simple string usually.
register_typeThe type of the register; an optional field.
register_attributeOptional 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_fieldGiven a name, return the field info structure for that field.
find_fields_with_tagGiven a tag name, return ALL the fields for this register that have that tag.
has_fieldGiven a name, return 1, if this is a name of a field in this register.
has_tagGiven a name, return 1, if any field has this tag in this register.
add_field_tagGiven a field name, add the tag to the list of tags for this field.
add_fieldDefine a new field.
is_field_definedLike has_field, but spit out an error if not defined.
print_fieldsDump the field info structure for all the fields.
m_poke_field_by_nameProvide a current value, passed in as ‘x’.
m_peek_field_by_nameProvide a current value, passed in as ‘x’.
m_check_field_by_nameCheck 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.

register_name

protected string register_name

The name of the register; a simple string usually.  Like “regA” or “r102”

register_type

string register_type

The type of the register; an optional field.

register_attribute

string register_attribute

Optional field.

new()

function new(string l_name =  "",
uvm_named_object p =  null)

Construct a register base class, providing a name and a parent.

build()

virtual function void build()

Match the UVM engine

build_maps()

virtual function void build_maps()

find_field

virtual function uvm_register_field_info_t find_field(string name)

Given a name, return the field info structure for that field.

find_fields_with_tag

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.

has_field

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.

has_tag

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.

add_field_tag

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.

add_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()

Where “access” is one of

”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

is_field_defined

virtual function bit is_field_defined(string name,  
string msg =  "")

Like has_field, but spit out an error if not defined.

print_fields

virtual function void print_fields()

Dump the field info structure for all the fields.  Most useful in debug.

m_poke_field_by_name

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.

m_peek_field_by_name

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

m_check_field_by_name

virtual function void m_check_field_by_name(string name)

Check to make sure the field as defined can hold the defined reset value.

get_full_name()

virtual function string deprecated_get_full_name()

Return the full pathname of the register. ie. top.i2.apb.d2.reg3

get_name()

Return the short name for the register, like “REG1”. virtual function string get_name(); return register_name; endfunction

set_name()

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()

convert2string()

virtual function string convert2string()

Should be implemented in the extended class.  Return a pretty string representing the register.

get_container()

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.

get_num_bits()

virtual function int get_num_bits()

Return the number of bits this register contains.

poke_data32()

virtual function void poke_data32(lv32_t bv)

Set the data value as a raw 32 bit vector.

peek_data32()

virtual function lv32_t peek_data32()

Return the data value as a raw 32 bit vector.

poke_data64()

virtual function void poke_data64(lv64_t bv)

Set the data value as a raw 64 bit vector.

peek_data64()

virtual function lv64_t peek_data64()

Return the data value as a raw 64 bit vector.

read_data32()

virtual function lv32_t read_data32()

Calls read_data32() in the extended class.

write_data32()

virtual function void write_data32(lv32_t bv)

Calls write_data32() in the extended class.

read_data64()

virtual function lv64_t read_data64()

Calls read_data64() in the extended class.

write_data64()

virtual function void write_data64(lv64_t bv)

Calls write_data64() in the extended class.

set_data32()

virtual function void set_data32(lv32_t bv)

DEPRECATED.  Use poke_data32();

get_data32()

virtual function lv32_t get_data32()

DEPRECATED.  Use peek_data32();

set_data64()

virtual function void set_data64(lv64_t bv)

DEPRECATED.  Use poke_data64();

get_data64()

virtual function lv64_t get_data64()

DEPRECATED.  Use peek_data64();

bus_read32()

pure virtual function void bus_read32(input bv32_t read_data_bv,  
address_t address =  0)

Must be implemented in the extended class.

bus_write32()

pure virtual function void bus_write32(input bv32_t write_data_bv)

Must be implemented in the extended class.

bus_read()

pure virtual function void bus_read(input bytearray_t read_data,  
address_t address =  0)

Must be implemented in the extended class.

bus_write()

pure virtual function void bus_write(input bytearray_t write_data)

Must be implemented in the extended class.

set_byte_array()

virtual function void set_byte_array(input bytearray_t i)

Return the data value as a list of bytes.

get_byte_array()

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.

get_byte_array_no_masking()

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.

sample()

virtual function void sample()

Should be implemented in the extended class.  The implementation will usually call the covergroup sample function.

reset()

virtual function void reset()

Should be implemented in the extended class.  Causes the register to take the resetValue.

uvm_register

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

Summary
uvm_register
The register class that a user build registers from.
Class Hierarchy
uvm_object
uvm_register
Class Declaration
class uvm_register #(
   type T =  int
) extends uvm_register_base
dataThe register data.
resetValueThe reset value.
previous_dataThe previous value of the register.
Bit masks for permission.
RMASKThis bit mask defines bits that are readable.
WMASKThis bit mask defines bits that are writable.
UNPREDICTABLEThis bit mask is used as an additional compare mask.
Bit masks for behavior.
compare_read_only_bitsIf set, then READ-ONLY bits are included in compare operations.
compareMaskThis bit mask is used to define bits that should not participate in a comparison.
set_actual_registerSetup 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_nameThis code is NOT implemented in a library base class.
set_MASK_field_by_nameGiven a mask name and a field name, set the field to value v in that mask.
set_access_policy_field_by_nameGiven an “access policy”, interrpret it into the proper mask settings.
peek_field_by_nameUser callable function to return the value of a field.
poke_field_by_nameUser callable function to set the value of a field.
read_field_by_nameUser callable function to return the value of a field.
write_field_by_nameUser callable function to set the value of a field.
reset_field_by_nameUser 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

data

rand T data

The register data.  The actual value stored in the register.

resetValue

T resetValue

The reset value.  This is the value of the register after reset() is called.

previous_data

T previous_data

The previous value of the register.

RMASK

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.

WMASK

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.

UNPREDICTABLE

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.

compare_read_only_bits

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.

compareMask

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)

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

put()

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.

get()

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.

try_get()

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.

get_num_bits()

virtual function int get_num_bits()

Return the number of bits in this type.

check_width()

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.

m_register_field_by_name

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.

set_MASK_field_by_name

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.

set_access_policy_field_by_name

virtual function void set_access_policy_field_by_name(string name,
string access)

Given an “access policy”, interrpret it into the proper mask settings.

peek_field_by_name

virtual function BV peek_field_by_name(string name)

User callable function to return the value of a field.

poke_field_by_name

virtual function void poke_field_by_name(string name,
BV v)

User callable function to set the value of a field.

read_field_by_name

virtual function BV read_field_by_name(string name)

User callable function to return the value of a field.

write_field_by_name

virtual function void write_field_by_name(string name,
BV v)

User callable function to set the value of a field.

reset_field_by_name

virtual function void reset_field_by_name(string name)

User callable function to reset a field by name

reset_field_by_name_with_tag()

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.

peek_data32()

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.

poke_data32()

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.

peek_data64()

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.

poke_data64()

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.

read_data32()

virtual function lv32_t read_data32()

Returns the masked value.  Not the RAW value.

write_data32()

virtual function void write_data32(lv32_t bv)

Writes the masked value.  Not the RAW value.

read_data64()

virtual function lv64_t read_data64()

Returns the masked value.  Not the RAW value.

write_data64()

virtual function void write_data64(lv64_t bv)

Writes the masked value.  Not the RAW value.

bus_read_bv()

virtual function void bus_read_bv(input 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.

bus_write_bv()

virtual function void bus_write_bv(input 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.

bus_read32()

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.

bus_write32()

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.

bus_read()

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.

bus_write()

virtual function void bus_write(input bytearray_t write_data)

An alias for bus_write_bv() which takes an array of bytes as input.

set_byte_array()

virtual function void set_byte_array(input bytearray_t i)

This is an alias for bus_write().

get_byte_array()

virtual function void get_byte_array(ref bytearray_t o)

This is an alias for read().

get_byte_array_no_masking()

virtual function void get_byte_array_no_masking(ref bytearray_t o)

This is an alias for get_dataN().

build_ap()

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.

new()

function new(string l_name =  "registerName",
uvm_named_object p =  null,
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.

reset()

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.

set_reset_value()

virtual function void set_reset_value(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)

calc_read()

virtual function T calc_read(current_value,
output new_register_value,

Calculate the new value, based on the old value, the local mask, and the register masks.

calc_write()

virtual function T calc_write(current_value,
new_value,

Calculate the new value, based on the old value, the new value, the local mask, and the register masks.

read_without_notify()

virtual function T read_without_notify(

Read the masked data without notify.  This function can be overridden by extended registers to implement new behaviors.

write_without_notify()

virtual function void write_without_notify(v,

Write masked data without notify.  This function can be overridden by extended registers to implement new behaviors.

read()

virtual function T read(

Read masked data with notify.

write()

virtual function void write(v,

Write masked data with notify.

poke()

virtual function void poke(v)

”Raw” interface to write data.  No masking or notification is performed.

peek()

virtual function T peek()

”Raw” interface to read data.  No masking or notification is performed.

compare_data()

virtual function bit compare_data(new_data)

Compare the data field using the compare mask.  Return 1 if the new_data matches the existing value.  Return 0 otherwise.

compare()

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.

sample()

virtual function void sample()

Implement this is the design specific register.

uvm_register_container

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.

Summary
uvm_register_container
The shared base class for register files and register maps.
Class Hierarchy
uvm_object
uvm_register_container
Class Declaration
class uvm_register_container extends uvm_named_object
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.

build()

virtual function void build()

Match the UVM engine

find_register_container()

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”

get_register_array()

virtual function void get_register_array(output register_list_t register_array)

Return the list of all registers in this address map

reset()

virtual function void reset()

For all the registers, call the reset() function

reset_field_by_name()

virtual function void reset_field_by_name(string field_name)

reset_field_by_name_with_tag()

virtual function void reset_field_by_name_with_tag(string tag_name)

print_fields()

virtual function void print_fields()

Call print_fields() on every register contained in this register_file/register_map.

display_address_map_by_address()

virtual function void display_address_map_by_address()

Print information about the address map, arranged by address

display_address_map_by_name()

virtual function void display_address_map_by_name()

Print information about the address map, arranged by name

display_address_map()

virtual function void display_address_map()

Print information about the address map.

add_register_alias()

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.

delete_mappings()

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.

add_register()

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.

add_register_file()

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.

add_register_map()

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.

add_register_in_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 =  "")

Shortcut for adding a register with a large address range.

lookup_register_addresslist_by_name()

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.

lookup_register_address_by_name()

virtual function address_t lookup_register_address_by_name(
   string name,
   output bit valid_address
)

Given a register name, provide a single mapped address.

lookup_register_by_name()

virtual function uvm_register_base lookup_register_by_name(string name)

Given a register name, return the corresponding register handle.

lookup_register_by_address()

virtual function uvm_register_base lookup_register_by_address(offset_t offset)

Given an offset, provide the register mapped there.

uvm_register_file

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

Summary
uvm_register_file
A register file contains a list of registers.
Class Hierarchy
uvm_object
uvm_register_file
Class Declaration
class uvm_register_file extends uvm_register_container

uvm_register_map

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.

Summary
uvm_register_map
A register map contains other register maps, register files and registers.
Class Hierarchy
Class Declaration
class uvm_register_map extends uvm_register_file
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.

get_register_map()

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.

Example usages

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.

uvm_register_get_register_map() (DEPRECATED)

Return the currently registered register map from the configuration.

virtual class uvm_named_object extends uvm_object
The uvm_named_object class is the root base class for UVM components.
virtual class uvm_register_base extends uvm_named_object
Base class for registers.
protected string register_name
The name of the register; a simple string usually.
string register_type
The type of the register; an optional field.
string register_attribute
Optional field.
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()
Match the UVM engine
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.
virtual function bit has_tag(string tag_name)
Given a name, return 1, if any field has this tag in this register.
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.
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.
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)
Provide a current value, passed in as ‘x’.
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.
virtual function void xxx_set_name(string name)
Set the short name for the register, like “REG1”.
virtual function string convert2string()
Should be implemented in the extended class.
virtual function uvm_named_object get_container()
DEPRECATED: Just use get_parent().
virtual function int get_num_bits()
Return the number of bits this register contains.
virtual function void poke_data32(lv32_t bv)
Set the data value as a raw 32 bit vector.
virtual function lv32_t peek_data32()
Return the data value as a raw 32 bit vector.
virtual function void poke_data64(lv64_t bv)
Set the data value as a raw 64 bit vector.
virtual function lv64_t peek_data64()
Return the data value as a raw 64 bit vector.
virtual function lv32_t read_data32()
Calls read_data32() in the extended class.
virtual function void write_data32(lv32_t bv)
Calls write_data32() in the extended class.
virtual function lv64_t read_data64()
Calls read_data64() in the extended class.
virtual function void write_data64(lv64_t bv)
Calls write_data64() in the extended class.
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()
DEPRECATED.
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.
virtual function void get_byte_array_no_masking(ref bytearray_t o)
Return the data value as a list of bytes.
virtual function void sample()
Should be implemented in the extended class.
virtual function void reset()
Should be implemented in the extended class.
class uvm_register #(type T =  int) extends uvm_register_base
The register class that a user build registers from.
rand T data
The register data.
T resetValue
The reset value.
T previous_data
The previous value of the register.
T RMASK = '1
This bit mask defines bits that are readable.
T WMASK = '1
This bit mask defines bits that are writable.
T UNPREDICTABLEMASK = '0
This bit mask is used as an additional compare mask.
bit compare_read_only_bits = 0
If set, then READ-ONLY bits are included in compare operations.
T compareMask = '1
This bit mask is used to define bits that should not participate in a comparison.
function void set_actual_register(this_type s)
Setup the special mirroring code.
function void put(int n =  1)
Unlock the lock, by “putting back” n keys.
task get(int n =  1)
Lock the lock, by “getting” n keys.
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.
virtual function int get_num_bits()
Return the number of bits in this type.
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.
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.
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.
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 lv32_t read_data32()
Returns the masked value.
virtual function void write_data32(lv32_t bv)
Writes the masked value.
virtual function lv64_t read_data64()
Returns the masked value.
virtual function void write_data64(lv64_t bv)
Writes the masked value.
virtual function void bus_read_bv(input read_data_bv,  
address_t address =  0)
This function is called when a “READ” transaction is detected.
virtual function void bus_write_bv(input write_data_bv)
This function is called when a “WRITE” transaction is detected.
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(ref bytearray_t o)
This is an alias for read().
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.
function new(string l_name =  "registerName",
uvm_named_object p =  null,
l_resetVal =  0)
Construct the register, given a name, a parent and a reset value.
virtual function void reset()
Set the value of the register to the reset value.
virtual function void set_reset_value(resetValue)
Use this function to set the default reset value.
virtual function T calc_read(current_value,
output new_register_value,
Calculate the new value, based on the old value, the local mask, and the register masks.
virtual function T calc_write(current_value,
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.
virtual function void write_without_notify(v,
Write masked data without notify.
virtual function T read(
Read masked data with notify.
virtual function void write(v,
Write masked data with notify.
virtual function void poke(v)
“Raw” interface to write data.
virtual function T peek()
“Raw” interface to read data.
virtual function bit compare_data(new_data)
Compare the data field using the compare mask.
virtual function bit compare(this_type b)
Same functionality as compare_data(), but a register is passed in, instead of the register data value.
virtual function void sample()
Implement this is the design specific register.
class uvm_register_container extends uvm_named_object
The shared base class for register files and register maps.
virtual function void build()
Match the UVM engine
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’.
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()
For all the registers, call the reset() function
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.
virtual function void delete_mappings()
Delete all the mapping data structures for this register container.
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).
function void add_register_file(uvm_register_container rf,
address_t addr)
Add a register file to this register map.
function void add_register_map(uvm_register_container rm,
address_t addr)
Add a register map to this register map.
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.
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.
class uvm_register_file extends uvm_register_container
A register file contains a list of registers.
class uvm_register_map extends uvm_register_file
A register map contains other register maps, register files and registers.
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.