diff options
Diffstat (limited to 'src/systemc/core/sc_module_name.cc')
-rw-r--r-- | src/systemc/core/sc_module_name.cc | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/systemc/core/sc_module_name.cc b/src/systemc/core/sc_module_name.cc index ca568e2ad..c18c0f9b8 100644 --- a/src/systemc/core/sc_module_name.cc +++ b/src/systemc/core/sc_module_name.cc @@ -30,14 +30,24 @@ #include "base/logging.hh" #include "systemc/core/module.hh" +#include "systemc/core/scheduler.hh" +#include "systemc/ext/core/sc_main.hh" #include "systemc/ext/core/sc_module_name.hh" +#include "systemc/ext/utils/sc_report_handler.hh" namespace sc_core { sc_module_name::sc_module_name(const char *name) : - _name(name), _gem5_module(new sc_gem5::Module(name)), _on_the_stack(true) -{} + _name(name), _gem5_module(nullptr), _on_the_stack(true) +{ + if (sc_is_running()) + SC_REPORT_ERROR("(E529) insert module failed", "simulation running"); + else if (::sc_gem5::scheduler.elaborationDone()) + SC_REPORT_ERROR("(E529) insert module failed", "elaboration done"); + else + _gem5_module = new sc_gem5::Module(name); +} sc_module_name::sc_module_name(const sc_module_name &other) : _name(other._name), _gem5_module(other._gem5_module), _on_the_stack(false) |