svt_timer Class Reference

Inheritance diagram for class svt_timer:

List of all members.


Detailed Description

This class provides basic timer capabilities. The client uses this timer to watch for a timeout, after which a notification is generated. If the specified activities occur before the timeout expiry, the client can avoid the timeout by stopping the timer.

The timer also accepts an optional svt_err_check object at construction. If provided, this check instance is used to register a timeout check and to flag successes and failures relative to the timeout check.

The timer is started by calling start_timer with timeout value. The timer is started immediately, and allowed to run until the timer expires or the timer is stopped.

Once the timer has been stopped or has expired, the timer stops execution. In the total absence of activity, the timer will not indicate a timeout condition. The timer must be restarted by a new call to start_timer, or by a call to restart_timer.



Public Member Functions

function void  calibrate ( longint client_ns )
task   do_delay ( real delay_value )
function real  get_expired_time ( )
function real  get_fuse_length ( )
function string  get_instance ( )
function real  get_remaining_time ( )
function real  get_start_time ( )
function real  get_stop_time ( )
function string  get_suite_name ( )
function void  init ( svt_err_check check = null, ovm_report_object reporter = null )
function bit  is_active ( )
function void  new ( string suite_name, string inst, svt_err_check check = null, ovm_report_object reporter = null )
function void  reset ( )
function void  restart_timer ( string reason = "" )
function void  set_instance ( string inst )
function void  set_timeout_sev ( svt_types :: severity_enum sev )
function void  start_finite_timer ( real positive_fuse_value, string reason = "" )
function void  start_infinite_timer ( real positive_fuse_value, string reason = "" )
function void  start_timer ( real positive_fuse_value, string reason = "", bit zero_is_infinite = 1, bit allow_restart = 0 )
function void  stop_timer ( string reason = "" )
task   track_timeout_forever ( )
task   wait_for_timeout ( output bit timed_out )

Public Attributes

ovm_event  EXPIRED 
ovm_report_object  reporter 
ovm_event  STARTED 
ovm_event  STOPPED 
ovm_event  TIMEOUT 
ovm_severity  timeout_sev = OVM_WARNING; 
ovm_verbosity  timeout_verb 

Protected Member Functions

task   main ( bit zero_is_infinite )

Protected Attributes

protected string  suite_name = ""; 


Member Function Documentation

  function void
 svt_timer::calibrate

 (  longint client_ns  ) 


As the SVT library may be accessed by multiple VIP and testbench clients, possibly with timescale settings which differ from each other and/or which differ from the SVT timescale, the svt_timer includes a scaling factor to convert from the client timescale to the SVT timescale.

This method sets the scaling factor for time literal logic. All clients that use svt_timer instances must call this method with a value of '1ns' before using these timers. This calibrates the timers so that they can convert client provided time literal values (i.e., interpreted using the client timescale) into values consistent with the timescale being used by the SVT package.

  task
 svt_timer::do_delay

 (  real delay_value  ) 


Method which actually implements the delay. By default implemented to just do a time unit based celay. Extended classes could override this method to implement cycle or other types of delays.

  function real
 svt_timer::get_expired_time

 (   ) 


If the timer is active, returns the time delta between the current time and the start time. Otherwise returns 0.

  function real
 svt_timer::get_fuse_length

 (   ) 


Returns the current fuse_length.

  function string
 svt_timer::get_instance

 (   ) 


Returns the instance name of this object.

  function real
 svt_timer::get_remaining_time

 (   ) 


If the timer is active, returns the time delta between the current time and the expected stop time. Otherwise returns 0.

  function real
 svt_timer::get_start_time

 (   ) 


If the timer is active, returns the current start time. Otherwise returns 0.

  function real
 svt_timer::get_stop_time

 (   ) 


If the timer is active, returns the current stop time. Otherwise returns 0.

  function string
 svt_timer::get_suite_name

 (   ) 


Returns the suite name associated with the timer.

  function void
 svt_timer::init

 (  svt_err_check check = null, ovm_report_object reporter = null  ) 


Initialize the contents with the provided objects.

check - Provides access to a checker package to track the success/failure of the timer.

reporter - A component through which messages are routed

  function bit
 svt_timer::is_active

 (   ) 


Returns 1 if timer is running, 0 otherwise

 protected task
 svt_timer::main

 (  bit zero_is_infinite  ) 


Block for fuse_length time delay

  function void
 svt_timer::new

 (  string suite_name , string inst , svt_err_check check = null, ovm_report_object reporter = null  ) 


Creates a new instance of this class.

suite_name - A String that identifies the product suite to which the transaction object belongs.

inst - The name of the timer instance, for its logger.

check - Provides access to a checker package to track the success/failure of the timer.

reporter - A component through which messages are routed


 Superseding functions 
 svt_triggered_timer :: new 

  function void
 svt_timer::reset

 (   ) 


Resets the contents of the object.

  function void
 svt_timer::restart_timer

 (  string reason = ""  ) 


Retart the timer, using the current fuse_length, as specified by the most recent call to any of the start_timer methods.

reason - String that describes the reason for the restart, and which is used to indicate the restart reason in the restart messages.

  function void
 svt_timer::set_instance

 (  string inst  ) 


Sets the instance name of this object.

  function void
 svt_timer::set_timeout_sev

 (  svt_types :: severity_enum sev  ) 


Set the message verbosity associated with timer timeout. This method takes care of the methodology specific severity settings.

sev - The severity level to be established.

  function void
 svt_timer::start_finite_timer

 (  real positive_fuse_value , string reason = ""  ) 


Start the timer, setting up a timeout based on positive_fuse_value. For this timer, a positive_fuse_value of 0 results in an immediate timeout.

positive_fuse_value - The timeout time, interpreted by the do_delay method.

reason - String that describes the reason for the start, and which is used to indicate the start reason in the start messages.

  function void
 svt_timer::start_infinite_timer

 (  real positive_fuse_value , string reason = ""  ) 


Start the timer, setting up a timeout based on positive_fuse_value. For this timer, a positive_fuse_value of 0 results in an infinite timeout.

positive_fuse_value - The timeout time, interpreted by the do_delay method.

reason - String that describes the reason for the start, and which is used to indicate the start reason in the start messages.

  function void
 svt_timer::start_timer

 (  real positive_fuse_value , string reason = "", bit zero_is_infinite = 1, bit allow_restart = 0  ) 


Start the timer, setting up a timeout based on positive_fuse_value. If timer is already active and allow_restart is 1 then the positive_fuse_value and zero_is_infinite fields are used to update the state of the timer and then a restart is initiated. If timer is already active and allow_restart is 0 then a warning is generated and the timer is not restarted.

positive_fuse_value - The timeout time, interpreted by the do_delay method.

reason - String that describes the reason for the start, and which is used to indicate the start reason in the start messages.

zero_is_infinite - Indicates whether a positive_fuse_value of zero should be interpreted as an immediate (0) or infinite (1) timeout request.

allow_restart - When set to 1, allow a restart if the timer is already active.


 Superseding functions 
 svt_exit_timer :: start_timer 
 svt_triggered_timer :: start_timer 

  function void
 svt_timer::stop_timer

 (  string reason = ""  ) 


Stop the timer.

reason - String that describes the reason for the stop, and which is used to indicate the stop reason in the stop messages.

  task
 svt_timer::track_timeout_forever

 (   ) 


Method to track a timeout forever, flagging timeouts if and when they occur.

  task
 svt_timer::wait_for_timeout

 (  output bit timed_out  ) 


Watch out for the EXPIRED or STOPPED indication.

timed_out - Indicates whether the method is returning due to a timeout (1) or due to the timer being stopped (0).


Member Attribute Documentation

 ovm_event  attribute
 svt_timer::EXPIRED


Event used to indicate that the timer has expired. The event is an ON_OFF event and is reset whenever the timer is restarted.

 ovm_report_object  attribute
 svt_timer::reporter


Component through which messages are routed.

 ovm_event  attribute
 svt_timer::STARTED


Event used to indicate whether the timer is active. The event is an ON_OFF event.

 ovm_event  attribute
 svt_timer::STOPPED


Event used to indicate that the timer has been stopped. The event is an ON_OFF event and is reset whenever the timer is restarted.

 protected string  attribute
 svt_timer::suite_name = ""


Identifies the product suite with which a derivative class is associated. Can be accessed through 'get_suite_name', but cannot be altered after object creation.

 ovm_event  attribute
 svt_timer::TIMEOUT


Event used to indicating a timeout event. The event is a ONE_SHOT event. A message is also issued, with the severity of the message controlled by the timeout_sev data field.

 ovm_severity  attribute
 svt_timer::timeout_sev = OVM_WARNING


Public data member which can be modified to change the severity of the timeout message when timeout_verb is MEDIUM (i.e., when the timeout message is a 'warning' or 'note' message. Defaults to the severity corresponding to a 'warning' message.

 ovm_verbosity  attribute
 svt_timer::timeout_verb = OVM_MEDIUM


Public data member which can be modified to change the verbosity of the timeout message. Defaults to the verbosity corresponding to a 'warning' or 'note' message.