drain.hh (10913:38dbdeea7f1f) | drain.hh (11002:4413195267fd) |
---|---|
1/* 2 * Copyright (c) 2012, 2015 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 --- 124 unchanged lines hidden (view full) --- 133 * at a later stage, recreated objects will be in the Running 134 * state since the state isn't stored in checkpoints. This method 135 * performs state fixups on all Drainable objects and the 136 * DrainManager itself. 137 */ 138 void preCheckpointRestore(); 139 140 /** Check if the system is drained */ | 1/* 2 * Copyright (c) 2012, 2015 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 --- 124 unchanged lines hidden (view full) --- 133 * at a later stage, recreated objects will be in the Running 134 * state since the state isn't stored in checkpoints. This method 135 * performs state fixups on all Drainable objects and the 136 * DrainManager itself. 137 */ 138 void preCheckpointRestore(); 139 140 /** Check if the system is drained */ |
141 bool isDrained() { return _state == DrainState::Drained; } | 141 bool isDrained() const { return _state == DrainState::Drained; } |
142 143 /** Get the simulators global drain state */ | 142 143 /** Get the simulators global drain state */ |
144 DrainState state() { return _state; } | 144 DrainState state() const { return _state; } |
145 146 /** 147 * Notify the DrainManager that a Drainable object has finished 148 * draining. 149 */ 150 void signalDrainDone(); 151 152 public: --- 51 unchanged lines hidden (view full) --- 204 * haven't drained yet, simulation stops when the set of 205 * non-drained objects becomes empty. 206 * 207 * <li>Check if any object still needs draining 208 * (DrainManager::tryDrain()), if so repeat the process above. 209 * 210 * <li>Serialize objects, switch CPU model, or change timing model. 211 * | 145 146 /** 147 * Notify the DrainManager that a Drainable object has finished 148 * draining. 149 */ 150 void signalDrainDone(); 151 152 public: --- 51 unchanged lines hidden (view full) --- 204 * haven't drained yet, simulation stops when the set of 205 * non-drained objects becomes empty. 206 * 207 * <li>Check if any object still needs draining 208 * (DrainManager::tryDrain()), if so repeat the process above. 209 * 210 * <li>Serialize objects, switch CPU model, or change timing model. 211 * |
212 * <li>Call DrainManager::resume(), which intern calls 213 * Drainable::drainResume() for all objects, and continue the | 212 * <li>Call DrainManager::resume(), which in turn calls 213 * Drainable::drainResume() for all objects, and then continue the |
214 * simulation. 215 * </ol> 216 * 217 */ 218class Drainable 219{ 220 friend class DrainManager; 221 222 protected: 223 Drainable(); 224 virtual ~Drainable(); 225 226 /** | 214 * simulation. 215 * </ol> 216 * 217 */ 218class Drainable 219{ 220 friend class DrainManager; 221 222 protected: 223 Drainable(); 224 virtual ~Drainable(); 225 226 /** |
227 * Determine if an object needs draining and register a 228 * DrainManager. | 227 * Notify an object that it needs to drain its state. |
229 * 230 * If the object does not need further simulation to drain | 228 * 229 * If the object does not need further simulation to drain |
231 * internal buffers, it returns true and automatically switches to 232 * the Drained state, otherwise it switches to the Draining state. | 230 * internal buffers, it returns DrainState::Drained and 231 * automatically switches to the Drained state. If the object 232 * needs more simulation, it returns DrainState::Draining and 233 * automatically enters the Draining state. Other return values 234 * are invalid. |
233 * 234 * @note An object that has entered the Drained state can be | 235 * 236 * @note An object that has entered the Drained state can be |
235 * disturbed by other objects in the system and consequently be 236 * being drained. These perturbations are not visible in the 237 * drain state. The simulator therefore repeats the draining 238 * process until all objects return DrainState::Drained on the 239 * first call to drain(). | 237 * disturbed by other objects in the system and consequently stop 238 * being drained. These perturbations are not visible in the drain 239 * state. The simulator therefore repeats the draining process 240 * until all objects return DrainState::Drained on the first call 241 * to drain(). |
240 * | 242 * |
241 * @return DrainState::Drained if the object is ready for 242 * serialization now, DrainState::Draining if it needs further | 243 * @return DrainState::Drained if the object is drained at this 244 * point in time, DrainState::Draining if it needs further |
243 * simulation. 244 */ 245 virtual DrainState drain() = 0; 246 247 /** 248 * Resume execution after a successful drain. 249 */ 250 virtual void drainResume() {}; --- 43 unchanged lines hidden --- | 245 * simulation. 246 */ 247 virtual DrainState drain() = 0; 248 249 /** 250 * Resume execution after a successful drain. 251 */ 252 virtual void drainResume() {}; --- 43 unchanged lines hidden --- |