systemc: Add deprecated default time unit management functions.
[gem5.git] / src / sim / ticked_object.hh
index d8b69a3208b6fcd85352703ebac1b12741201750..ad7d6e93b1930fda46ddc3d02fea3a2fe018f5c1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2014 ARM Limited
+ * Copyright (c) 2013-2014, 2017 ARM Limited
  * All rights reserved
  *
  * The license below extends only to copyright in the software and shall
@@ -60,39 +60,14 @@ class TickedObjectParams;
 class Ticked : public Serializable
 {
   protected:
-    /** An event to call process periodically */
-    class ClockEvent : public Event
-    {
-      public:
-        Ticked &owner;
-
-        ClockEvent(Ticked &owner_, Priority priority) :
-            Event(priority),
-            owner(owner_)
-        { }
-
-        /** Evaluate and reschedule */
-        void
-        process()
-        {
-            ++owner.tickCycles;
-            ++owner.numCycles;
-            owner.countCycles(Cycles(1));
-            owner.evaluate();
-            if (owner.running) {
-                owner.object.schedule(this,
-                    owner.object.clockEdge(Cycles(1)));
-            }
-        }
-    };
-
-    friend class ClockEvent;
-
     /** ClockedObject who is responsible for this Ticked's actions/stats */
     ClockedObject &object;
 
-    /** The single instance of ClockEvent used */
-    ClockEvent event;
+    /** The wrapper for processClockEvent */
+    EventFunctionWrapper event;
+
+    /** Evaluate and reschedule */
+    void processClockEvent();
 
     /** Have I been started? and am not stopped */
     bool running;
@@ -190,7 +165,7 @@ class Ticked : public Serializable
 class TickedObject : public ClockedObject, public Ticked
 {
   public:
-    TickedObject(TickedObjectParams *params,
+    TickedObject(const TickedObjectParams *params,
         Event::Priority priority = Event::CPU_Tick_Pri);
 
     /** Disambiguate to make these functions overload correctly */