systemc: Add an error check to the deprecated notify_delayed.
authorGabe Black <gabeblack@google.com>
Fri, 5 Oct 2018 23:24:18 +0000 (16:24 -0700)
committerGabe Black <gabeblack@google.com>
Tue, 16 Oct 2018 00:58:56 +0000 (00:58 +0000)
This can't override pending notifications like normal notify does.

Change-Id: Ie5f12a97ffdcc3dfca20fa7852f89687ee8bfca3
Reviewed-on: https://gem5-review.googlesource.com/c/13305
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

src/systemc/core/event.cc
src/systemc/core/event.hh
src/systemc/core/sc_event.cc

index 120b51476d2211d48e8164331107d7aa3e65587c..2e356bdb6c66dc9e86f0f923d89d481fddf5ffe8 100644 (file)
@@ -178,6 +178,16 @@ Event::notify(const sc_core::sc_time &t)
     scheduler.schedule(&delayedNotify, t);
 }
 
+void
+Event::notifyDelayed(const sc_core::sc_time &t)
+{
+    if (delayedNotify.scheduled()) {
+        SC_REPORT_ERROR("(E531) notify_delayed() cannot be called on events "
+                "that have pending notifications", "");
+    }
+    notify(t);
+}
+
 void
 Event::cancel()
 {
index 532d983435547cdea44b6fa8035f2c92ef9976b5..75687729fbb659928e03b98a06361055a9f29c8d 100644 (file)
@@ -82,6 +82,7 @@ class Event
     {
         notify(sc_core::sc_time(d, u));
     }
+    void notifyDelayed(const sc_core::sc_time &t);
     void cancel();
 
     bool triggered() const;
index 318fea62452b57b6b33494d166854b7408debc22..b2dc0e5252bbab7079bd486d247439c760dcc505 100644 (file)
@@ -342,8 +342,16 @@ void sc_event::notify(const sc_time &t) { _gem5_event->notify(t); }
 void sc_event::notify(double d, sc_time_unit u) { _gem5_event->notify(d, u); }
 void sc_event::cancel() { _gem5_event->cancel(); }
 bool sc_event::triggered() const { return _gem5_event->triggered(); }
-void sc_event::notify_delayed() { _gem5_event->notify(SC_ZERO_TIME); }
-void sc_event::notify_delayed(const sc_time &t) { _gem5_event->notify(t); }
+void
+sc_event::notify_delayed()
+{
+    _gem5_event->notifyDelayed(SC_ZERO_TIME);
+}
+void
+sc_event::notify_delayed(const sc_time &t)
+{
+    _gem5_event->notifyDelayed(t);
+}
 
 sc_event_and_expr
 sc_event::operator & (const sc_event &e) const