187 GlobalSimLoopExitEvent *
190 std::unique_ptr<GlobalSyncEvent, DescheduleDeleter> quantum_event;
192 inform(
"Entering event queue @ %d. Starting simulation...\n",
curTick());
202 if (num_cycles != -1) {
217 "Quantum for multi-eventq simulation not specified");
234 assert(global_event);
238 assert(global_exit_event);
240 return global_exit_event;
248 "simulate() limit reached", 0);
281 static std::mutex mutex;
283 bool was_set =
false;
310 assert(!eventq->
empty());
312 "event scheduled in the past");
317 std::lock_guard<EventQueue>
lock(*eventq);
341 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
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
SimulatorThreads & operator=(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.
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Tick simQuantum
Simulation Quantum for multiple eventq simulation.
void set_max_tick(Tick tick)
Set the maximum tick.
static bool testAndClearAsyncEvent()
Test and clear the global async_event flag, such that each time the flag is cleared,...
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 (...
EventQueue * curEventQueue()
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)
Simulate for num_cycles additional 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.
bool inParallelMode
Current mode of execution: parallel / serial.
Event * doSimLoop(EventQueue *)
forward declaration
volatile bool async_exception
Python exception.
std::vector< EventQueue * > mainEventQueue
Array for main event queues.
void operator()(BaseGlobalEvent *event)