Deleted Added
sdiff udiff text old ( 13068:822c1be3550e ) new ( 13069:d894ba8f881c )
full compact
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

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

72
73 for (auto ets: eventsToSchedule)
74 eq->schedule(ets.first, ets.second);
75 eventsToSchedule.clear();
76
77 if (_started) {
78 if (starved() && !runToTime)
79 scheduleStarvationEvent();
80 eq->schedule(&maxTickEvent, maxTick);
81 }
82
83 initDone = true;
84}
85
86void
87Scheduler::reg(Process *p)
88{

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

148
149 scheduleReadyEvent();
150}
151
152void
153Scheduler::requestUpdate(Channel *c)
154{
155 updateList.pushLast(c);
156 if (eq)
157 scheduleReadyEvent();
158}
159
160void
161Scheduler::scheduleReadyEvent()
162{
163 // Schedule the evaluate and update phases.
164 if (!readyEvent.scheduled()) {
165 panic_if(!eq, "Need to schedule ready, but no event manager.\n");
166 eq->schedule(&readyEvent, eq->getCurTick());
167 if (starvationEvent.scheduled())
168 eq->deschedule(&starvationEvent);
169 }
170}
171
172void
173Scheduler::scheduleStarvationEvent()
174{
175 if (!starvationEvent.scheduled()) {
176 Tick now = getCurTick();
177 if (initDone)
178 eq->schedule(&starvationEvent, now);
179 else
180 eventsToSchedule[&starvationEvent] = now;
181 if (readyEvent.scheduled())
182 eq->deschedule(&readyEvent);
183 }
184}
185
186void
187Scheduler::runReady()
188{
189 bool empty = readyList.empty();
190

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

253 runToTime = run_to_time;
254
255 maxTick = max_tick;
256
257 if (initDone) {
258 if (starved() && !runToTime)
259 scheduleStarvationEvent();
260 kernel->status(::sc_core::SC_RUNNING);
261 eq->schedule(&maxTickEvent, maxTick);
262 }
263
264 // Return to gem5 to let it run events, etc.
265 Fiber::primaryFiber()->run();
266
267 if (pauseEvent.scheduled())
268 eq->deschedule(&pauseEvent);
269 if (stopEvent.scheduled())
270 eq->deschedule(&stopEvent);
271 if (maxTickEvent.scheduled())

--- 46 unchanged lines hidden ---