From: Gabe Black Date: Wed, 3 Oct 2018 23:24:10 +0000 (-0700) Subject: systemc: Add some error checks to the sc_module constructor. X-Git-Tag: v19.0.0.0~1535 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0686b8553381caf7ccd4ac7023ce1d419743ca54;p=gem5.git 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 Maintainer: Gabe Black --- diff --git a/src/systemc/core/sc_module.cc b/src/systemc/core/sc_module.cc index 0954805c8..1c3b54b98 100644 --- a/src/systemc/core/sc_module.cc +++ b/src/systemc/core/sc_module.cc @@ -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))