From 5bfa521c46e489c06ac3ae44b97421f5ccb30bb7 Mon Sep 17 00:00:00 2001 From: Mitch Hayenga Date: Wed, 29 Oct 2014 23:18:27 -0500 Subject: cpu: Add writeback modeling for drain functionality It is possible for the O3 CPU to consider itself drained and later have a squashed instruction perform a writeback. This patch re-adds tracking of in-flight instructions to prevent falsely signaling a drained event. --- src/cpu/o3/inst_queue_impl.hh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/cpu/o3/inst_queue_impl.hh') diff --git a/src/cpu/o3/inst_queue_impl.hh b/src/cpu/o3/inst_queue_impl.hh index 6a76b49d0..33e523f4d 100644 --- a/src/cpu/o3/inst_queue_impl.hh +++ b/src/cpu/o3/inst_queue_impl.hh @@ -415,6 +415,7 @@ InstructionQueue::resetState() deferredMemInsts.clear(); blockedMemInsts.clear(); retryMemInsts.clear(); + wbOutstanding = 0; } template @@ -444,7 +445,9 @@ template bool InstructionQueue::isDrained() const { - bool drained = dependGraph.empty() && instsToExecute.empty(); + bool drained = dependGraph.empty() && + instsToExecute.empty() && + wbOutstanding == 0; for (ThreadID tid = 0; tid < numThreads; ++tid) drained = drained && memDepUnit[tid].isDrained(); @@ -723,6 +726,7 @@ InstructionQueue::processFUCompletion(DynInstPtr &inst, int fu_idx) assert(!cpu->switchedOut()); // The CPU could have been sleeping until this op completed (*extremely* // long latency op). Wake it if it was. This may be overkill. + --wbOutstanding; iewStage->wakeCPU(); if (fu_idx > -1) @@ -823,6 +827,7 @@ InstructionQueue::scheduleReadyInsts() } else { Cycles issue_latency = fuPool->getIssueLatency(op_class); // Generate completion event for the FU + ++wbOutstanding; FUCompletion *execution = new FUCompletion(issuing_inst, idx, this); -- cgit v1.2.3