svt_pattern_sequence Class Reference

Inheritance diagram for class svt_pattern_sequence:

List of all members.


Detailed Description

Simple data object that stores a pattern sequence as an array of patterns. This object also provides basic methods for using these array patterns to find pattern sequences in svt_data lists.

The match_sequence and wait_for_match methods supported by svt_pattern_sequence can be used to match the pattern against any set of svt_data instances, simply by providing an iterator which can scan the set of svt_data instances.



Public Member Functions

function void  add_prop ( int pttrn_ix, string name, bit [1023:0] value, int array_ix = 0, bit positive_match = 1 )
function svt_pattern_sequence  allocate ( )
function svt_pattern_sequence  copy ( svt_pattern_sequence to = null )
function void  copy_patterns ( svt_pattern_sequence to, int first_ix = 0, int limit_ix = -1 )
function bit  detail_match ( svt_data data_match[$] )
function void  match_sequence ( svt_data_iter data_iter, ref svt_data data_match[$] )
function void  new ( int pttrn_seq_id = -1, int pttrn_cnt = 0, string pttrn_name = "", vmm_log log = null )
function string  psdisplay ( string prefix = "" )
function void  safe_resize ( int new_size )
task   wait_for_match ( svt_data_iter data_iter, ref svt_data data_match[$] )

Public Attributes

bit  is_subsequence = 0; 
vmm_log  log 
svt_pattern  pttrn [] 
string  pttrn_name = ""; 
int  pttrn_seq_id = -1; 

Protected Member Functions

function void  check_full_match ( svt_data data_match[$], int pttrn_ix, ref bit match, ref bit restart_match )
function string  get_pttrn_seq_uniq_id ( )
function void  process_sub_match ( ref svt_data data_match[$], ref int pttrn_ix, input svt_data curr_data, input svt_data data_sub_match[$] )
function void  setup_match_restart ( svt_data_iter data_iter, ref svt_data data_match[$], ref int pttrn_ix, ref int pttrn_match_cnt, ref bit match, ref bit restart_match )
function svt_pattern_sequence  setup_pattern_sub_sequence ( int first_pttrn_ix )


Member Function Documentation

  function void
 svt_pattern_sequence::add_prop

 (  int pttrn_ix , string name , bit [1023:0] value , int array_ix = 0, bit positive_match = 1  ) 


Method to add a new name/value pair to the indicated pattern.

pttrn_ix - Pattern which is to get the new name/value pair.

name - Name portion of the new name/value pair.

value - Value portion of the new name/value pair.

array_ix - Index into value when value is an array.

positive_match - Indicates whether match (positive_match == 1) or mismatch (positive_match == 0) is desired.

  function svt_pattern_sequence
 svt_pattern_sequence::allocate

 (   ) 


Allocates a new object of same type.

Return values - Returns a newly allocated svt_pattern_sequence instance.

 protected function void
 svt_pattern_sequence::check_full_match

 (  svt_data data_match [$], int pttrn_ix , ref bit match , ref bit restart_match  ) 


Utility method to check for a full sequence match.

data_match - The current matching data.

pttrn_ix - The position of the current match.

match - Indication of the current match.

restart_match - Indication of whether a the match is to be restarted.

  function svt_pattern_sequence
 svt_pattern_sequence::copy

 (  svt_pattern_sequence to = null  ) 


Copies the object into to, allocating if necessay.

to - svt_pattern_sequence object is the destination of the copy. If not provided, copy method will use the allocate method to create an object of the necessary type.

  function void
 svt_pattern_sequence::copy_patterns

 (  svt_pattern_sequence to , int first_ix = 0, int limit_ix = -1  ) 


Copies the sequence of patterns into the provided svt_pattern_sequence.

to - svt_pattern_sequence that the pttrn is copied to.

first_ix - The index at which the copy is to start. Defaults to 0 indicating that the copy should start with the first pttrn array element.

limit_ix - The first index AFTER the last element to be copied. Defaults to -1 indicating that the copy should go from first_ix to the end of the current pttrn array.

  function bit
 svt_pattern_sequence::detail_match

 (  svt_data data_match [$]  ) 


Method called at the end of the match_sequence and wait_for_match pattern match to do additional checks of the original data_match. Can be used by an extended class to impose additional requirements above and beyond the basic pattern match requirements.

data_match - Queue which includes the data objects that made up the pattern match.

 protected function string
 svt_pattern_sequence::get_pttrn_seq_uniq_id

 (   ) 


Utility method used to get a unique identifier string for the pattern sequence.

  function void
 svt_pattern_sequence::match_sequence

 (  svt_data_iter data_iter , ref svt_data data_match [$]  ) 


Method to see if this pattern sequence can be matched against the provided queue of svt_data objects. This method assumes that the data is complete and that it can be fully accessed via the iterator svt_data_iter :: next method.

Does a basic pattern match before calling detail_match to do a final detailed validation of the match. This method will also return if it makes a match or completely fails based on starting at the current position. The client is responsible for setting up and initiating the next match_sequence request.

data_iter - Iterator that will be scanned in search of the pattern sequence.

data_match - If a match was made, this queue includes the data objects that made up the pattern match. If the data_match queue is empty, it indicates the match failed.

  function void
 svt_pattern_sequence::new

 (  int pttrn_seq_id = -1, int pttrn_cnt = 0, string pttrn_name = "", vmm_log log = null  ) 


CONSTRUCTOR: Creates a new instance of the svt_pattern_sequence class.

pttrn_seq_id - Identifier associated with this pattern sequence.

pttrn_cnt - Number of patterns that will be placed in the pattern sequence.

pttrn_name - Name associated with this pattern sequence.

log - Used to replace the default message report object.

 protected function void
 svt_pattern_sequence::process_sub_match

 (  ref svt_data data_match [$], ref int pttrn_ix , input svt_data curr_data , input svt_data data_sub_match [$]  ) 


Utility method to evaluate whether the previous match against a sub-sequence was successful.

data_match - The current matching data.

curr_data - The current data we are reviewing for a match.

data_sub_match - The data matched within the sub-sequence.

pttrn_ix - The position of the current match.

  function string
 svt_pattern_sequence::psdisplay

 (  string prefix = ""  ) 


Displays the contents of the object to a string. Each line of the generated output is preceded by prefix.

prefix - String which specifies a prefix to put at the beginning of each line of output.

  function void
 svt_pattern_sequence::safe_resize

 (  int new_size  ) 


Resizes the pattern array as indicated, loading up the pattern array with svt_pattern instances.

new_size - Number of patterns to include in the array.

 protected function void
 svt_pattern_sequence::setup_match_restart

 (  svt_data_iter data_iter , ref svt_data data_match [$], ref int pttrn_ix , ref int pttrn_match_cnt , ref bit match , ref bit restart_match  ) 


Utility method to set things up for a match restart.

data_iter - Iterator that is being used to do the overall scan in search of the pattern sequence.

data_match - The current matching data.

pttrn_ix - The position of the current match.

pttrn_match_cnt - The patterns within the pattern sequence that have been matched thus far.

match - Indication of the current match.

restart_match - Indication of whether a the match is to be restarted.

 protected function svt_pattern_sequence
 svt_pattern_sequence::setup_pattern_sub_sequence

 (  int first_pttrn_ix  ) 


Utility method for creating a pattern sub-sequence.

first_pttrn_ix - Position where the sub-sequence is to start.

  task
 svt_pattern_sequence::wait_for_match

 (  svt_data_iter data_iter , ref svt_data data_match [$]  ) 


Method to see if this pattern sequence can be matched against the provided queue of svt_data objects. This method assumes that the data is still being generated and that it must rely on the svt_data_iter :: wait_for_next method to recognize when additional data is available to continue the match.

Does a basic pattern match before calling detail_match to do a final detailed validation of the match. This method will also return if it makes a match or completely fails based on starting at the current position. The client is responsible for setting up and initiating the next wait_for_match request.

data_iter - Iterator that will be scanned in search of the pattern sequence.

data_match - If a match was made, this queue includes the data objects that made up the pattern match. If the data_match queue is empty, it indicates the match failed.


Member Attribute Documentation

 bit  attribute
 svt_pattern_sequence::is_subsequence = 0


Indicates if the svt_pattern_sequence is a subsequence and that the match_sequence and wait_for_match calls should therefore limit their actions based on being a subsequence. This includs skipping the detail_match. External clients should set this to 0 to insure normal match_sequence execution.

 vmm_log  attribute
 svt_pattern_sequence::log


Log||Reporter instance may be passed in via constructor.

 svt_pattern  attribute
 svt_pattern_sequence::pttrn[]


Patterns which make up the pattern sequence. Each pattern consists of multiple name/value pairs.

 string  attribute
 svt_pattern_sequence::pttrn_name = ""


Name associated with this pattern sequence

 int  attribute
 svt_pattern_sequence::pttrn_seq_id = -1


Identifier associated with this pattern sequence