inorder-cleanup: remove unused thread functions
This commit is contained in:
parent
e1fcc64980
commit
d9eaa2fe21
4 changed files with 80 additions and 332 deletions
|
@ -100,13 +100,9 @@ std::string InOrderCPU::eventNames[NumCPUEvents] =
|
||||||
"DeactivateThread",
|
"DeactivateThread",
|
||||||
"DeallocateThread",
|
"DeallocateThread",
|
||||||
"SuspendThread",
|
"SuspendThread",
|
||||||
"DisableThreads",
|
|
||||||
"EnableThreads",
|
|
||||||
"DisableVPEs",
|
|
||||||
"EnableVPEs",
|
|
||||||
"Trap",
|
"Trap",
|
||||||
"InstGraduated",
|
"InstGraduated",
|
||||||
"SquashAll",
|
"SquashFromMemStall",
|
||||||
"UpdatePCs"
|
"UpdatePCs"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -119,8 +115,6 @@ InOrderCPU::CPUEvent::process()
|
||||||
cpu->activateThread(tid);
|
cpu->activateThread(tid);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//@TODO: Consider Implementing "Suspend Thread" as Separate from
|
|
||||||
//Deallocate
|
|
||||||
case ActivateNextReadyThread:
|
case ActivateNextReadyThread:
|
||||||
cpu->activateNextReadyThread();
|
cpu->activateNextReadyThread();
|
||||||
break;
|
break;
|
||||||
|
@ -129,28 +123,12 @@ InOrderCPU::CPUEvent::process()
|
||||||
cpu->deactivateThread(tid);
|
cpu->deactivateThread(tid);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SuspendThread: // Suspend & Deallocate are same for now.
|
|
||||||
cpu->suspendThread(tid);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DeallocateThread:
|
case DeallocateThread:
|
||||||
cpu->deallocateThread(tid);
|
cpu->deallocateThread(tid);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EnableVPEs:
|
case SuspendThread:
|
||||||
cpu->enableVPEs(vpe);
|
cpu->suspendThread(tid);
|
||||||
break;
|
|
||||||
|
|
||||||
case DisableVPEs:
|
|
||||||
cpu->disableVPEs(tid, vpe);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EnableThreads:
|
|
||||||
cpu->enableThreads(vpe);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DisableThreads:
|
|
||||||
cpu->disableThreads(tid, vpe);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SquashFromMemStall:
|
case SquashFromMemStall:
|
||||||
|
@ -212,8 +190,7 @@ InOrderCPU::InOrderCPU(Params *params)
|
||||||
#endif // DEBUG
|
#endif // DEBUG
|
||||||
switchCount(0),
|
switchCount(0),
|
||||||
deferRegistration(false/*params->deferRegistration*/),
|
deferRegistration(false/*params->deferRegistration*/),
|
||||||
stageTracing(params->stageTracing),
|
stageTracing(params->stageTracing)
|
||||||
numVirtProcs(1)
|
|
||||||
{
|
{
|
||||||
ThreadID active_threads;
|
ThreadID active_threads;
|
||||||
cpu_params = params;
|
cpu_params = params;
|
||||||
|
@ -335,11 +312,10 @@ InOrderCPU::InOrderCPU(Params *params)
|
||||||
memset(floatRegs.i[tid], 0, sizeof(floatRegs.i[tid]));
|
memset(floatRegs.i[tid], 0, sizeof(floatRegs.i[tid]));
|
||||||
isa[tid].clear();
|
isa[tid].clear();
|
||||||
|
|
||||||
isa[tid].expandForMultithreading(numThreads, numVirtProcs);
|
isa[tid].expandForMultithreading(numThreads, 1/*numVirtProcs*/);
|
||||||
}
|
}
|
||||||
|
|
||||||
lastRunningCycle = curTick;
|
lastRunningCycle = curTick;
|
||||||
contextSwitch = false;
|
|
||||||
|
|
||||||
// Define dummy instructions and resource requests to be used.
|
// Define dummy instructions and resource requests to be used.
|
||||||
dummyInst = new InOrderDynInst(this, NULL, 0, 0);
|
dummyInst = new InOrderDynInst(this, NULL, 0, 0);
|
||||||
|
@ -526,7 +502,7 @@ InOrderCPU::reset()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < numThreads; i++) {
|
for (int i = 0; i < numThreads; i++) {
|
||||||
isa[i].reset(coreType, numThreads,
|
isa[i].reset(coreType, numThreads,
|
||||||
numVirtProcs, dynamic_cast<BaseCPU*>(this));
|
1/*numVirtProcs*/, dynamic_cast<BaseCPU*>(this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -703,6 +679,20 @@ InOrderCPU::activateThread(ThreadID tid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
InOrderCPU::deactivateContext(ThreadID tid, int delay)
|
||||||
|
{
|
||||||
|
DPRINTF(InOrderCPU,"[tid:%i]: Deactivating ...\n", tid);
|
||||||
|
|
||||||
|
scheduleCpuEvent(DeactivateThread, NoFault, tid, dummyInst, delay);
|
||||||
|
|
||||||
|
// Be sure to signal that there's some activity so the CPU doesn't
|
||||||
|
// deschedule itself.
|
||||||
|
activityRec.activity();
|
||||||
|
|
||||||
|
_status = Running;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
InOrderCPU::deactivateThread(ThreadID tid)
|
InOrderCPU::deactivateThread(ThreadID tid)
|
||||||
{
|
{
|
||||||
|
@ -722,6 +712,40 @@ InOrderCPU::deactivateThread(ThreadID tid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
InOrderCPU::deallocateContext(ThreadID tid, int delay)
|
||||||
|
{
|
||||||
|
DPRINTF(InOrderCPU,"[tid:%i]: Deallocating ...\n", tid);
|
||||||
|
|
||||||
|
scheduleCpuEvent(DeallocateThread, NoFault, tid, dummyInst, delay);
|
||||||
|
|
||||||
|
// Be sure to signal that there's some activity so the CPU doesn't
|
||||||
|
// deschedule itself.
|
||||||
|
activityRec.activity();
|
||||||
|
|
||||||
|
_status = Running;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
InOrderCPU::deallocateThread(ThreadID tid)
|
||||||
|
{
|
||||||
|
DPRINTF(InOrderCPU, "[tid:%i]: Calling deallocate thread.\n", tid);
|
||||||
|
|
||||||
|
if (isThreadActive(tid)) {
|
||||||
|
DPRINTF(InOrderCPU,"[tid:%i]: Removing from active threads list\n",
|
||||||
|
tid);
|
||||||
|
list<ThreadID>::iterator thread_it =
|
||||||
|
std::find(activeThreads.begin(), activeThreads.end(), tid);
|
||||||
|
|
||||||
|
removePipelineStalls(*thread_it);
|
||||||
|
|
||||||
|
activeThreads.erase(thread_it);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: "Un"Load/Unmap register file state
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
InOrderCPU::removePipelineStalls(ThreadID tid)
|
InOrderCPU::removePipelineStalls(ThreadID tid)
|
||||||
{
|
{
|
||||||
|
@ -733,36 +757,6 @@ InOrderCPU::removePipelineStalls(ThreadID tid)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
bool
|
|
||||||
InOrderCPU::isThreadInCPU(ThreadID tid)
|
|
||||||
{
|
|
||||||
list<ThreadID>::iterator isCurrent =
|
|
||||||
std::find(currentThreads.begin(), currentThreads.end(), tid);
|
|
||||||
|
|
||||||
return (isCurrent != currentThreads.end());
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
InOrderCPU::addToCurrentThreads(ThreadID tid)
|
|
||||||
{
|
|
||||||
if (!isThreadInCPU(tid)) {
|
|
||||||
DPRINTF(InOrderCPU, "Adding Thread %i to current threads list in CPU."
|
|
||||||
"\n", tid);
|
|
||||||
currentThreads.push_back(tid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
InOrderCPU::removeFromCurrentThreads(ThreadID tid)
|
|
||||||
{
|
|
||||||
if (isThreadInCPU(tid)) {
|
|
||||||
DPRINTF(InOrderCPU,
|
|
||||||
"Adding Thread %i to current threads list in CPU.\n", tid);
|
|
||||||
list<ThreadID>::iterator isCurrent =
|
|
||||||
std::find(currentThreads.begin(), currentThreads.end(), tid);
|
|
||||||
currentThreads.erase(isCurrent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
InOrderCPU::isThreadSuspended(ThreadID tid)
|
InOrderCPU::isThreadSuspended(ThreadID tid)
|
||||||
|
@ -773,125 +767,6 @@ InOrderCPU::isThreadSuspended(ThreadID tid)
|
||||||
return (isSuspended!= suspendedThreads.end());
|
return (isSuspended!= suspendedThreads.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
InOrderCPU::enableVirtProcElement(unsigned vpe)
|
|
||||||
{
|
|
||||||
DPRINTF(InOrderCPU, "[vpe:%i]: Scheduling "
|
|
||||||
"Enabling of concurrent virtual processor execution",
|
|
||||||
vpe);
|
|
||||||
|
|
||||||
scheduleCpuEvent(EnableVPEs, NoFault, 0/*tid*/, dummyInst);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
InOrderCPU::enableVPEs(unsigned vpe)
|
|
||||||
{
|
|
||||||
DPRINTF(InOrderCPU, "[vpe:%i]: Enabling Concurrent Execution "
|
|
||||||
"virtual processors %i", vpe);
|
|
||||||
|
|
||||||
list<ThreadID>::iterator thread_it = currentThreads.begin();
|
|
||||||
|
|
||||||
while (thread_it != currentThreads.end()) {
|
|
||||||
if (!isThreadSuspended(*thread_it)) {
|
|
||||||
activateThread(*thread_it);
|
|
||||||
}
|
|
||||||
thread_it++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
InOrderCPU::disableVirtProcElement(ThreadID tid, unsigned vpe)
|
|
||||||
{
|
|
||||||
DPRINTF(InOrderCPU, "[vpe:%i]: Scheduling "
|
|
||||||
"Disabling of concurrent virtual processor execution",
|
|
||||||
vpe);
|
|
||||||
|
|
||||||
scheduleCpuEvent(DisableVPEs, NoFault, 0/*tid*/, dummyInst);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
InOrderCPU::disableVPEs(ThreadID tid, unsigned vpe)
|
|
||||||
{
|
|
||||||
DPRINTF(InOrderCPU, "[vpe:%i]: Disabling Concurrent Execution of "
|
|
||||||
"virtual processors %i", vpe);
|
|
||||||
|
|
||||||
unsigned base_vpe = TheISA::getVirtProcNum(tcBase(tid));
|
|
||||||
|
|
||||||
list<ThreadID>::iterator thread_it = activeThreads.begin();
|
|
||||||
|
|
||||||
vector<list<ThreadID>::iterator> removeList;
|
|
||||||
|
|
||||||
while (thread_it != activeThreads.end()) {
|
|
||||||
if (base_vpe != vpe) {
|
|
||||||
removeList.push_back(thread_it);
|
|
||||||
}
|
|
||||||
thread_it++;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < removeList.size(); i++) {
|
|
||||||
activeThreads.erase(removeList[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
InOrderCPU::enableMultiThreading(unsigned vpe)
|
|
||||||
{
|
|
||||||
// Schedule event to take place at end of cycle
|
|
||||||
DPRINTF(InOrderCPU, "[vpe:%i]: Scheduling Enable Multithreading on "
|
|
||||||
"virtual processor %i", vpe);
|
|
||||||
|
|
||||||
scheduleCpuEvent(EnableThreads, NoFault, 0/*tid*/, dummyInst);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
InOrderCPU::enableThreads(unsigned vpe)
|
|
||||||
{
|
|
||||||
DPRINTF(InOrderCPU, "[vpe:%i]: Enabling Multithreading on "
|
|
||||||
"virtual processor %i", vpe);
|
|
||||||
|
|
||||||
list<ThreadID>::iterator thread_it = currentThreads.begin();
|
|
||||||
|
|
||||||
while (thread_it != currentThreads.end()) {
|
|
||||||
if (TheISA::getVirtProcNum(tcBase(*thread_it)) == vpe) {
|
|
||||||
if (!isThreadSuspended(*thread_it)) {
|
|
||||||
activateThread(*thread_it);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
thread_it++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void
|
|
||||||
InOrderCPU::disableMultiThreading(ThreadID tid, unsigned vpe)
|
|
||||||
{
|
|
||||||
// Schedule event to take place at end of cycle
|
|
||||||
DPRINTF(InOrderCPU, "[tid:%i]: Scheduling Disable Multithreading on "
|
|
||||||
"virtual processor %i", tid, vpe);
|
|
||||||
|
|
||||||
scheduleCpuEvent(DisableThreads, NoFault, tid, dummyInst);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
InOrderCPU::disableThreads(ThreadID tid, unsigned vpe)
|
|
||||||
{
|
|
||||||
DPRINTF(InOrderCPU, "[tid:%i]: Disabling Multithreading on "
|
|
||||||
"virtual processor %i", tid, vpe);
|
|
||||||
|
|
||||||
list<ThreadID>::iterator thread_it = activeThreads.begin();
|
|
||||||
|
|
||||||
vector<list<ThreadID>::iterator> removeList;
|
|
||||||
|
|
||||||
while (thread_it != activeThreads.end()) {
|
|
||||||
if (TheISA::getVirtProcNum(tcBase(*thread_it)) == vpe) {
|
|
||||||
removeList.push_back(thread_it);
|
|
||||||
}
|
|
||||||
thread_it++;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < removeList.size(); i++) {
|
|
||||||
activeThreads.erase(removeList[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
InOrderCPU::updateThreadPriority()
|
InOrderCPU::updateThreadPriority()
|
||||||
{
|
{
|
||||||
|
@ -958,6 +833,12 @@ InOrderCPU::activateNextReadyContext(int delay)
|
||||||
_status = Running;
|
_status = Running;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
InOrderCPU::haltContext(ThreadID tid, int delay)
|
||||||
|
{
|
||||||
|
suspendContext(tid, delay);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
InOrderCPU::suspendContext(ThreadID tid, int delay)
|
InOrderCPU::suspendContext(ThreadID tid, int delay)
|
||||||
{
|
{
|
||||||
|
@ -973,24 +854,6 @@ InOrderCPU::suspendThread(ThreadID tid)
|
||||||
suspendedThreads.push_back(tid);
|
suspendedThreads.push_back(tid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
InOrderCPU::deallocateContext(ThreadID tid, int delay)
|
|
||||||
{
|
|
||||||
scheduleCpuEvent(DeallocateThread, NoFault, tid, dummyInst, delay);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
InOrderCPU::deallocateThread(ThreadID tid)
|
|
||||||
{
|
|
||||||
DPRINTF(InOrderCPU,"[tid:%i]: Deallocating ...", tid);
|
|
||||||
|
|
||||||
removeFromCurrentThreads(tid);
|
|
||||||
|
|
||||||
deactivateThread(tid);
|
|
||||||
|
|
||||||
squashThreadInPipeline(tid);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
InOrderCPU::squashThreadInPipeline(ThreadID tid)
|
InOrderCPU::squashThreadInPipeline(ThreadID tid)
|
||||||
{
|
{
|
||||||
|
@ -1000,45 +863,12 @@ InOrderCPU::squashThreadInPipeline(ThreadID tid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
InOrderCPU::haltContext(ThreadID tid, int delay)
|
|
||||||
{
|
|
||||||
DPRINTF(InOrderCPU, "[tid:%i]: Halt context called.\n", tid);
|
|
||||||
|
|
||||||
// Halt is same thing as deallocate for now
|
|
||||||
// @TODO: Differentiate between halt & deallocate in the CPU
|
|
||||||
// model
|
|
||||||
deallocateContext(tid, delay);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
InOrderCPU::insertThread(ThreadID tid)
|
|
||||||
{
|
|
||||||
panic("Unimplemented Function\n.");
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
InOrderCPU::removeThread(ThreadID tid)
|
|
||||||
{
|
|
||||||
DPRINTF(InOrderCPU, "Removing Thread %i from CPU.\n", tid);
|
|
||||||
|
|
||||||
/** Broadcast to CPU resources*/
|
|
||||||
}
|
|
||||||
|
|
||||||
PipelineStage*
|
PipelineStage*
|
||||||
InOrderCPU::getPipeStage(int stage_num)
|
InOrderCPU::getPipeStage(int stage_num)
|
||||||
{
|
{
|
||||||
return pipelineStage[stage_num];
|
return pipelineStage[stage_num];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
InOrderCPU::activateWhenReady(ThreadID tid)
|
|
||||||
{
|
|
||||||
panic("Unimplemented Function\n.");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
uint64_t
|
uint64_t
|
||||||
InOrderCPU::readPC(ThreadID tid)
|
InOrderCPU::readPC(ThreadID tid)
|
||||||
{
|
{
|
||||||
|
|
|
@ -179,10 +179,6 @@ class InOrderCPU : public BaseCPU
|
||||||
DeactivateThread,
|
DeactivateThread,
|
||||||
DeallocateThread,
|
DeallocateThread,
|
||||||
SuspendThread,
|
SuspendThread,
|
||||||
DisableThreads,
|
|
||||||
EnableThreads,
|
|
||||||
DisableVPEs,
|
|
||||||
EnableVPEs,
|
|
||||||
Trap,
|
Trap,
|
||||||
InstGraduated,
|
InstGraduated,
|
||||||
SquashFromMemStall,
|
SquashFromMemStall,
|
||||||
|
@ -347,18 +343,6 @@ class InOrderCPU : public BaseCPU
|
||||||
void trap(Fault fault, ThreadID tid, int delay = 0);
|
void trap(Fault fault, ThreadID tid, int delay = 0);
|
||||||
void trapCPU(Fault fault, ThreadID tid);
|
void trapCPU(Fault fault, ThreadID tid);
|
||||||
|
|
||||||
/** squashFromMemStall() - sets up a squash event
|
|
||||||
* squashDueToMemStall() - squashes pipeline
|
|
||||||
*/
|
|
||||||
void squashFromMemStall(DynInstPtr inst, ThreadID tid, int delay = 0);
|
|
||||||
void squashDueToMemStall(int stage_num, InstSeqNum seq_num, ThreadID tid);
|
|
||||||
|
|
||||||
/** Setup CPU to insert a thread's context */
|
|
||||||
void insertThread(ThreadID tid);
|
|
||||||
|
|
||||||
/** Remove all of a thread's context from CPU */
|
|
||||||
void removeThread(ThreadID tid);
|
|
||||||
|
|
||||||
/** Add Thread to Active Threads List. */
|
/** Add Thread to Active Threads List. */
|
||||||
void activateContext(ThreadID tid, int delay = 0);
|
void activateContext(ThreadID tid, int delay = 0);
|
||||||
void activateThread(ThreadID tid);
|
void activateThread(ThreadID tid);
|
||||||
|
@ -367,16 +351,28 @@ class InOrderCPU : public BaseCPU
|
||||||
void activateNextReadyContext(int delay = 0);
|
void activateNextReadyContext(int delay = 0);
|
||||||
void activateNextReadyThread();
|
void activateNextReadyThread();
|
||||||
|
|
||||||
/** Remove Thread from Active Threads List */
|
/** Remove from Active Thread List */
|
||||||
|
void deactivateContext(ThreadID tid, int delay = 0);
|
||||||
|
void deactivateThread(ThreadID tid);
|
||||||
|
|
||||||
|
/** Suspend Thread, Remove from Active Threads List, Add to Suspend List */
|
||||||
|
void haltContext(ThreadID tid, int delay = 0);
|
||||||
void suspendContext(ThreadID tid, int delay = 0);
|
void suspendContext(ThreadID tid, int delay = 0);
|
||||||
void suspendThread(ThreadID tid);
|
void suspendThread(ThreadID tid);
|
||||||
|
|
||||||
/** Remove Thread from Active Threads List &&
|
/** Remove Thread from Active Threads List, Remove Any Loaded Thread State */
|
||||||
* Remove Thread Context from CPU.
|
|
||||||
*/
|
|
||||||
void deallocateContext(ThreadID tid, int delay = 0);
|
void deallocateContext(ThreadID tid, int delay = 0);
|
||||||
void deallocateThread(ThreadID tid);
|
void deallocateThread(ThreadID tid);
|
||||||
void deactivateThread(ThreadID tid);
|
|
||||||
|
/** squashFromMemStall() - sets up a squash event
|
||||||
|
* squashDueToMemStall() - squashes pipeline
|
||||||
|
*/
|
||||||
|
void squashFromMemStall(DynInstPtr inst, ThreadID tid, int delay = 0);
|
||||||
|
void squashDueToMemStall(int stage_num, InstSeqNum seq_num, ThreadID tid);
|
||||||
|
|
||||||
|
void removePipelineStalls(ThreadID tid);
|
||||||
|
void squashThreadInPipeline(ThreadID tid);
|
||||||
|
void squashBehindMemStall(int stage_num, InstSeqNum seq_num, ThreadID tid);
|
||||||
|
|
||||||
PipelineStage* getPipeStage(int stage_num);
|
PipelineStage* getPipeStage(int stage_num);
|
||||||
|
|
||||||
|
@ -387,37 +383,6 @@ class InOrderCPU : public BaseCPU
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Remove Thread from Active Threads List &&
|
|
||||||
* Remove Thread Context from CPU.
|
|
||||||
*/
|
|
||||||
void haltContext(ThreadID tid, int delay = 0);
|
|
||||||
|
|
||||||
void removePipelineStalls(ThreadID tid);
|
|
||||||
|
|
||||||
void squashThreadInPipeline(ThreadID tid);
|
|
||||||
|
|
||||||
/// Notify the CPU to enable a virtual processor element.
|
|
||||||
virtual void enableVirtProcElement(unsigned vpe);
|
|
||||||
void enableVPEs(unsigned vpe);
|
|
||||||
|
|
||||||
/// Notify the CPU to disable a virtual processor element.
|
|
||||||
virtual void disableVirtProcElement(ThreadID tid, unsigned vpe);
|
|
||||||
void disableVPEs(ThreadID tid, unsigned vpe);
|
|
||||||
|
|
||||||
/// Notify the CPU that multithreading is enabled.
|
|
||||||
virtual void enableMultiThreading(unsigned vpe);
|
|
||||||
void enableThreads(unsigned vpe);
|
|
||||||
|
|
||||||
/// Notify the CPU that multithreading is disabled.
|
|
||||||
virtual void disableMultiThreading(ThreadID tid, unsigned vpe);
|
|
||||||
void disableThreads(ThreadID tid, unsigned vpe);
|
|
||||||
|
|
||||||
/** Activate a Thread When CPU Resources are Available. */
|
|
||||||
void activateWhenReady(ThreadID tid);
|
|
||||||
|
|
||||||
/** Add or Remove a Thread Context in the CPU. */
|
|
||||||
void doContextSwitch();
|
|
||||||
|
|
||||||
/** Update The Order In Which We Process Threads. */
|
/** Update The Order In Which We Process Threads. */
|
||||||
void updateThreadPriority();
|
void updateThreadPriority();
|
||||||
|
|
||||||
|
@ -615,21 +580,15 @@ class InOrderCPU : public BaseCPU
|
||||||
/** Active Threads List */
|
/** Active Threads List */
|
||||||
std::list<ThreadID> activeThreads;
|
std::list<ThreadID> activeThreads;
|
||||||
|
|
||||||
/** Current Threads List */
|
|
||||||
std::list<ThreadID> currentThreads;
|
|
||||||
|
|
||||||
/** Ready Threads List */
|
/** Ready Threads List */
|
||||||
std::list<ThreadID> readyThreads;
|
std::list<ThreadID> readyThreads;
|
||||||
|
|
||||||
/** Suspended Threads List */
|
/** Suspended Threads List */
|
||||||
std::list<ThreadID> suspendedThreads;
|
std::list<ThreadID> suspendedThreads;
|
||||||
|
|
||||||
/** Thread Status Functions (Unused Currently) */
|
/** Thread Status Functions */
|
||||||
bool isThreadInCPU(ThreadID tid);
|
|
||||||
bool isThreadActive(ThreadID tid);
|
bool isThreadActive(ThreadID tid);
|
||||||
bool isThreadSuspended(ThreadID tid);
|
bool isThreadSuspended(ThreadID tid);
|
||||||
void addToCurrentThreads(ThreadID tid);
|
|
||||||
void removeFromCurrentThreads(ThreadID tid);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** The activity recorder; used to tell if the CPU has any
|
/** The activity recorder; used to tell if the CPU has any
|
||||||
|
@ -643,7 +602,8 @@ class InOrderCPU : public BaseCPU
|
||||||
ThreadID numActiveThreads() { return activeThreads.size(); }
|
ThreadID numActiveThreads() { return activeThreads.size(); }
|
||||||
|
|
||||||
/** Thread id of active thread
|
/** Thread id of active thread
|
||||||
* Only used for SwitchOnCacheMiss model. Assumes only 1 thread active
|
* Only used for SwitchOnCacheMiss model.
|
||||||
|
* Assumes only 1 thread active
|
||||||
*/
|
*/
|
||||||
ThreadID activeThreadId()
|
ThreadID activeThreadId()
|
||||||
{
|
{
|
||||||
|
@ -672,9 +632,6 @@ class InOrderCPU : public BaseCPU
|
||||||
virtual void wakeup();
|
virtual void wakeup();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** Gets a free thread id. Use if thread ids change across system. */
|
|
||||||
ThreadID getFreeTid();
|
|
||||||
|
|
||||||
// LL/SC debug functionality
|
// LL/SC debug functionality
|
||||||
unsigned stCondFails;
|
unsigned stCondFails;
|
||||||
|
|
||||||
|
@ -740,18 +697,9 @@ class InOrderCPU : public BaseCPU
|
||||||
/** Per-Stage Instruction Tracing */
|
/** Per-Stage Instruction Tracing */
|
||||||
bool stageTracing;
|
bool stageTracing;
|
||||||
|
|
||||||
/** Is there a context switch pending? */
|
|
||||||
bool contextSwitch;
|
|
||||||
|
|
||||||
/** Threads Scheduled to Enter CPU */
|
|
||||||
std::list<int> cpuWaitList;
|
|
||||||
|
|
||||||
/** The cycle that the CPU was last running, used for statistics. */
|
/** The cycle that the CPU was last running, used for statistics. */
|
||||||
Tick lastRunningCycle;
|
Tick lastRunningCycle;
|
||||||
|
|
||||||
/** Number of Virtual Processors the CPU can process */
|
|
||||||
unsigned numVirtProcs;
|
|
||||||
|
|
||||||
/** Update Thread , used for statistic purposes*/
|
/** Update Thread , used for statistic purposes*/
|
||||||
inline void tickThreadStats();
|
inline void tickThreadStats();
|
||||||
|
|
||||||
|
|
|
@ -583,30 +583,6 @@ InOrderDynInst::deallocateContext(int thread_num)
|
||||||
this->cpu->deallocateContext(thread_num);
|
this->cpu->deallocateContext(thread_num);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
InOrderDynInst::enableVirtProcElement(unsigned vpe)
|
|
||||||
{
|
|
||||||
this->cpu->enableVirtProcElement(vpe);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
InOrderDynInst::disableVirtProcElement(unsigned vpe)
|
|
||||||
{
|
|
||||||
this->cpu->disableVirtProcElement(threadNumber, vpe);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
InOrderDynInst::enableMultiThreading(unsigned vpe)
|
|
||||||
{
|
|
||||||
this->cpu->enableMultiThreading(vpe);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
InOrderDynInst::disableMultiThreading(unsigned vpe)
|
|
||||||
{
|
|
||||||
this->cpu->disableMultiThreading(threadNumber, vpe);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
inline Fault
|
inline Fault
|
||||||
InOrderDynInst::read(Addr addr, T &data, unsigned flags)
|
InOrderDynInst::read(Addr addr, T &data, unsigned flags)
|
||||||
|
|
|
@ -515,12 +515,6 @@ class InOrderDynInst : public FastAlloc, public RefCounted
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
virtual void deallocateContext(int thread_num);
|
virtual void deallocateContext(int thread_num);
|
||||||
|
|
||||||
virtual void enableVirtProcElement(unsigned vpe);
|
|
||||||
virtual void disableVirtProcElement(unsigned vpe);
|
|
||||||
|
|
||||||
virtual void enableMultiThreading(unsigned vpe);
|
|
||||||
virtual void disableMultiThreading(unsigned vpe);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// PROGRAM COUNTERS - PC/NPC/NPC
|
// PROGRAM COUNTERS - PC/NPC/NPC
|
||||||
|
|
Loading…
Reference in a new issue