svt_mem_backdoor Class Reference

Inheritance diagram for class svt_mem_backdoor:

List of all members.


Detailed Description

This class provides a backdoor and iterator interface to a memory core. Multiple instances of this interface may exist on the same memory core.



Public Member Functions

function bit  are_set ( svt_mem_attr_t attr, svt_mem_addr_t addr )
function bit  clear_attributes ( svt_mem_attr_t attr, svt_mem_addr_t addr )
function svt_mem_backdoor  clone ( )
function int  compare_base ( string filename, svt_mem_backdoor_base :: compare_type_enum compare_type, int max_errors, svt_mem_addr_t addr_lo, svt_mem_addr_t addr_hi, svt_mem_address_mapper mapper = null )
function void  copy ( svt_mem_backdoor rhs )
function void  dump_base ( string filename, string filetype, svt_mem_addr_t addr_lo, svt_mem_addr_t addr_hi, svt_mem_address_mapper mapper = null, int modes = 0 )
function void  free_all ( )
function bit  free_attribute ( svt_mem_attr_t free_attr_mask )
function bit  free_base ( svt_mem_addr_t addr_lo, svt_mem_addr_t addr_hi, int modes = 0 )
function int  get_access_lock_attr ( )
function svt_mem_addr_t  get_addr ( )
function int  get_addr_width ( )
function svt_mem_attr_t  get_attributes ( )
function unsigned int  get_checks ( )
function svt_mem_data_t  get_data ( )
function int  get_data_width ( )
function int  get_supported_features ( )
function int  get_write_protect_attr ( )
function void  initialize_base ( svt_mem_backdoor_base :: init_pattern_type_enum pattern = INIT_CONST, svt_mem_data_t base_data = 0, svt_mem_addr_t start_addr = 0, svt_mem_addr_t end_addr = -1, int modes = 0, svt_mem_data_t optional_data = 0 )
function void  load_base ( string filename, svt_mem_address_mapper mapper = null, int modes = 0 )
function void  new ( string name = "", svt_mem_core mem_core = null, vmm_log log = null )
function svt_mem_attr_t  new_attribute ( )
function bit  next ( )
function svt_mem_attr_t  peek_attributes ( svt_mem_addr_t addr_lo, svt_mem_addr_t addr_hi, int modes = 0 )
function bit  peek_base ( svt_mem_addr_t addr, output svt_mem_data_t data, input int modes )
function void  poke_attributes ( svt_mem_attr_t attr, svt_mem_addr_t addr_lo, svt_mem_addr_t addr_hi, int modes = 0 )
function bit  poke_base ( svt_mem_addr_t addr, svt_mem_data_t data, int modes = 0 )
function void  protect ( svt_mem_addr_t addr_lo, svt_mem_addr_t addr_hi )
function bit  reset ( svt_mem_attr_t attr = 'h2 )
function void  set_attributes ( svt_mem_attr_t attr, svt_mem_addr_t addr )
function void  set_checks ( int unsigned enables )
function void  unprotect ( svt_mem_addr_t addr_lo, svt_mem_addr_t addr_hi )

Public Attributes

static const svt_mem_attr_t  LAST_RD = SVT_MEM_ATTRIBUTE_LAST_RD
static const svt_mem_attr_t  LAST_WR = SVT_MEM_ATTRIBUTE_LAST_WR
string  name 
static const svt_mem_attr_t  WRITTEN = SVT_MEM_ATTRIBUTE_INIT


Member Function Documentation

  function bit
 svt_mem_backdoor::are_set

 (  svt_mem_attr_t attr , svt_mem_addr_t addr  ) 


Return TRUE if the specified address exists and all of the specified attributes are set for the specified address.

attr - attribute to test for

addr - address to test at

  function bit
 svt_mem_backdoor::clear_attributes

 (  svt_mem_attr_t attr , svt_mem_addr_t addr  ) 


Clear the specified attributes for the specified address

attr - attribute mask which determines which attributes to clear

addr - address to modify the attribute for

  function svt_mem_backdoor
 svt_mem_backdoor::clone

 (   ) 


Make a copy of this class, including the state of the iterator

  function int
 svt_mem_backdoor::compare_base

 (  string filename , svt_mem_backdoor_base :: compare_type_enum compare_type , int max_errors , svt_mem_addr_t addr_lo , svt_mem_addr_t addr_hi , svt_mem_address_mapper mapper = null  ) 


Internal method for comparing the content of the memory in the specifed address range (entire memory by default) with the data found in the specifed file, using the relevant policy based on the filename.

The 'mapper' can be used to convert between the source address domain used in the file and the destination address domain used by the backdoor. If the 'mapper' is not provided it implies the source and destination address domains are the same.

The following comparison mode are available:

  • Subset: The content of the file is present in the memory core. The memory core may contain additional values that are ignored.
  • Strict: The content of the file is strictly equal to the content of the memory core.
  • Superset: The content of the memory core is present in the file. The file may contain additional values that are ignored.
  • Intersect: The same addresses present in the memory core and in the file contain the same data. Addresses present only in the file or the memory core are ignored.

filename - Name of the file to compare to. The file extension determines which format the file is created in.

compare_type - Determines which kind of compare is executed

max_errors - Data comparison terminates after reaching max_errors. If max_errors is 0 assume a maximum error count of 10.

addr_lo - Starting address

addr_hi - Ending address

Return values - The number of miscompares.


 Superseded functions 
 svt_mem_backdoor_base :: compare_base 

  function void
 svt_mem_backdoor::copy

 (  svt_mem_backdoor rhs  ) 


Copy the state of the specified iterator to this iterator. The specified iterator must refer to the same memory core.

rhs - svt_mem_backdoor object to be copied.

  function void
 svt_mem_backdoor::dump_base

 (  string filename , string filetype , svt_mem_addr_t addr_lo , svt_mem_addr_t addr_hi , svt_mem_address_mapper mapper = null, int modes = 0  ) 


Internal method for saving memory contents within the indicated 'addr_lo' to 'addr_hi' address range into the specified 'file' using the format identified by 'filetype', where the only supported values are "MIF" and "MEMH".

The 'mapper' can be used to convert between the source address domain used in the file and the destination address domain used by the backdoor. If the 'mapper' is not provided it implies the source and destination address domains are the same.

The 'modes' field is a loophole for conveying basic well defined instructions to the backdoor implementations.

filename - Name of the file to write to. The file extension determines which format the file is created in.

filetype - The string name of the format to be used when writing a memory dump file, either "MIF" or "MEMH".

addr_lo - Starting address

addr_hi - Ending address

mapper - Used to convert between address domains.

modes - Optional dump modes, represented by individual constants. Supported values:

  • SVT_MEM_DUMP_ALL - Specify in order to include 'all' addresses in the output.
  • SVT_MEM_DUMP_NO_HEADER - To exclude the header at the front of the file.
  • SVT_MEM_DUMP_NO_BEGIN - To exclude the BEGIN at the start of the data block (MIF).
  • SVT_MEM_DUMP_NO_END - To exclude the END at the end of the data block (MIF).
  • SVT_MEM_DUMP_APPEND - Append the contents to the existing file if found.

 Superseded functions 
 svt_mem_backdoor_base :: dump_base 

  function void
 svt_mem_backdoor::free_all

 (   ) 


Free all data in the memory.

  function bit
 svt_mem_backdoor::free_attribute

 (  svt_mem_attr_t free_attr_mask  ) 


Release a presviously-created user-defined attribute. The released attibute may be reused by a new subsequently created user-defined attibute.

free_attr_mask - attributes to be freed.

  function bit
 svt_mem_backdoor::free_base

 (  svt_mem_addr_t addr_lo , svt_mem_addr_t addr_hi , int modes = 0  ) 


Free the data associated with the specified address range, as if it had never been written. If addr_lo == 0 and addr_hi == -1 then this frees all of the data in the memory.

addr_lo - Low address

addr_hi - High address

modes - Optional access modes, represented by individual constants. No predefined values supported.

Return values - Bit indicating the success (1) or failure (0) of the free operation.


 Superseded functions 
 svt_mem_backdoor_base :: free_base 

  function int
 svt_mem_backdoor::get_access_lock_attr

 (   ) 


Retrieve the attribute mask for the lock attribute

  function svt_mem_addr_t
 svt_mem_backdoor::get_addr

 (   ) 


Return the address of the memory location corresponding to the current location of the iterator.

  function int
 svt_mem_backdoor::get_addr_width

 (   ) 


Returns the configured address width of the memcore

  function svt_mem_attr_t
 svt_mem_backdoor::get_attributes

 (   ) 


Return the bitwise-OR of all attributes set for the memory location corresponding to the current location of the iterator

  function unsigned int
 svt_mem_backdoor::get_checks

 (   ) 


Retrieves the check mask which determines which checks the memserver performs

Retrieves the check mask which determines which checks the C-based memserver application performs. The return value is a bitwise-OR that determines which checks are enabled.

The following macros can be used to test whether specific checks are enabled:

  • 32'h00000001
  • 32'h00000002
  • 32'h00000004
  • 32'h00000008
  • 32'h00000010
  • 32'h00000020
  • 32'h00000040
  • 32'h00000080
  • 32'h00000100
  • 32'h00000200
  • 32'h00000800

  function svt_mem_data_t
 svt_mem_backdoor::get_data

 (   ) 


Return the value in the memory location corresponding to the current location of the iterator.

  function int
 svt_mem_backdoor::get_data_width

 (   ) 


Returns the configured data width of the memcore

  function int
 svt_mem_backdoor::get_supported_features

 (   ) 


Method to provide a bit vector identifying which of the common memory operations (i.e., currently peek, poke, load, and dump) are supported.

This class supports all of the common memory operations, so this method returns a value which is an 'OR' of the following:

  • SVT_MEM_PEEK_OP_MASK
  • SVT_MEM_POKE_OP_MASK
  • SVT_MEM_LOAD_OP_MASK
  • SVT_MEM_DUMP_OP_MASK
  • SVT_MEM_FREE_OP_MASK
  • SVT_MEM_INITIALIZE_OP_MASK
  • SVT_MEM_COMPARE_OP_MASK
  • SVT_MEM_ATTRIBUTE_OP_MASK

Return values - Bit vector indicating which features are supported by this backdoor.


 Superseded functions 
 svt_mem_backdoor_base :: get_supported_features 

  function int
 svt_mem_backdoor::get_write_protect_attr

 (   ) 


Retrieve the attribute mask for the write protect attribute

  function void
 svt_mem_backdoor::initialize_base

 (  svt_mem_backdoor_base :: init_pattern_type_enum pattern = INIT_CONST, svt_mem_data_t base_data = 0, svt_mem_addr_t start_addr = 0, svt_mem_addr_t end_addr = -1, int modes = 0, svt_mem_data_t optional_data = 0  ) 


Initialize the specified address range in the memory with the specified pattern. Supported patterns are: constant value, incrementing values, decrementing values, walk left, walk right. For user-defined patterns, the backdoor should be used.

pattern - initialization pattern.

base_data - Starting data value used with each pattern For pattern INIT_ODD_EVEN_CONST pattern denotes data value for even addresses

start_addr - start address of the region to be initialized.

end_addr - end address of the region to be initilized.

modes - Optional access modes, represented by individual constants. No predefined values supported.

optional_data - Starting data value used for odd addresses with INIT_ODD_EVEN_CONST pattern


 Superseded functions 
 svt_mem_backdoor_base :: initialize_base 

  function void
 svt_mem_backdoor::load_base

 (  string filename , svt_mem_address_mapper mapper = null, int modes = 0  ) 


Internal method for loading memory locations with the contents of the specified file.

The 'mapper' can be used to convert between the source address domain used in the file and the destination address domain used by the backdoor. If the 'mapper' is not provided it implies the source and destination address domains are the same.

filename - Name of the file to load. The file extension determines which format to expect.

mapper - Used to convert between address domains.

modes - Optional load modes, represented by individual constants. Supported values:

  • SVT_MEM_LOAD_WRITE_PROTECT - Marks the addresses initialized by the file as write protected

 Superseded functions 
 svt_mem_backdoor_base :: load_base 

  function void
 svt_mem_backdoor::new

 (  string name = "", svt_mem_core mem_core = null, vmm_log log = null  ) 


CONSTRUCTOR: Create a new svt_mem_backdoor instance

name - (optional) Used to identify the backdoor in any reported messages.

mem_core - (required) The specific mem_core that this backdoor points to.

log - (optional but recommended) Used to report messages.

  function svt_mem_attr_t
 svt_mem_backdoor::new_attribute

 (   ) 


Creates a new user-defined attribute that can be attanched to any address. Different user-defined attributes can be bitwise-OR's to operate on multiple attributes at the same time.

The return value is the attribute mask for the new attribute.

  function bit
 svt_mem_backdoor::next

 (   ) 


Move the iterator to the next memory location. The order in which memory location are visited is not specified.

  function svt_mem_attr_t
 svt_mem_backdoor::peek_attributes

 (  svt_mem_addr_t addr_lo , svt_mem_addr_t addr_hi , int modes = 0  ) 


Return the attribute settings for the indicated address range. Does an 'AND' or an 'OR' of the attributes within the range, based on the 'modes' setting. The default setting results in an 'AND' of the attributes.

addr_lo - Starting address.

addr_hi - Ending address.

modes - Optional attribute modes, represented by individual constants. Supported values:

  • SVT_MEM_ATTRIBUTE_OR - Specify to do an 'OR' of the attributes within the range.

 Superseded functions 
 svt_mem_backdoor_base :: peek_attributes 

  function bit
 svt_mem_backdoor::peek_base

 (  svt_mem_addr_t addr , output svt_mem_data_t data , input int modes  ) 


Set the output argument to the value found a the specified address Returns TRUE if a value was found. Returns FALSE otherwise. By default. the attributes are not modified but if specified, attributes may be set or cleared.

addr - address on which data to be read

data - ouput data on specified address.

modes - Optional access modes, represented by individual constants. No predefined values supported.

Return values - '1' if the value was written, otherwise '0'.


 Superseded functions 
 svt_mem_backdoor_base :: peek_base 

  function void
 svt_mem_backdoor::poke_attributes

 (  svt_mem_attr_t attr , svt_mem_addr_t addr_lo , svt_mem_addr_t addr_hi , int modes = 0  ) 


Set the attributes for the addresses in the indicated address range. Does an 'AND' or an 'OR' of the attributes within the range, based on the 'modes' setting. The default setting results in an 'AND' of the attributes.

Special care must be taken when setting the 'access' attributes for a memory location as these attributes govern how the memory package interacts with the location. An access value of SVT_MEM_ATTRIBUTE_UNINIT, for example, indicates the location is not occupied. This will result in the failure of subsequent peek, peek_attribute, and poke_attribute operations of that location.

Changing the access value between the different 'occupied' settings will not not result in failures with subsequent peek or poke operations. But it could impact the outcome of subsequent access checks which rely on these settings to discern the current state of the memory locations. The 'occupied' settings are defined by:

  • SVT_MEM_ATTRIBUTE_LAST_WR - Last access was a 'write' operation.
  • SVT_MEM_ATTRIBUTE_INIT - Last access was a 'poke' or 'initialize' operation.
  • SVT_MEM_ATTRIBUTE_LAST_RD - Last access was a 'read' operation.

attr - attribute to be set

addr_lo - Starting address.

addr_hi - Ending address.

modes - Optional attribute modes, represented by individual constants. Supported values:

  • SVT_MEM_ATTRIBUTE_OR - Specify to do an 'OR' of the attributes within the range.

 Superseded functions 
 svt_mem_backdoor_base :: poke_attributes 

  function bit
 svt_mem_backdoor::poke_base

 (  svt_mem_addr_t addr , svt_mem_data_t data , int modes = 0  ) 


Write the specified value at the specified address. By default, the attributes are not modified but if specified, attributes may be set or cleared.

addr - address on which data to be written

data - data to be written to the specific address.

modes - Optional access modes, represented by individual constants. No predefined values supported.

Return values - '1' if the value was written, otherwise '0'.


 Superseded functions 
 svt_mem_backdoor_base :: poke_base 

  function void
 svt_mem_backdoor::protect

 (  svt_mem_addr_t addr_lo , svt_mem_addr_t addr_hi  ) 


Create a write protect to a memory range

addr_lo - low addr address

addr_hi - high addr address

  function bit
 svt_mem_backdoor::reset

 (  svt_mem_attr_t attr = 'h2  ) 


Reset the iterator to the first address with all the specified(bitwise-OR'd) attributes set. Default is SVT_MEM_ATTRIBUTE_INIT, which is interpreted to represent all occupied locations, whether they have been initialized or written to.

  function void
 svt_mem_backdoor::set_attributes

 (  svt_mem_attr_t attr , svt_mem_addr_t addr  ) 


Set the specified attributes for the specified address

attr - attribute to be set

addr - address at which the attribute is updated

  function void
 svt_mem_backdoor::set_checks

 (  int unsigned enables  ) 


Sets the error checking enables which determine whether particular types of errors or warnings will be checked by the C-based memserver application. The check_enables mask uses the same bits as the status values.

The following macros can be supplied as a bitwise-OR:

  • 32'h00000001
  • 32'h00000002
  • 32'h00000004
  • 32'h00000008
  • 32'h00000010
  • 32'h00000020
  • 32'h00000040
  • 32'h00000080
  • 32'h00000100
  • 32'h00000200
  • 32'h00000800

Note however that not all status values represent error checks that can be disabled. Two pre-defined check enable defines exist:

  • (32'h00000010 | 32'h00000800 | 32'h00000040 | 32'h00000080 )
    • includes RD_B4_WR, PARTIAL_RD, ADR_ERR, DATA_ERR
  • (32'h00000001 | 32'h00000002 | 32'h00000004 | 32'h00000008 | 32'h00000010 | 32'h00000020 | 32'h00000040 | 32'h00000080 | 32'h00000100 | 32'h00000200 | 32'h00000800 | 32'h00004000 )
    • includes all checks listed above

enables - Error check enable mask

  function void
 svt_mem_backdoor::unprotect

 (  svt_mem_addr_t addr_lo , svt_mem_addr_t addr_hi  ) 


Release write protect to a memory range

addr_lo - low addr address

addr_hi - high addr address


Member Attribute Documentation

 static const svt_mem_attr_t  attribute
 svt_mem_backdoor::LAST_RD = SVT_MEM_ATTRIBUTE_LAST_RD


Predefined attribute indicating an address was last accessed by a READ operation.

 static const svt_mem_attr_t  attribute
 svt_mem_backdoor::LAST_WR = SVT_MEM_ATTRIBUTE_LAST_WR


Predefined attribute indicating an address was last accessed by a WRITE operation. Provided for backwards compatibility, but clients should actually use the SVT specified attribute constants.

 string  attribute
 svt_mem_backdoor::name

 static const svt_mem_attr_t  attribute
 svt_mem_backdoor::WRITTEN = SVT_MEM_ATTRIBUTE_INIT


Pre-defined attribute indicating an address has been written or initialized. Provided for backwards compatibility, but clients should actually use the SVT specified attribute constants.

Note that this uses the SVT_MEM_ATTRIBUTE_INIT constant, although the backdoor code actually assumes that it represents all occupied locations, whether they have been initialized or written to.