CycleManager Class Reference

yasimavr: CycleManager Class Reference
yasimavr
Loading...
Searching...
No Matches
CycleManager Class Reference

#include <sim_cycle_timer.h>

Classes

struct  TimerSlot
 

Public Member Functions

 CycleManager ()
 
 ~CycleManager ()
 
cycle_count_t cycle () const
 Returns the current cycle.
 
void increment_cycle (cycle_count_t count)
 
void schedule (CycleTimer &timer, cycle_count_t when)
 
void delay (CycleTimer &timer, cycle_count_t d)
 
void cancel (CycleTimer &timer)
 
void pause (CycleTimer &timer)
 
void resume (CycleTimer &timer)
 
void process_timers ()
 
cycle_count_t next_when () const
 
 CycleManager (const CycleManager &)=delete
 
CycleManageroperator= (const CycleManager &)=delete
 

Friends

class CycleTimer
 

Detailed Description

Class to manage the simulation cycle counter and cycle timers

Cycles are meant to represent one cycle of the MCU main clock though the overall cycle-level accuracy of the simulation is not guaranteed. It it a counter guaranteed to start at 0 and always increasing.

Constructor & Destructor Documentation

◆ CycleManager() [1/2]

CycleManager::CycleManager ( )

◆ ~CycleManager()

CycleManager::~CycleManager ( )

◆ CycleManager() [2/2]

CycleManager::CycleManager ( const CycleManager )
delete

Member Function Documentation

◆ cancel()

void CycleManager::cancel ( CycleTimer timer)

Remove a timer from the queue. No-op if the timer is not scheduled.

◆ cycle()

cycle_count_t CycleManager::cycle ( ) const
inline

Returns the current cycle.

◆ delay()

void CycleManager::delay ( CycleTimer timer,
cycle_count_t  delay 
)

Schedule or reschedule a timer for call in 'delay' cycles

Parameters
timertimer to schedule
delaydelay from the current cycle number

◆ increment_cycle()

void CycleManager::increment_cycle ( cycle_count_t  count)

Increment the cycle counter.

◆ next_when()

cycle_count_t CycleManager::next_when ( ) const
Returns
the next cycle at which a timer is scheduled to be called, or INVALID_CYCLE if no timer is scheduled or all scheduled timers are paused.

◆ operator=()

CycleManager & CycleManager::operator= ( const CycleManager )
delete

◆ pause()

void CycleManager::pause ( CycleTimer timer)

Pause a timer.

The timer stays in the queue but won't be called until it's resumed. The remaining delay until the timer 'when' is conserved during the pause.

See also
resume

◆ process_timers()

void CycleManager::process_timers ( )

Process the timers for the current cycle.

◆ resume()

void CycleManager::resume ( CycleTimer timer)

Resume a paused timer.

See also
pause

◆ schedule()

void CycleManager::schedule ( CycleTimer timer,
cycle_count_t  when 
)

Schedule or reschedule a timer for call at 'when'.

Parameters
timertimer to schedule
whenabsolute cycle number when the timer should be called

Friends And Related Symbol Documentation

◆ CycleTimer

friend class CycleTimer
friend

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