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 --- 18 unchanged lines hidden (view full) --- 27 * Authors: Gabe Black 28 */ 29 30#include "systemc/core/scheduler.hh" 31 32#include "base/fiber.hh" 33#include "base/logging.hh" 34#include "sim/eventq.hh" |
35#include "systemc/core/kernel.hh" 36#include "systemc/ext/core/sc_main.hh" |
37 38namespace sc_gem5 39{ 40 41Scheduler::Scheduler() : 42 eq(nullptr), readyEvent(this, false, ReadyPriority), 43 pauseEvent(this, false, PausePriority), 44 stopEvent(this, false, StopPriority), --- 126 unchanged lines hidden (view full) --- 171 channel = updateList.getNext(); 172 } 173} 174 175void 176Scheduler::pause() 177{ 178 _paused = true; |
179 kernel->status(::sc_core::SC_PAUSED); |
180 scMain->run(); 181} 182 183void 184Scheduler::stop() 185{ 186 _stopped = true; |
187 kernel->stop(); |
188 scMain->run(); 189} 190 191void 192Scheduler::start(Tick max_tick, bool run_to_time) 193{ 194 // We should be running from sc_main. Keep track of that Fiber to return 195 // to later. 196 scMain = Fiber::currentFiber(); 197 198 _started = true; 199 _paused = false; 200 _stopped = false; 201 202 maxTick = max_tick; 203 |
204 if (initReady) { 205 kernel->status(::sc_core::SC_RUNNING); |
206 eq->schedule(&maxTickEvent, maxTick); |
207 } |
208 209 // Return to gem5 to let it run events, etc. 210 Fiber::primaryFiber()->run(); 211 212 if (pauseEvent.scheduled()) 213 eq->deschedule(&pauseEvent); 214 if (stopEvent.scheduled()) 215 eq->deschedule(&stopEvent); --- 35 unchanged lines hidden --- |