Class CycleManager
Defined in File sim_cycle_timer.h
Nested Relationships
Nested Types
Class Documentation
-
class CycleManager
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.
Public Functions
-
CycleManager()
-
~CycleManager()
-
inline cycle_count_t cycle() const
Returns the current cycle.
-
void increment_cycle(cycle_count_t count)
Increment the cycle counter.
-
void schedule(CycleTimer &timer, cycle_count_t when)
Schedule or reschedule a timer for call at ‘when’.
- Parameters:
timer – timer to schedule
when – absolute cycle number when the timer should be called
-
void delay(CycleTimer &timer, cycle_count_t d)
Schedule or reschedule a timer for call in ‘delay’ cycles
- Parameters:
timer – timer to schedule
delay – delay from the current cycle number
-
void cancel(CycleTimer &timer)
Remove a timer from the queue. No-op if the timer is not scheduled.
-
void 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
-
void resume(CycleTimer &timer)
Resume a paused timer.
See also
-
void process_timers()
Process the timers for the current cycle.
-
cycle_count_t 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.
-
CycleManager(const CycleManager&) = delete
-
CycleManager &operator=(const CycleManager&) = delete
-
struct TimerSlot
-
CycleManager()