diff options
author | Gabe Black <gabeblack@google.com> | 2018-07-18 20:59:56 -0700 |
---|---|---|
committer | Gabe Black <gabeblack@google.com> | 2018-09-05 06:09:21 +0000 |
commit | 743a1b5cdd8e607f2e1bb5ad182047c512eae3f8 (patch) | |
tree | 646432533f331db140547ac1cb4f60feda5928bd /src/systemc/core/sc_main.cc | |
parent | 91a6b128198515a7a29ee766715c9a1fe1bf7b0c (diff) | |
download | gem5-743a1b5cdd8e607f2e1bb5ad182047c512eae3f8.tar.xz |
systemc: Implement pending activity related functions
Track the number of notifications/timeouts that are scheduled at any
given time. This lets us implement sc_pending_activity_at_current_time,
sc_pending_activity_at_future_time, and sc_time_to_pending_activity.
Change-Id: Ia3fcd29bdbfe1a6c77eb52ce4836982d4705263c
Reviewed-on: https://gem5-review.googlesource.com/12032
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'src/systemc/core/sc_main.cc')
-rw-r--r-- | src/systemc/core/sc_main.cc | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/systemc/core/sc_main.cc b/src/systemc/core/sc_main.cc index 120bbf9ae..103b3032f 100644 --- a/src/systemc/core/sc_main.cc +++ b/src/systemc/core/sc_main.cc @@ -140,7 +140,7 @@ sc_argv() void sc_start() { - Tick now = curEventQueue() ? curEventQueue()->getCurTick() : 0; + Tick now = ::sc_gem5::scheduler.getCurTick(); sc_start(sc_time::from_value(MaxTick - now), SC_EXIT_ON_STARVATION); } @@ -156,7 +156,7 @@ sc_start(const sc_time &time, sc_starvation_policy p) { _status = SC_RUNNING; - Tick now = curEventQueue() ? curEventQueue()->getCurTick() : 0; + Tick now = ::sc_gem5::scheduler.getCurTick(); ::sc_gem5::scheduler.start(now + time.value(), p == SC_RUN_TO_TIME); if (::sc_gem5::scheduler.paused()) @@ -200,7 +200,7 @@ const sc_time & sc_time_stamp() { static sc_time tstamp; - Tick tick = sc_gem5::scheduler.eventQueue().getCurTick(); + Tick tick = ::sc_gem5::scheduler.getCurTick(); //XXX We're assuming the systemc time resolution is in ps. tstamp = sc_time::from_value(tick / SimClock::Int::ps); return tstamp; @@ -221,15 +221,13 @@ sc_is_running() bool sc_pending_activity_at_current_time() { - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return false; + return ::sc_gem5::scheduler.pendingCurr(); } bool sc_pending_activity_at_future_time() { - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return false; + return ::sc_gem5::scheduler.pendingFuture(); } bool @@ -242,8 +240,7 @@ sc_pending_activity() sc_time sc_time_to_pending_activity() { - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return sc_time(); + return sc_time::from_value(::sc_gem5::scheduler.timeToPending()); } sc_status |