arch: Do value-initialization for MemOperand
[gem5.git] / src / sim / ticked_object.cc
index 4cd0dc171fff62fbb7787bcb08ad32b516857279..7af439cd56010e66e3bb5db8dba2ffa8db44ac54 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
@@ -33,8 +33,6 @@
  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Authors: Andrew Bardsley
  */
 
 #include "sim/ticked_object.hh"
@@ -46,7 +44,7 @@ Ticked::Ticked(ClockedObject &object_,
     Stats::Scalar *imported_num_cycles,
     Event::Priority priority) :
     object(object_),
-    event(*this, priority),
+    event([this]{ processClockEvent(); }, object_.name(), false, priority),
     running(false),
     lastStopped(0),
     /* Allocate numCycles if an external stat wasn't passed in */
@@ -55,12 +53,22 @@ Ticked::Ticked(ClockedObject &object_,
         *numCyclesLocal))
 { }
 
+void
+Ticked::processClockEvent() {
+    ++tickCycles;
+    ++numCycles;
+    countCycles(Cycles(1));
+    evaluate();
+    if (running)
+        object.schedule(event, object.clockEdge(Cycles(1)));
+}
+
 void
 Ticked::regStats()
 {
     if (numCyclesLocal) {
         numCycles
-            .name(object.name() + ".tickCycles")
+            .name(object.name() + ".totalTickCycles")
             .desc("Number of cycles that the object ticked or was stopped");
     }
 
@@ -98,7 +106,7 @@ Ticked::unserialize(CheckpointIn &cp)
     lastStopped = Cycles(lastStoppedUint);
 }
 
-TickedObject::TickedObject(TickedObjectParams *params,
+TickedObject::TickedObject(const TickedObjectParams *params,
     Event::Priority priority) :
     ClockedObject(params),
     /* Make numCycles in Ticked */
@@ -109,6 +117,7 @@ void
 TickedObject::regStats()
 {
     Ticked::regStats();
+    ClockedObject::regStats();
 }
 
 void