70 threadBarrier->
wait();
88 static bool threads_initialized =
false;
91 if (!threads_initialized) {
101 threads_initialized =
true;
102 simulate_limit_event =
104 "simulate() limit reached", 0);
107 inform(
"Entering event queue @ %d. Starting simulation...\n",
curTick());
110 num_cycles =
curTick() + num_cycles;
119 fatal(
"Quantum for multi-eventq simulation not specified");
131 threadBarrier->
wait();
133 assert(local_event != NULL);
139 assert(global_event != NULL);
143 assert(global_exit_event != NULL);
146 if (quantum_event != NULL) {
148 delete quantum_event;
151 return global_exit_event;
162 bool was_set =
false;
189 assert(!eventq->
empty());
191 "event scheduled in the past");
196 std::lock_guard<EventQueue>
lock(*eventq);
220 if (exit_event != NULL) {
static const Priority Progress_Event_Pri
Progress events come at the end.
GlobalSimLoopExitEvent * simulate(Tick num_cycles)
Simulate for num_cycles additional cycles.
Barrier * threadBarrier
Global barrier for synchronizing threads entering/exiting the simulation loop.
This file defines flags used to handle asynchronous simulator events.
volatile bool async_exit
Async request to exit simulator.
A special global event that synchronizes all threads and forces them to process asynchronously enqueu...
vector< EventQueue * > mainEventQueue
Array for main event queues.
static void thread_loop(EventQueue *queue)
The main function for all subordinate threads (i.e., all threads other than the main thread)...
std::mutex asyncEventMutex
Mutex for handling async events.
bool inParallelMode
Current mode of execution: parallel / serial.
Tick curTick()
The current simulated tick.
Queue of events sorted in time order.
uint64_t Tick
Tick count type.
virtual BaseGlobalEvent * globalEvent()
If this is part of a GlobalEvent, return the pointer to the Global Event.
EventQueue * curEventQueue()
Event * doSimLoop(EventQueue *)
forward declaration
volatile bool async_exception
Python exception.
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,16,32,64}_t.
volatile bool async_statdump
Async request to dump stats.
void handleAsyncInsertions()
Function for moving events from the async_queue to the main queue.
GlobalSimLoopExitEvent * simulate_limit_event
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 (...
void reschedule(Tick when)
uint32_t numMainEventQueues
Current number of allocated main event queues.
static bool testAndClearAsyncEvent()
Test and clear the global async_event flag, such that each time the flag is cleared, only one thread returns true (and thus is assigned to handle the corresponding async event(s)).
volatile bool async_io
Async I/O request (SIGIO).
volatile bool async_statreset
Async request to reset stats.
void schedStatEvent(bool dump, bool reset, Tick when, Tick repeat)
Schedule statistics dumping.
Common base class for GlobalEvent and GlobalSyncEvent.
volatile bool async_event
Some asynchronous event has happened.
Tick simQuantum
Simulation Quantum for multiple eventq simulation.