summaryrefslogtreecommitdiff
path: root/src/systemc/core/module.cc
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2018-07-19 15:51:24 -0700
committerGabe Black <gabeblack@google.com>2018-09-11 21:40:48 +0000
commita6c0e4623c6bb1077ca43c66663e039efb221bda (patch)
tree32054538eab1993856c1c9909c1a3e7c877d2092 /src/systemc/core/module.cc
parent544b136cbfbba53b6d97b763445e9f9b25eb2a7f (diff)
downloadgem5-a6c0e4623c6bb1077ca43c66663e039efb221bda.tar.xz
systemc: Implement the various sc_module stage callbacks.
This change also gets rid of the SystemC namespace which was deprecated in favor of sc_gem5. A few utility functions which check whether certain callbacks have finished were also implemented. status tracking moved from a global variable in sc_main.cc to a member of the kernel simobject. Change-Id: I50967fae9c576fbe45b1faff587aaa824857a289 Reviewed-on: https://gem5-review.googlesource.com/12033 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'src/systemc/core/module.cc')
-rw-r--r--src/systemc/core/module.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/systemc/core/module.cc b/src/systemc/core/module.cc
index 3b7e922e3..e41e93285 100644
--- a/src/systemc/core/module.cc
+++ b/src/systemc/core/module.cc
@@ -51,6 +51,8 @@ Module::Module(const char *name) : _name(name), _sc_mod(nullptr), _obj(nullptr)
_new_module = this;
}
+Module::~Module() { allModules.erase(this); }
+
void
Module::finish(Object *this_obj)
{
@@ -58,6 +60,10 @@ Module::finish(Object *this_obj)
_obj = this_obj;
_modules.push_back(this);
_new_module = nullptr;
+ // This is called from the constructor of this_obj, so it can't use
+ // dynamic cast.
+ sc_mod(static_cast<::sc_core::sc_module *>(this_obj->sc_obj()));
+ allModules.insert(this);
}
void
@@ -84,4 +90,6 @@ newModule()
return _new_module;
}
+std::set<Module *> allModules;
+
} // namespace sc_gem5