summaryrefslogtreecommitdiff
path: root/src/systemc/core/module.cc
diff options
context:
space:
mode:
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