From 743a1b5cdd8e607f2e1bb5ad182047c512eae3f8 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Wed, 18 Jul 2018 20:59:56 -0700 Subject: 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 Maintainer: Gabe Black --- src/systemc/core/sc_main.cc | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'src/systemc/core/sc_main.cc') 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 -- cgit v1.2.3