inorder: user per-thread dummy insts/reqs

This commit is contained in:
Korey Sewell 2010-01-31 18:29:59 -05:00
parent 002f1b8b7e
commit 1a89e8f4cb
4 changed files with 30 additions and 20 deletions

View file

@ -211,6 +211,7 @@ InOrderCPU::InOrderCPU(Params *params)
"edit your workload size."); "edit your workload size.");
} }
if (active_threads > 1) { if (active_threads > 1) {
threadModel = (InOrderCPU::ThreadModel) params->threadModel; threadModel = (InOrderCPU::ThreadModel) params->threadModel;
@ -257,6 +258,9 @@ InOrderCPU::InOrderCPU(Params *params)
Process* dummy_proc = params->workload[0]; Process* dummy_proc = params->workload[0];
thread[tid] = new Thread(this, tid, dummy_proc); thread[tid] = new Thread(this, tid, dummy_proc);
} }
// Eventually set this with parameters...
asid[tid] = tid;
#endif #endif
// Setup the TC that will serve as the interface to the threads/CPU. // Setup the TC that will serve as the interface to the threads/CPU.
@ -313,14 +317,24 @@ InOrderCPU::InOrderCPU(Params *params)
isa[tid].clear(); isa[tid].clear();
isa[tid].expandForMultithreading(numThreads, 1/*numVirtProcs*/); isa[tid].expandForMultithreading(numThreads, 1/*numVirtProcs*/);
// Define dummy instructions and resource requests to be used.
dummyInst[tid] = new InOrderDynInst(this,
thread[tid],
0,
tid,
asid[tid]);
dummyReq[tid] = new ResourceRequest(resPool->getResource(0),
dummyInst[tid],
0,
0,
0,
0);
} }
lastRunningCycle = curTick; lastRunningCycle = curTick;
// Define dummy instructions and resource requests to be used.
dummyInst = new InOrderDynInst(this, NULL, 0, 0);
dummyReq = new ResourceRequest(resPool->getResource(0), NULL, 0, 0, 0, 0);
// Reset CPU to reset state. // Reset CPU to reset state.
#if FULL_SYSTEM #if FULL_SYSTEM
Fault resetFault = new ResetFault(); Fault resetFault = new ResetFault();
@ -585,7 +599,7 @@ void
InOrderCPU::trap(Fault fault, ThreadID tid, int delay) InOrderCPU::trap(Fault fault, ThreadID tid, int delay)
{ {
//@ Squash Pipeline during TRAP //@ Squash Pipeline during TRAP
scheduleCpuEvent(Trap, fault, tid, dummyInst, delay); scheduleCpuEvent(Trap, fault, tid, dummyInst[tid], delay);
} }
void void
@ -747,7 +761,7 @@ InOrderCPU::deactivateContext(ThreadID tid, int delay)
{ {
DPRINTF(InOrderCPU,"[tid:%i]: Deactivating ...\n", tid); DPRINTF(InOrderCPU,"[tid:%i]: Deactivating ...\n", tid);
scheduleCpuEvent(DeactivateThread, NoFault, tid, dummyInst, delay); scheduleCpuEvent(DeactivateThread, NoFault, tid, dummyInst[tid], delay);
// Be sure to signal that there's some activity so the CPU doesn't // Be sure to signal that there's some activity so the CPU doesn't
// deschedule itself. // deschedule itself.
@ -830,7 +844,8 @@ InOrderCPU::activateContext(ThreadID tid, int delay)
{ {
DPRINTF(InOrderCPU,"[tid:%i]: Activating ...\n", tid); DPRINTF(InOrderCPU,"[tid:%i]: Activating ...\n", tid);
scheduleCpuEvent(ActivateThread, NoFault, tid, dummyInst, delay);
scheduleCpuEvent(ActivateThread, NoFault, tid, dummyInst[tid], delay);
// Be sure to signal that there's some activity so the CPU doesn't // Be sure to signal that there's some activity so the CPU doesn't
// deschedule itself. // deschedule itself.
@ -847,7 +862,7 @@ InOrderCPU::activateNextReadyContext(int delay)
// NOTE: Add 5 to the event priority so that we always activate // NOTE: Add 5 to the event priority so that we always activate
// threads after we've finished deactivating, squashing,etc. // threads after we've finished deactivating, squashing,etc.
// other threads // other threads
scheduleCpuEvent(ActivateNextReadyThread, NoFault, 0/*tid*/, dummyInst, scheduleCpuEvent(ActivateNextReadyThread, NoFault, 0/*tid*/, dummyInst[0],
delay, 5); delay, 5);
// Be sure to signal that there's some activity so the CPU doesn't // Be sure to signal that there's some activity so the CPU doesn't
@ -862,7 +877,7 @@ InOrderCPU::haltContext(ThreadID tid, int delay)
{ {
DPRINTF(InOrderCPU, "[tid:%i]: Calling Halt Context...\n", tid); DPRINTF(InOrderCPU, "[tid:%i]: Calling Halt Context...\n", tid);
scheduleCpuEvent(HaltThread, NoFault, tid, dummyInst, delay); scheduleCpuEvent(HaltThread, NoFault, tid, dummyInst[tid], delay);
activityRec.activity(); activityRec.activity();
} }
@ -885,7 +900,7 @@ InOrderCPU::haltThread(ThreadID tid)
void void
InOrderCPU::suspendContext(ThreadID tid, int delay) InOrderCPU::suspendContext(ThreadID tid, int delay)
{ {
scheduleCpuEvent(SuspendThread, NoFault, tid, dummyInst, delay); scheduleCpuEvent(SuspendThread, NoFault, tid, dummyInst[tid], delay);
} }
void void

View file

@ -97,6 +97,9 @@ class InOrderCPU : public BaseCPU
/** CPU ID */ /** CPU ID */
int cpu_id; int cpu_id;
// SE Mode ASIDs
ThreadID asid[ThePipeline::MaxThreads];
/** Type of core that this is */ /** Type of core that this is */
std::string coreType; std::string coreType;
@ -241,10 +244,10 @@ class InOrderCPU : public BaseCPU
/** Instruction used to signify that there is no *real* instruction in /** Instruction used to signify that there is no *real* instruction in
buffer slot */ buffer slot */
DynInstPtr dummyInst; DynInstPtr dummyInst[ThePipeline::MaxThreads];
/** Used by resources to signify a denied access to a resource. */ /** Used by resources to signify a denied access to a resource. */
ResourceRequest *dummyReq; ResourceRequest *dummyReq[ThePipeline::MaxThreads];
/** Identifies the resource id that identifies a fetch /** Identifies the resource id that identifies a fetch
* access unit. * access unit.

View file

@ -448,11 +448,6 @@ ResourcePool::updateAfterContextSwitch(DynInstPtr inst, ThreadID tid)
} }
} }
ResourcePool::ResPoolEvent::ResPoolEvent(ResourcePool *_resPool)
: Event((Event::Priority)((unsigned)CPU_Tick_Pri+5)), resPool(_resPool),
eventType((InOrderCPU::CPUEventType) Default)
{ }
ResourcePool::ResPoolEvent::ResPoolEvent(ResourcePool *_resPool, ResourcePool::ResPoolEvent::ResPoolEvent(ResourcePool *_resPool,
InOrderCPU::CPUEventType e_type, InOrderCPU::CPUEventType e_type,
DynInstPtr _inst, DynInstPtr _inst,

View file

@ -85,9 +85,6 @@ class ResourcePool {
ThreadID tid; ThreadID tid;
public: public:
/** Constructs a resource event. */
ResPoolEvent(ResourcePool *_resPool);
/** Constructs a resource event. */ /** Constructs a resource event. */
ResPoolEvent(ResourcePool *_resPool, ResPoolEvent(ResourcePool *_resPool,
InOrderCPU::CPUEventType e_type, InOrderCPU::CPUEventType e_type,