changeset b20a1364e019 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=b20a1364e019
description:
        misc: Clean up and complete the gem5<->SystemC-TLM bridge [10/10]

        The current TLM bridge only provides a Slave Port that allows the gem5
        world to send request to the SystemC world. This patch series refractors
        and cleans up the existing code, and adds a Master Port that allows the
        SystemC world to send requests to the gem5 world.

        This patch:
          * Add callbacks for the Gem5SimControl that are called at before and
          * after simulate()

        Reviewed at http://reviews.gem5.org/r/3799/

        Signed-off-by: Jason Lowe-Power <[email protected]>

diffstat:

 util/tlm/sim_control.cc |   6 ++++++
 util/tlm/sim_control.hh |  16 ++++++++++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)

diffs (49 lines):

diff -r 2a5b4e334f7d -r b20a1364e019 util/tlm/sim_control.cc
--- a/util/tlm/sim_control.cc   Thu Feb 09 19:15:48 2017 -0500
+++ b/util/tlm/sim_control.cc   Thu Feb 09 19:15:51 2017 -0500
@@ -152,6 +152,9 @@
 void
 Gem5SimControl::run()
 {
+    // notify callback
+    beforeSimulate();
+
     GlobalSimLoopExitEvent *exit_event = NULL;
 
     if (simulationEnd == 0) {
@@ -165,6 +168,9 @@
 
     getEventQueue(0)->dump();
 
+    // notify callback
+    afterSimulate();
+
 #if TRY_CLEAN_DELETE
     config_manager->deleteObjects();
 #endif
diff -r 2a5b4e334f7d -r b20a1364e019 util/tlm/sim_control.hh
--- a/util/tlm/sim_control.hh   Thu Feb 09 19:15:48 2017 -0500
+++ b/util/tlm/sim_control.hh   Thu Feb 09 19:15:51 2017 -0500
@@ -77,6 +77,22 @@
     /// Pointer to a previously created instance.
     static Gem5SimControl* instance;
 
+    /** A callback that is called from the run thread before gem5 simulation is
+     * started.
+     *
+     * A derived class may use this to perform any additional initializations
+     * prior simulation.
+     */
+    virtual void beforeSimulate() {}
+
+    /** A callback that is called from the run thread after gem5 simulation
+     * completed.
+     *
+     * A derived class may use this to perform any additional tasks after gem5
+     * exits. For instance, a derived class could use this to call sc_stop().
+     */
+    virtual void afterSimulate() {}
+
   public:
     SC_HAS_PROCESS(Gem5SimControl);
 
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to