diff options
author | Gabe Black <gblack@eecs.umich.edu> | 2007-01-03 00:52:30 -0500 |
---|---|---|
committer | Gabe Black <gblack@eecs.umich.edu> | 2007-01-03 00:52:30 -0500 |
commit | 8840ebcb00f3988c781063e572b6df5742968f95 (patch) | |
tree | e9711f561dff45b31489a7fb539ed98660e26d0e /src/cpu/o3/lsq_impl.hh | |
parent | a0e8aa6737f534a8e51d866728dd6dc59bef263d (diff) | |
parent | 7d7f3d0e99eca98a5659e73bce56d615f0ed4fc3 (diff) | |
download | gem5-8840ebcb00f3988c781063e572b6df5742968f95.tar.xz |
Merge zizzer:/bk/newmem
into zower.eecs.umich.edu:/eecshome/m5/newmem
--HG--
extra : convert_revision : f4a05accb8fa24d425dd818b1b7f268378180e99
Diffstat (limited to 'src/cpu/o3/lsq_impl.hh')
-rw-r--r-- | src/cpu/o3/lsq_impl.hh | 146 |
1 files changed, 88 insertions, 58 deletions
diff --git a/src/cpu/o3/lsq_impl.hh b/src/cpu/o3/lsq_impl.hh index 6758e51c8..fb738f7c9 100644 --- a/src/cpu/o3/lsq_impl.hh +++ b/src/cpu/o3/lsq_impl.hh @@ -244,10 +244,7 @@ void LSQ<Impl>::resetEntries() { if (lsqPolicy != Dynamic || numThreads > 1) { - int active_threads = (*activeThreads).size(); - - std::list<unsigned>::iterator threads = (*activeThreads).begin(); - std::list<unsigned>::iterator list_end = (*activeThreads).end(); + int active_threads = activeThreads->size(); int maxEntries; @@ -259,8 +256,13 @@ LSQ<Impl>::resetEntries() maxEntries = LQEntries; } - while (threads != list_end) { - resizeEntries(maxEntries,*threads++); + std::list<unsigned>::iterator threads = activeThreads->begin(); + std::list<unsigned>::iterator end = activeThreads->end(); + + while (threads != end) { + unsigned tid = *threads++; + + resizeEntries(maxEntries, tid); } } } @@ -285,10 +287,11 @@ template<class Impl> void LSQ<Impl>::tick() { - std::list<unsigned>::iterator active_threads = (*activeThreads).begin(); + std::list<unsigned>::iterator threads = activeThreads->begin(); + std::list<unsigned>::iterator end = activeThreads->end(); - while (active_threads != (*activeThreads).end()) { - unsigned tid = *active_threads++; + while (threads != end) { + unsigned tid = *threads++; thread[tid].tick(); } @@ -334,10 +337,11 @@ template<class Impl> void LSQ<Impl>::writebackStores() { - std::list<unsigned>::iterator active_threads = (*activeThreads).begin(); + std::list<unsigned>::iterator threads = activeThreads->begin(); + std::list<unsigned>::iterator end = activeThreads->end(); - while (active_threads != (*activeThreads).end()) { - unsigned tid = *active_threads++; + while (threads != end) { + unsigned tid = *threads++; if (numStoresToWB(tid) > 0) { DPRINTF(Writeback,"[tid:%i] Writing back stores. %i stores " @@ -353,10 +357,12 @@ bool LSQ<Impl>::violation() { /* Answers: Does Anybody Have a Violation?*/ - std::list<unsigned>::iterator active_threads = (*activeThreads).begin(); + std::list<unsigned>::iterator threads = activeThreads->begin(); + std::list<unsigned>::iterator end = activeThreads->end(); + + while (threads != end) { + unsigned tid = *threads++; - while (active_threads != (*activeThreads).end()) { - unsigned tid = *active_threads++; if (thread[tid].violation()) return true; } @@ -370,10 +376,12 @@ LSQ<Impl>::getCount() { unsigned total = 0; - std::list<unsigned>::iterator active_threads = (*activeThreads).begin(); + std::list<unsigned>::iterator threads = activeThreads->begin(); + std::list<unsigned>::iterator end = activeThreads->end(); + + while (threads != end) { + unsigned tid = *threads++; - while (active_threads != (*activeThreads).end()) { - unsigned tid = *active_threads++; total += getCount(tid); } @@ -386,10 +394,12 @@ LSQ<Impl>::numLoads() { unsigned total = 0; - std::list<unsigned>::iterator active_threads = (*activeThreads).begin(); + std::list<unsigned>::iterator threads = activeThreads->begin(); + std::list<unsigned>::iterator end = activeThreads->end(); + + while (threads != end) { + unsigned tid = *threads++; - while (active_threads != (*activeThreads).end()) { - unsigned tid = *active_threads++; total += numLoads(tid); } @@ -402,10 +412,12 @@ LSQ<Impl>::numStores() { unsigned total = 0; - std::list<unsigned>::iterator active_threads = (*activeThreads).begin(); + std::list<unsigned>::iterator threads = activeThreads->begin(); + std::list<unsigned>::iterator end = activeThreads->end(); + + while (threads != end) { + unsigned tid = *threads++; - while (active_threads != (*activeThreads).end()) { - unsigned tid = *active_threads++; total += thread[tid].numStores(); } @@ -418,10 +430,12 @@ LSQ<Impl>::numLoadsReady() { unsigned total = 0; - std::list<unsigned>::iterator active_threads = (*activeThreads).begin(); + std::list<unsigned>::iterator threads = activeThreads->begin(); + std::list<unsigned>::iterator end = activeThreads->end(); + + while (threads != end) { + unsigned tid = *threads++; - while (active_threads != (*activeThreads).end()) { - unsigned tid = *active_threads++; total += thread[tid].numLoadsReady(); } @@ -434,10 +448,12 @@ LSQ<Impl>::numFreeEntries() { unsigned total = 0; - std::list<unsigned>::iterator active_threads = (*activeThreads).begin(); + std::list<unsigned>::iterator threads = activeThreads->begin(); + std::list<unsigned>::iterator end = activeThreads->end(); + + while (threads != end) { + unsigned tid = *threads++; - while (active_threads != (*activeThreads).end()) { - unsigned tid = *active_threads++; total += thread[tid].numFreeEntries(); } @@ -448,7 +464,7 @@ template<class Impl> unsigned LSQ<Impl>::numFreeEntries(unsigned tid) { - //if( lsqPolicy == Dynamic ) + //if (lsqPolicy == Dynamic) //return numFreeEntries(); //else return thread[tid].numFreeEntries(); @@ -458,11 +474,13 @@ template<class Impl> bool LSQ<Impl>::isFull() { - std::list<unsigned>::iterator active_threads = (*activeThreads).begin(); + std::list<unsigned>::iterator threads = activeThreads->begin(); + std::list<unsigned>::iterator end = activeThreads->end(); + + while (threads != end) { + unsigned tid = *threads++; - while (active_threads != (*activeThreads).end()) { - unsigned tid = *active_threads++; - if (! (thread[tid].lqFull() || thread[tid].sqFull()) ) + if (!(thread[tid].lqFull() || thread[tid].sqFull())) return false; } @@ -475,7 +493,7 @@ LSQ<Impl>::isFull(unsigned tid) { //@todo: Change to Calculate All Entries for //Dynamic Policy - if( lsqPolicy == Dynamic ) + if (lsqPolicy == Dynamic) return isFull(); else return thread[tid].lqFull() || thread[tid].sqFull(); @@ -485,10 +503,12 @@ template<class Impl> bool LSQ<Impl>::lqFull() { - std::list<unsigned>::iterator active_threads = (*activeThreads).begin(); + std::list<unsigned>::iterator threads = activeThreads->begin(); + std::list<unsigned>::iterator end = activeThreads->end(); + + while (threads != end) { + unsigned tid = *threads++; - while (active_threads != (*activeThreads).end()) { - unsigned tid = *active_threads++; if (!thread[tid].lqFull()) return false; } @@ -502,7 +522,7 @@ LSQ<Impl>::lqFull(unsigned tid) { //@todo: Change to Calculate All Entries for //Dynamic Policy - if( lsqPolicy == Dynamic ) + if (lsqPolicy == Dynamic) return lqFull(); else return thread[tid].lqFull(); @@ -512,10 +532,12 @@ template<class Impl> bool LSQ<Impl>::sqFull() { - std::list<unsigned>::iterator active_threads = (*activeThreads).begin(); + std::list<unsigned>::iterator threads = activeThreads->begin(); + std::list<unsigned>::iterator end = activeThreads->end(); + + while (threads != end) { + unsigned tid = *threads++; - while (active_threads != (*activeThreads).end()) { - unsigned tid = *active_threads++; if (!sqFull(tid)) return false; } @@ -529,7 +551,7 @@ LSQ<Impl>::sqFull(unsigned tid) { //@todo: Change to Calculate All Entries for //Dynamic Policy - if( lsqPolicy == Dynamic ) + if (lsqPolicy == Dynamic) return sqFull(); else return thread[tid].sqFull(); @@ -539,10 +561,12 @@ template<class Impl> bool LSQ<Impl>::isStalled() { - std::list<unsigned>::iterator active_threads = (*activeThreads).begin(); + std::list<unsigned>::iterator threads = activeThreads->begin(); + std::list<unsigned>::iterator end = activeThreads->end(); + + while (threads != end) { + unsigned tid = *threads++; - while (active_threads != (*activeThreads).end()) { - unsigned tid = *active_threads++; if (!thread[tid].isStalled()) return false; } @@ -554,7 +578,7 @@ template<class Impl> bool LSQ<Impl>::isStalled(unsigned tid) { - if( lsqPolicy == Dynamic ) + if (lsqPolicy == Dynamic) return isStalled(); else return thread[tid].isStalled(); @@ -564,13 +588,15 @@ template<class Impl> bool LSQ<Impl>::hasStoresToWB() { - std::list<unsigned>::iterator active_threads = (*activeThreads).begin(); + std::list<unsigned>::iterator threads = activeThreads->begin(); + std::list<unsigned>::iterator end = activeThreads->end(); - if ((*activeThreads).empty()) + if (threads == end) return false; - while (active_threads != (*activeThreads).end()) { - unsigned tid = *active_threads++; + while (threads != end) { + unsigned tid = *threads++; + if (!hasStoresToWB(tid)) return false; } @@ -582,10 +608,12 @@ template<class Impl> bool LSQ<Impl>::willWB() { - std::list<unsigned>::iterator active_threads = (*activeThreads).begin(); + std::list<unsigned>::iterator threads = activeThreads->begin(); + std::list<unsigned>::iterator end = activeThreads->end(); + + while (threads != end) { + unsigned tid = *threads++; - while (active_threads != (*activeThreads).end()) { - unsigned tid = *active_threads++; if (!willWB(tid)) return false; } @@ -597,10 +625,12 @@ template<class Impl> void LSQ<Impl>::dumpInsts() { - std::list<unsigned>::iterator active_threads = (*activeThreads).begin(); + std::list<unsigned>::iterator threads = activeThreads->begin(); + std::list<unsigned>::iterator end = activeThreads->end(); + + while (threads != end) { + unsigned tid = *threads++; - while (active_threads != (*activeThreads).end()) { - unsigned tid = *active_threads++; thread[tid].dumpInsts(); } } |