Deleted Added
sdiff udiff text old ( 13053:a7a320144bc1 ) new ( 13059:4be5f408e128 )
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

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

25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 *
27 * Authors: Gabe Black
28 */
29
30#include "systemc/core/kernel.hh"
31
32#include "base/logging.hh"
33#include "systemc/core/module.hh"
34#include "systemc/core/scheduler.hh"
35
36namespace sc_gem5
37{
38
39namespace
40{

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

62
63void
64Kernel::init()
65{
66 status(::sc_core::SC_BEFORE_END_OF_ELABORATION);
67 for (auto m: sc_gem5::allModules) {
68 callbackModule(m);
69 m->sc_mod()->before_end_of_elaboration();
70 }
71 callbackModule(nullptr);
72
73 if (stopAfterCallbacks)
74 stopWork();
75}
76
77void
78Kernel::regStats()
79{
80 for (auto m: sc_gem5::allModules)
81 for (auto p: m->ports)
82 p->_gem5Finalize();
83
84 status(::sc_core::SC_END_OF_ELABORATION);
85 for (auto m: sc_gem5::allModules)
86 m->sc_mod()->end_of_elaboration();
87
88 if (stopAfterCallbacks)
89 stopWork();
90}
91
92void
93Kernel::startup()
94{
95 status(::sc_core::SC_START_OF_SIMULATION);
96 for (auto m: sc_gem5::allModules)
97 m->sc_mod()->start_of_simulation();
98
99 startComplete = true;
100
101 if (stopAfterCallbacks)
102 stopWork();
103
104 kernel->status(::sc_core::SC_RUNNING);
105

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

116 else
117 stopWork();
118}
119
120void
121Kernel::stopWork()
122{
123 status(::sc_core::SC_END_OF_SIMULATION);
124 for (auto m: sc_gem5::allModules)
125 m->sc_mod()->end_of_simulation();
126
127 endComplete = true;
128
129 status(::sc_core::SC_STOPPED);
130
131 if (stopAfterCallbacks)
132 fatal("Simulation called sc_stop during elaboration.\n");
133}

--- 28 unchanged lines hidden ---