diff options
author | Gabe Black <gabeblack@google.com> | 2018-08-27 23:18:18 -0700 |
---|---|---|
committer | Gabe Black <gabeblack@google.com> | 2018-10-03 00:12:18 +0000 |
commit | e731642149c50955efb63b3f255a5112185976dd (patch) | |
tree | 33e7403b6fc87cfa65ab76d98351ee9c286f3631 | |
parent | 3f94dad180a24a0900b1457c06e69e705e357abf (diff) | |
download | gem5-e731642149c50955efb63b3f255a5112185976dd.tar.xz |
systemc: Clamp the time of events to the present.
If systemc attempts to schedule an event in the past, schedule it for
right now instead. Still preserve the difference between delta and
timed events. This scheme doesn't really make a lot of sense (why not
just disallow scheduling events in the past?) but this will approximate
what I think the correct behavior is. What's probably supposed to
happen is that events in the past are executed from most past to most
present until they catch up with now, and then now advances as normal.
Our approach is simpler, but won't preserve ordering between multiple
events scheduled in the past.
Change-Id: I73c1e581c532530178458f044674613a4f4ea3be
Reviewed-on: https://gem5-review.googlesource.com/c/12277
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>
-rw-r--r-- | src/systemc/core/scheduler.hh | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/systemc/core/scheduler.hh b/src/systemc/core/scheduler.hh index ff8434bef..2da8da470 100644 --- a/src/systemc/core/scheduler.hh +++ b/src/systemc/core/scheduler.hh @@ -215,6 +215,9 @@ class Scheduler schedule(ScEvent *event, const ::sc_core::sc_time &delay) { Tick tick = delayed(delay); + if (tick < getCurTick()) + tick = getCurTick(); + event->schedule(tick); // Delta notification/timeout. |