scheduler.cc (13076:c9e2a8bfe907) scheduler.cc (13088:05763ab10391)
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

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

65 e->deschedule();
66 deltas.clear();
67
68 // Timed notifications.
69 for (auto &tsp: timeSlots) {
70 TimeSlot *&ts = tsp.second;
71 for (auto &e: ts->events)
72 e->deschedule();
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

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

65 e->deschedule();
66 deltas.clear();
67
68 // Timed notifications.
69 for (auto &tsp: timeSlots) {
70 TimeSlot *&ts = tsp.second;
71 for (auto &e: ts->events)
72 e->deschedule();
73 eq->deschedule(ts);
73 deschedule(ts);
74 }
75 timeSlots.clear();
76
77 // gem5 events.
78 if (readyEvent.scheduled())
74 }
75 timeSlots.clear();
76
77 // gem5 events.
78 if (readyEvent.scheduled())
79 eq->deschedule(&readyEvent);
79 deschedule(&readyEvent);
80 if (pauseEvent.scheduled())
80 if (pauseEvent.scheduled())
81 eq->deschedule(&pauseEvent);
81 deschedule(&pauseEvent);
82 if (stopEvent.scheduled())
82 if (stopEvent.scheduled())
83 eq->deschedule(&stopEvent);
83 deschedule(&stopEvent);
84 if (starvationEvent.scheduled())
84 if (starvationEvent.scheduled())
85 eq->deschedule(&starvationEvent);
85 deschedule(&starvationEvent);
86 if (maxTickEvent.scheduled())
86 if (maxTickEvent.scheduled())
87 eq->deschedule(&maxTickEvent);
87 deschedule(&maxTickEvent);
88
89 Process *p;
90 while ((p = toFinalize.getNext()))
91 p->popListNode();
92 while ((p = initList.getNext()))
93 p->popListNode();
94 while ((p = readyList.getNext()))
95 p->popListNode();

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

307 }
308
309 schedule(&maxTickEvent, maxTick);
310
311 // Return to gem5 to let it run events, etc.
312 Fiber::primaryFiber()->run();
313
314 if (pauseEvent.scheduled())
88
89 Process *p;
90 while ((p = toFinalize.getNext()))
91 p->popListNode();
92 while ((p = initList.getNext()))
93 p->popListNode();
94 while ((p = readyList.getNext()))
95 p->popListNode();

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

307 }
308
309 schedule(&maxTickEvent, maxTick);
310
311 // Return to gem5 to let it run events, etc.
312 Fiber::primaryFiber()->run();
313
314 if (pauseEvent.scheduled())
315 eq->deschedule(&pauseEvent);
315 deschedule(&pauseEvent);
316 if (stopEvent.scheduled())
316 if (stopEvent.scheduled())
317 eq->deschedule(&stopEvent);
317 deschedule(&stopEvent);
318 if (maxTickEvent.scheduled())
318 if (maxTickEvent.scheduled())
319 eq->deschedule(&maxTickEvent);
319 deschedule(&maxTickEvent);
320 if (starvationEvent.scheduled())
320 if (starvationEvent.scheduled())
321 eq->deschedule(&starvationEvent);
321 deschedule(&starvationEvent);
322}
323
324void
325Scheduler::oneCycle()
326{
327 runOnce = true;
328 start(::MaxTick, false);
329}
330
331void
332Scheduler::schedulePause()
333{
334 if (pauseEvent.scheduled())
335 return;
336
322}
323
324void
325Scheduler::oneCycle()
326{
327 runOnce = true;
328 start(::MaxTick, false);
329}
330
331void
332Scheduler::schedulePause()
333{
334 if (pauseEvent.scheduled())
335 return;
336
337 eq->schedule(&pauseEvent, eq->getCurTick());
337 schedule(&pauseEvent);
338}
339
340void
341Scheduler::scheduleStop(bool finish_delta)
342{
343 if (stopEvent.scheduled())
344 return;
345
346 if (!finish_delta) {
347 // If we're not supposed to finish the delta cycle, flush all
348 // pending activity.
349 clear();
350 }
338}
339
340void
341Scheduler::scheduleStop(bool finish_delta)
342{
343 if (stopEvent.scheduled())
344 return;
345
346 if (!finish_delta) {
347 // If we're not supposed to finish the delta cycle, flush all
348 // pending activity.
349 clear();
350 }
351 eq->schedule(&stopEvent, eq->getCurTick());
351 schedule(&stopEvent);
352}
353
354Scheduler scheduler;
355
356} // namespace sc_gem5
352}
353
354Scheduler scheduler;
355
356} // namespace sc_gem5