Deleted Added
sdiff udiff text old ( 13244:deedec45898f ) new ( 13245:c666c5d4996b )
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

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

43#include "systemc/core/process.hh"
44#include "systemc/core/sched_event.hh"
45
46class Fiber;
47
48namespace sc_gem5
49{
50
51typedef NodeList<Process> ProcessList;
52typedef NodeList<Channel> ChannelList;
53
54/*
55 * The scheduler supports three different mechanisms, the initialization phase,
56 * delta cycles, and timed notifications.
57 *
58 * INITIALIZATION PHASE

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

275 void
276 completeTimeSlot(TimeSlot *ts)
277 {
278 _changeStamp++;
279 assert(ts == timeSlots.begin()->second);
280 timeSlots.erase(timeSlots.begin());
281 if (!runToTime && starved())
282 scheduleStarvationEvent();
283 }
284
285 // Pending activity ignores gem5 activity, much like how a systemc
286 // simulation wouldn't know about asynchronous external events (socket IO
287 // for instance) that might happen before time advances in a pure
288 // systemc simulation. Also the spec lists what specific types of pending
289 // activity needs to be counted, which obviously doesn't include gem5
290 // events.

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

352
353 uint64_t changeStamp() { return _changeStamp; }
354
355 void throwToScMain(const ::sc_core::sc_report *r=nullptr);
356
357 Status status() { return _status; }
358 void status(Status s) { _status = s; }
359
360 private:
361 typedef const EventBase::Priority Priority;
362 static Priority DefaultPriority = EventBase::Default_Pri;
363
364 static Priority StopPriority = DefaultPriority - 1;
365 static Priority PausePriority = DefaultPriority + 1;
366 static Priority MaxTickPriority = DefaultPriority + 2;
367 static Priority ReadyPriority = DefaultPriority + 3;
368 static Priority StarvationPriority = ReadyPriority;
369
370 EventQueue *eq;
371
372 // For gem5 style events.
373 void
374 schedule(::Event *event, Tick tick)
375 {
376 if (initDone)

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

435 maxTickFunc()
436 {
437 if (lastReadyTick != getCurTick())
438 _changeStamp++;
439 pause();
440 }
441 EventWrapper<Scheduler, &Scheduler::maxTickFunc> maxTickEvent;
442
443 uint64_t _numCycles;
444 uint64_t _changeStamp;
445
446 Process *_current;
447
448 bool initDone;
449 bool runToTime;
450 bool runOnce;
451
452 ProcessList initList;
453
454 ProcessList readyListMethods;
455 ProcessList readyListThreads;
456
457 ChannelList updateList;
458
459 std::map<::Event *, Tick> eventsToSchedule;
460};
461
462extern Scheduler scheduler;
463
464inline void
465Scheduler::TimeSlot::process()
466{
467 scheduler.status(StatusTiming);

--- 21 unchanged lines hidden ---