From 0686b8553381caf7ccd4ac7023ce1d419743ca54 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Wed, 3 Oct 2018 16:24:10 -0700 Subject: [PATCH] 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 --- src/systemc/core/sc_module.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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)) -- 2.30.2