svt_exception_list Class Reference

Inheritance diagram for class svt_exception_list:

List of all members.


Detailed Description

Base class for all SVT model exception list objects. As functionality commonly needed for exception lists for SVT models is defined, it will be implemented (or at least prototyped) in this class.



Public Member Functions

function void  add_exception ( T exception )
function void  add_exceptions ( svt_exception_list list_to_add )
virtual function vmm_data  allocate ( )
virtual function unsigned int  byte_pack ( ref logic [7:0] bytes[], input int unsigned offset, input int kind )
function unsigned int  byte_size ( int kind = -1 )
virtual function unsigned int  byte_unpack ( const ref logic [7:0] bytes[], input int unsigned offset, input int len, input int kind )
virtual function bit  compare ( vmm_data to, output string diff, input int kind )
virtual function vmm_data  copy ( vmm_data to = null )
function void  do_all ( vmm_data :: do_what_e do_what, ref logic [7:0] pack[], const ref logic [7:0] unpack[] )
function svt_pattern  do_allocate_pattern ( )
function unsigned int  do_byte_pack ( ref logic [7:0] bytes[], input int unsigned offset, input int kind )
function unsigned int  do_byte_unpack ( const ref logic [7:0] bytes[], input int unsigned offset, input int len, input int kind )
function bit  do_compare ( vmm_data to, output string diff, input int kind )
function vmm_data  do_copy ( vmm_data to = null )
function bit  do_is_valid ( bit silent = 1, int kind = -1 )
function T  get_exception ( int unsigned idx )
function bit  get_prop_val ( string prop_name, ref bit [1023:0] prop_val, input int array_ix, ref svt_data data_obj )
function T  get_randomized_exception ( )
function void  inject_exceptions ( )
virtual function bit  is_valid ( bit silent = 1, int kind = -1 )
function void  new ( vmm_log log = null, string suite_name = "", T randomized_exception = null, int max_num_exceptions = 1 )
function bit  num_exceptions_first_randomize ( )
function void  populate_exceptions ( )
function void  post_randomize ( )
function void  pre_randomize ( )
virtual function string  psdisplay ( string prefix = "" )
function int  reasonable_constraint_mode ( bit on_off )
function void  remove_collisions ( )
function void  remove_empty_exceptions ( )
function int  safe_num_exceptions ( )
function void  set_constraint_weights ( int new_weight )
function bit  set_prop_val ( string prop_name, bit [1023:0] prop_val, int array_ix )

Class Parameters

type  T = svt_exception

Public Attributes

bit  data_injected = 0; 
bit  enable_combine = 0; 
rand T  exceptions [] 
int  EXCEPTION_LIST_EMPTY_wt = 10; 
int  EXCEPTION_LIST_LONG_wt = 0; 
int  EXCEPTION_LIST_SHORT_wt = 0; 
int  EXCEPTION_LIST_SINGLE_wt = 1; 
int  max_num_exceptions = 1; 
rand int  num_exceptions = 0; 
randomized_exception = null; 

Protected Attributes

protected bit  enable_exception_randomize = 1; 
static protected svt_exception_list  __vmm_rhs 

Constraints

constraint  reasonable_num_exceptions  ( )
constraint  valid_ranges  ( )


Member Function Documentation

  function void
 svt_exception_list::add_exception

 (  T exception  ) 


Method to add a single exception into our exception list. Insures that 'num_exceptions' is updated properly.

exception - The exception to be added.

  function void
 svt_exception_list::add_exceptions

 (  svt_exception_list list_to_add  ) 


Method to add the exceptions in the provided exception list into our exception list.

list_to_add - Uses list_to_add.num_exceptions to see how many exceptions are to be added and uses list_to_add.exceptions to get the actual exceptions.

 virtual function vmm_data
 svt_exception_list::allocate

 (   ) 


 Superseded functions 
 vmm_data :: allocate 
 svt_data :: allocate 

 virtual function unsigned int
 svt_exception_list::byte_pack

 (  ref logic [7:0] bytes [], input int unsigned offset , input int kind  ) 


 Superseded functions 
 vmm_data :: byte_pack 
 svt_data :: byte_pack 

  function unsigned int
 svt_exception_list::byte_size

 (  int kind = -1  ) 


Returns the size (in bytes) required by the byte_pack operation.

kind - This int indicates the type of byte_size being requested. Only supported kind value is svt_data :: COMPLETE, which results in a size calculation based on the non-static fields. All other kind values result in a return value of 0.

Return values - Indicates how many bytes are required to pack this object.


 Superseded functions 
 vmm_data :: byte_size 
 svt_data :: byte_size 

 virtual function unsigned int
 svt_exception_list::byte_unpack

 (  const ref logic [7:0] bytes [], input int unsigned offset , input int len , input int kind  ) 


 Superseded functions 
 vmm_data :: byte_unpack 
 svt_data :: byte_unpack 

 virtual function bit
 svt_exception_list::compare

 (  vmm_data to , output string diff , input int kind  ) 


 Superseded functions 
 vmm_data :: compare 
 svt_data :: compare 

 virtual function vmm_data
 svt_exception_list::copy

 (  vmm_data to = null  ) 


 Superseded functions 
 vmm_data :: copy 
 svt_data :: copy 

  function void
 svt_exception_list::do_all

 (  vmm_data :: do_what_e do_what , ref logic [7:0] pack [], const ref logic [7:0] unpack []  ) 


 Superseded functions 
 vmm_data :: do_all 
 svt_data :: do_all 

  function svt_pattern
 svt_exception_list::do_allocate_pattern

 (   ) 


This method allocates a pattern containing svt_pattern_data instances for all of the primitive data fields in the object. The svt_pattern_data :: name is set to the corresponding field name, the svt_pattern_data :: value is set to 0.

Return values - An svt_pattern instance containing entries for all of the data fields.


 Superseded functions 
 svt_data :: do_allocate_pattern 

  function unsigned int
 svt_exception_list::do_byte_pack

 (  ref logic [7:0] bytes [], input int unsigned offset , input int kind  ) 


Packs the object into the bytes buffer, beginning at offset, based on the requested byte_pack kind.

bytes - Buffer that will contain the packed bytes at the end of the operation.

offset - Offset into bytes where the packing is to begin.

kind - This int indicates the type of byte_pack being requested. Only supported kind value is svt_data :: COMPLETE, which results in all of the non-static fields being packed and the return of an integer indicating the number of packed bytes. All other kind values result in no change to the buffer contents, and a return value of 0.

Return values - Indicates how many bytes were actually packed.


 Superseded functions 
 vmm_data :: do_byte_pack 
 svt_data :: do_byte_pack 

  function unsigned int
 svt_exception_list::do_byte_unpack

 (  const ref logic [7:0] bytes [], input int unsigned offset , input int len , input int kind  ) 


Unpacks the object from the bytes buffer, beginning at offset, based on the requested byte_unpack kind.

bytes - Buffer containing the bytes to be unpacked.

offset - Offset into bytes where the unpacking is to begin.

len - Number of bytes to be unpacked.

kind - This int indicates the type of byte_unpack being requested. Only supported kind value is svt_data :: COMPLETE, which results in all of the non-static fields being unpacked and the return of an integer indicating the number of unpacked bytes. All other kind values result in no change to the exception contents, and a return value of 0.

Return values - Indicates how many bytes were actually unpacked.


 Superseded functions 
 vmm_data :: do_byte_unpack 
 svt_data :: do_byte_unpack 

  function bit
 svt_exception_list::do_compare

 (  vmm_data to , output string diff , input int kind  ) 


Compares the object with to. Differences are placed in diff.

to - vmm_data object to be compared against.

diff - String indicating the differences between this and to.

kind - This int indicates the type of compare to be attempted. Supports both RELEVANT and COMPLETE compares.


 Superseded functions 
 vmm_data :: do_compare 
 svt_data :: do_compare 

  function vmm_data
 svt_exception_list::do_copy

 (  vmm_data to = null  ) 


Extend the copy method to copy the exception_list base class fields.

to - Destination class for the copy operation


 Superseded functions 
 vmm_data :: do_copy 
 svt_data :: do_copy 

  function bit
 svt_exception_list::do_is_valid

 (  bit silent = 1, int kind = -1  ) 


Checks to see that the data field values are valid.

silent - bit indicating whether failures should result in warning messages.

kind - This int indicates the type of is_avalid check to attempt. Only supported kind value is svt_data :: COMPLETE, which results in verification that the data members are all valid. All other kind values result in a return value of 1.

Return values - Indicates function success (1) or failure (0).


 Superseded functions 
 vmm_data :: do_is_valid 
 svt_data :: do_is_valid 

  function T
 svt_exception_list::get_exception

 (  int unsigned idx  ) 


Method to get the specified exception from our exception list. returns 'null' if the specified index is out of range.

idx - The index of the exception to get

  function bit
 svt_exception_list::get_prop_val

 (  string prop_name , ref bit [1023:0] prop_val , input int array_ix , ref svt_data data_obj  ) 


This method is used by a component's command interface, to allow command code to retrieve the value of a single named property of a data class derived from this class. If the prop_name argument does not match a property of the class, or if the array_ix argument is not zero and does not point to a valid array element, this function returns '0'. Otherwise it returns '1', with the value of the prop_val argument assigned to the value of the specified property. However, If the property is a sub-object, a reference to it is assigned to the data_obj (ref) argument. In that case, the prop_val argument is meaningless. The component will then store the data object reference in its temporary data object array, and return a handle to its location as the prop_val argument of the get_data_prop task of its component. The command testbench code must then use that handle to access the properties of the sub-object.

prop_name - The name of a property in this class, or a derived class.

prop_val - A ref argument used to return the current value of the property, expressed as a 1024 bit quantity. When returning a string value each character requires 8 bits so returned strings must be 128 characters or less.

array_ix - If the property is an array, this argument specifies the index being accessed. If the property is not an array, it should be set to 0.

data_obj - If the property is not a sub-object, this argument is assigned to null. If the property is a sub-object, a reference to it is assigned to this (ref) argument. In that case, the prop_val argument is meaningless. The component will then store the data object reference in its temporary data object array, and return a handle to its location as the prop_val argument of the get_data_prop task of its component. The command testbench code must then use that handle to access the properties of the sub-object.

Return values - A single bit representing whether or not a valid property was retrieved.


 Superseded functions 
 svt_data :: get_prop_val 

  function T
 svt_exception_list::get_randomized_exception

 (   ) 


Get the transaction exception factory object.

  function void
 svt_exception_list::inject_exceptions

 (   ) 


Method to inject the exceptions into the transaction. Note that if 'data_injected == 1' then the exceptions are NOT injected.

 virtual function bit
 svt_exception_list::is_valid

 (  bit silent = 1, int kind = -1  ) 


 Superseded functions 
 vmm_data :: is_valid 
 svt_data :: is_valid 

  function void
 svt_exception_list::new

 (  vmm_log log = null, string suite_name = "", T randomized_exception = null, int max_num_exceptions = 1  ) 


CONSTRUCTOR: Create a new exception list instance, passing the appropriate argument values to the svt_data parent class.

log - Sets the log file that is used for status output.

suite_name - Identifies the product suite to which the data object belongs.

randomized_exception - Sets the exception factory used to generate exceptions during randomization.

max_num_exceptions - Sets the maximum number of exceptions generated during randomization.

  function bit
 svt_exception_list::num_exceptions_first_randomize

 (   ) 


Method which randomizes num_exceptions first, before randomizing exceptions. This is done by doing the randomization once to isolate num_exceptions, then again to isolate exceptions.

Return values - Indicates success of the individual randomization phases.

  function void
 svt_exception_list::populate_exceptions

 (   ) 


Populate the exceptions array to insure it is ready for randomization.

  function void
 svt_exception_list::post_randomize

 (   ) 


Cleanup exceptions [] by getting rid of no-op exceptions and sizing to match num_exceptions.

  function void
 svt_exception_list::pre_randomize

 (   ) 


Populate the exceptions array to allow for the randomization.

 virtual function string
 svt_exception_list::psdisplay

 (  string prefix = ""  ) 


 Superseded functions 
 vmm_data :: psdisplay 
 svt_data :: psdisplay 

  function int
 svt_exception_list::reasonable_constraint_mode

 (  bit on_off  ) 


Method to turn reasonable constraints on/off as a block.

 Superseded functions 
 svt_data :: reasonable_constraint_mode 

  function void
 svt_exception_list::remove_collisions

 (   ) 


Method to remove any collisions (i.e., exception vs. exception) present in the list.

  function void
 svt_exception_list::remove_empty_exceptions

 (   ) 


Method used to remove any empty exception slots from the exception list.

  function int
 svt_exception_list::safe_num_exceptions

 (   ) 


This method is used to safely get the current number of exceptions. It basically chooses the smaller of 'num_exceptions' and 'exceptions.size'. Note that this does NOT check that the elements in the exceptions array are non-null.

Return values - Number of exceptions

  function void
 svt_exception_list::set_constraint_weights

 (  int new_weight  ) 


Method to change the exception weights as a block.

  function bit
 svt_exception_list::set_prop_val

 (  string prop_name , bit [1023:0] prop_val , int array_ix  ) 


This method is used by a component's command interface, to allow command code to set the value of a single named property of a data class derived from this class. This method cannot be used to set the value of a sub-object, since sub-object consruction is taken care of automatically by the command interface. If the prop_name argument does not match a property of the class, or it matches a sub-object of the class, or if the array_ix argument is not zero and does not point to a valid array element, this function returns '0'. Otherwise it returns '1'.

prop_name - The name of a property in this class, or a derived class.

prop_val - The value to assign to the property, expressed as a 1024 bit quantity. When assigning a string value each character requires 8 bits so assigned strings must be 128 characters or less.

array_ix - If the property is an array, this argument specifies the index being accessed. If the property is not an array, it should be set to 0.

Return values - A single bit representing whether or not a valid property was set.


 Superseded functions 
 svt_data :: set_prop_val 


Class Parameters Documentation

 type  attribute
 svt_exception_list::T = svt_exception


Member Attribute Documentation

 bit  attribute
 svt_exception_list::data_injected = 0


Flag indicating whether the exceptions have been injected into the transaction

 bit  attribute
 svt_exception_list::enable_combine = 0


Flag which indicates whether these exceptions should be used "as is", or if the component is allowed to combine them with other exceptions that are being introduced from another source. For example this flag can be used to indicate that exceptions coming in with a transaction via the input channel can be combined with randomly generated exceptions produced by an exception factory residing with the component.

Components supporting the use of this field should recognize the ability to combine whether the flag is set on the exception coming in with the transaction or with the exception factory. The combining of exceptions should only be disallowed if BOTH flags are set to 0.

These flags should be reflected in the resulting exception list based on the outcome of AND'ing the values from the combining transactions. As such enable_combine should be set to 1 in the combined exception list if and only if it is set to 1 in both of the exception lists being combined.

When the exception list at one level of the component stack is used to produce exceptions at a lower level of the component stack, this value should be passed down to the lower level exceptions.

 protected bit  attribute
 svt_exception_list::enable_exception_randomize = 1


Flag which is used by num_exceptions_first_randomize to control whether the exceptions are being randomized in the current phase.

 rand T  attribute
 svt_exception_list::exceptions[]


Dynamic array of exceptions.

 int  attribute
 svt_exception_list::EXCEPTION_LIST_EMPTY_wt = 10


Relative (distribution) weight for generating empty exception list.

 int  attribute
 svt_exception_list::EXCEPTION_LIST_LONG_wt = 0


Relative (distribution) weight for generating long (i.e. greater than num_exceptions/2) exception list.

 int  attribute
 svt_exception_list::EXCEPTION_LIST_SHORT_wt = 0


Relative (distribution) weight for generating short (i.e., less than or equal to num_exceptions/2) exception list.

 int  attribute
 svt_exception_list::EXCEPTION_LIST_SINGLE_wt = 1


Relative (distribution) weight for generating singleton exception list.

 int  attribute
 svt_exception_list::max_num_exceptions = 1


Variable to control the maximum number of exceptions which can be generated for a single transaction.

 rand int  attribute
 svt_exception_list::num_exceptions = 0


Random variable defining actual number of exceptions.

 T  attribute
 svt_exception_list::randomized_exception = null


Used to create (i.e., via allocate) new exceptions during exception list randomization.

 static protected svt_exception_list  attribute
 svt_exception_list::__vmm_rhs


Member Constraint Documentation

  constraint
 svt_exception_list::reasonable_num_exceptions


Defines a distribution for randomly generated exception list lengths.

constraint reasonable_num_exceptions {
    if (max_num_exceptions > 3) {
      num_exceptions dist
      {
        0 := EXCEPTION_LIST_EMPTY_wt,
        1 := EXCEPTION_LIST_SINGLE_wt,
        [2:(max_num_exceptions/2)] := EXCEPTION_LIST_SHORT_wt,
        [((max_num_exceptions/2)+1):max_num_exceptions] := EXCEPTION_LIST_LONG_wt
      };
    } else if (max_num_exceptions > 1) {
      num_exceptions dist
      {
        0 := EXCEPTION_LIST_EMPTY_wt,
        1 := EXCEPTION_LIST_SINGLE_wt,
        [2:max_num_exceptions] := EXCEPTION_LIST_SHORT_wt+EXCEPTION_LIST_LONG_wt
      };
    } else {
      num_exceptions dist
      {
        0 := EXCEPTION_LIST_EMPTY_wt,
        1 := EXCEPTION_LIST_SINGLE_wt
      };
    }
  }

  constraint
 svt_exception_list::valid_ranges


Keeps the randomized number of exceptions from exceeding the limit defined by max_num_exceptions.

constraint valid_ranges {
    num_exceptions inside { [0:max_num_exceptions] };
     if (enable_exception_randomize) {
      exceptions.size() == max_num_exceptions;
    } else {
       exceptions.size() == 0;
    }
  }