From 8c0def8d0347e9a7b84f21895c5cbd94eba9a09a Mon Sep 17 00:00:00 2001 From: Korey Sewell Date: Sun, 19 Jun 2011 21:43:41 -0400 Subject: [PATCH] inorder: use trapPending flag to manage traps --- src/cpu/inorder/cpu.cc | 8 +++++--- src/cpu/inorder/cpu.hh | 2 ++ src/cpu/inorder/resources/graduation_unit.cc | 4 +++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/cpu/inorder/cpu.cc b/src/cpu/inorder/cpu.cc index 365b2f18a..158489f86 100644 --- a/src/cpu/inorder/cpu.cc +++ b/src/cpu/inorder/cpu.cc @@ -149,6 +149,7 @@ InOrderCPU::CPUEvent::process() DPRINTF(InOrderCPU, "Trapping CPU\n"); cpu->trap(fault, tid, inst); cpu->resPool->trap(fault, tid, inst); + cpu->trapPending[tid] = false; break; #if !FULL_SYSTEM @@ -359,6 +360,8 @@ InOrderCPU::InOrderCPU(Params *params) dummyTrapInst[tid]->setTid(tid); #endif + trapPending[tid] = false; + } dummyReqInst = new InOrderDynInst(this, NULL, 0, 0, 0); @@ -698,8 +701,8 @@ InOrderCPU::tick() ++numCycles; + checkForInterrupts(); bool pipes_idle = true; - //Tick each of the stages for (int stNum=NumStages - 1; stNum >= 0 ; stNum--) { pipelineStage[stNum]->tick(); @@ -707,8 +710,6 @@ InOrderCPU::tick() pipes_idle = pipes_idle && pipelineStage[stNum]->idle; } - checkForInterrupts(); - if (pipes_idle) idleCycles++; else @@ -902,6 +903,7 @@ void InOrderCPU::trapContext(Fault fault, ThreadID tid, DynInstPtr inst, int delay) { scheduleCpuEvent(Trap, fault, tid, inst, delay); + trapPending[tid] = true; } void diff --git a/src/cpu/inorder/cpu.hh b/src/cpu/inorder/cpu.hh index a1e92f302..a5616f8b1 100644 --- a/src/cpu/inorder/cpu.hh +++ b/src/cpu/inorder/cpu.hh @@ -667,6 +667,8 @@ class InOrderCPU : public BaseCPU */ std::queue removeList; + bool trapPending[ThePipeline::MaxThreads]; + /** List of all the cpu event requests that will be removed at the end of * the current cycle. */ diff --git a/src/cpu/inorder/resources/graduation_unit.cc b/src/cpu/inorder/resources/graduation_unit.cc index ebcf40c6a..c69e55512 100644 --- a/src/cpu/inorder/resources/graduation_unit.cc +++ b/src/cpu/inorder/resources/graduation_unit.cc @@ -66,7 +66,9 @@ GraduationUnit::execute(int slot_num) return; } - if (lastFaultTick[tid] == cur_tick) { + //@todo: use trap Pending + if (cpu->trapPending[tid]) { + //if (lastFaultTick[tid] == cur_tick) { DPRINTF(InOrderGraduation, "Unable to graduate [sn:%i]. " "Only 1 fault can be handled per tick.\n"); grad_req->done(false);