kernel.cc (13188:7af408b60cac) kernel.cc (13191:a2254693aa5b)
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

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

70{
71 if (scMainDone)
72 return;
73
74 if (stopAfterCallbacks)
75 fatal("Simulation called sc_stop during elaboration.\n");
76
77 status(::sc_core::SC_BEFORE_END_OF_ELABORATION);
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

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

70{
71 if (scMainDone)
72 return;
73
74 if (stopAfterCallbacks)
75 fatal("Simulation called sc_stop during elaboration.\n");
76
77 status(::sc_core::SC_BEFORE_END_OF_ELABORATION);
78 for (auto m: sc_gem5::allModules) {
79 callbackModule(m);
80 m->sc_mod()->before_end_of_elaboration();
81 for (auto p: m->ports)
82 p->before_end_of_elaboration();
83 for (auto e: m->exports)
84 e->before_end_of_elaboration();
85 }
86 callbackModule(nullptr);
78 for (auto m: sc_gem5::allModules)
79 m->beforeEndOfElaboration();
87 for (auto c: sc_gem5::allChannels)
88 c->sc_chan()->before_end_of_elaboration();
89}
90
91void
92Kernel::regStats()
93{
94 if (scMainDone || stopAfterCallbacks)
95 return;
96
97 try {
98 for (auto m: sc_gem5::allModules)
99 for (auto p: m->ports)
100 p->_gem5Finalize();
101
102 status(::sc_core::SC_END_OF_ELABORATION);
80 for (auto c: sc_gem5::allChannels)
81 c->sc_chan()->before_end_of_elaboration();
82}
83
84void
85Kernel::regStats()
86{
87 if (scMainDone || stopAfterCallbacks)
88 return;
89
90 try {
91 for (auto m: sc_gem5::allModules)
92 for (auto p: m->ports)
93 p->_gem5Finalize();
94
95 status(::sc_core::SC_END_OF_ELABORATION);
103 for (auto m: sc_gem5::allModules) {
104 callbackModule(m);
105 m->sc_mod()->end_of_elaboration();
106 for (auto p: m->ports)
107 p->end_of_elaboration();
108 for (auto e: m->exports)
109 e->end_of_elaboration();
110 }
111 callbackModule(nullptr);
96 for (auto m: sc_gem5::allModules)
97 m->endOfElaboration();
112 for (auto c: sc_gem5::allChannels)
113 c->sc_chan()->end_of_elaboration();
114 } catch (...) {
115 ::sc_gem5::scheduler.throwToScMain();
116 }
117
118 ::sc_gem5::scheduler.elaborationDone(true);
119}

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

126
127 schedule(t0Event, curTick());
128
129 if (stopAfterCallbacks)
130 return;
131
132 try {
133 status(::sc_core::SC_START_OF_SIMULATION);
98 for (auto c: sc_gem5::allChannels)
99 c->sc_chan()->end_of_elaboration();
100 } catch (...) {
101 ::sc_gem5::scheduler.throwToScMain();
102 }
103
104 ::sc_gem5::scheduler.elaborationDone(true);
105}

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

112
113 schedule(t0Event, curTick());
114
115 if (stopAfterCallbacks)
116 return;
117
118 try {
119 status(::sc_core::SC_START_OF_SIMULATION);
134 for (auto m: sc_gem5::allModules) {
135 m->sc_mod()->start_of_simulation();
136 for (auto p: m->ports)
137 p->start_of_simulation();
138 for (auto e: m->exports)
139 e->start_of_simulation();
140 }
141 callbackModule(nullptr);
120 for (auto m: sc_gem5::allModules)
121 m->startOfSimulation();
142 for (auto c: sc_gem5::allChannels)
143 c->sc_chan()->start_of_simulation();
144 } catch (...) {
145 ::sc_gem5::scheduler.throwToScMain();
146 }
147
148 startComplete = true;
149

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

162 stopWork();
163}
164
165void
166Kernel::stopWork()
167{
168 status(::sc_core::SC_END_OF_SIMULATION);
169 try {
122 for (auto c: sc_gem5::allChannels)
123 c->sc_chan()->start_of_simulation();
124 } catch (...) {
125 ::sc_gem5::scheduler.throwToScMain();
126 }
127
128 startComplete = true;
129

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

142 stopWork();
143}
144
145void
146Kernel::stopWork()
147{
148 status(::sc_core::SC_END_OF_SIMULATION);
149 try {
170 for (auto m: sc_gem5::allModules) {
171 m->sc_mod()->end_of_simulation();
172 for (auto p: m->ports)
173 p->end_of_simulation();
174 for (auto e: m->exports)
175 e->end_of_simulation();
176 }
177 callbackModule(nullptr);
150 for (auto m: sc_gem5::allModules)
151 m->endOfSimulation();
178 for (auto c: sc_gem5::allChannels)
179 c->sc_chan()->end_of_simulation();
180 } catch (...) {
181 ::sc_gem5::scheduler.throwToScMain();
182 }
183
184 endComplete = true;
185

--- 28 unchanged lines hidden ---
152 for (auto c: sc_gem5::allChannels)
153 c->sc_chan()->end_of_simulation();
154 } catch (...) {
155 ::sc_gem5::scheduler.throwToScMain();
156 }
157
158 endComplete = true;
159

--- 28 unchanged lines hidden ---