idv_timer_sim Class Reference

Simulation Countdown Timer. More...

Inheritance diagram for idv_timer_sim:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 new (time countdown_time, string name="IDV Timer", bit autostart=0)
 Constructor.
void show ()
 Show Show the member variable contents.
void start_timer ()
 Start Timer.
void stop_timer ()
 Stop Timer.
void reset_timer ()
 Reset Timer.
void restart_timer ()
 Restart Timer.
virtual void alarm ()
 Alarm.
virtual void fatal_error (string msg="")
 Fatal Error.

Public Attributes

string m_name
 Name of this instance of timer - displayed with console messages.

Protected Attributes

bit m_timer_running
 Timer is Running.

Private Member Functions

task timer ()
 Timer Task - timer core.

Private Attributes

time m_countdown_time
 Countdown Time - time to countdown from.
time m_split_time
 Split Time - time at stop.
event m_stop_timer
 Stop Timer Event - stop the timer.
event m_reset_timer
 Reset Timer Event - reset to countdown_time.

Detailed Description

Simulation Countdown Timer.

This class is a simulation countdown timer. This timer behaves like an 'egg timer' for simulation time. We say simulation time to differentiate from a 'wall time' countdown timer.
Timer behaves like a stopwatch countdown 'egg timer.' It can started, stopped, restarted (from stopped time), and reset to the initial time.

Usage:
Where to Use:
use anywhere that you want to timeout after a specific amount of simulation time.
For example:
  • set a limit on how long you want you testcase to run by putting a timer in your environment
  • use in a bfm to time out if a specific signal wasn't recieved in time
  • use to do something after the time expires -- by reimplementing the alarm() method in a class that you derive from this class
How to Use:
  • construct the timer: set the amount of time to countdown; and select whether you want the timer to start counting immediately
            idv_timer_sim mytimeout;
            mytimeout = new(50 ns, "timer name"); // set timeout to 100ns, name 'timer name', do not autostart
    
  • stop - stop the timer at its current time
            mytimeout.stop_timer();
    
  • start - start the timer -- continue countdown from where the timer was last stopped
            mytimeout.start_timer();
    
  • reset - reset the timer to the original value
            mytimeout.stop_timer();
    
  • restart - restart the timer; set to the original value and then start the countdown
            mytimeout.restart_timer();
    
  • set a new timeout value -- by constructing a new instance
            mytimeout = new(50 ns, "timer name", 1);  // set timeout to 50 us, name 'timer name' and immediately start countdown timer
    

Definition at line 95 of file idv_timer_sim.sv.


Member Function Documentation

void idv_timer_sim::alarm (  )  [virtual]

Alarm.

Defines what happens when the countdown time expires.
Method defined virtual - so a derived class handle can redefine what happens in the event of an alarm.
For example: if the timer is to be used in a VMM environment - then extend the timer class and redefine this method with a vmm_log and a vmm_fatal or vmm_error call.

Returns:
void

Reimplemented in idv_timer_sim_vmm, idv_watchdog_sim_vmm, and idv_watchdog_sim.

Definition at line 286 of file idv_timer_sim.sv.

void idv_timer_sim::fatal_error ( string  msg = ""  )  [virtual]

Fatal Error.

Defines what happens when a fatal error occurs in the base class (this class).
Method defined virtual - so a derived class handle can redefine what happens in the event of a fatal error.
For example: if the timer is to be used in a VMM environment - then extend the timer class and redefine this method with a vmm_log and a vmm_fatal call.

Returns:
void

Reimplemented in idv_timer_sim_vmm, idv_watchdog_sim_vmm, and idv_watchdog_sim.

Definition at line 294 of file idv_timer_sim.sv.

idv_timer_sim::new ( time  countdown_time,
string  name = "IDV Timer",
bit  autostart = 0 
)

Constructor.

Class Constructor

Parameters:
countdown_time time - Time to countdown from
name string - Name of this instance of timer - displayed with console messages
autostart bit - Start timer on construction (defaults to off)

Reimplemented in idv_timer_sim_vmm.

Definition at line 195 of file idv_timer_sim.sv.

void idv_timer_sim::reset_timer (  ) 

Reset Timer.

Reset the timer.
If the timer is running stop and reset the timer.
If the timer is not running just reset the timer.

Returns:
void

Definition at line 265 of file idv_timer_sim.sv.

void idv_timer_sim::restart_timer (  ) 

Restart Timer.

Restart the Timer
Start the timer over - resets and then starts the timer from the original countdown timme

Returns:
void

Definition at line 278 of file idv_timer_sim.sv.

void idv_timer_sim::show (  ) 

Show Show the member variable contents.

Returns:
void

Definition at line 207 of file idv_timer_sim.sv.

void idv_timer_sim::start_timer (  ) 

Start Timer.

Start the timer - forks off the timer task

Returns:
void

Definition at line 244 of file idv_timer_sim.sv.

void idv_timer_sim::stop_timer (  ) 

Stop Timer.

Stop the timer

Returns:
void

Definition at line 257 of file idv_timer_sim.sv.

task idv_timer_sim::timer (  )  [private]

Timer Task - timer core.

Forks off 3 threads:
1. Countdown timer: counts down and then sounds alarm
2. Thread waiting for stop: stops timer on stop event and stores split time for restart
3. Thread waiting for reset: resets timer on reset event

Definition at line 219 of file idv_timer_sim.sv.


Member Data Documentation

Countdown Time - time to countdown from.

Definition at line 98 of file idv_timer_sim.sv.

Name of this instance of timer - displayed with console messages.

Definition at line 97 of file idv_timer_sim.sv.

Reset Timer Event - reset to countdown_time.

Definition at line 102 of file idv_timer_sim.sv.

Split Time - time at stop.

Definition at line 99 of file idv_timer_sim.sv.

event idv_timer_sim::m_stop_timer [private]

Stop Timer Event - stop the timer.

Definition at line 101 of file idv_timer_sim.sv.

Timer is Running.

Definition at line 100 of file idv_timer_sim.sv.


The documentation for this class was generated from the following file:

Intelligent Design Verification
Intelligent Design Verification
Project: Timers, Revision: 1.1.1
Copyright (c) 2008-2010 Intelligent Design Verification.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included here:
http://www.intelligentdv.com/licenses/fdl.txt
doxygen
Doxygen Version: 1.6.3
IDV SV Filter Version: 2.6.3
Sat Jun 19 12:14:05 2010
Find a documentation bug? Report bugs to: bugs.intelligentdv.com Project: DoxygenFilterSV