summaryrefslogtreecommitdiff
path: root/src/systemc/ext
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/ext
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/ext')
-rw-r--r--src/systemc/ext/core/sc_event.hh62
1 files changed, 62 insertions, 0 deletions
diff --git a/src/systemc/ext/core/sc_event.hh b/src/systemc/ext/core/sc_event.hh
index 0b901ff1e..d037a84bf 100644
--- a/src/systemc/ext/core/sc_event.hh
+++ b/src/systemc/ext/core/sc_event.hh
@@ -30,10 +30,18 @@
#ifndef __SYSTEMC_EXT_CORE_SC_EVENT_HH__
#define __SYSTEMC_EXT_CORE_SC_EVENT_HH__
+#include <set>
#include <vector>
#include "sc_time.hh"
+namespace sc_gem5
+{
+
+class Event;
+
+}
+
namespace sc_core
{
@@ -79,6 +87,7 @@ class sc_event_and_list
sc_event_and_list(const sc_event_and_list &);
sc_event_and_list(const sc_event &);
sc_event_and_list &operator = (const sc_event_and_list &);
+ ~sc_event_and_list();
int size() const;
void swap(sc_event_and_list &);
@@ -88,6 +97,18 @@ class sc_event_and_list
sc_event_and_expr operator & (const sc_event &) const;
sc_event_and_expr operator & (const sc_event_and_list &);
+
+ private:
+ friend class sc_event_and_expr;
+
+ explicit sc_event_and_list(bool auto_delete);
+
+ void insert(sc_event const &e);
+ void insert(sc_event_and_list const &eal);
+
+ std::set<const sc_event *> events;
+ bool autoDelete;
+ mutable unsigned busy;
};
class sc_event_or_list
@@ -107,12 +128,37 @@ class sc_event_or_list
sc_event_or_expr operator | (const sc_event &) const;
sc_event_or_expr operator | (const sc_event_or_list &) const;
+
+ private:
+ friend class sc_event_or_expr;
+
+ explicit sc_event_or_list(bool auto_delete);
+
+ void insert(sc_event const &e);
+ void insert(sc_event_or_list const &eol);
+
+ std::set<const sc_event *> events;
+ bool autoDelete;
+ mutable unsigned busy;
};
class sc_event_and_expr
{
public:
+ sc_event_and_expr(sc_event_and_expr const &e);
operator const sc_event_and_list &() const;
+
+ void insert(sc_event const &e) const;
+ void insert(sc_event_and_list const &eal) const;
+
+ ~sc_event_and_expr();
+
+ private:
+ friend class sc_event_and_list;
+ friend class sc_event;
+
+ sc_event_and_expr();
+ mutable sc_event_and_list *list;
};
sc_event_and_expr operator & (sc_event_and_expr, sc_event const &);
@@ -121,7 +167,20 @@ sc_event_and_expr operator & (sc_event_and_expr, sc_event_and_list const &);
class sc_event_or_expr
{
public:
+ sc_event_or_expr(sc_event_or_expr const &e);
operator const sc_event_or_list &() const;
+
+ void insert(sc_event const &e) const;
+ void insert(sc_event_or_list const &eol) const;
+
+ ~sc_event_or_expr();
+
+ private:
+ friend class sc_event_or_list;
+ friend class sc_event;
+
+ sc_event_or_expr();
+ mutable sc_event_or_list *list;
};
sc_event_or_expr operator | (sc_event_or_expr, sc_event const &);
@@ -161,6 +220,9 @@ class sc_event
// Disabled
sc_event(const sc_event &) {}
sc_event &operator = (const sc_event &) { return *this; }
+
+ friend class ::sc_gem5::Event;
+ ::sc_gem5::Event *_gem5_event;
};
const std::vector<sc_event *> &sc_get_top_level_events();