1/* 2 * Copyright 2018 Google, Inc. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are 6 * met: redistributions of source code must retain the above copyright 7 * notice, this list of conditions and the following disclaimer; 8 * redistributions in binary form must reproduce the above copyright --- 115 unchanged lines hidden (view full) --- 124 * delta notifications have happened, but after the evaluate and update phases. 125 * For that, a stop event with slightly higher than normal priority will be 126 * scheduled so that it happens before any of the delta notification events 127 * which are at normal priority. 128 * 129 * MAX RUN TIME 130 * 131 * When sc_start is called, it's possible to pass in a maximum time the |
132 * simulation should run to, at which point sc_pause is implicitly called. The 133 * simulation is supposed to run up to the latest timed notification phase 134 * which is less than or equal to the maximum time. In other words it should 135 * run timed notifications at the maximum time, but not the subsequent evaluate 136 * phase. That's implemented by scheduling an event at the max time with a 137 * priority which is lower than all the others except the ready event. Timed 138 * notifications will happen before it fires, but it will override any ready 139 * event and prevent the evaluate phase from starting. |
140 */ 141 142class Scheduler 143{ 144 public: 145 Scheduler(); 146 147 const std::string name() const { return "systemc_scheduler"; } --- 129 unchanged lines hidden (view full) --- 277 bool stopped() { return _stopped; } 278 279 private: 280 typedef const EventBase::Priority Priority; 281 static Priority DefaultPriority = EventBase::Default_Pri; 282 283 static Priority StopPriority = DefaultPriority - 1; 284 static Priority PausePriority = DefaultPriority + 1; |
285 static Priority MaxTickPriority = DefaultPriority + 2; 286 static Priority ReadyPriority = DefaultPriority + 3; |
287 static Priority StarvationPriority = ReadyPriority; |
288 289 EventQueue *eq; 290 std::map<Tick, int> pendingTicks; 291 292 void runReady(); 293 EventWrapper<Scheduler, &Scheduler::runReady> readyEvent; 294 void scheduleReadyEvent(); 295 --- 45 unchanged lines hidden --- |