Inheritance diagram for class svt_exception_list:
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; |
| T | 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 ( ) |
|
||
Method to add a single exception into our exception list. Insures that 'num_exceptions' is updated properly. exception - The exception to be added. |
|
||
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. |
|
||||||
|
|
||||||
|
|
||||||
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. | ||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||
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. | ||||
|
|
||||||
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. | ||||||
|
|
||||||
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. | ||||||
|
|
||||||
|
|
||||||
Extend the copy method to copy the exception_list base class fields.
to - Destination class for the copy operation | ||||||
|
|
||||||
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). | ||||||
|
|
||
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 |
|
||||
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. | ||||
|
|
||
Get the transaction exception factory object.
|
|
||
Method to inject the exceptions into the transaction. Note that if 'data_injected == 1' then the exceptions are NOT injected.
|
|
||||||
|
|
||
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. |
|
||
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. |
|
||
Populate the exceptions array to insure it is ready for randomization.
|
|
||
Cleanup exceptions [] by getting rid of no-op exceptions and sizing to match num_exceptions.
|
|
||
Populate the exceptions array to allow for the randomization.
|
|
||||||
|
|
||||
Method to turn reasonable constraints on/off as a block.
| ||||
|
|
||
Method to remove any collisions (i.e., exception vs. exception) present in the list.
|
|
||
Method used to remove any empty exception slots from the exception list.
|
|
||
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 |
|
||
Method to change the exception weights as a block.
|
|
||||
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. | ||||
|
|
|
Flag indicating whether the exceptions have been injected into the transaction
|
|
|
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. |
|
|
Flag which is used by num_exceptions_first_randomize to control whether the exceptions are being randomized in the current phase.
|
|
|
Dynamic array of exceptions.
|
|
|
Relative (distribution) weight for generating empty exception list.
|
|
|
Relative (distribution) weight for generating long (i.e. greater than num_exceptions/2) exception list.
|
|
|
Relative (distribution) weight for generating short (i.e., less than or equal to num_exceptions/2) exception list.
|
|
|
Relative (distribution) weight for generating singleton exception list.
|
|
|
Variable to control the maximum number of exceptions which can be generated for a single transaction.
|
|
|
Random variable defining actual number of exceptions.
|
|
|
Used to create (i.e., via allocate) new exceptions during exception list randomization.
|
|
|
|
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 }; } } |
|
|
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; } } |