Álvaro Moreno has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/67697?usp=email )
Change subject: sim: Possible bug found relating simulate function.
......................................................................
sim: Possible bug found relating simulate function.
This commits try to solve an unexpected behaviour
observed related with the RubySystem::MemWriteback
function in RubySystem.cc (lines 241-244).
With te current status of the simulate function
is not possible to validate the assert in
doSimLoop checking that the event queue is not empty.
For solving this problem I tried to reschedule the
event to MaxTick in case of an event being already
in the queue and not num_cycles is specified as
it was done in the previous gem5 version.
Change-Id: I5cd76f1b07040d7e774823d1ec694d9f2eeac89e
---
M src/sim/simulate.cc
1 file changed, 27 insertions(+), 6 deletions(-)
diff --git a/src/sim/simulate.cc b/src/sim/simulate.cc
index 86d516d..b90bb09 100644
--- a/src/sim/simulate.cc
+++ b/src/sim/simulate.cc
@@ -184,12 +184,9 @@
* via the 'set_max_tick' function prior. This function is exported to
Python.
* @return The SimLoopExitEvent that caused the loop to exit.
*/
-GlobalSimLoopExitEvent *global_exit_event= nullptr;
GlobalSimLoopExitEvent *
simulate(Tick num_cycles)
{
- if (global_exit_event)//cleaning last global exit event
- global_exit_event->clean();
std::unique_ptr<GlobalSyncEvent, DescheduleDeleter> quantum_event;
inform("Entering event queue @ %d. Starting simulation...\n",
curTick());
@@ -198,11 +195,16 @@
simulatorThreads.reset(new SimulatorThreads(numMainEventQueues));
if (!simulate_limit_event) {
+
// If the simulate_limit_event is not set, we set it to MaxTick.
set_max_tick(MaxTick);
+ }else if (num_cycles == -1){
+ simulate_limit_event->reschedule(MaxTick);
}
+
if (num_cycles != -1) {
+
// If the user has specified an exit event after X cycles, do so
here.
// Note: This will override any prior set max_tick behaviour (such
as
// that above when it is set to MAxTick).
@@ -212,6 +214,7 @@
// This is kept to `set_max_tick` instead of `schedule_tick_exit`
to
// preserve backwards functionality. It may be better to deprecate
this
// behaviour at some point in favor of `schedule_tick_exit`.
+
set_max_tick(max_tick);
}
@@ -236,10 +239,9 @@
BaseGlobalEvent *global_event = local_event->globalEvent();
assert(global_event);
- global_exit_event =
+ GlobalSimLoopExitEvent *global_exit_event =
dynamic_cast<GlobalSimLoopExitEvent *>(global_event);
assert(global_exit_event);
-
return global_exit_event;
}
@@ -306,7 +308,6 @@
// set the per thread current eventq pointer
curEventQueue(eventq);
eventq->handleAsyncInsertions();
-
while (1) {
// there should always be at least one event (the SimLoopExitEvent
// we just scheduled) in the queue
--
To view, visit
https://gem5-review.googlesource.com/c/public/gem5/+/67697?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I5cd76f1b07040d7e774823d1ec694d9f2eeac89e
Gerrit-Change-Number: 67697
Gerrit-PatchSet: 1
Gerrit-Owner: Álvaro Moreno <gmalvaromor...@gmail.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org