sim: Add a mechanism to exit the simulation loop immediately.
authorGabe Black <gabeblack@google.com>
Thu, 14 Feb 2019 09:46:54 +0000 (01:46 -0800)
committerGabe Black <gabeblack@google.com>
Tue, 19 Feb 2019 23:34:05 +0000 (23:34 +0000)
commit598991fda1ee852ef7fa38917e3e2198811fe4f9
tree19ed5c54c3d2a0e6e914665043fb5b0823a134b9
parent150104648f713fcf45a1ea423468948d1dc509fc
sim: Add a mechanism to exit the simulation loop immediately.

There are some cases, specifically when running systemc, that it's
necessary to exit the simulation loop immediately rather than finishing
running events scheduled for the current Tick. When running under
sc_main, sc_stop and sc_pause return control to sc_main which can
happen immediately. When running without sc_main, control needs to
return to the python config script which needs to happen through a
global exit event.

Since sc_pause and sc_stop are supposed to stop simulation without
necessarily letting all the events at the current time run, we need
a way to schedule an exit event with a very high priority (rather than
a very low priority).

This change adds a new exitSimLoopNow function which does that, and
adds a new constructor to the GlobalSimLoopExitEvent which uses that
priority.

Also, a couple of cruft functions from the sim events are removed.

Change-Id: Icfbec17fb10f98084a75740acd839dbf4096fbb3
Reviewed-on: https://gem5-review.googlesource.com/c/16444
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
src/sim/sim_events.cc
src/sim/sim_events.hh
src/sim/sim_exit.hh