summaryrefslogtreecommitdiff
path: root/src/systemc/core/object.cc
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2018-07-11 20:00:50 -0700
committerGabe Black <gabeblack@google.com>2018-09-05 06:04:46 +0000
commit7b8c8bcaa5dc33cd7432cd3f25077321b09c61c9 (patch)
treed4734cba6d15962384c47392b7d3ed9dd3178873 /src/systemc/core/object.cc
parent7088d69ab5fc70fca4890e0d0169fadd2b19bab8 (diff)
downloadgem5-7b8c8bcaa5dc33cd7432cd3f25077321b09c61c9.tar.xz
systemc: Implement much of events, event lists and event exprs.
Three things aren't yet implemented, waking up processes which are sensitive to the event, triggering of events, and garbage collecting list objects which came from expression objects. The garbage collection aspect is problematic since there doesn't seem to be a correct way to implement it given the constraints in the spec, including the way that's implemented by Accellera. It's something that will need to be dealt with at some point, but in the interest of forward progress it's being ignored for now. Change-Id: Ic4e3c219ff482729f1f1302ab10181a798d48041 Reviewed-on: https://gem5-review.googlesource.com/11711 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'src/systemc/core/object.cc')
-rw-r--r--src/systemc/core/object.cc33
1 files changed, 23 insertions, 10 deletions
diff --git a/src/systemc/core/object.cc b/src/systemc/core/object.cc
index 2bc6804e2..68c52eb06 100644
--- a/src/systemc/core/object.cc
+++ b/src/systemc/core/object.cc
@@ -67,10 +67,10 @@ popObject(Objects *objects, const std::string &name)
} // anonymous namespace
-Object::Object(sc_core::sc_object *sc_obj) : Object(sc_obj, "object") {}
+Object::Object(sc_core::sc_object *_sc_obj) : Object(_sc_obj, "object") {}
-Object::Object(sc_core::sc_object *sc_obj, const char *obj_name) :
- sc_obj(sc_obj), _basename(obj_name), parent(nullptr)
+Object::Object(sc_core::sc_object *_sc_obj, const char *obj_name) :
+ _sc_obj(_sc_obj), _basename(obj_name), parent(nullptr)
{
if (_basename == "")
_basename = "object";
@@ -86,17 +86,17 @@ Object::Object(sc_core::sc_object *sc_obj, const char *obj_name) :
if (p) {
// We're "within" a parent module, ie we're being created while its
// constructor is running.
- parent = p->obj()->sc_obj;
- addObject(&parent->_gem5_object->children, sc_obj);
+ parent = p->obj()->_sc_obj;
+ addObject(&parent->_gem5_object->children, _sc_obj);
} else if (scheduler.current()) {
// Our parent is the currently running process.
parent = scheduler.current();
} else {
// We're a top level object.
- addObject(&topLevelObjects, sc_obj);
+ addObject(&topLevelObjects, _sc_obj);
}
- addObject(&allObjects, sc_obj);
+ addObject(&allObjects, _sc_obj);
_name = _basename;
sc_core::sc_object *sc_p = parent;
@@ -106,8 +106,8 @@ Object::Object(sc_core::sc_object *sc_obj, const char *obj_name) :
}
}
-Object::Object(sc_core::sc_object *sc_obj, const Object &arg) :
- Object(sc_obj, arg._basename.c_str())
+Object::Object(sc_core::sc_object *_sc_obj, const Object &arg) :
+ Object(_sc_obj, arg._basename.c_str())
{}
Object &
@@ -149,7 +149,7 @@ void
Object::dump(std::ostream &out) const
{
out << "name = " << name() << "\n";
- out << "kind = " << sc_obj->kind() << "\n";
+ out << "kind = " << _sc_obj->kind() << "\n";
}
const std::vector<sc_core::sc_object *> &
@@ -218,6 +218,19 @@ Object::simcontext() const
return nullptr;
}
+EventsIt
+Object::addChildEvent(sc_core::sc_event *e)
+{
+ return events.emplace(events.end(), e);
+}
+
+void
+Object::delChildEvent(EventsIt it)
+{
+ std::swap(*it, events.back());
+ events.pop_back();
+}
+
Objects topLevelObjects;
Objects allObjects;