scheduler.hh (13063:c9905ead0041) scheduler.hh (13067:3d6ef32002ef)
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

--- 151 unchanged lines hidden (view full) ---

160
161 Scheduler();
162
163 const std::string name() const { return "systemc_scheduler"; }
164
165 uint64_t numCycles() { return _numCycles; }
166 Process *current() { return _current; }
167
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

--- 151 unchanged lines hidden (view full) ---

160
161 Scheduler();
162
163 const std::string name() const { return "systemc_scheduler"; }
164
165 uint64_t numCycles() { return _numCycles; }
166 Process *current() { return _current; }
167
168 // Prepare for initialization.
169 void prepareForInit();
168 void initPhase();
170
171 // Register a process with the scheduler.
172 void reg(Process *p);
173
174 // Tell the scheduler not to initialize a process.
175 void dontInitialize(Process *p);
176
177 // Run the next process, if there is one.

--- 43 unchanged lines hidden (view full) ---

221 scheduleReadyEvent();
222 return;
223 }
224
225 // Timed notification/timeout.
226 TimeSlot *&ts = timeSlots[tick];
227 if (!ts) {
228 ts = new TimeSlot;
169
170 // Register a process with the scheduler.
171 void reg(Process *p);
172
173 // Tell the scheduler not to initialize a process.
174 void dontInitialize(Process *p);
175
176 // Run the next process, if there is one.

--- 43 unchanged lines hidden (view full) ---

220 scheduleReadyEvent();
221 return;
222 }
223
224 // Timed notification/timeout.
225 TimeSlot *&ts = timeSlots[tick];
226 if (!ts) {
227 ts = new TimeSlot;
229 if (initReady)
228 if (initDone)
230 eq->schedule(ts, tick);
231 else
232 eventsToSchedule[ts] = tick;
233 }
234 ts->events.insert(event);
235 }
236
237 // For descheduling delayed/timed notifications/timeouts.

--- 13 unchanged lines hidden (view full) ---

251 "Descheduling event at time with no events.");
252 TimeSlot *ts = tsit->second;
253 ScEvents &events = ts->events;
254 events.erase(event);
255 event->deschedule();
256
257 // If no more events are happening at this time slot, get rid of it.
258 if (events.empty()) {
229 eq->schedule(ts, tick);
230 else
231 eventsToSchedule[ts] = tick;
232 }
233 ts->events.insert(event);
234 }
235
236 // For descheduling delayed/timed notifications/timeouts.

--- 13 unchanged lines hidden (view full) ---

250 "Descheduling event at time with no events.");
251 TimeSlot *ts = tsit->second;
252 ScEvents &events = ts->events;
253 events.erase(event);
254 event->deschedule();
255
256 // If no more events are happening at this time slot, get rid of it.
257 if (events.empty()) {
259 if (initReady)
258 if (initDone)
260 eq->deschedule(ts);
261 else
262 eventsToSchedule.erase(ts);
263 timeSlots.erase(tsit);
264 }
265 }
266
267 void

--- 90 unchanged lines hidden (view full) ---

358
359 Tick maxTick;
360 EventWrapper<Scheduler, &Scheduler::pause> maxTickEvent;
361
362 uint64_t _numCycles;
363
364 Process *_current;
365
259 eq->deschedule(ts);
260 else
261 eventsToSchedule.erase(ts);
262 timeSlots.erase(tsit);
263 }
264 }
265
266 void

--- 90 unchanged lines hidden (view full) ---

357
358 Tick maxTick;
359 EventWrapper<Scheduler, &Scheduler::pause> maxTickEvent;
360
361 uint64_t _numCycles;
362
363 Process *_current;
364
366 bool initReady;
365 bool initDone;
367 bool runToTime;
368 bool runOnce;
369
370 ProcessList initList;
371 ProcessList toFinalize;
372 ProcessList readyList;
373
374 ChannelList updateList;

--- 17 unchanged lines hidden ---
366 bool runToTime;
367 bool runOnce;
368
369 ProcessList initList;
370 ProcessList toFinalize;
371 ProcessList readyList;
372
373 ChannelList updateList;

--- 17 unchanged lines hidden ---