scheduler.cc (13063:c9905ead0041) scheduler.cc (13064:e06421881cec)
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

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

191 if (starved() && !runToTime)
192 scheduleStarvationEvent();
193
194 // The delta phase.
195 for (auto &e: deltas)
196 e->run();
197 deltas.clear();
198
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

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

191 if (starved() && !runToTime)
192 scheduleStarvationEvent();
193
194 // The delta phase.
195 for (auto &e: deltas)
196 e->run();
197 deltas.clear();
198
199 if (runOnce) {
200 eq->reschedule(&maxTickEvent, eq->getCurTick());
201 runOnce = false;
202 }
199 if (runOnce)
200 schedulePause();
203}
204
205void
206Scheduler::update()
207{
208 Channel *channel = updateList.getNext();
209 while (channel) {
210 channel->popListNode();

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

215
216void
217Scheduler::pause()
218{
219 _paused = true;
220 kernel->status(::sc_core::SC_PAUSED);
221 runOnce = false;
222 scMain->run();
201}
202
203void
204Scheduler::update()
205{
206 Channel *channel = updateList.getNext();
207 while (channel) {
208 channel->popListNode();

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

213
214void
215Scheduler::pause()
216{
217 _paused = true;
218 kernel->status(::sc_core::SC_PAUSED);
219 runOnce = false;
220 scMain->run();
223
224 // If the ready event is supposed to run now, run it inline so that it
225 // preempts any delta notifications which were scheduled while we were
226 // paused.
227 if (readyEvent.scheduled()) {
228 eq->deschedule(&readyEvent);
229 runReady();
230 }
231}
232
233void
234Scheduler::stop()
235{
236 _stopped = true;
237 kernel->stop();
238 runOnce = false;

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

293void
294Scheduler::scheduleStop(bool finish_delta)
295{
296 if (stopEvent.scheduled())
297 return;
298
299 if (!finish_delta) {
300 // If we're not supposed to finish the delta cycle, flush the list
221}
222
223void
224Scheduler::stop()
225{
226 _stopped = true;
227 kernel->stop();
228 runOnce = false;

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

283void
284Scheduler::scheduleStop(bool finish_delta)
285{
286 if (stopEvent.scheduled())
287 return;
288
289 if (!finish_delta) {
290 // If we're not supposed to finish the delta cycle, flush the list
301 // of ready processes and scheduled updates.
291 // of ready processes, scheduled updates, and delta notifications.
302 Process *p;
303 while ((p = readyList.getNext()))
304 p->popListNode();
305 Channel *c;
306 while ((c = updateList.getNext()))
307 c->popListNode();
292 Process *p;
293 while ((p = readyList.getNext()))
294 p->popListNode();
295 Channel *c;
296 while ((c = updateList.getNext()))
297 c->popListNode();
298 for (auto &e: deltas)
299 e->deschedule();
300 deltas.clear();
308 }
309 eq->schedule(&stopEvent, eq->getCurTick());
310}
311
312Scheduler scheduler;
313
314} // namespace sc_gem5
301 }
302 eq->schedule(&stopEvent, eq->getCurTick());
303}
304
305Scheduler scheduler;
306
307} // namespace sc_gem5