Inheritance diagram for class svt_mem:
This class is used to model a single memory region.
An instance of this class represents an address space. When constructed, the address space number is assigned to the instance. If there are multiple memory banks/address spaces, the value of m_bv_addr_region should be used to select the corresponding memory instance to access.
Internally, the memory is modeled with a sparse array of svt_mem_word objects, each of which represents a full data word.
Public Member Functions | |
| function void | clear ( ) |
| function svt_pattern | do_allocate_pattern ( ) |
| function bit | do_compare ( uvm_object rhs, uvm_comparer comparer ) |
| function void | do_copy ( uvm_object rhs ) |
| function void | do_print ( uvm_printer printer ) |
| function bit | get_aligned_addr ( ref bit [SVT_MEM_MAX_ADDR_WIDTH-1:0] addr ) |
| function string | get_mcd_class_name ( ) |
| function bit | get_prop_val ( string prop_name, ref bit [1023:0] prop_val, input int array_ix, ref svt_sequence_item_base data_obj ) |
| function bit | get_property ( string name, output bit [1023:0] value ) |
| function bit | is_in_bounds ( bit [SVT_MEM_MAX_ADDR_WIDTH-1:0] addr ) |
| function bit | is_locked ( bit [SVT_MEM_MAX_ADDR_WIDTH-1:0] addr ) |
| function bit | load_mem ( string filename, bit is_pattern = 0, int data_wdth = -1, bit [SVT_MEM_MAX_ADDR_WIDTH-1:0] start_addr = 0, bit [SVT_MEM_MAX_ADDR_WIDTH-1:0] end_addr = 1 << 64 - 1 ) |
| function void | new ( string name = "svt_mem_inst", string suite_name = "", int data_wdth = 32, int addr_region = 0, bit [SVT_MEM_MAX_ADDR_WIDTH-1:0] min_addr = 0, bit [SVT_MEM_MAX_ADDR_WIDTH-1:0] max_addr = 1 << 64 - 1 ) |
| function logic [SVT_MEM_MAX_DATA_WIDTH-1:0] | read ( bit [SVT_MEM_MAX_ADDR_WIDTH-1:0] addr, int set_lock = -1 ) |
| function bit | save_mem ( string filename, int data_wdth = -1, bit [SVT_MEM_MAX_ADDR_WIDTH-1:0] start_addr = 0, bit [SVT_MEM_MAX_ADDR_WIDTH-1:0] end_addr = 1 << 64 - 1, bit enable_autosize_of_saveddata = 0 ) |
| task | set_meminit ( svt_mem :: meminit_enum meminit = UNKNOWNS, bit [SVT_MEM_MAX_DATA_WIDTH-1:0] meminit_value = 0, bit [SVT_MEM_MAX_ADDR_WIDTH-1:0] meminit_address_offset = 0 ) |
| function void | set_property ( string name, bit [1023:0] value ) |
| function bit | write ( bit [(SVT_MEM_MAX_ADDR_WIDTH-1):0] addr = 0, bit [(SVT_MEM_MAX_DATA_WIDTH-1):0] data = 0, bit [(SVT_MEM_MAX_DATA_WIDTH/8-1):0] byteen = ~0, int set_lock = -1 ) |
Public Attributes | |
| bit [SVT_MEM_MAX_ADDR_REGION_WIDTH-1:0] | addr_region = 0; |
| int | data_wdth = 0; |
| bit [SVT_MEM_MAX_ADDR_WIDTH-1:0] | max_addr = 0; |
| svt_mem :: meminit_enum | meminit |
| bit [SVT_MEM_MAX_ADDR_WIDTH-1:0] | meminit_address_offset |
| bit [SVT_MEM_MAX_DATA_WIDTH-1:0] | meminit_value |
| bit [SVT_MEM_MAX_ADDR_WIDTH-1:0] | min_addr = 0; |
| bit [SVT_MEM_MAX_DATA_WIDTH-1:0] | user_pattern [$] |
Member Typedefs | |
| typedef enum | meminit_enum |
|
||
Clears contents of the memory.
|
|
||||
Added t support the svt_shorthand_psdisplay_method
| ||||
|
|
||||||
Extend the compare routine to compare the memory contents
| ||||||
|
|
||||||||
Extend the copy routine to compare the memory contents
| ||||||||
|
|
||||||||||
Extend the display routine to display the memory contents
| ||||||||||
|
|
||
Gets the aligned address.
|
|
||||
Returns the class name for the object.
| ||||
|
|
||||
Added to support the svt_shorthand_psdisplay method
| ||||
|
|
||
|
||
Used to check whether a given byte-level address is within the Min/Max bounds for this memory.
addr - The byte-level address to be checked.
Return values - 1 if the address is in the memory, 0 if it is not. |
|
||
Used to check whether a given byte-level address within this memory is locked or not locked.
addr - The byte-level address to be checked.
Return values - 1 if the address is locked, 0 if it is not. |
|
||
Loads the contents of the file into memory. Data should be in $readmemh format.
If the data width of the file contents is different than the configured width of the memory then a step value is generated that is proportional to the relationship between the two widths.
filename - Name of the file from which data is to be loaded.
is_pattern - If this bit is set, the contents of the file are loaded as a user-defined pattern. This pattern is used to return data from a read to an uninitialized location if meminit is USER_PATTERN. The pattern is repeated across the entire memory.
data_wdth - If the data width of the memory is greater than or equal to 8 and is an exact power of 2, this value specifies the data width of the the words in the file. If the data width of the memory is not a power of 2 or is less than 8, this value must be left at its default value (-1). If left at its default value, it is assumed that the data width of the words in the file is same as that of the memory.
start_addr - The byte aligned start address at which data in the memory is to be loaded. If the value supplied is not byte aligned then a warning is generated and the start address will be modified to be byte aligned. This argument is optional, and if not provided then the load will begin at address 0.
end_addr - The byte aligned end address up to which data is to be loaded. If the value supplied is not byte aligned then a warning is generated and the end address will be modified to be byte aligned. This argument is optional, and if not provided then the end address will be the maximum addressable location. |
|
||
CONSTRUCTOR: Create a new instance of this class.
When this object is created, the memory is assigned an instance name, data width, an address region and Max/Min byte address locations.
name - Intance name for this memory object
suite_name - Name of the suite in which the memory is used.
data_wdth - The data width of this memory.
addr_region - The address region of this memory.
min_addr - The lower (word-aligned) address bound of this memory.
max_addr - The upper (word-aligned) address bound of this memory. |
|
||
Returns the value of the data word stored by this object.
addr - The byte-level address to be read. The addr should be aligned to the data_width of memory, if address is unaligned it will be realigned to data_width of memory.
set_lock - (Optional) If supplied as 1 (or any positive int), locks this memory location (preventing writes). If supplied as 0, unlocks this memory location (to allow writes). If not supplied (or supplied as any negative int) the locked/unlocked state of this memory location is not changed.
Return values - The data stored at the indicated address. If the address has not previously been written, data is returned per the setting in meminit. |
|
||
Dumps the contents of this memory into a file. The data is dumped in hex format.
filename - Name of the file into which the contents are to be dumped.
data_wdth - If the data width of the memory is greater than or equal to 8 and is an exact power of 2, this value specifies the data width of the the words in the file. If the data width of the memory is not a power of 2 or is less than 8, this value must be left at its default value (-1). If left at its default value, it is assumed that the data width of the words in the file is same as that of the memory.
start_addr - The start address from which data in the memory is to be saved.
end_addr - The end address upto which data is to be saved.
enable_autosize_of_saveddata - Control to write/save the data with automatic sizing i.e. with leading zeros, if any |
|
||
Configures how the memory structures data to be returned by reads from uninitialized addresses.
meminit - (Optional: Default = UNKNOWNS). Refer to meminit_enum for supported types.
meminit_value - Specifies the (hex) value to be returned by a read from any uninitialized memory location, if the meminit argument was passed with the value VALUE. Specifies the value at the minimum address if the meminit argument was passed as INCR or DECR.
meminit_address_offset - Specifies the (hex) value of a word-aligned byte level address. If (and only if) the meminit argument was passed with the value ADDR, a read from any uninitialized memory location will return the address of that location, plus this offset. |
|
||
|
||
Stores a data word into this object, with optional byte-enables.
addr - The byte-level address to be written. The addr should be aligned to the data_width of memory, if address is unaligned it will be realigned to data_width of memory.
data - The data word to be stored. If the memory location is currently locked, the attempted write will not change the stored data, and the function will return 0.
byteen - (Optional) The byte-enables to be applied to this write. A 1 in a given bit position enables the byte in the data word corresponding to that bit position.
set_lock - (Optional) If supplied as 1 (or any positive int), locks this memory location (preventing writes). If supplied as 0, unlocks this memory location (to allow writes). If not supplied (or supplied as any negative int) the locked/unlocked state of this memory location is not changed.
Return values - 1 if the write was successful, or 0 if it was not successful (because the memory location was locked). |
|
|
Identifies the address region in which this memory resides.
|
|
|
Stores the effective data width, as defined by the configuration.
|
|
|
Identifies maximum byte-level address considered part of this memory.
|
|
|
Determines the form of data that is returned by a read from an address that has not previously been written.
|
|
|
The offset to be added to the address, the sum of which defines the data returned by read from a location not previously written, if (and only if) meminit = ADDR.
|
|
|
Value used to calculate default data returned by read from a location not previously written, if meminit is VALUE, INCR or DECR. If meminit = VALUE, this represents the default value returned; if meminit = INCR or if meminit = DECR, this represents the default value at the minimum byte-level address of this memory. Default value of other locations will be calculated based on this value.
|
|
|
Identifies minimum byte-level address considered part of this memory.
|
|
|
Queue used to store a user-defined pattern
|
|
|
|