197 std::unique_ptr<GlobalSyncEvent, DescheduleDeleter> quantum_event;
199 inform(
"Entering event queue @ %d. Starting simulation...\n",
curTick());
209 if (num_cycles != -1) {
224 "Quantum for multi-eventq simulation not specified");
244 assert(global_event);
258 "simulate() limit reached", 0);
300 assert(!eventq->
empty());
302 "event scheduled in the past");
308 std::lock_guard<EventQueue>
lock(*eventq);
332 if (exit_event != NULL) {
This file defines flags used to handle asynchronous simulator events.
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,...
Common base class for GlobalEvent and GlobalSyncEvent.
void reschedule(Tick when)
Queue of events sorted in time order.
void handleAsyncInsertions()
Function for moving events from the async_queue to the main queue.
virtual BaseGlobalEvent * globalEvent()
If this is part of a GlobalEvent, return the pointer to the Global Event.
A special global event that synchronizes all threads and forces them to process asynchronously enqueu...
SimulatorThreads(uint32_t num_queues)
std::vector< std::thread > threads
SimulatorThreads()=delete
SimulatorThreads & operator=(SimulatorThreads &)=delete
void thread_main(EventQueue *queue)
The main function for all subordinate threads (i.e., all threads other than the main thread).
std::atomic< bool > terminate
SimulatorThreads(const SimulatorThreads &)=delete
static const Priority Progress_Event_Pri
Progress events come at the end.
bool empty() const
Returns true if no events are queued.
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
void schedStatEvent(bool dump, bool reset, Tick when, Tick repeat)
Schedule statistics dumping.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Tick simQuantum
Simulation Quantum for multiple eventq simulation.
GlobalSimLoopExitEvent * global_exit_event
Simulate for num_cycles additional cycles.
void set_max_tick(Tick tick)
Set the maximum tick.
volatile bool async_event
Some asynchronous event has happened.
volatile bool async_statdump
Async request to dump stats.
GlobalSimLoopExitEvent * simulate_limit_event
Tick curTick()
The universal simulation clock.
static std::unique_ptr< SimulatorThreads > simulatorThreads
Tick get_max_tick()
Get the maximum simulation tick.
uint64_t Tick
Tick count type.
void exitSimLoop(const std::string &message, int exit_code, Tick when, Tick repeat, bool serialize)
Schedule an event to exit the simulation loop (returning to Python) at the end of the current cycle (...
uint32_t numMainEventQueues
Current number of allocated main event queues.
void terminateEventQueueThreads()
Terminate helper threads when running in parallel mode.
GlobalSimLoopExitEvent * simulate(Tick num_cycles)
volatile bool async_io
Async I/O request (SIGIO).
volatile bool async_exit
Async request to exit simulator.
volatile bool async_statreset
Async request to reset stats.
EventQueue * curEventQueue()
bool inParallelMode
Current mode of execution: parallel / serial.
Event * doSimLoop(EventQueue *)
forward declaration
EventQueue * getEventQueue(uint32_t index)
Function for returning eventq queue for the provided index.
volatile bool async_exception
Python exception.
std::vector< EventQueue * > mainEventQueue
Array for main event queues.
void operator()(BaseGlobalEvent *event)