1/* 2 * Copyright (c) 2011 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 --- 282 unchanged lines hidden (view full) --- 291 stringstream namestr; 292 ccprintf(namestr, "%s.ctx%d", name(), i); 293 threadContexts[i]->regStats(namestr.str()); 294 } 295 } else if (size == 1) 296 threadContexts[0]->regStats(name()); 297} 298 |
299Port * 300BaseCPU::getPort(const string &if_name, int idx) 301{ 302 // Get the right port based on name. This applies to all the 303 // subclasses of the base CPU and relies on their implementation 304 // of getDataPort and getInstPort. In all cases there methods 305 // return a CpuPort pointer. 306 if (if_name == "dcache_port") 307 return &getDataPort(); 308 else if (if_name == "icache_port") 309 return &getInstPort(); 310 else 311 panic("CPU %s has no port named %s\n", name(), if_name); 312} 313 |
314Tick 315BaseCPU::nextCycle() 316{ 317 Tick next_tick = curTick() - phase + clock - 1; 318 next_tick -= (next_tick % clock); 319 next_tick += phase; 320 return next_tick; 321} --- 51 unchanged lines hidden (view full) --- 373{ 374 if (profileEvent && profileEvent->scheduled()) 375 deschedule(profileEvent); 376} 377 378void 379BaseCPU::takeOverFrom(BaseCPU *oldCPU) 380{ |
381 CpuPort &ic = getInstPort(); 382 CpuPort &dc = getDataPort(); |
383 assert(threadContexts.size() == oldCPU->threadContexts.size()); 384 385 _cpuId = oldCPU->cpuId(); 386 387 ThreadID size = threadContexts.size(); 388 for (ThreadID i = 0; i < size; ++i) { 389 ThreadContext *newTC = threadContexts[i]; 390 ThreadContext *oldTC = oldCPU->threadContexts[i]; --- 72 unchanged lines hidden (view full) --- 463 464 if (profileEvent) 465 schedule(profileEvent, curTick()); 466 } 467 468 // Connect new CPU to old CPU's memory only if new CPU isn't 469 // connected to anything. Also connect old CPU's memory to new 470 // CPU. |
471 if (!ic.isConnected()) { 472 Port *peer = oldCPU->getInstPort().getPeer(); 473 ic.setPeer(peer); 474 peer->setPeer(&ic); |
475 } 476 |
477 if (!dc.isConnected()) { 478 Port *peer = oldCPU->getDataPort().getPeer(); 479 dc.setPeer(peer); 480 peer->setPeer(&dc); |
481 } 482} 483 484 485BaseCPU::ProfileEvent::ProfileEvent(BaseCPU *_cpu, Tick _interval) 486 : cpu(_cpu), interval(_interval) 487{ } 488 --- 85 unchanged lines hidden --- |