sc_main.cc (13312:a7685ffbead8) | sc_main.cc (13317:36c574a4036e) |
---|---|
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 --- 25 unchanged lines hidden (view full) --- 34#include "base/logging.hh" 35#include "base/types.hh" 36#include "sim/core.hh" 37#include "sim/eventq.hh" 38#include "sim/init.hh" 39#include "systemc/core/kernel.hh" 40#include "systemc/core/python.hh" 41#include "systemc/core/scheduler.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 --- 25 unchanged lines hidden (view full) --- 34#include "base/logging.hh" 35#include "base/types.hh" 36#include "sim/core.hh" 37#include "sim/eventq.hh" 38#include "sim/init.hh" 39#include "systemc/core/kernel.hh" 40#include "systemc/core/python.hh" 41#include "systemc/core/scheduler.hh" |
42#include "systemc/ext/core/messages.hh" |
|
42#include "systemc/ext/core/sc_main.hh" 43#include "systemc/ext/utils/sc_report_handler.hh" 44#include "systemc/utils/report.hh" 45 46// A weak symbol to detect if sc_main has been defined, and if so where it is. 47[[gnu::weak]] int sc_main(int argc, char *argv[]); 48 49namespace sc_core --- 148 unchanged lines hidden (view full) --- 198 199void 200sc_start(const sc_time &time, sc_starvation_policy p) 201{ 202 if (time.value() == 0) { 203 ::sc_gem5::scheduler.oneCycle(); 204 } else { 205 Tick now = ::sc_gem5::scheduler.getCurTick(); | 43#include "systemc/ext/core/sc_main.hh" 44#include "systemc/ext/utils/sc_report_handler.hh" 45#include "systemc/utils/report.hh" 46 47// A weak symbol to detect if sc_main has been defined, and if so where it is. 48[[gnu::weak]] int sc_main(int argc, char *argv[]); 49 50namespace sc_core --- 148 unchanged lines hidden (view full) --- 199 200void 201sc_start(const sc_time &time, sc_starvation_policy p) 202{ 203 if (time.value() == 0) { 204 ::sc_gem5::scheduler.oneCycle(); 205 } else { 206 Tick now = ::sc_gem5::scheduler.getCurTick(); |
206 if (MaxTick - now < time.value()) { 207 SC_REPORT_ERROR("(E544) simulation time value overflow, " 208 "simulation aborted", ""); 209 } | 207 if (MaxTick - now < time.value()) 208 SC_REPORT_ERROR(SC_ID_SIMULATION_TIME_OVERFLOW_, ""); |
210 ::sc_gem5::scheduler.start(now + time.value(), p == SC_RUN_TO_TIME); 211 } 212} 213 214void 215sc_set_stop_mode(sc_stop_mode mode) 216{ 217 if (sc_is_running()) { | 209 ::sc_gem5::scheduler.start(now + time.value(), p == SC_RUN_TO_TIME); 210 } 211} 212 213void 214sc_set_stop_mode(sc_stop_mode mode) 215{ 216 if (sc_is_running()) { |
218 SC_REPORT_ERROR("attempt to set sc_stop mode " 219 "after start will be ignored", ""); | 217 SC_REPORT_ERROR(SC_ID_STOP_MODE_AFTER_START_, ""); |
220 return; 221 } 222 _stop_mode = mode; 223} 224 225sc_stop_mode 226sc_get_stop_mode() 227{ 228 return _stop_mode; 229} 230 231void 232sc_stop() 233{ 234 static bool stop_called = false; 235 if (stop_called) { 236 static bool stop_warned = false; 237 if (!stop_warned) | 218 return; 219 } 220 _stop_mode = mode; 221} 222 223sc_stop_mode 224sc_get_stop_mode() 225{ 226 return _stop_mode; 227} 228 229void 230sc_stop() 231{ 232 static bool stop_called = false; 233 if (stop_called) { 234 static bool stop_warned = false; 235 if (!stop_warned) |
238 SC_REPORT_WARNING("(W545) sc_stop has already been called", ""); | 236 SC_REPORT_WARNING(SC_ID_SIMULATION_STOP_CALLED_TWICE_, ""); |
239 stop_warned = true; 240 return; 241 } 242 stop_called = true; 243 244 if (::sc_gem5::Kernel::status() == SC_STOPPED) 245 return; 246 --- 120 unchanged lines hidden --- | 237 stop_warned = true; 238 return; 239 } 240 stop_called = true; 241 242 if (::sc_gem5::Kernel::status() == SC_STOPPED) 243 return; 244 --- 120 unchanged lines hidden --- |