Gabe Black has submitted this change and it was merged. (
https://gem5-review.googlesource.com/c/public/gem5/+/12218 )
Change subject: systemc: Make sure sc_start waits for simulation even when
starving.
......................................................................
systemc: Make sure sc_start waits for simulation even when starving.
Even if the simulation would return from sc_start immediately because
of starvation, this change ensures that sc_start gives control back
to gem5 so that the scheduler will have a chance to set up
sensitivities, etc., before things get torn down.
Change-Id: I39b1fd704fcbe12c299cad9dbd30258e8fe9d032
Reviewed-on: https://gem5-review.googlesource.com/12218
Reviewed-by: Gabe Black <[email protected]>
Maintainer: Gabe Black <[email protected]>
---
M src/systemc/core/scheduler.cc
1 file changed, 11 insertions(+), 7 deletions(-)
Approvals:
Gabe Black: Looks good to me, approved; Looks good to me, approved
diff --git a/src/systemc/core/scheduler.cc b/src/systemc/core/scheduler.cc
index 77015dd..e18855c 100644
--- a/src/systemc/core/scheduler.cc
+++ b/src/systemc/core/scheduler.cc
@@ -74,8 +74,11 @@
eq->schedule(ets.first, ets.second);
eventsToSchedule.clear();
- if (_started)
+ if (_started) {
+ if (starved() && !runToTime)
+ scheduleStarvationEvent();
eq->schedule(&maxTickEvent, maxTick);
+ }
initDone = true;
}
@@ -170,9 +173,11 @@
Scheduler::scheduleStarvationEvent()
{
if (!starvationEvent.scheduled()) {
- panic_if(!eq, "Need to schedule starvation event, "
- "but no event manager.\n");
- eq->schedule(&starvationEvent, eq->getCurTick());
+ Tick now = getCurTick();
+ if (initDone)
+ eq->schedule(&starvationEvent, now);
+ else
+ eventsToSchedule[&starvationEvent] = now;
if (readyEvent.scheduled())
eq->deschedule(&readyEvent);
}
@@ -249,10 +254,9 @@
maxTick = max_tick;
- if (starved() && !runToTime)
- return;
-
if (initDone) {
+ if (starved() && !runToTime)
+ scheduleStarvationEvent();
kernel->status(::sc_core::SC_RUNNING);
eq->schedule(&maxTickEvent, maxTick);
}
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12218
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I39b1fd704fcbe12c299cad9dbd30258e8fe9d032
Gerrit-Change-Number: 12218
Gerrit-PatchSet: 11
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: Matthias Jung <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev