svt_log_format Class Reference

Inheritance diagram for class svt_log_format:

List of all members.


Detailed Description

This class extension is used by the verification environment to modify the VMM log message format and to add expected error and warning capability to the Pass or Fail calculation.

The message format difference relative to the default vmm_log format is that the first element of each message is the timestamp, which is prefixed by the '@' character. In addition, this modified format supports the ability for the user to choose between the (default) two-line message format, and a single-line message format (which of course results in longer lines. If +single_line_msgs=1 is used on the command line, the custom single-line message format will be used.

There are four accessor methods added to this class to set and get the number of expected errors and warnings. These values, expected_err_cnt and expected_warn_cnt, are used by expected_pass_or_fail and pass_or_fail in calculating the Pass or Fail results.

The class provides the ability to initialize the expected_err_cnt and expected_warn_cnt values from the command line, via plusargs.

If +expected_err_cnt=n is specified on the command line for some integer n, then the expected_err_cnt value is initialized to n. If +expected_warn_cnt=n is specified on the command line for some integer n, then the expected_warn_cnt value is initialized to n.

The class also provides an automated mechanism for watching the vmm_log error count and initiating simulator exit if a client specified unexpected_err_cnt_max is exceeded. Note that if used this feature supercedes the vmm stop_after_n_errors feature.

The class provides the ability to initialize the unexpected_err_cnt_max value from the command line via plusargs. If +unexpected_err_cnt_max=n is specified on the command line for some integer n, then the +unexpected_err_cnt_max=n value is initialized to n.



Public Member Functions

function void  check_err_cnt_exceeded ( string severity )
function string  continue_msg ( string name, string inst, string msg_typ, string severity, ref string lines[$] )
function void  enable_err_cnt_watch ( vmm_log log, int unexpected_err_cnt_max = -1 )
function bit  expected_pass_or_fail ( int fatals, int errors, int warnings )
function string  format_msg ( string name, string inst, string msg_typ, string severity, ref string lines[$] )
function int  get_expected_err_cnt ( )
function int  get_expected_fatal_cnt ( )
function int  get_expected_warn_cnt ( )
function int  get_unexpected_err_cnt_max ( )
function void  incr_expected_err_cnt ( int num = 1 )
function void  incr_expected_fatal_cnt ( int num = 1 )
function void  incr_expected_warn_cnt ( int num = 1 )
function void  new ( )
function string  pass_or_fail ( bit pass, string name, string inst, int fatals, int errors, int warnings, int dem_errs, int dem_warns )
function void  set_unexpected_err_cnt_max ( int new_max )

Public Attributes

event  expected_err_cnt_exceeded 

Protected Attributes

protected int  expected_err_cnt = 0; 
protected int  expected_fatal_cnt = 0; 
protected int  expected_warn_cnt = 0; 
protected vmm_log  log = null; 
protected int  unexpected_err_cnt_max = 10; 


Member Function Documentation

  function void
 svt_log_format::check_err_cnt_exceeded

 (  string severity  ) 


Method used to check whether this message will cause the number of errors to exceed (expected_err_cnt + unexpected_err_cnt_max) has been exceeded. If log != null and this sum has been exceeded the expected_err_cnt_exceeded event is triggered. A client env, subenv, etc., can catch the event to implement an orderly simulation exit.

  function string
 svt_log_format::continue_msg

 (  string name , string inst , string msg_typ , string severity , ref string lines [$]  ) 


This virtual method is overloaded in this class extension to apply a different format (versus the default format used by vmm_log) to continuation lines of an output message.

 Superseded functions 
 vmm_log_format :: continue_msg 

  function void
 svt_log_format::enable_err_cnt_watch

 (  vmm_log log , int unexpected_err_cnt_max = -1  ) 


Enables watch of error counts by the svt_log_format instance. Once enabled, class will produce expected_err_cnt_exceeded event if number of errors exceeds (expected_err_cnt + unexpected_err_cnt_max).

When this feature is enabled it also bumps up the VMM stop_after_n_errs value to avoid conflicts between the VMM automated exit and this automated exit.

log - vmm_log used by the svt_log_format class to watch the error counts.

unexpected_err_cnt_max - Number of "unexpected" errors that should result in the triggering of the expected_err_cnt_exceeded event. If set to -1 this defers to the current unexpected_err_cnt_max setting,

  function bit
 svt_log_format::expected_pass_or_fail

 (  int fatals , int errors , int warnings  ) 


This utility method is provided to make it easy to find out out the current pass/fail situation relative to the 'expected' errors and warnings.

Return values - Indicates pass (1) or fail (0) status of the call.

  function string
 svt_log_format::format_msg

 (  string name , string inst , string msg_typ , string severity , ref string lines [$]  ) 


This virtual method is overloaded in this class extension to apply a different format (versus the default format used by vmm_log) to the first line of an output message.

 Superseded functions 
 vmm_log_format :: format_msg 

  function int
 svt_log_format::get_expected_err_cnt

 (   ) 


Returns the current expected error count.

  function int
 svt_log_format::get_expected_fatal_cnt

 (   ) 


Returns the current expected fatal count (can only be 0 or 1).

  function int
 svt_log_format::get_expected_warn_cnt

 (   ) 


Returns the current expected warning count.

  function int
 svt_log_format::get_unexpected_err_cnt_max

 (   ) 


Returns the current unexpected error count maximum.

  function void
 svt_log_format::incr_expected_err_cnt

 (  int num = 1  ) 


Increments the expected error count by the number passed in.

  function void
 svt_log_format::incr_expected_fatal_cnt

 (  int num = 1  ) 


Increments the expected error count by the number passed in.

  function void
 svt_log_format::incr_expected_warn_cnt

 (  int num = 1  ) 


Increments the expected warning count by the number passed in.

  function void
 svt_log_format::new

 (   ) 


CONSTRUCTOR: Creates a new instance of the svt_log_format class.

  function string
 svt_log_format::pass_or_fail

 (  bit pass , string name , string inst , int fatals , int errors , int warnings , int dem_errs , int dem_warns  ) 


This virtual method is extended to add the 'expected' error and warning counts into account in Pass or Fail calculations.

 Superseded functions 
 vmm_log_format :: pass_or_fail 

  function void
 svt_log_format::set_unexpected_err_cnt_max

 (  int new_max  ) 


Sets the unexpected error count maximum to new_max.

Member Attribute Documentation

 protected int  attribute
 svt_log_format::expected_err_cnt = 0


Maximum number of 'allowed' errors for test to still report "Passed".

 event  attribute
 svt_log_format::expected_err_cnt_exceeded


Event to indicate that the expected_err_count has been exceeded and that the simulation should exit. Only supported if watch_expected_err_cnt enabled in the constructor.

 protected int  attribute
 svt_log_format::expected_fatal_cnt = 0


Maximum number of 'allowed' fatals for test to still report "Passed".

 protected int  attribute
 svt_log_format::expected_warn_cnt = 0


Maximum number of 'allowed' warnings for test to still report "Passed".

 protected vmm_log  attribute
 svt_log_format::log = null


vmm_log that is used by the check_err_cnt_exceeded method to recognize an error failure.

 protected int  attribute
 svt_log_format::unexpected_err_cnt_max = 10


Maximum number of 'unexpected' errors to be allowed before exit.