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 --- 19 unchanged lines hidden (view full) --- 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/core/sc_main_fiber.hh" |
37#include "systemc/ext/core/messages.hh" 38#include "systemc/ext/core/sc_main.hh" 39#include "systemc/ext/utils/sc_report.hh" 40#include "systemc/ext/utils/sc_report_handler.hh" 41#include "systemc/utils/report.hh" 42#include "systemc/utils/tracefile.hh" 43 44namespace sc_gem5 45{ 46 47Scheduler::Scheduler() : 48 eq(nullptr), readyEvent(this, false, ReadyPriority), 49 pauseEvent(this, false, PausePriority), |
50 stopEvent(this, false, StopPriority), _throwToScMain(nullptr), |
51 starvationEvent(this, false, StarvationPriority), 52 _elaborationDone(false), _started(false), _stopNow(false), 53 _status(StatusOther), maxTickEvent(this, false, MaxTickPriority), 54 timeAdvancesEvent(this, false, TimeAdvancesPriority), _numCycles(0), 55 _changeStamp(0), _current(nullptr), initDone(false), runOnce(false) 56{} 57 58Scheduler::~Scheduler() --- 285 unchanged lines hidden (view full) --- 344} 345 346void 347Scheduler::pause() 348{ 349 status(StatusPaused); 350 kernel->status(::sc_core::SC_PAUSED); 351 runOnce = false; |
352 if (scMainFiber.called() && !scMainFiber.finished()) 353 scMainFiber.run(); |
354} 355 356void 357Scheduler::stop() 358{ 359 status(StatusStopped); 360 kernel->stop(); 361 362 clear(); 363 364 runOnce = false; |
365 if (scMainFiber.called() && !scMainFiber.finished()) 366 scMainFiber.run(); |
367} 368 369void 370Scheduler::start(Tick max_tick, bool run_to_time) 371{ |
372 _started = true; 373 status(StatusOther); 374 runToTime = run_to_time; 375 376 maxTick = max_tick; 377 lastReadyTick = getCurTick(); 378 379 if (initDone) { --- 42 unchanged lines hidden (view full) --- 422} 423 424void 425Scheduler::throwToScMain() 426{ 427 ::sc_core::sc_report report = reportifyException(); 428 _throwToScMain = &report; 429 status(StatusOther); |
430 scMainFiber.run(); |
431} 432 433void 434Scheduler::scheduleStop(bool finish_delta) 435{ 436 if (stopEvent.scheduled()) 437 return; 438 --- 65 unchanged lines hidden --- |