scheduler.hh (12987:97fbdee919d8) | scheduler.hh (13058:da3ffd935b29) |
---|---|
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 | 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. 133 * That's implemented by scheduling an event at the max time with a priority 134 * which is lower than all the others so that it happens only if time would 135 * advance. When that event triggers, it calls the same function as the pause 136 * event. | 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. |
137 */ 138 139class Scheduler 140{ 141 public: 142 Scheduler(); 143 144 const std::string name() const { return "systemc_scheduler"; } --- 129 unchanged lines hidden (view full) --- 274 bool stopped() { return _stopped; } 275 276 private: 277 typedef const EventBase::Priority Priority; 278 static Priority DefaultPriority = EventBase::Default_Pri; 279 280 static Priority StopPriority = DefaultPriority - 1; 281 static Priority PausePriority = DefaultPriority + 1; | 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; |
282 static Priority ReadyPriority = DefaultPriority + 2; | 285 static Priority MaxTickPriority = DefaultPriority + 2; 286 static Priority ReadyPriority = DefaultPriority + 3; |
283 static Priority StarvationPriority = ReadyPriority; | 287 static Priority StarvationPriority = ReadyPriority; |
284 static Priority MaxTickPriority = DefaultPriority + 3; | |
285 286 EventQueue *eq; 287 std::map<Tick, int> pendingTicks; 288 289 void runReady(); 290 EventWrapper<Scheduler, &Scheduler::runReady> readyEvent; 291 void scheduleReadyEvent(); 292 --- 45 unchanged lines hidden --- | 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 --- |