From: Gabe Black Date: Fri, 5 Oct 2018 23:24:18 +0000 (-0700) Subject: systemc: Add an error check to the deprecated notify_delayed. X-Git-Tag: v19.0.0.0~1520 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=77d9e3bcf3a74fabeed3209bb4ce78e35d1b1f47;p=gem5.git systemc: Add an error check to the deprecated notify_delayed. 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 Maintainer: Gabe Black --- diff --git a/src/systemc/core/event.cc b/src/systemc/core/event.cc index 120b51476..2e356bdb6 100644 --- a/src/systemc/core/event.cc +++ b/src/systemc/core/event.cc @@ -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() { diff --git a/src/systemc/core/event.hh b/src/systemc/core/event.hh index 532d98343..75687729f 100644 --- a/src/systemc/core/event.hh +++ b/src/systemc/core/event.hh @@ -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; diff --git a/src/systemc/core/sc_event.cc b/src/systemc/core/sc_event.cc index 318fea624..b2dc0e525 100644 --- a/src/systemc/core/sc_event.cc +++ b/src/systemc/core/sc_event.cc @@ -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