/*
- * 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
* 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"
+#include "params/TickedObject.hh"
+#include "sim/clocked_object.hh"
+
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 */
*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");
}
lastStopped = Cycles(lastStoppedUint);
}
-TickedObject::TickedObject(TickedObjectParams *params,
+TickedObject::TickedObject(const TickedObjectParams *params,
Event::Priority priority) :
ClockedObject(params),
/* Make numCycles in Ticked */
TickedObject::regStats()
{
Ticked::regStats();
+ ClockedObject::regStats();
}
void