diff options
Diffstat (limited to 'src/cpu/o3/lsq_impl.hh')
-rw-r--r-- | src/cpu/o3/lsq_impl.hh | 92 |
1 files changed, 69 insertions, 23 deletions
diff --git a/src/cpu/o3/lsq_impl.hh b/src/cpu/o3/lsq_impl.hh index 89fd1a71d..db2c253e1 100644 --- a/src/cpu/o3/lsq_impl.hh +++ b/src/cpu/o3/lsq_impl.hh @@ -29,23 +29,66 @@ */ #include <algorithm> +#include <list> #include <string> #include "cpu/o3/lsq.hh" -using namespace std; +template <class Impl> +Tick +LSQ<Impl>::DcachePort::recvAtomic(PacketPtr pkt) +{ + panic("O3CPU model does not work with atomic mode!"); + return curTick; +} + +template <class Impl> +void +LSQ<Impl>::DcachePort::recvFunctional(PacketPtr pkt) +{ + panic("O3CPU doesn't expect recvFunctional callback!"); +} + +template <class Impl> +void +LSQ<Impl>::DcachePort::recvStatusChange(Status status) +{ + if (status == RangeChange) + return; + + panic("O3CPU doesn't expect recvStatusChange callback!"); +} + +template <class Impl> +bool +LSQ<Impl>::DcachePort::recvTiming(PacketPtr pkt) +{ + lsq->thread[pkt->req->getThreadNum()].completeDataAccess(pkt); + return true; +} + +template <class Impl> +void +LSQ<Impl>::DcachePort::recvRetry() +{ + lsq->thread[lsq->retryTid].recvRetry(); + // Speculatively clear the retry Tid. This will get set again if + // the LSQUnit was unable to complete its access. + lsq->retryTid = -1; +} template <class Impl> LSQ<Impl>::LSQ(Params *params) - : LQEntries(params->LQEntries), SQEntries(params->SQEntries), - numThreads(params->numberOfThreads) + : dcachePort(this), LQEntries(params->LQEntries), + SQEntries(params->SQEntries), numThreads(params->numberOfThreads), + retryTid(-1) { DPRINTF(LSQ, "Creating LSQ object.\n"); //**********************************************/ //************ Handle SMT Parameters ***********/ //**********************************************/ - string policy = params->smtLSQPolicy; + std::string policy = params->smtLSQPolicy; //Convert string to lowercase std::transform(policy.begin(), policy.end(), policy.begin(), @@ -94,7 +137,8 @@ LSQ<Impl>::LSQ(Params *params) //Initialize LSQs for (int tid=0; tid < numThreads; tid++) { - thread[tid].init(params, maxLQEntries, maxSQEntries, tid); + thread[tid].init(params, this, maxLQEntries, maxSQEntries, tid); + thread[tid].setDcachePort(&dcachePort); } } @@ -118,7 +162,7 @@ LSQ<Impl>::regStats() template<class Impl> void -LSQ<Impl>::setActiveThreads(list<unsigned> *at_ptr) +LSQ<Impl>::setActiveThreads(std::list<unsigned> *at_ptr) { activeThreads = at_ptr; assert(activeThreads != 0); @@ -130,6 +174,8 @@ LSQ<Impl>::setCPU(O3CPU *cpu_ptr) { cpu = cpu_ptr; + dcachePort.setName(name()); + for (int tid=0; tid < numThreads; tid++) { thread[tid].setCPU(cpu_ptr); } @@ -182,8 +228,8 @@ LSQ<Impl>::resetEntries() if (lsqPolicy != Dynamic || numThreads > 1) { int active_threads = (*activeThreads).size(); - list<unsigned>::iterator threads = (*activeThreads).begin(); - list<unsigned>::iterator list_end = (*activeThreads).end(); + std::list<unsigned>::iterator threads = (*activeThreads).begin(); + std::list<unsigned>::iterator list_end = (*activeThreads).end(); int maxEntries; @@ -221,7 +267,7 @@ template<class Impl> void LSQ<Impl>::tick() { - list<unsigned>::iterator active_threads = (*activeThreads).begin(); + std::list<unsigned>::iterator active_threads = (*activeThreads).begin(); while (active_threads != (*activeThreads).end()) { unsigned tid = *active_threads++; @@ -270,7 +316,7 @@ template<class Impl> void LSQ<Impl>::writebackStores() { - list<unsigned>::iterator active_threads = (*activeThreads).begin(); + std::list<unsigned>::iterator active_threads = (*activeThreads).begin(); while (active_threads != (*activeThreads).end()) { unsigned tid = *active_threads++; @@ -289,7 +335,7 @@ bool LSQ<Impl>::violation() { /* Answers: Does Anybody Have a Violation?*/ - list<unsigned>::iterator active_threads = (*activeThreads).begin(); + std::list<unsigned>::iterator active_threads = (*activeThreads).begin(); while (active_threads != (*activeThreads).end()) { unsigned tid = *active_threads++; @@ -306,7 +352,7 @@ LSQ<Impl>::getCount() { unsigned total = 0; - list<unsigned>::iterator active_threads = (*activeThreads).begin(); + std::list<unsigned>::iterator active_threads = (*activeThreads).begin(); while (active_threads != (*activeThreads).end()) { unsigned tid = *active_threads++; @@ -322,7 +368,7 @@ LSQ<Impl>::numLoads() { unsigned total = 0; - list<unsigned>::iterator active_threads = (*activeThreads).begin(); + std::list<unsigned>::iterator active_threads = (*activeThreads).begin(); while (active_threads != (*activeThreads).end()) { unsigned tid = *active_threads++; @@ -338,7 +384,7 @@ LSQ<Impl>::numStores() { unsigned total = 0; - list<unsigned>::iterator active_threads = (*activeThreads).begin(); + std::list<unsigned>::iterator active_threads = (*activeThreads).begin(); while (active_threads != (*activeThreads).end()) { unsigned tid = *active_threads++; @@ -354,7 +400,7 @@ LSQ<Impl>::numLoadsReady() { unsigned total = 0; - list<unsigned>::iterator active_threads = (*activeThreads).begin(); + std::list<unsigned>::iterator active_threads = (*activeThreads).begin(); while (active_threads != (*activeThreads).end()) { unsigned tid = *active_threads++; @@ -370,7 +416,7 @@ LSQ<Impl>::numFreeEntries() { unsigned total = 0; - list<unsigned>::iterator active_threads = (*activeThreads).begin(); + std::list<unsigned>::iterator active_threads = (*activeThreads).begin(); while (active_threads != (*activeThreads).end()) { unsigned tid = *active_threads++; @@ -394,7 +440,7 @@ template<class Impl> bool LSQ<Impl>::isFull() { - list<unsigned>::iterator active_threads = (*activeThreads).begin(); + std::list<unsigned>::iterator active_threads = (*activeThreads).begin(); while (active_threads != (*activeThreads).end()) { unsigned tid = *active_threads++; @@ -421,7 +467,7 @@ template<class Impl> bool LSQ<Impl>::lqFull() { - list<unsigned>::iterator active_threads = (*activeThreads).begin(); + std::list<unsigned>::iterator active_threads = (*activeThreads).begin(); while (active_threads != (*activeThreads).end()) { unsigned tid = *active_threads++; @@ -448,7 +494,7 @@ template<class Impl> bool LSQ<Impl>::sqFull() { - list<unsigned>::iterator active_threads = (*activeThreads).begin(); + std::list<unsigned>::iterator active_threads = (*activeThreads).begin(); while (active_threads != (*activeThreads).end()) { unsigned tid = *active_threads++; @@ -475,7 +521,7 @@ template<class Impl> bool LSQ<Impl>::isStalled() { - list<unsigned>::iterator active_threads = (*activeThreads).begin(); + std::list<unsigned>::iterator active_threads = (*activeThreads).begin(); while (active_threads != (*activeThreads).end()) { unsigned tid = *active_threads++; @@ -500,7 +546,7 @@ template<class Impl> bool LSQ<Impl>::hasStoresToWB() { - list<unsigned>::iterator active_threads = (*activeThreads).begin(); + std::list<unsigned>::iterator active_threads = (*activeThreads).begin(); if ((*activeThreads).empty()) return false; @@ -518,7 +564,7 @@ template<class Impl> bool LSQ<Impl>::willWB() { - list<unsigned>::iterator active_threads = (*activeThreads).begin(); + std::list<unsigned>::iterator active_threads = (*activeThreads).begin(); while (active_threads != (*activeThreads).end()) { unsigned tid = *active_threads++; @@ -533,7 +579,7 @@ template<class Impl> void LSQ<Impl>::dumpInsts() { - list<unsigned>::iterator active_threads = (*activeThreads).begin(); + std::list<unsigned>::iterator active_threads = (*activeThreads).begin(); while (active_threads != (*activeThreads).end()) { unsigned tid = *active_threads++; |