Deleted Added
sdiff udiff text old ( 13312:a7685ffbead8 ) new ( 13317:36c574a4036e )
full compact
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"
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();
207 if (MaxTick - now < time.value())
208 SC_REPORT_ERROR(SC_ID_SIMULATION_TIME_OVERFLOW_, "");
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()) {
217 SC_REPORT_ERROR(SC_ID_STOP_MODE_AFTER_START_, "");
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)
236 SC_REPORT_WARNING(SC_ID_SIMULATION_STOP_CALLED_TWICE_, "");
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 ---