cpu.cc (10910:32f3d1c454ec) | cpu.cc (10913:38dbdeea7f1f) |
---|---|
1/* 2 * Copyright (c) 2012-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 --- 33 unchanged lines hidden (view full) --- 42#include "cpu/minor/dyn_inst.hh" 43#include "cpu/minor/fetch1.hh" 44#include "cpu/minor/pipeline.hh" 45#include "debug/Drain.hh" 46#include "debug/MinorCPU.hh" 47#include "debug/Quiesce.hh" 48 49MinorCPU::MinorCPU(MinorCPUParams *params) : | 1/* 2 * Copyright (c) 2012-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 --- 33 unchanged lines hidden (view full) --- 42#include "cpu/minor/dyn_inst.hh" 43#include "cpu/minor/fetch1.hh" 44#include "cpu/minor/pipeline.hh" 45#include "debug/Drain.hh" 46#include "debug/MinorCPU.hh" 47#include "debug/Quiesce.hh" 48 49MinorCPU::MinorCPU(MinorCPUParams *params) : |
50 BaseCPU(params), 51 drainManager(NULL) | 50 BaseCPU(params) |
52{ 53 /* This is only written for one thread at the moment */ 54 Minor::MinorThread *thread; 55 56 if (FullSystem) { 57 thread = new Minor::MinorThread(this, 0, params->system, params->itb, 58 params->dtb, params->isa[0]); 59 } else { --- 129 unchanged lines hidden (view full) --- 189 190 for (auto i = threads.begin(); i != threads.end(); i ++) 191 (*i)->startup(); 192 193 /* CPU state setup, activate initial context */ 194 activateContext(0); 195} 196 | 51{ 52 /* This is only written for one thread at the moment */ 53 Minor::MinorThread *thread; 54 55 if (FullSystem) { 56 thread = new Minor::MinorThread(this, 0, params->system, params->itb, 57 params->dtb, params->isa[0]); 58 } else { --- 129 unchanged lines hidden (view full) --- 188 189 for (auto i = threads.begin(); i != threads.end(); i ++) 190 (*i)->startup(); 191 192 /* CPU state setup, activate initial context */ 193 activateContext(0); 194} 195 |
197unsigned int 198MinorCPU::drain(DrainManager *drain_manager) | 196DrainState 197MinorCPU::drain() |
199{ 200 DPRINTF(Drain, "MinorCPU drain\n"); 201 | 198{ 199 DPRINTF(Drain, "MinorCPU drain\n"); 200 |
202 drainManager = drain_manager; 203 | |
204 /* Need to suspend all threads and wait for Execute to idle. 205 * Tell Fetch1 not to fetch */ | 201 /* Need to suspend all threads and wait for Execute to idle. 202 * Tell Fetch1 not to fetch */ |
206 unsigned int ret = pipeline->drain(drain_manager); 207 208 if (ret == 0) | 203 if (pipeline->drain()) { |
209 DPRINTF(Drain, "MinorCPU drained\n"); | 204 DPRINTF(Drain, "MinorCPU drained\n"); |
210 else | 205 return DrainState::Drained; 206 } else { |
211 DPRINTF(Drain, "MinorCPU not finished draining\n"); | 207 DPRINTF(Drain, "MinorCPU not finished draining\n"); |
212 213 return ret; | 208 return DrainState::Draining; 209 } |
214} 215 216void 217MinorCPU::signalDrainDone() 218{ 219 DPRINTF(Drain, "MinorCPU drain done\n"); | 210} 211 212void 213MinorCPU::signalDrainDone() 214{ 215 DPRINTF(Drain, "MinorCPU drain done\n"); |
220 setDrainState(DrainState::Drained); 221 drainManager->signalDrainDone(); 222 drainManager = NULL; | 216 signalDrainDone(); |
223} 224 225void 226MinorCPU::drainResume() 227{ | 217} 218 219void 220MinorCPU::drainResume() 221{ |
228 assert(getDrainState() == DrainState::Drained || 229 getDrainState() == DrainState::Running); | 222 assert(drainState() == DrainState::Drained); |
230 231 if (switchedOut()) { 232 DPRINTF(Drain, "drainResume while switched out. Ignoring\n"); 233 return; 234 } 235 236 DPRINTF(Drain, "MinorCPU drainResume\n"); 237 238 if (!system->isTimingMode()) { 239 fatal("The Minor CPU requires the memory system to be in " 240 "'timing' mode.\n"); 241 } 242 243 wakeup(); 244 pipeline->drainResume(); | 223 224 if (switchedOut()) { 225 DPRINTF(Drain, "drainResume while switched out. Ignoring\n"); 226 return; 227 } 228 229 DPRINTF(Drain, "MinorCPU drainResume\n"); 230 231 if (!system->isTimingMode()) { 232 fatal("The Minor CPU requires the memory system to be in " 233 "'timing' mode.\n"); 234 } 235 236 wakeup(); 237 pipeline->drainResume(); |
245 246 setDrainState(DrainState::Running); | |
247} 248 249void 250MinorCPU::memWriteback() 251{ 252 DPRINTF(Drain, "MinorCPU memWriteback\n"); 253} 254 --- 97 unchanged lines hidden --- | 238} 239 240void 241MinorCPU::memWriteback() 242{ 243 DPRINTF(Drain, "MinorCPU memWriteback\n"); 244} 245 --- 97 unchanged lines hidden --- |