if (scMainDone || stopAfterCallbacks)
return;
- for (auto m: sc_gem5::allModules)
- for (auto p: m->ports)
- p->_gem5Finalize();
-
- status(::sc_core::SC_END_OF_ELABORATION);
- for (auto m: sc_gem5::allModules) {
- callbackModule(m);
- m->sc_mod()->end_of_elaboration();
- for (auto p: m->ports)
- p->end_of_elaboration();
- for (auto e: m->exports)
- e->end_of_elaboration();
+ try {
+ for (auto m: sc_gem5::allModules)
+ for (auto p: m->ports)
+ p->_gem5Finalize();
+
+ status(::sc_core::SC_END_OF_ELABORATION);
+ for (auto m: sc_gem5::allModules) {
+ callbackModule(m);
+ m->sc_mod()->end_of_elaboration();
+ for (auto p: m->ports)
+ p->end_of_elaboration();
+ for (auto e: m->exports)
+ e->end_of_elaboration();
+ }
+ callbackModule(nullptr);
+ for (auto c: sc_gem5::allChannels)
+ c->sc_chan()->end_of_elaboration();
+ } catch (...) {
+ ::sc_gem5::scheduler.throwToScMain();
}
- callbackModule(nullptr);
- for (auto c: sc_gem5::allChannels)
- c->sc_chan()->end_of_elaboration();
+
+ ::sc_gem5::scheduler.elaborationDone(true);
}
void
if (stopAfterCallbacks)
return;
- status(::sc_core::SC_START_OF_SIMULATION);
- for (auto m: sc_gem5::allModules) {
- m->sc_mod()->start_of_simulation();
- for (auto p: m->ports)
- p->start_of_simulation();
- for (auto e: m->exports)
- e->start_of_simulation();
+ try {
+ status(::sc_core::SC_START_OF_SIMULATION);
+ for (auto m: sc_gem5::allModules) {
+ m->sc_mod()->start_of_simulation();
+ for (auto p: m->ports)
+ p->start_of_simulation();
+ for (auto e: m->exports)
+ e->start_of_simulation();
+ }
+ callbackModule(nullptr);
+ for (auto c: sc_gem5::allChannels)
+ c->sc_chan()->start_of_simulation();
+ } catch (...) {
+ ::sc_gem5::scheduler.throwToScMain();
}
- for (auto c: sc_gem5::allChannels)
- c->sc_chan()->start_of_simulation();
startComplete = true;
Kernel::stopWork()
{
status(::sc_core::SC_END_OF_SIMULATION);
- for (auto m: sc_gem5::allModules) {
- m->sc_mod()->end_of_simulation();
- for (auto p: m->ports)
- p->end_of_simulation();
- for (auto e: m->exports)
- e->end_of_simulation();
+ try {
+ for (auto m: sc_gem5::allModules) {
+ m->sc_mod()->end_of_simulation();
+ for (auto p: m->ports)
+ p->end_of_simulation();
+ for (auto e: m->exports)
+ e->end_of_simulation();
+ }
+ callbackModule(nullptr);
+ for (auto c: sc_gem5::allChannels)
+ c->sc_chan()->end_of_simulation();
+ } catch (...) {
+ ::sc_gem5::scheduler.throwToScMain();
}
- for (auto c: sc_gem5::allChannels)
- c->sc_chan()->end_of_simulation();
endComplete = true;