scheduler.cc (12962:004cc9133bd6) | scheduler.cc (12982:c7966254372e) |
---|---|
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" | 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" |
|
35 36namespace sc_gem5 37{ 38 39Scheduler::Scheduler() : 40 eq(nullptr), readyEvent(this, false, ReadyPriority), 41 pauseEvent(this, false, PausePriority), 42 stopEvent(this, false, StopPriority), --- 126 unchanged lines hidden (view full) --- 169 channel = updateList.getNext(); 170 } 171} 172 173void 174Scheduler::pause() 175{ 176 _paused = true; | 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); |
|
177 scMain->run(); 178} 179 180void 181Scheduler::stop() 182{ 183 _stopped = true; | 180 scMain->run(); 181} 182 183void 184Scheduler::stop() 185{ 186 _stopped = true; |
187 kernel->stop(); |
|
184 scMain->run(); 185} 186 187void 188Scheduler::start(Tick max_tick, bool run_to_time) 189{ 190 // We should be running from sc_main. Keep track of that Fiber to return 191 // to later. 192 scMain = Fiber::currentFiber(); 193 194 _started = true; 195 _paused = false; 196 _stopped = false; 197 198 maxTick = max_tick; 199 | 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 |
200 if (initReady) | 204 if (initReady) { 205 kernel->status(::sc_core::SC_RUNNING); |
201 eq->schedule(&maxTickEvent, maxTick); | 206 eq->schedule(&maxTickEvent, maxTick); |
207 } |
|
202 203 // Return to gem5 to let it run events, etc. 204 Fiber::primaryFiber()->run(); 205 206 if (pauseEvent.scheduled()) 207 eq->deschedule(&pauseEvent); 208 if (stopEvent.scheduled()) 209 eq->deschedule(&stopEvent); --- 35 unchanged lines hidden --- | 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 --- |