Deleted Added
sdiff udiff text old ( 13154:f86c71dac456 ) new ( 13176:76f52e8d8c6a )
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

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

192
193 // Schedule an update for a given channel.
194 void requestUpdate(Channel *c);
195
196 // Run the given process immediately, preempting whatever may be running.
197 void
198 runNow(Process *p)
199 {
200 // If a process is running, schedule it/us to run again.
201 if (_current)
202 readyList.pushFirst(_current);
203 // Schedule p to run first.
204 readyList.pushFirst(p);
205 yield();
206 }
207
208 // Set an event queue for scheduling events.
209 void setEventQueue(EventQueue *_eq) { eq = _eq; }
210
211 // Get the current time according to gem5.
212 Tick getCurTick() { return eq ? eq->getCurTick() : 0; }

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

285 // systemc simulation. Also the spec lists what specific types of pending
286 // activity needs to be counted, which obviously doesn't include gem5
287 // events.
288
289 // Return whether there's pending systemc activity at this time.
290 bool
291 pendingCurr()
292 {
293 return !readyList.empty() || !updateList.empty() || !deltas.empty();
294 }
295
296 // Return whether there are pending timed notifications or timeouts.
297 bool
298 pendingFuture()
299 {
300 return !timeSlots.empty();
301 }

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

371 void stop();
372 EventWrapper<Scheduler, &Scheduler::pause> pauseEvent;
373 EventWrapper<Scheduler, &Scheduler::stop> stopEvent;
374 Fiber *scMain;
375
376 bool
377 starved()
378 {
379 return (readyList.empty() && updateList.empty() && deltas.empty() &&
380 (timeSlots.empty() || timeSlots.begin()->first > maxTick) &&
381 initList.empty());
382 }
383 EventWrapper<Scheduler, &Scheduler::pause> starvationEvent;
384 void scheduleStarvationEvent();
385
386 bool _started;
387 bool _paused;

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

405 Process *_current;
406
407 bool initDone;
408 bool runToTime;
409 bool runOnce;
410
411 ProcessList initList;
412 ProcessList toFinalize;
413 ProcessList readyList;
414
415 ChannelList updateList;
416
417 std::map<::Event *, Tick> eventsToSchedule;
418};
419
420extern Scheduler scheduler;
421
422inline void
423Scheduler::TimeSlot::process()
424{
425 while (!events.empty())
426 events.front()->run();
427 scheduler.completeTimeSlot(this);
428}
429
430} // namespace sc_gem5
431
432#endif // __SYSTEMC_CORE_SCHEDULER_H__