ticked_object.hh (10259:ebb376f73dd2) | ticked_object.hh (10464:2a0fe8bca031) |
---|---|
1/* 2 * Copyright (c) 2013-2014 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 --- 62 unchanged lines hidden (view full) --- 71 { } 72 73 /** Evaluate and reschedule */ 74 void 75 process() 76 { 77 ++owner.tickCycles; 78 ++owner.numCycles; | 1/* 2 * Copyright (c) 2013-2014 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 --- 62 unchanged lines hidden (view full) --- 71 { } 72 73 /** Evaluate and reschedule */ 74 void 75 process() 76 { 77 ++owner.tickCycles; 78 ++owner.numCycles; |
79 owner.countCycles(Cycles(1)); |
|
79 owner.evaluate(); 80 if (owner.running) { 81 owner.object.schedule(this, 82 owner.object.clockEdge(Cycles(1))); 83 } 84 } 85 }; 86 --- 40 unchanged lines hidden (view full) --- 127 void 128 start() 129 { 130 if (!running) { 131 if (!event.scheduled()) 132 object.schedule(event, object.clockEdge(Cycles(1))); 133 running = true; 134 numCycles += cyclesSinceLastStopped(); | 80 owner.evaluate(); 81 if (owner.running) { 82 owner.object.schedule(this, 83 owner.object.clockEdge(Cycles(1))); 84 } 85 } 86 }; 87 --- 40 unchanged lines hidden (view full) --- 128 void 129 start() 130 { 131 if (!running) { 132 if (!event.scheduled()) 133 object.schedule(event, object.clockEdge(Cycles(1))); 134 running = true; 135 numCycles += cyclesSinceLastStopped(); |
136 countCycles(cyclesSinceLastStopped()); |
|
135 } 136 } 137 138 /** How long have we been stopped for? */ 139 Cycles 140 cyclesSinceLastStopped() const 141 { 142 return object.curCycle() - lastStopped; --- 19 unchanged lines hidden (view full) --- 162 } 163 164 /** Checkpoint lastStopped */ 165 void serialize(std::ostream &os); 166 void unserialize(Checkpoint *cp, const std::string §ion); 167 168 /** Action to call on the clock tick */ 169 virtual void evaluate() = 0; | 137 } 138 } 139 140 /** How long have we been stopped for? */ 141 Cycles 142 cyclesSinceLastStopped() const 143 { 144 return object.curCycle() - lastStopped; --- 19 unchanged lines hidden (view full) --- 164 } 165 166 /** Checkpoint lastStopped */ 167 void serialize(std::ostream &os); 168 void unserialize(Checkpoint *cp, const std::string §ion); 169 170 /** Action to call on the clock tick */ 171 virtual void evaluate() = 0; |
172 173 /** 174 * Callback to handle cycle statistics and probes. 175 * 176 * This callback is called at the beginning of a new cycle active 177 * cycle and when restarting the ticked object. The delta 178 * parameter indicates the number of cycles elapsed since the 179 * previous call is normally '1' unless the object has been 180 * stopped and restarted. 181 * 182 * @param delta Number of cycles since the previous call. 183 */ 184 virtual void countCycles(Cycles delta) {} |
|
170}; 171 172/** TickedObject attaches Ticked to ClockedObject and can be used as 173 * a base class where ticked operation */ 174class TickedObject : public ClockedObject, public Ticked 175{ 176 public: 177 TickedObject(TickedObjectParams *params, --- 14 unchanged lines hidden --- | 185}; 186 187/** TickedObject attaches Ticked to ClockedObject and can be used as 188 * a base class where ticked operation */ 189class TickedObject : public ClockedObject, public Ticked 190{ 191 public: 192 TickedObject(TickedObjectParams *params, --- 14 unchanged lines hidden --- |