Deleted Added
sdiff udiff text old ( 13077:0037323cb4dd ) new ( 13081:fd1b50840830 )
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

--- 14 unchanged lines hidden (view full) ---

23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 *
27 * Authors: Gabe Black
28 */
29
30#include <cstring>
31
32#include "base/fiber.hh"
33#include "base/logging.hh"
34#include "base/types.hh"
35#include "sim/core.hh"
36#include "sim/eventq.hh"
37#include "sim/init.hh"
38#include "systemc/core/kernel.hh"

--- 13 unchanged lines hidden (view full) ---

52
53bool scMainCalled = false;
54
55int _argc = 0;
56char **_argv = NULL;
57
58class ScMainFiber : public Fiber
59{
60 void
61 main()
62 {
63 if (::sc_main) {
64 ::sc_main(_argc, _argv);
65 // Make sure no systemc events/notifications are scheduled
66 // after sc_main returns.
67 ::sc_gem5::Kernel::scMainFinished(true);
68 ::sc_gem5::scheduler.clear();
69 } else {
70 // If python tries to call sc_main but no sc_main was defined...
71 fatal("sc_main called but not defined.\n");
72 }
73 }
74};

--- 35 unchanged lines hidden (view full) ---

110
111 // At this point we're going to call the c++ sc_main, so we can't try
112 // again later.
113 scMainCalled = true;
114
115 scMainFiber.run();
116}
117
118// Make our sc_main wrapper available in the internal _m5 python module under
119// the systemc submodule.
120
121struct InstallScMain : public ::sc_gem5::PythonInitFunc
122{
123 void
124 run(pybind11::module &systemc) override
125 {
126 systemc.def("sc_main", &sc_main);
127 }
128} installScMain;
129
130sc_stop_mode _stop_mode = SC_STOP_FINISH_DELTA;
131
132} // anonymous namespace
133
134int

--- 181 unchanged lines hidden ---