scheduler.cc revision 13180
112953Sgabeblack@google.com/*
212953Sgabeblack@google.com * Copyright 2018 Google, Inc.
312953Sgabeblack@google.com *
412953Sgabeblack@google.com * Redistribution and use in source and binary forms, with or without
512953Sgabeblack@google.com * modification, are permitted provided that the following conditions are
612953Sgabeblack@google.com * met: redistributions of source code must retain the above copyright
712953Sgabeblack@google.com * notice, this list of conditions and the following disclaimer;
812953Sgabeblack@google.com * redistributions in binary form must reproduce the above copyright
912953Sgabeblack@google.com * notice, this list of conditions and the following disclaimer in the
1012953Sgabeblack@google.com * documentation and/or other materials provided with the distribution;
1112953Sgabeblack@google.com * neither the name of the copyright holders nor the names of its
1212953Sgabeblack@google.com * contributors may be used to endorse or promote products derived from
1312953Sgabeblack@google.com * this software without specific prior written permission.
1412953Sgabeblack@google.com *
1512953Sgabeblack@google.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1612953Sgabeblack@google.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1712953Sgabeblack@google.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1812953Sgabeblack@google.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1912953Sgabeblack@google.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2012953Sgabeblack@google.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2112953Sgabeblack@google.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2212953Sgabeblack@google.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2312953Sgabeblack@google.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2412953Sgabeblack@google.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2512953Sgabeblack@google.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2612953Sgabeblack@google.com *
2712953Sgabeblack@google.com * Authors: Gabe Black
2812953Sgabeblack@google.com */
2912953Sgabeblack@google.com
3012953Sgabeblack@google.com#include "systemc/core/scheduler.hh"
3112953Sgabeblack@google.com
3212953Sgabeblack@google.com#include "base/fiber.hh"
3312954Sgabeblack@google.com#include "base/logging.hh"
3412954Sgabeblack@google.com#include "sim/eventq.hh"
3512982Sgabeblack@google.com#include "systemc/core/kernel.hh"
3612982Sgabeblack@google.com#include "systemc/ext/core/sc_main.hh"
3712953Sgabeblack@google.com
3812953Sgabeblack@google.comnamespace sc_gem5
3912953Sgabeblack@google.com{
4012953Sgabeblack@google.com
4112954Sgabeblack@google.comScheduler::Scheduler() :
4212962Sgabeblack@google.com    eq(nullptr), readyEvent(this, false, ReadyPriority),
4312961Sgabeblack@google.com    pauseEvent(this, false, PausePriority),
4412961Sgabeblack@google.com    stopEvent(this, false, StopPriority),
4512987Sgabeblack@google.com    scMain(nullptr),
4612987Sgabeblack@google.com    starvationEvent(this, false, StarvationPriority),
4713154Sgabeblack@google.com    _started(false), _paused(false), _stopped(false), _stopNow(false),
4812961Sgabeblack@google.com    maxTickEvent(this, false, MaxTickPriority),
4913140Sgabeblack@google.com    _numCycles(0), _changeStamp(0), _current(nullptr), initDone(false),
5013176Sgabeblack@google.com    runOnce(false), readyList(nullptr)
5112954Sgabeblack@google.com{}
5212953Sgabeblack@google.com
5313072Sgabeblack@google.comScheduler::~Scheduler()
5413072Sgabeblack@google.com{
5513072Sgabeblack@google.com    // Clear out everything that belongs to us to make sure nobody tries to
5613072Sgabeblack@google.com    // clear themselves out after the scheduler goes away.
5713076Sgabeblack@google.com    clear();
5813076Sgabeblack@google.com}
5913072Sgabeblack@google.com
6013076Sgabeblack@google.comvoid
6113076Sgabeblack@google.comScheduler::clear()
6213076Sgabeblack@google.com{
6313072Sgabeblack@google.com    // Delta notifications.
6413144Sgabeblack@google.com    while (!deltas.empty())
6513144Sgabeblack@google.com        deltas.front()->deschedule();
6613072Sgabeblack@google.com
6713072Sgabeblack@google.com    // Timed notifications.
6813076Sgabeblack@google.com    for (auto &tsp: timeSlots) {
6913076Sgabeblack@google.com        TimeSlot *&ts = tsp.second;
7013144Sgabeblack@google.com        while (!ts->events.empty())
7113144Sgabeblack@google.com            ts->events.front()->deschedule();
7213088Sgabeblack@google.com        deschedule(ts);
7313072Sgabeblack@google.com    }
7413076Sgabeblack@google.com    timeSlots.clear();
7513072Sgabeblack@google.com
7613072Sgabeblack@google.com    // gem5 events.
7713072Sgabeblack@google.com    if (readyEvent.scheduled())
7813088Sgabeblack@google.com        deschedule(&readyEvent);
7913072Sgabeblack@google.com    if (pauseEvent.scheduled())
8013088Sgabeblack@google.com        deschedule(&pauseEvent);
8113072Sgabeblack@google.com    if (stopEvent.scheduled())
8213088Sgabeblack@google.com        deschedule(&stopEvent);
8313072Sgabeblack@google.com    if (starvationEvent.scheduled())
8413088Sgabeblack@google.com        deschedule(&starvationEvent);
8513072Sgabeblack@google.com    if (maxTickEvent.scheduled())
8613088Sgabeblack@google.com        deschedule(&maxTickEvent);
8713072Sgabeblack@google.com
8813072Sgabeblack@google.com    Process *p;
8913072Sgabeblack@google.com    while ((p = toFinalize.getNext()))
9013072Sgabeblack@google.com        p->popListNode();
9113072Sgabeblack@google.com    while ((p = initList.getNext()))
9213072Sgabeblack@google.com        p->popListNode();
9313176Sgabeblack@google.com    while ((p = readyListMethods.getNext()))
9413176Sgabeblack@google.com        p->popListNode();
9513176Sgabeblack@google.com    while ((p = readyListThreads.getNext()))
9613072Sgabeblack@google.com        p->popListNode();
9713072Sgabeblack@google.com
9813072Sgabeblack@google.com    Channel *c;
9913072Sgabeblack@google.com    while ((c = updateList.getNext()))
10013072Sgabeblack@google.com        c->popListNode();
10113072Sgabeblack@google.com}
10213072Sgabeblack@google.com
10312953Sgabeblack@google.comvoid
10413067Sgabeblack@google.comScheduler::initPhase()
10512953Sgabeblack@google.com{
10612957Sgabeblack@google.com    for (Process *p = toFinalize.getNext(); p; p = toFinalize.getNext()) {
10712957Sgabeblack@google.com        p->finalize();
10812957Sgabeblack@google.com        p->popListNode();
10913180Sgabeblack@google.com
11013180Sgabeblack@google.com        if (!p->hasStaticSensitivities() && !p->internal()) {
11113180Sgabeblack@google.com            SC_REPORT_WARNING(
11213180Sgabeblack@google.com                    "(W558) disable() or dont_initialize() called on process "
11313180Sgabeblack@google.com                    "with no static sensitivity, it will be orphaned",
11413180Sgabeblack@google.com                    p->name());
11513180Sgabeblack@google.com        }
11612957Sgabeblack@google.com    }
11712957Sgabeblack@google.com
11812957Sgabeblack@google.com    for (Process *p = initList.getNext(); p; p = initList.getNext()) {
11912957Sgabeblack@google.com        p->finalize();
12012996Sgabeblack@google.com        p->popListNode();
12112959Sgabeblack@google.com        p->ready();
12212957Sgabeblack@google.com    }
12312957Sgabeblack@google.com
12413067Sgabeblack@google.com    update();
12513067Sgabeblack@google.com
12613144Sgabeblack@google.com    while (!deltas.empty())
12713144Sgabeblack@google.com        deltas.front()->run();
12813067Sgabeblack@google.com
12912985Sgabeblack@google.com    for (auto ets: eventsToSchedule)
13012985Sgabeblack@google.com        eq->schedule(ets.first, ets.second);
13112985Sgabeblack@google.com    eventsToSchedule.clear();
13212985Sgabeblack@google.com
13313068Sgabeblack@google.com    if (_started) {
13413096Sgabeblack@google.com        if (!runToTime && starved())
13513068Sgabeblack@google.com            scheduleStarvationEvent();
13613069Sgabeblack@google.com        kernel->status(::sc_core::SC_RUNNING);
13713068Sgabeblack@google.com    }
13812961Sgabeblack@google.com
13913067Sgabeblack@google.com    initDone = true;
14012957Sgabeblack@google.com}
14112957Sgabeblack@google.com
14212957Sgabeblack@google.comvoid
14312957Sgabeblack@google.comScheduler::reg(Process *p)
14412957Sgabeblack@google.com{
14513067Sgabeblack@google.com    if (initDone) {
14612957Sgabeblack@google.com        // If we're past initialization, finalize static sensitivity.
14712957Sgabeblack@google.com        p->finalize();
14812957Sgabeblack@google.com        // Mark the process as ready.
14912959Sgabeblack@google.com        p->ready();
15012957Sgabeblack@google.com    } else {
15112957Sgabeblack@google.com        // Otherwise, record that this process should be initialized once we
15212957Sgabeblack@google.com        // get there.
15312957Sgabeblack@google.com        initList.pushLast(p);
15412957Sgabeblack@google.com    }
15512957Sgabeblack@google.com}
15612957Sgabeblack@google.com
15712957Sgabeblack@google.comvoid
15812957Sgabeblack@google.comScheduler::dontInitialize(Process *p)
15912957Sgabeblack@google.com{
16013067Sgabeblack@google.com    if (initDone) {
16112957Sgabeblack@google.com        // Pop this process off of the ready list.
16212957Sgabeblack@google.com        p->popListNode();
16312957Sgabeblack@google.com    } else {
16412957Sgabeblack@google.com        // Push this process onto the list of processes which still need
16512957Sgabeblack@google.com        // their static sensitivity to be finalized. That implicitly pops it
16612957Sgabeblack@google.com        // off the list of processes to be initialized/marked ready.
16712957Sgabeblack@google.com        toFinalize.pushLast(p);
16812957Sgabeblack@google.com    }
16912953Sgabeblack@google.com}
17012953Sgabeblack@google.com
17112953Sgabeblack@google.comvoid
17212953Sgabeblack@google.comScheduler::yield()
17312953Sgabeblack@google.com{
17413176Sgabeblack@google.com    // Pull a process from the active list.
17513176Sgabeblack@google.com    _current = readyList->getNext();
17612953Sgabeblack@google.com    if (!_current) {
17712953Sgabeblack@google.com        // There are no more processes, so return control to evaluate.
17812953Sgabeblack@google.com        Fiber::primaryFiber()->run();
17912953Sgabeblack@google.com    } else {
18012953Sgabeblack@google.com        _current->popListNode();
18112953Sgabeblack@google.com        // Switch to whatever Fiber is supposed to run this process. All
18212953Sgabeblack@google.com        // Fibers which aren't running should be parked at this line.
18312953Sgabeblack@google.com        _current->fiber()->run();
18412961Sgabeblack@google.com        // If the current process needs to be manually started, start it.
18513093Sgabeblack@google.com        if (_current && _current->needsStart()) {
18613093Sgabeblack@google.com            _current->needsStart(false);
18712953Sgabeblack@google.com            _current->run();
18813093Sgabeblack@google.com        }
18912953Sgabeblack@google.com    }
19012995Sgabeblack@google.com    if (_current && _current->excWrapper) {
19112995Sgabeblack@google.com        // Make sure this isn't a method process.
19212995Sgabeblack@google.com        assert(!_current->needsStart());
19312995Sgabeblack@google.com        auto ew = _current->excWrapper;
19412995Sgabeblack@google.com        _current->excWrapper = nullptr;
19512995Sgabeblack@google.com        ew->throw_it();
19612995Sgabeblack@google.com    }
19712953Sgabeblack@google.com}
19812953Sgabeblack@google.com
19912953Sgabeblack@google.comvoid
20012954Sgabeblack@google.comScheduler::ready(Process *p)
20112953Sgabeblack@google.com{
20213154Sgabeblack@google.com    if (_stopNow)
20313154Sgabeblack@google.com        return;
20413154Sgabeblack@google.com
20513176Sgabeblack@google.com    if (p->procKind() == ::sc_core::SC_METHOD_PROC_)
20613176Sgabeblack@google.com        readyListMethods.pushLast(p);
20712954Sgabeblack@google.com    else
20813176Sgabeblack@google.com        readyListThreads.pushLast(p);
20912953Sgabeblack@google.com
21012954Sgabeblack@google.com    scheduleReadyEvent();
21112954Sgabeblack@google.com}
21212954Sgabeblack@google.com
21312954Sgabeblack@google.comvoid
21413133Sgabeblack@google.comScheduler::resume(Process *p)
21513133Sgabeblack@google.com{
21613133Sgabeblack@google.com    if (initDone)
21713133Sgabeblack@google.com        ready(p);
21813133Sgabeblack@google.com    else
21913133Sgabeblack@google.com        initList.pushLast(p);
22013133Sgabeblack@google.com}
22113133Sgabeblack@google.com
22213133Sgabeblack@google.combool
22313176Sgabeblack@google.comlistContains(ListNode *list, ListNode *target)
22413176Sgabeblack@google.com{
22513176Sgabeblack@google.com    ListNode *n = list->nextListNode;
22613176Sgabeblack@google.com    while (n != list)
22713176Sgabeblack@google.com        if (n == target)
22813176Sgabeblack@google.com            return true;
22913176Sgabeblack@google.com    return false;
23013176Sgabeblack@google.com}
23113176Sgabeblack@google.com
23213176Sgabeblack@google.combool
23313133Sgabeblack@google.comScheduler::suspend(Process *p)
23413133Sgabeblack@google.com{
23513176Sgabeblack@google.com    bool was_ready;
23613133Sgabeblack@google.com    if (initDone) {
23713133Sgabeblack@google.com        // After initialization, the only list we can be on is the ready list.
23813176Sgabeblack@google.com        was_ready = (p->nextListNode != nullptr);
23913133Sgabeblack@google.com        p->popListNode();
24013133Sgabeblack@google.com    } else {
24113176Sgabeblack@google.com        // Check the ready lists to see if we find this process.
24213176Sgabeblack@google.com        was_ready = listContains(&readyListMethods, p) ||
24313176Sgabeblack@google.com            listContains(&readyListThreads, p);
24413133Sgabeblack@google.com        if (was_ready)
24513133Sgabeblack@google.com            toFinalize.pushLast(p);
24613133Sgabeblack@google.com    }
24713176Sgabeblack@google.com    return was_ready;
24813133Sgabeblack@google.com}
24913133Sgabeblack@google.com
25013133Sgabeblack@google.comvoid
25112954Sgabeblack@google.comScheduler::requestUpdate(Channel *c)
25212954Sgabeblack@google.com{
25312954Sgabeblack@google.com    updateList.pushLast(c);
25413069Sgabeblack@google.com    scheduleReadyEvent();
25512954Sgabeblack@google.com}
25612954Sgabeblack@google.com
25712954Sgabeblack@google.comvoid
25812954Sgabeblack@google.comScheduler::scheduleReadyEvent()
25912954Sgabeblack@google.com{
26012954Sgabeblack@google.com    // Schedule the evaluate and update phases.
26112954Sgabeblack@google.com    if (!readyEvent.scheduled()) {
26213069Sgabeblack@google.com        schedule(&readyEvent);
26312987Sgabeblack@google.com        if (starvationEvent.scheduled())
26413069Sgabeblack@google.com            deschedule(&starvationEvent);
26512987Sgabeblack@google.com    }
26612987Sgabeblack@google.com}
26712987Sgabeblack@google.com
26812987Sgabeblack@google.comvoid
26912987Sgabeblack@google.comScheduler::scheduleStarvationEvent()
27012987Sgabeblack@google.com{
27112987Sgabeblack@google.com    if (!starvationEvent.scheduled()) {
27213069Sgabeblack@google.com        schedule(&starvationEvent);
27312987Sgabeblack@google.com        if (readyEvent.scheduled())
27413069Sgabeblack@google.com            deschedule(&readyEvent);
27512954Sgabeblack@google.com    }
27612954Sgabeblack@google.com}
27712954Sgabeblack@google.com
27812954Sgabeblack@google.comvoid
27912954Sgabeblack@google.comScheduler::runReady()
28012954Sgabeblack@google.com{
28113176Sgabeblack@google.com    bool empty = readyListMethods.empty() && readyListThreads.empty();
28213140Sgabeblack@google.com    lastReadyTick = getCurTick();
28312954Sgabeblack@google.com
28412954Sgabeblack@google.com    // The evaluation phase.
28512953Sgabeblack@google.com    do {
28613176Sgabeblack@google.com        // We run methods and threads in two seperate passes to emulate how
28713176Sgabeblack@google.com        // Accellera orders things, but without having to scan through a
28813176Sgabeblack@google.com        // unified list to find the next process of the correct type.
28913176Sgabeblack@google.com        readyList = &readyListMethods;
29013176Sgabeblack@google.com        while (!readyListMethods.empty())
29113176Sgabeblack@google.com            yield();
29213176Sgabeblack@google.com
29313176Sgabeblack@google.com        readyList = &readyListThreads;
29413176Sgabeblack@google.com        while (!readyListThreads.empty())
29513176Sgabeblack@google.com            yield();
29613176Sgabeblack@google.com
29713176Sgabeblack@google.com        // We already know that readyListThreads is empty at this point.
29813176Sgabeblack@google.com    } while (!readyListMethods.empty());
29912954Sgabeblack@google.com
30013140Sgabeblack@google.com    if (!empty) {
30112954Sgabeblack@google.com        _numCycles++;
30213140Sgabeblack@google.com        _changeStamp++;
30313140Sgabeblack@google.com    }
30412954Sgabeblack@google.com
30513154Sgabeblack@google.com    if (_stopNow)
30613154Sgabeblack@google.com        return;
30713154Sgabeblack@google.com
30812954Sgabeblack@google.com    // The update phase.
30912954Sgabeblack@google.com    update();
31012954Sgabeblack@google.com
31113063Sgabeblack@google.com    // The delta phase.
31213144Sgabeblack@google.com    while (!deltas.empty())
31313144Sgabeblack@google.com        deltas.front()->run();
31413061Sgabeblack@google.com
31513096Sgabeblack@google.com    if (!runToTime && starved())
31613096Sgabeblack@google.com        scheduleStarvationEvent();
31713096Sgabeblack@google.com
31813064Sgabeblack@google.com    if (runOnce)
31913064Sgabeblack@google.com        schedulePause();
32012953Sgabeblack@google.com}
32112953Sgabeblack@google.com
32212953Sgabeblack@google.comvoid
32312953Sgabeblack@google.comScheduler::update()
32412953Sgabeblack@google.com{
32512954Sgabeblack@google.com    Channel *channel = updateList.getNext();
32612954Sgabeblack@google.com    while (channel) {
32712954Sgabeblack@google.com        channel->popListNode();
32812954Sgabeblack@google.com        channel->update();
32912954Sgabeblack@google.com        channel = updateList.getNext();
33012954Sgabeblack@google.com    }
33112953Sgabeblack@google.com}
33212953Sgabeblack@google.com
33312961Sgabeblack@google.comvoid
33412961Sgabeblack@google.comScheduler::pause()
33512961Sgabeblack@google.com{
33612961Sgabeblack@google.com    _paused = true;
33712982Sgabeblack@google.com    kernel->status(::sc_core::SC_PAUSED);
33813061Sgabeblack@google.com    runOnce = false;
33912961Sgabeblack@google.com    scMain->run();
34012961Sgabeblack@google.com}
34112961Sgabeblack@google.com
34212961Sgabeblack@google.comvoid
34312961Sgabeblack@google.comScheduler::stop()
34412961Sgabeblack@google.com{
34512961Sgabeblack@google.com    _stopped = true;
34612982Sgabeblack@google.com    kernel->stop();
34713074Sgabeblack@google.com
34813076Sgabeblack@google.com    clear();
34913074Sgabeblack@google.com
35013061Sgabeblack@google.com    runOnce = false;
35112961Sgabeblack@google.com    scMain->run();
35212961Sgabeblack@google.com}
35312961Sgabeblack@google.com
35412961Sgabeblack@google.comvoid
35512961Sgabeblack@google.comScheduler::start(Tick max_tick, bool run_to_time)
35612961Sgabeblack@google.com{
35712961Sgabeblack@google.com    // We should be running from sc_main. Keep track of that Fiber to return
35812961Sgabeblack@google.com    // to later.
35912961Sgabeblack@google.com    scMain = Fiber::currentFiber();
36012961Sgabeblack@google.com
36112961Sgabeblack@google.com    _started = true;
36212961Sgabeblack@google.com    _paused = false;
36312961Sgabeblack@google.com    _stopped = false;
36412987Sgabeblack@google.com    runToTime = run_to_time;
36512961Sgabeblack@google.com
36612961Sgabeblack@google.com    maxTick = max_tick;
36713140Sgabeblack@google.com    lastReadyTick = getCurTick();
36812961Sgabeblack@google.com
36913067Sgabeblack@google.com    if (initDone) {
37013096Sgabeblack@google.com        if (!runToTime && starved())
37113068Sgabeblack@google.com            scheduleStarvationEvent();
37212982Sgabeblack@google.com        kernel->status(::sc_core::SC_RUNNING);
37312982Sgabeblack@google.com    }
37412961Sgabeblack@google.com
37513069Sgabeblack@google.com    schedule(&maxTickEvent, maxTick);
37613069Sgabeblack@google.com
37712961Sgabeblack@google.com    // Return to gem5 to let it run events, etc.
37812961Sgabeblack@google.com    Fiber::primaryFiber()->run();
37912961Sgabeblack@google.com
38012961Sgabeblack@google.com    if (pauseEvent.scheduled())
38113088Sgabeblack@google.com        deschedule(&pauseEvent);
38212961Sgabeblack@google.com    if (stopEvent.scheduled())
38313088Sgabeblack@google.com        deschedule(&stopEvent);
38412961Sgabeblack@google.com    if (maxTickEvent.scheduled())
38513088Sgabeblack@google.com        deschedule(&maxTickEvent);
38612987Sgabeblack@google.com    if (starvationEvent.scheduled())
38713088Sgabeblack@google.com        deschedule(&starvationEvent);
38812961Sgabeblack@google.com}
38912961Sgabeblack@google.com
39012961Sgabeblack@google.comvoid
39113061Sgabeblack@google.comScheduler::oneCycle()
39213061Sgabeblack@google.com{
39313061Sgabeblack@google.com    runOnce = true;
39413095Sgabeblack@google.com    scheduleReadyEvent();
39513061Sgabeblack@google.com    start(::MaxTick, false);
39613061Sgabeblack@google.com}
39713061Sgabeblack@google.com
39813061Sgabeblack@google.comvoid
39912961Sgabeblack@google.comScheduler::schedulePause()
40012961Sgabeblack@google.com{
40112961Sgabeblack@google.com    if (pauseEvent.scheduled())
40212961Sgabeblack@google.com        return;
40312961Sgabeblack@google.com
40413088Sgabeblack@google.com    schedule(&pauseEvent);
40512961Sgabeblack@google.com}
40612961Sgabeblack@google.com
40712961Sgabeblack@google.comvoid
40812961Sgabeblack@google.comScheduler::scheduleStop(bool finish_delta)
40912961Sgabeblack@google.com{
41012961Sgabeblack@google.com    if (stopEvent.scheduled())
41112961Sgabeblack@google.com        return;
41212961Sgabeblack@google.com
41312961Sgabeblack@google.com    if (!finish_delta) {
41413154Sgabeblack@google.com        _stopNow = true;
41513076Sgabeblack@google.com        // If we're not supposed to finish the delta cycle, flush all
41613076Sgabeblack@google.com        // pending activity.
41713076Sgabeblack@google.com        clear();
41812961Sgabeblack@google.com    }
41913088Sgabeblack@google.com    schedule(&stopEvent);
42012961Sgabeblack@google.com}
42112961Sgabeblack@google.com
42212953Sgabeblack@google.comScheduler scheduler;
42312953Sgabeblack@google.com
42412953Sgabeblack@google.com} // namespace sc_gem5
425