summaryrefslogtreecommitdiff
path: root/src/cpu
diff options
context:
space:
mode:
authorNilay Vaish <nilay@cs.wisc.edu>2015-03-09 09:39:07 -0500
committerNilay Vaish <nilay@cs.wisc.edu>2015-03-09 09:39:07 -0500
commit61edd5ac97147ec4510fee8d68b2bc1780cbd5d0 (patch)
tree04dbd9cd55bba95ce8d36a7c9c8435f948d5611e /src/cpu
parentf69a74fda63860c795e22c5dcd739a559cf95b5d (diff)
downloadgem5-61edd5ac97147ec4510fee8d68b2bc1780cbd5d0.tar.xz
cpu: o3: remove member variable squashCounter
The variable is used in only one place and a whole new function setNextStatus() has been defined just to compute the value of the variable. Instead of calling the function, the value is now computed in the loop that preceded the function call.
Diffstat (limited to 'src/cpu')
-rw-r--r--src/cpu/o3/commit.hh8
-rw-r--r--src/cpu/o3/commit_impl.hh41
2 files changed, 11 insertions, 38 deletions
diff --git a/src/cpu/o3/commit.hh b/src/cpu/o3/commit.hh
index 93c145d5b..12d04a1c2 100644
--- a/src/cpu/o3/commit.hh
+++ b/src/cpu/o3/commit.hh
@@ -246,11 +246,6 @@ class DefaultCommit
*/
void updateStatus();
- /** Sets the next status based on threads' statuses, which becomes the
- * current status at the end of the cycle.
- */
- void setNextStatus();
-
/** Returns if any of the threads have the number of ROB entries changed
* on this cycle. Used to determine if the number of free ROB entries needs
* to be sent back to previous stages.
@@ -392,9 +387,6 @@ class DefaultCommit
*/
bool changedROBNumEntries[Impl::MaxThreads];
- /** A counter of how many threads are currently squashing. */
- ThreadID squashCounter;
-
/** Records if a thread has to squash this cycle due to a trap. */
bool trapSquash[Impl::MaxThreads];
diff --git a/src/cpu/o3/commit_impl.hh b/src/cpu/o3/commit_impl.hh
index bb2b17209..403e582d3 100644
--- a/src/cpu/o3/commit_impl.hh
+++ b/src/cpu/o3/commit_impl.hh
@@ -96,7 +96,6 @@ DefaultCommit<Impl>::TrapEvent::description() const
template <class Impl>
DefaultCommit<Impl>::DefaultCommit(O3CPU *_cpu, DerivO3CPUParams *params)
: cpu(_cpu),
- squashCounter(0),
iewToCommitDelay(params->iewToCommitDelay),
commitToIEWDelay(params->commitToIEWDelay),
renameToROBDelay(params->renameToROBDelay),
@@ -460,7 +459,6 @@ DefaultCommit<Impl>::takeOverFrom()
tcSquash[tid] = false;
squashAfterInst[tid] = NULL;
}
- squashCounter = 0;
rob->takeOverFrom();
}
@@ -509,32 +507,6 @@ DefaultCommit<Impl>::updateStatus()
}
template <class Impl>
-void
-DefaultCommit<Impl>::setNextStatus()
-{
- int squashes = 0;
-
- list<ThreadID>::iterator threads = activeThreads->begin();
- list<ThreadID>::iterator end = activeThreads->end();
-
- while (threads != end) {
- ThreadID tid = *threads++;
-
- if (commitStatus[tid] == ROBSquashing) {
- squashes++;
- }
- }
-
- squashCounter = squashes;
-
- // If commit is currently squashing, then it will have activity for the
- // next cycle. Set its next status as active.
- if (squashCounter) {
- _nextStatus = Active;
- }
-}
-
-template <class Impl>
bool
DefaultCommit<Impl>::changedROBEntries()
{
@@ -856,6 +828,8 @@ DefaultCommit<Impl>::commit()
list<ThreadID>::iterator threads = activeThreads->begin();
list<ThreadID>::iterator end = activeThreads->end();
+ int num_squashing_threads = 0;
+
while (threads != end) {
ThreadID tid = *threads++;
@@ -941,11 +915,18 @@ DefaultCommit<Impl>::commit()
}
}
+ if (commitStatus[tid] == ROBSquashing) {
+ num_squashing_threads++;
+ }
}
- setNextStatus();
+ // If commit is currently squashing, then it will have activity for the
+ // next cycle. Set its next status as active.
+ if (num_squashing_threads) {
+ _nextStatus = Active;
+ }
- if (squashCounter != numThreads) {
+ if (num_squashing_threads != numThreads) {
// If we're not currently squashing, then get instructions.
getInsts();