cpu.cc (2670:9107b8bd08cd) | cpu.cc (2680:246e7104f744) |
---|---|
1/* 2 * Copyright (c) 2004-2006 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 25 unchanged lines hidden (view full) --- 34#include "sim/system.hh" 35#else 36#include "sim/process.hh" 37#endif 38 39#include "cpu/activity.hh" 40#include "cpu/checker/cpu.hh" 41#include "cpu/cpu_exec_context.hh" | 1/* 2 * Copyright (c) 2004-2006 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 25 unchanged lines hidden (view full) --- 34#include "sim/system.hh" 35#else 36#include "sim/process.hh" 37#endif 38 39#include "cpu/activity.hh" 40#include "cpu/checker/cpu.hh" 41#include "cpu/cpu_exec_context.hh" |
42#include "cpu/exec_context.hh" | 42#include "cpu/thread_context.hh" |
43#include "cpu/o3/alpha_dyn_inst.hh" 44#include "cpu/o3/alpha_impl.hh" 45#include "cpu/o3/cpu.hh" 46 47#include "sim/root.hh" 48#include "sim/stat_control.hh" 49 50using namespace std; --- 328 unchanged lines hidden (view full) --- 379 380} 381 382template <class Impl> 383void 384FullO3CPU<Impl>::init() 385{ 386 if (!deferRegistration) { | 43#include "cpu/o3/alpha_dyn_inst.hh" 44#include "cpu/o3/alpha_impl.hh" 45#include "cpu/o3/cpu.hh" 46 47#include "sim/root.hh" 48#include "sim/stat_control.hh" 49 50using namespace std; --- 328 unchanged lines hidden (view full) --- 379 380} 381 382template <class Impl> 383void 384FullO3CPU<Impl>::init() 385{ 386 if (!deferRegistration) { |
387 registerExecContexts(); | 387 registerThreadContexts(); |
388 } 389 390 // Set inSyscall so that the CPU doesn't squash when initially 391 // setting up registers. 392 for (int i = 0; i < number_of_threads; ++i) 393 thread[i]->inSyscall = true; 394 395 for (int tid=0; tid < number_of_threads; tid++) { 396#if FULL_SYSTEM | 388 } 389 390 // Set inSyscall so that the CPU doesn't squash when initially 391 // setting up registers. 392 for (int i = 0; i < number_of_threads; ++i) 393 thread[i]->inSyscall = true; 394 395 for (int tid=0; tid < number_of_threads; tid++) { 396#if FULL_SYSTEM |
397 ExecContext *src_xc = execContexts[tid]; | 397 ThreadContext *src_tc = threadContexts[tid]; |
398#else | 398#else |
399 ExecContext *src_xc = thread[tid]->getXCProxy(); | 399 ThreadContext *src_tc = thread[tid]->getTC(); |
400#endif 401 // Threads start in the Suspended State | 400#endif 401 // Threads start in the Suspended State |
402 if (src_xc->status() != ExecContext::Suspended) { | 402 if (src_tc->status() != ThreadContext::Suspended) { |
403 continue; 404 } 405 406#if FULL_SYSTEM | 403 continue; 404 } 405 406#if FULL_SYSTEM |
407 TheISA::initCPU(src_xc, src_xc->readCpuId()); | 407 TheISA::initCPU(src_tc, src_tc->readCpuId()); |
408#endif 409 } 410 411 // Clear inSyscall. 412 for (int i = 0; i < number_of_threads; ++i) 413 thread[i]->inSyscall = false; 414 415 // Initialize stages. --- 9 unchanged lines hidden (view full) --- 425void 426FullO3CPU<Impl>::insertThread(unsigned tid) 427{ 428 DPRINTF(FullCPU,"[tid:%i] Initializing thread data"); 429 // Will change now that the PC and thread state is internal to the CPU 430 // and not in the CPUExecContext. 431#if 0 432#if FULL_SYSTEM | 408#endif 409 } 410 411 // Clear inSyscall. 412 for (int i = 0; i < number_of_threads; ++i) 413 thread[i]->inSyscall = false; 414 415 // Initialize stages. --- 9 unchanged lines hidden (view full) --- 425void 426FullO3CPU<Impl>::insertThread(unsigned tid) 427{ 428 DPRINTF(FullCPU,"[tid:%i] Initializing thread data"); 429 // Will change now that the PC and thread state is internal to the CPU 430 // and not in the CPUExecContext. 431#if 0 432#if FULL_SYSTEM |
433 ExecContext *src_xc = system->execContexts[tid]; | 433 ThreadContext *src_tc = system->threadContexts[tid]; |
434#else | 434#else |
435 CPUExecContext *src_xc = thread[tid]; | 435 CPUExecContext *src_tc = thread[tid]; |
436#endif 437 438 //Bind Int Regs to Rename Map 439 for (int ireg = 0; ireg < TheISA::NumIntRegs; ireg++) { 440 PhysRegIndex phys_reg = freeList.getIntReg(); 441 442 renameMap[tid].setEntry(ireg,phys_reg); 443 scoreboard.setReg(phys_reg); 444 } 445 446 //Bind Float Regs to Rename Map 447 for (int freg = 0; freg < TheISA::NumFloatRegs; freg++) { 448 PhysRegIndex phys_reg = freeList.getFloatReg(); 449 450 renameMap[tid].setEntry(freg,phys_reg); 451 scoreboard.setReg(phys_reg); 452 } 453 454 //Copy Thread Data Into RegFile | 436#endif 437 438 //Bind Int Regs to Rename Map 439 for (int ireg = 0; ireg < TheISA::NumIntRegs; ireg++) { 440 PhysRegIndex phys_reg = freeList.getIntReg(); 441 442 renameMap[tid].setEntry(ireg,phys_reg); 443 scoreboard.setReg(phys_reg); 444 } 445 446 //Bind Float Regs to Rename Map 447 for (int freg = 0; freg < TheISA::NumFloatRegs; freg++) { 448 PhysRegIndex phys_reg = freeList.getFloatReg(); 449 450 renameMap[tid].setEntry(freg,phys_reg); 451 scoreboard.setReg(phys_reg); 452 } 453 454 //Copy Thread Data Into RegFile |
455 this->copyFromXC(tid); | 455 this->copyFromTC(tid); |
456 457 //Set PC/NPC | 456 457 //Set PC/NPC |
458 regFile.pc[tid] = src_xc->readPC(); 459 regFile.npc[tid] = src_xc->readNextPC(); | 458 regFile.pc[tid] = src_tc->readPC(); 459 regFile.npc[tid] = src_tc->readNextPC(); |
460 | 460 |
461 src_xc->setStatus(ExecContext::Active); | 461 src_tc->setStatus(ThreadContext::Active); |
462 463 activateContext(tid,1); 464 465 //Reset ROB/IQ/LSQ Entries 466 commit.rob->resetEntries(); 467 iew.resetEntries(); 468#endif 469} --- 21 unchanged lines hidden (view full) --- 491 } 492 493 //Copy Thread Data From RegFile 494 /* Fix Me: 495 * Do we really need to do this if we are removing a thread 496 * in the sense that it's finished (exiting)? If the thread is just 497 * being suspended we might... 498 */ | 462 463 activateContext(tid,1); 464 465 //Reset ROB/IQ/LSQ Entries 466 commit.rob->resetEntries(); 467 iew.resetEntries(); 468#endif 469} --- 21 unchanged lines hidden (view full) --- 491 } 492 493 //Copy Thread Data From RegFile 494 /* Fix Me: 495 * Do we really need to do this if we are removing a thread 496 * in the sense that it's finished (exiting)? If the thread is just 497 * being suspended we might... 498 */ |
499// this->copyToXC(tid); | 499// this->copyToTC(tid); |
500 501 //Squash Throughout Pipeline 502 fetch.squash(0,tid); 503 decode.squash(tid); 504 rename.squash(tid); 505 506 assert(iew.ldstQueue.getCount(tid) == 0); 507 --- 232 unchanged lines hidden (view full) --- 740 DPRINTF(FullCPU, "Adding Thread %i to active threads list\n", 741 tid); 742 743 activeThreads.push_back(tid); 744 } 745 746 // Set all statuses to active, schedule the CPU's tick event. 747 // @todo: Fix up statuses so this is handled properly | 500 501 //Squash Throughout Pipeline 502 fetch.squash(0,tid); 503 decode.squash(tid); 504 rename.squash(tid); 505 506 assert(iew.ldstQueue.getCount(tid) == 0); 507 --- 232 unchanged lines hidden (view full) --- 740 DPRINTF(FullCPU, "Adding Thread %i to active threads list\n", 741 tid); 742 743 activeThreads.push_back(tid); 744 } 745 746 // Set all statuses to active, schedule the CPU's tick event. 747 // @todo: Fix up statuses so this is handled properly |
748 for (int i = 0; i < execContexts.size(); ++i) { 749 ExecContext *xc = execContexts[i]; 750 if (xc->status() == ExecContext::Active && _status != Running) { | 748 for (int i = 0; i < threadContexts.size(); ++i) { 749 ThreadContext *tc = threadContexts[i]; 750 if (tc->status() == ThreadContext::Active && _status != Running) { |
751 _status = Running; 752 tickEvent.schedule(curTick); 753 } 754 } 755 if (!tickEvent.scheduled()) 756 tickEvent.schedule(curTick); 757} 758 --- 437 unchanged lines hidden --- | 751 _status = Running; 752 tickEvent.schedule(curTick); 753 } 754 } 755 if (!tickEvent.scheduled()) 756 tickEvent.schedule(curTick); 757} 758 --- 437 unchanged lines hidden --- |