Simulation Countdown Timer. More...

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. | |
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.
idv_timer_sim mytimeout; mytimeout = new(50 ns, "timer name"); // set timeout to 100ns, name 'timer name', do not autostart
mytimeout.stop_timer();
mytimeout.start_timer();
mytimeout.stop_timer();
mytimeout.restart_timer();
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.
| 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.
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.
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
| 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.
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
Definition at line 278 of file idv_timer_sim.sv.
| void idv_timer_sim::show | ( | ) |
Show Show the member variable contents.
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
Definition at line 244 of file idv_timer_sim.sv.
| void idv_timer_sim::stop_timer | ( | ) |
| 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.
time idv_timer_sim::m_countdown_time [private] |
Countdown Time - time to countdown from.
Definition at line 98 of file idv_timer_sim.sv.
| string idv_timer_sim::m_name |
Name of this instance of timer - displayed with console messages.
Definition at line 97 of file idv_timer_sim.sv.
event idv_timer_sim::m_reset_timer [private] |
Reset Timer Event - reset to countdown_time.
Definition at line 102 of file idv_timer_sim.sv.
time idv_timer_sim::m_split_time [private] |
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.
bit idv_timer_sim::m_timer_running [protected] |
Timer is Running.
Definition at line 100 of file idv_timer_sim.sv.
![]() 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 Version: 1.6.3 IDV SV Filter Version: 2.6.3 Sat Jun 19 12:14:05 2010 |