systemc: Add some error checks to the sc_module constructor.

These match error checks which are already in, for instance, the
sc_port constructor.

Change-Id: I8dfb4ce37bf0e59c6fa879f0afda5112af78b40b
Reviewed-on: https://gem5-review.googlesource.com/c/13290
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>
This commit is contained in:
Gabe Black
2018-10-03 16:24:10 -07:00
parent 8946c9d52f
commit 0686b85533

View File

@@ -221,7 +221,16 @@ sc_module::get_child_events() const
sc_module::sc_module() :
sc_object(sc_gem5::newModuleChecked()->name()),
_gem5_module(sc_gem5::currentModule())
{}
{
if (sc_is_running()) {
SC_REPORT_ERROR("(E529) insert module failed", "simulation running");
std::cout << "Running!\n";
}
if (::sc_gem5::scheduler.elaborationDone()) {
SC_REPORT_ERROR("(E529) insert module failed", "elaboration done");
std::cout << "Elaboration done!\n";
}
}
sc_module::sc_module(const sc_module_name &) : sc_module() {}
sc_module::sc_module(const char *_name) : sc_module(sc_module_name(_name))