ticked_object.hh (12113:bdf1545c9919) | ticked_object.hh (12125:0066d9926c1a) |
---|---|
1/* 2 * Copyright (c) 2013-2014, 2017 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 46 unchanged lines hidden (view full) --- 55/** Ticked attaches gem5's event queue/scheduler to evaluate 56 * calls and provides a start/stop interface to ticking. 57 * 58 * Ticked is not a ClockedObject but can be attached to one by 59 * inheritance and by calling regStats, serialize/unserialize */ 60class Ticked : public Serializable 61{ 62 protected: | 1/* 2 * Copyright (c) 2013-2014, 2017 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 46 unchanged lines hidden (view full) --- 55/** Ticked attaches gem5's event queue/scheduler to evaluate 56 * calls and provides a start/stop interface to ticking. 57 * 58 * Ticked is not a ClockedObject but can be attached to one by 59 * inheritance and by calling regStats, serialize/unserialize */ 60class Ticked : public Serializable 61{ 62 protected: |
63 /** An event to call process periodically */ 64 class ClockEvent : public Event 65 { 66 public: 67 Ticked &owner; 68 69 ClockEvent(Ticked &owner_, Priority priority) : 70 Event(priority), 71 owner(owner_) 72 { } 73 74 /** Evaluate and reschedule */ 75 void 76 process() 77 { 78 ++owner.tickCycles; 79 ++owner.numCycles; 80 owner.countCycles(Cycles(1)); 81 owner.evaluate(); 82 if (owner.running) { 83 owner.object.schedule(this, 84 owner.object.clockEdge(Cycles(1))); 85 } 86 } 87 }; 88 89 friend class ClockEvent; 90 | |
91 /** ClockedObject who is responsible for this Ticked's actions/stats */ 92 ClockedObject &object; 93 | 63 /** ClockedObject who is responsible for this Ticked's actions/stats */ 64 ClockedObject &object; 65 |
94 /** The single instance of ClockEvent used */ 95 ClockEvent event; | 66 /** The wrapper for processClockEvent */ 67 EventFunctionWrapper event; |
96 | 68 |
69 /** Evaluate and reschedule */ 70 void processClockEvent(); 71 |
|
97 /** Have I been started? and am not stopped */ 98 bool running; 99 100 /** Time of last stop event to calculate run time */ 101 Cycles lastStopped; 102 103 private: 104 /** Locally allocated stats */ --- 103 unchanged lines hidden --- | 72 /** Have I been started? and am not stopped */ 73 bool running; 74 75 /** Time of last stop event to calculate run time */ 76 Cycles lastStopped; 77 78 private: 79 /** Locally allocated stats */ --- 103 unchanged lines hidden --- |