lsq_impl.hh revision 4192
12292SN/A/* 22727Sktlim@umich.edu * Copyright (c) 2005-2006 The Regents of The University of Michigan 32292SN/A * All rights reserved. 42292SN/A * 52292SN/A * Redistribution and use in source and binary forms, with or without 62292SN/A * modification, are permitted provided that the following conditions are 72292SN/A * met: redistributions of source code must retain the above copyright 82292SN/A * notice, this list of conditions and the following disclaimer; 92292SN/A * redistributions in binary form must reproduce the above copyright 102292SN/A * notice, this list of conditions and the following disclaimer in the 112292SN/A * documentation and/or other materials provided with the distribution; 122292SN/A * neither the name of the copyright holders nor the names of its 132292SN/A * contributors may be used to endorse or promote products derived from 142292SN/A * this software without specific prior written permission. 152292SN/A * 162292SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 172292SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 182292SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 192292SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 202292SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 212292SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 222292SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 232292SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 242292SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 252292SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 262292SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 272689Sktlim@umich.edu * 282689Sktlim@umich.edu * Authors: Korey Sewell 292292SN/A */ 302292SN/A 312329SN/A#include <algorithm> 322980Sgblack@eecs.umich.edu#include <list> 332329SN/A#include <string> 342329SN/A 352292SN/A#include "cpu/o3/lsq.hh" 362292SN/A 374192Sktlim@umich.edutemplate<class Impl> 384192Sktlim@umich.eduvoid 394192Sktlim@umich.eduLSQ<Impl>::DcachePort::setPeer(Port *port) 404192Sktlim@umich.edu{ 414192Sktlim@umich.edu Port::setPeer(port); 424192Sktlim@umich.edu 434192Sktlim@umich.edu#if FULL_SYSTEM 444192Sktlim@umich.edu // Update the ThreadContext's memory ports (Functional/Virtual 454192Sktlim@umich.edu // Ports) 464192Sktlim@umich.edu lsq->updateMemPorts(); 474192Sktlim@umich.edu#endif 484192Sktlim@umich.edu} 494192Sktlim@umich.edu 502292SN/Atemplate <class Impl> 512907Sktlim@umich.eduTick 522907Sktlim@umich.eduLSQ<Impl>::DcachePort::recvAtomic(PacketPtr pkt) 532907Sktlim@umich.edu{ 542907Sktlim@umich.edu panic("O3CPU model does not work with atomic mode!"); 552907Sktlim@umich.edu return curTick; 562907Sktlim@umich.edu} 572907Sktlim@umich.edu 582907Sktlim@umich.edutemplate <class Impl> 592907Sktlim@umich.eduvoid 602907Sktlim@umich.eduLSQ<Impl>::DcachePort::recvFunctional(PacketPtr pkt) 612907Sktlim@umich.edu{ 623639Sktlim@umich.edu DPRINTF(LSQ, "LSQ doesn't update things on a recvFunctional."); 632907Sktlim@umich.edu} 642907Sktlim@umich.edu 652907Sktlim@umich.edutemplate <class Impl> 662907Sktlim@umich.eduvoid 672907Sktlim@umich.eduLSQ<Impl>::DcachePort::recvStatusChange(Status status) 682907Sktlim@umich.edu{ 693647Srdreslin@umich.edu if (status == RangeChange) { 703647Srdreslin@umich.edu if (!snoopRangeSent) { 713647Srdreslin@umich.edu snoopRangeSent = true; 723647Srdreslin@umich.edu sendStatusChange(Port::RangeChange); 733647Srdreslin@umich.edu } 742907Sktlim@umich.edu return; 753647Srdreslin@umich.edu } 762907Sktlim@umich.edu panic("O3CPU doesn't expect recvStatusChange callback!"); 772907Sktlim@umich.edu} 782907Sktlim@umich.edu 792907Sktlim@umich.edutemplate <class Impl> 802907Sktlim@umich.edubool 812907Sktlim@umich.eduLSQ<Impl>::DcachePort::recvTiming(PacketPtr pkt) 822907Sktlim@umich.edu{ 833310Srdreslin@umich.edu if (pkt->isResponse()) { 843310Srdreslin@umich.edu lsq->thread[pkt->req->getThreadNum()].completeDataAccess(pkt); 853310Srdreslin@umich.edu } 863310Srdreslin@umich.edu else { 873310Srdreslin@umich.edu //else it is a coherence request, maybe you need to do something 883339Srdreslin@umich.edu warn("Recieved a coherence request (Invalidate?), 03CPU doesn't" 893310Srdreslin@umich.edu "update LSQ for these\n"); 903310Srdreslin@umich.edu } 912907Sktlim@umich.edu return true; 922907Sktlim@umich.edu} 932907Sktlim@umich.edu 942907Sktlim@umich.edutemplate <class Impl> 952907Sktlim@umich.eduvoid 962907Sktlim@umich.eduLSQ<Impl>::DcachePort::recvRetry() 972907Sktlim@umich.edu{ 983014Srdreslin@umich.edu if (lsq->retryTid == -1) 993014Srdreslin@umich.edu { 1003014Srdreslin@umich.edu //Squashed, so drop it 1013014Srdreslin@umich.edu return; 1023014Srdreslin@umich.edu } 1032907Sktlim@umich.edu lsq->thread[lsq->retryTid].recvRetry(); 1042907Sktlim@umich.edu // Speculatively clear the retry Tid. This will get set again if 1052907Sktlim@umich.edu // the LSQUnit was unable to complete its access. 1062907Sktlim@umich.edu lsq->retryTid = -1; 1072907Sktlim@umich.edu} 1082907Sktlim@umich.edu 1092907Sktlim@umich.edutemplate <class Impl> 1102292SN/ALSQ<Impl>::LSQ(Params *params) 1112907Sktlim@umich.edu : dcachePort(this), LQEntries(params->LQEntries), 1122907Sktlim@umich.edu SQEntries(params->SQEntries), numThreads(params->numberOfThreads), 1132907Sktlim@umich.edu retryTid(-1) 1142292SN/A{ 1152292SN/A DPRINTF(LSQ, "Creating LSQ object.\n"); 1162292SN/A 1173647Srdreslin@umich.edu dcachePort.snoopRangeSent = false; 1183647Srdreslin@umich.edu 1192292SN/A //**********************************************/ 1202292SN/A //************ Handle SMT Parameters ***********/ 1212292SN/A //**********************************************/ 1222980Sgblack@eecs.umich.edu std::string policy = params->smtLSQPolicy; 1232292SN/A 1242292SN/A //Convert string to lowercase 1252292SN/A std::transform(policy.begin(), policy.end(), policy.begin(), 1262292SN/A (int(*)(int)) tolower); 1272292SN/A 1282292SN/A //Figure out fetch policy 1292292SN/A if (policy == "dynamic") { 1302292SN/A lsqPolicy = Dynamic; 1312292SN/A 1322292SN/A maxLQEntries = LQEntries; 1332292SN/A maxSQEntries = SQEntries; 1342292SN/A 1352292SN/A DPRINTF(LSQ, "LSQ sharing policy set to Dynamic\n"); 1362292SN/A 1372292SN/A } else if (policy == "partitioned") { 1382292SN/A lsqPolicy = Partitioned; 1392292SN/A 1402292SN/A //@todo:make work if part_amt doesnt divide evenly. 1412292SN/A maxLQEntries = LQEntries / numThreads; 1422292SN/A maxSQEntries = SQEntries / numThreads; 1432292SN/A 1442292SN/A DPRINTF(Fetch, "LSQ sharing policy set to Partitioned: " 1452292SN/A "%i entries per LQ | %i entries per SQ", 1462292SN/A maxLQEntries,maxSQEntries); 1472292SN/A 1482292SN/A } else if (policy == "threshold") { 1492292SN/A lsqPolicy = Threshold; 1502292SN/A 1512292SN/A assert(params->smtLSQThreshold > LQEntries); 1522292SN/A assert(params->smtLSQThreshold > SQEntries); 1532292SN/A 1542292SN/A //Divide up by threshold amount 1552292SN/A //@todo: Should threads check the max and the total 1562292SN/A //amount of the LSQ 1572292SN/A maxLQEntries = params->smtLSQThreshold; 1582292SN/A maxSQEntries = params->smtLSQThreshold; 1592292SN/A 1602292SN/A DPRINTF(LSQ, "LSQ sharing policy set to Threshold: " 1612292SN/A "%i entries per LQ | %i entries per SQ", 1622292SN/A maxLQEntries,maxSQEntries); 1632292SN/A 1642292SN/A } else { 1652292SN/A assert(0 && "Invalid LSQ Sharing Policy.Options Are:{Dynamic," 1662292SN/A "Partitioned, Threshold}"); 1672292SN/A } 1682292SN/A 1692292SN/A //Initialize LSQs 1702292SN/A for (int tid=0; tid < numThreads; tid++) { 1712907Sktlim@umich.edu thread[tid].init(params, this, maxLQEntries, maxSQEntries, tid); 1722907Sktlim@umich.edu thread[tid].setDcachePort(&dcachePort); 1732292SN/A } 1742292SN/A} 1752292SN/A 1762292SN/A 1772292SN/Atemplate<class Impl> 1782292SN/Astd::string 1792292SN/ALSQ<Impl>::name() const 1802292SN/A{ 1812292SN/A return iewStage->name() + ".lsq"; 1822292SN/A} 1832292SN/A 1842292SN/Atemplate<class Impl> 1852292SN/Avoid 1862727Sktlim@umich.eduLSQ<Impl>::regStats() 1872727Sktlim@umich.edu{ 1882727Sktlim@umich.edu //Initialize LSQs 1892727Sktlim@umich.edu for (int tid=0; tid < numThreads; tid++) { 1902727Sktlim@umich.edu thread[tid].regStats(); 1912727Sktlim@umich.edu } 1922727Sktlim@umich.edu} 1932727Sktlim@umich.edu 1942727Sktlim@umich.edutemplate<class Impl> 1952727Sktlim@umich.eduvoid 1962980Sgblack@eecs.umich.eduLSQ<Impl>::setActiveThreads(std::list<unsigned> *at_ptr) 1972292SN/A{ 1982292SN/A activeThreads = at_ptr; 1992292SN/A assert(activeThreads != 0); 2002292SN/A} 2012292SN/A 2022292SN/Atemplate<class Impl> 2032292SN/Avoid 2042733Sktlim@umich.eduLSQ<Impl>::setCPU(O3CPU *cpu_ptr) 2052292SN/A{ 2062292SN/A cpu = cpu_ptr; 2072292SN/A 2082907Sktlim@umich.edu dcachePort.setName(name()); 2092907Sktlim@umich.edu 2102292SN/A for (int tid=0; tid < numThreads; tid++) { 2112292SN/A thread[tid].setCPU(cpu_ptr); 2122292SN/A } 2132292SN/A} 2142292SN/A 2152292SN/Atemplate<class Impl> 2162292SN/Avoid 2172292SN/ALSQ<Impl>::setIEW(IEW *iew_ptr) 2182292SN/A{ 2192292SN/A iewStage = iew_ptr; 2202292SN/A 2212292SN/A for (int tid=0; tid < numThreads; tid++) { 2222292SN/A thread[tid].setIEW(iew_ptr); 2232292SN/A } 2242292SN/A} 2252292SN/A 2262292SN/Atemplate <class Impl> 2272307SN/Avoid 2282307SN/ALSQ<Impl>::switchOut() 2292307SN/A{ 2302307SN/A for (int tid = 0; tid < numThreads; tid++) { 2312307SN/A thread[tid].switchOut(); 2322307SN/A } 2332307SN/A} 2342307SN/A 2352307SN/Atemplate <class Impl> 2362307SN/Avoid 2372307SN/ALSQ<Impl>::takeOverFrom() 2382307SN/A{ 2392307SN/A for (int tid = 0; tid < numThreads; tid++) { 2402307SN/A thread[tid].takeOverFrom(); 2412307SN/A } 2422307SN/A} 2432307SN/A 2442307SN/Atemplate <class Impl> 2452292SN/Aint 2462292SN/ALSQ<Impl>::entryAmount(int num_threads) 2472292SN/A{ 2482292SN/A if (lsqPolicy == Partitioned) { 2492292SN/A return LQEntries / num_threads; 2502292SN/A } else { 2512292SN/A return 0; 2522292SN/A } 2532292SN/A} 2542292SN/A 2552292SN/Atemplate <class Impl> 2562292SN/Avoid 2572292SN/ALSQ<Impl>::resetEntries() 2582292SN/A{ 2592292SN/A if (lsqPolicy != Dynamic || numThreads > 1) { 2603867Sbinkertn@umich.edu int active_threads = activeThreads->size(); 2612292SN/A 2622292SN/A int maxEntries; 2632292SN/A 2642292SN/A if (lsqPolicy == Partitioned) { 2652292SN/A maxEntries = LQEntries / active_threads; 2662292SN/A } else if (lsqPolicy == Threshold && active_threads == 1) { 2672292SN/A maxEntries = LQEntries; 2682292SN/A } else { 2692292SN/A maxEntries = LQEntries; 2702292SN/A } 2712292SN/A 2723867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 2733867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 2743867Sbinkertn@umich.edu 2753867Sbinkertn@umich.edu while (threads != end) { 2763867Sbinkertn@umich.edu unsigned tid = *threads++; 2773867Sbinkertn@umich.edu 2783867Sbinkertn@umich.edu resizeEntries(maxEntries, tid); 2792292SN/A } 2802292SN/A } 2812292SN/A} 2822292SN/A 2832292SN/Atemplate<class Impl> 2842292SN/Avoid 2852292SN/ALSQ<Impl>::removeEntries(unsigned tid) 2862292SN/A{ 2872292SN/A thread[tid].clearLQ(); 2882292SN/A thread[tid].clearSQ(); 2892292SN/A} 2902292SN/A 2912292SN/Atemplate<class Impl> 2922292SN/Avoid 2932292SN/ALSQ<Impl>::resizeEntries(unsigned size,unsigned tid) 2942292SN/A{ 2952292SN/A thread[tid].resizeLQ(size); 2962292SN/A thread[tid].resizeSQ(size); 2972292SN/A} 2982292SN/A 2992292SN/Atemplate<class Impl> 3002292SN/Avoid 3012292SN/ALSQ<Impl>::tick() 3022292SN/A{ 3033867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 3043867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 3052292SN/A 3063867Sbinkertn@umich.edu while (threads != end) { 3073867Sbinkertn@umich.edu unsigned tid = *threads++; 3082292SN/A 3092292SN/A thread[tid].tick(); 3102292SN/A } 3112292SN/A} 3122292SN/A 3132292SN/Atemplate<class Impl> 3142292SN/Avoid 3152292SN/ALSQ<Impl>::insertLoad(DynInstPtr &load_inst) 3162292SN/A{ 3172292SN/A unsigned tid = load_inst->threadNumber; 3182292SN/A 3192292SN/A thread[tid].insertLoad(load_inst); 3202292SN/A} 3212292SN/A 3222292SN/Atemplate<class Impl> 3232292SN/Avoid 3242292SN/ALSQ<Impl>::insertStore(DynInstPtr &store_inst) 3252292SN/A{ 3262292SN/A unsigned tid = store_inst->threadNumber; 3272292SN/A 3282292SN/A thread[tid].insertStore(store_inst); 3292292SN/A} 3302292SN/A 3312292SN/Atemplate<class Impl> 3322292SN/AFault 3332292SN/ALSQ<Impl>::executeLoad(DynInstPtr &inst) 3342292SN/A{ 3352292SN/A unsigned tid = inst->threadNumber; 3362292SN/A 3372292SN/A return thread[tid].executeLoad(inst); 3382292SN/A} 3392292SN/A 3402292SN/Atemplate<class Impl> 3412292SN/AFault 3422292SN/ALSQ<Impl>::executeStore(DynInstPtr &inst) 3432292SN/A{ 3442292SN/A unsigned tid = inst->threadNumber; 3452292SN/A 3462292SN/A return thread[tid].executeStore(inst); 3472292SN/A} 3482292SN/A 3492292SN/Atemplate<class Impl> 3502292SN/Avoid 3512292SN/ALSQ<Impl>::writebackStores() 3522292SN/A{ 3533867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 3543867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 3552292SN/A 3563867Sbinkertn@umich.edu while (threads != end) { 3573867Sbinkertn@umich.edu unsigned tid = *threads++; 3582292SN/A 3592292SN/A if (numStoresToWB(tid) > 0) { 3602329SN/A DPRINTF(Writeback,"[tid:%i] Writing back stores. %i stores " 3612329SN/A "available for Writeback.\n", tid, numStoresToWB(tid)); 3622292SN/A } 3632292SN/A 3642292SN/A thread[tid].writebackStores(); 3652292SN/A } 3662292SN/A} 3672292SN/A 3682292SN/Atemplate<class Impl> 3692292SN/Abool 3702292SN/ALSQ<Impl>::violation() 3712292SN/A{ 3722292SN/A /* Answers: Does Anybody Have a Violation?*/ 3733867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 3743867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 3752292SN/A 3763867Sbinkertn@umich.edu while (threads != end) { 3773867Sbinkertn@umich.edu unsigned tid = *threads++; 3783867Sbinkertn@umich.edu 3792292SN/A if (thread[tid].violation()) 3802292SN/A return true; 3812292SN/A } 3822292SN/A 3832292SN/A return false; 3842292SN/A} 3852292SN/A 3862292SN/Atemplate<class Impl> 3872292SN/Aint 3882292SN/ALSQ<Impl>::getCount() 3892292SN/A{ 3902292SN/A unsigned total = 0; 3912292SN/A 3923867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 3933867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 3942292SN/A 3953867Sbinkertn@umich.edu while (threads != end) { 3963867Sbinkertn@umich.edu unsigned tid = *threads++; 3973867Sbinkertn@umich.edu 3982292SN/A total += getCount(tid); 3992292SN/A } 4002292SN/A 4012292SN/A return total; 4022292SN/A} 4032292SN/A 4042292SN/Atemplate<class Impl> 4052292SN/Aint 4062292SN/ALSQ<Impl>::numLoads() 4072292SN/A{ 4082292SN/A unsigned total = 0; 4092292SN/A 4103867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 4113867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 4122292SN/A 4133867Sbinkertn@umich.edu while (threads != end) { 4143867Sbinkertn@umich.edu unsigned tid = *threads++; 4153867Sbinkertn@umich.edu 4162292SN/A total += numLoads(tid); 4172292SN/A } 4182292SN/A 4192292SN/A return total; 4202292SN/A} 4212292SN/A 4222292SN/Atemplate<class Impl> 4232292SN/Aint 4242292SN/ALSQ<Impl>::numStores() 4252292SN/A{ 4262292SN/A unsigned total = 0; 4272292SN/A 4283867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 4293867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 4302292SN/A 4313867Sbinkertn@umich.edu while (threads != end) { 4323867Sbinkertn@umich.edu unsigned tid = *threads++; 4333867Sbinkertn@umich.edu 4342292SN/A total += thread[tid].numStores(); 4352292SN/A } 4362292SN/A 4372292SN/A return total; 4382292SN/A} 4392292SN/A 4402292SN/Atemplate<class Impl> 4412292SN/Aint 4422292SN/ALSQ<Impl>::numLoadsReady() 4432292SN/A{ 4442292SN/A unsigned total = 0; 4452292SN/A 4463867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 4473867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 4482292SN/A 4493867Sbinkertn@umich.edu while (threads != end) { 4503867Sbinkertn@umich.edu unsigned tid = *threads++; 4513867Sbinkertn@umich.edu 4522292SN/A total += thread[tid].numLoadsReady(); 4532292SN/A } 4542292SN/A 4552292SN/A return total; 4562292SN/A} 4572292SN/A 4582292SN/Atemplate<class Impl> 4592292SN/Aunsigned 4602292SN/ALSQ<Impl>::numFreeEntries() 4612292SN/A{ 4622292SN/A unsigned total = 0; 4632292SN/A 4643867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 4653867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 4662292SN/A 4673867Sbinkertn@umich.edu while (threads != end) { 4683867Sbinkertn@umich.edu unsigned tid = *threads++; 4693867Sbinkertn@umich.edu 4702292SN/A total += thread[tid].numFreeEntries(); 4712292SN/A } 4722292SN/A 4732292SN/A return total; 4742292SN/A} 4752292SN/A 4762292SN/Atemplate<class Impl> 4772292SN/Aunsigned 4782292SN/ALSQ<Impl>::numFreeEntries(unsigned tid) 4792292SN/A{ 4803870Sbinkertn@umich.edu //if (lsqPolicy == Dynamic) 4812292SN/A //return numFreeEntries(); 4822292SN/A //else 4832292SN/A return thread[tid].numFreeEntries(); 4842292SN/A} 4852292SN/A 4862292SN/Atemplate<class Impl> 4872292SN/Abool 4882292SN/ALSQ<Impl>::isFull() 4892292SN/A{ 4903867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 4913867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 4922292SN/A 4933867Sbinkertn@umich.edu while (threads != end) { 4943867Sbinkertn@umich.edu unsigned tid = *threads++; 4953867Sbinkertn@umich.edu 4963867Sbinkertn@umich.edu if (!(thread[tid].lqFull() || thread[tid].sqFull())) 4972292SN/A return false; 4982292SN/A } 4992292SN/A 5002292SN/A return true; 5012292SN/A} 5022292SN/A 5032292SN/Atemplate<class Impl> 5042292SN/Abool 5052292SN/ALSQ<Impl>::isFull(unsigned tid) 5062292SN/A{ 5072292SN/A //@todo: Change to Calculate All Entries for 5082292SN/A //Dynamic Policy 5093867Sbinkertn@umich.edu if (lsqPolicy == Dynamic) 5102292SN/A return isFull(); 5112292SN/A else 5122292SN/A return thread[tid].lqFull() || thread[tid].sqFull(); 5132292SN/A} 5142292SN/A 5152292SN/Atemplate<class Impl> 5162292SN/Abool 5172292SN/ALSQ<Impl>::lqFull() 5182292SN/A{ 5193867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 5203867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 5212292SN/A 5223867Sbinkertn@umich.edu while (threads != end) { 5233867Sbinkertn@umich.edu unsigned tid = *threads++; 5243867Sbinkertn@umich.edu 5252292SN/A if (!thread[tid].lqFull()) 5262292SN/A return false; 5272292SN/A } 5282292SN/A 5292292SN/A return true; 5302292SN/A} 5312292SN/A 5322292SN/Atemplate<class Impl> 5332292SN/Abool 5342292SN/ALSQ<Impl>::lqFull(unsigned tid) 5352292SN/A{ 5362292SN/A //@todo: Change to Calculate All Entries for 5372292SN/A //Dynamic Policy 5383870Sbinkertn@umich.edu if (lsqPolicy == Dynamic) 5392292SN/A return lqFull(); 5402292SN/A else 5412292SN/A return thread[tid].lqFull(); 5422292SN/A} 5432292SN/A 5442292SN/Atemplate<class Impl> 5452292SN/Abool 5462292SN/ALSQ<Impl>::sqFull() 5472292SN/A{ 5483867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 5493867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 5502292SN/A 5513867Sbinkertn@umich.edu while (threads != end) { 5523867Sbinkertn@umich.edu unsigned tid = *threads++; 5533867Sbinkertn@umich.edu 5542292SN/A if (!sqFull(tid)) 5552292SN/A return false; 5562292SN/A } 5572292SN/A 5582292SN/A return true; 5592292SN/A} 5602292SN/A 5612292SN/Atemplate<class Impl> 5622292SN/Abool 5632292SN/ALSQ<Impl>::sqFull(unsigned tid) 5642292SN/A{ 5652292SN/A //@todo: Change to Calculate All Entries for 5662292SN/A //Dynamic Policy 5673870Sbinkertn@umich.edu if (lsqPolicy == Dynamic) 5682292SN/A return sqFull(); 5692292SN/A else 5702292SN/A return thread[tid].sqFull(); 5712292SN/A} 5722292SN/A 5732292SN/Atemplate<class Impl> 5742292SN/Abool 5752292SN/ALSQ<Impl>::isStalled() 5762292SN/A{ 5773867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 5783867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 5792292SN/A 5803867Sbinkertn@umich.edu while (threads != end) { 5813867Sbinkertn@umich.edu unsigned tid = *threads++; 5823867Sbinkertn@umich.edu 5832292SN/A if (!thread[tid].isStalled()) 5842292SN/A return false; 5852292SN/A } 5862292SN/A 5872292SN/A return true; 5882292SN/A} 5892292SN/A 5902292SN/Atemplate<class Impl> 5912292SN/Abool 5922292SN/ALSQ<Impl>::isStalled(unsigned tid) 5932292SN/A{ 5943870Sbinkertn@umich.edu if (lsqPolicy == Dynamic) 5952292SN/A return isStalled(); 5962292SN/A else 5972292SN/A return thread[tid].isStalled(); 5982292SN/A} 5992292SN/A 6002292SN/Atemplate<class Impl> 6012292SN/Abool 6022292SN/ALSQ<Impl>::hasStoresToWB() 6032292SN/A{ 6043867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 6053867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 6062292SN/A 6073867Sbinkertn@umich.edu if (threads == end) 6082864Sktlim@umich.edu return false; 6092864Sktlim@umich.edu 6103867Sbinkertn@umich.edu while (threads != end) { 6113867Sbinkertn@umich.edu unsigned tid = *threads++; 6123867Sbinkertn@umich.edu 6132292SN/A if (!hasStoresToWB(tid)) 6142292SN/A return false; 6152292SN/A } 6162292SN/A 6172292SN/A return true; 6182292SN/A} 6192292SN/A 6202292SN/Atemplate<class Impl> 6212292SN/Abool 6222292SN/ALSQ<Impl>::willWB() 6232292SN/A{ 6243867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 6253867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 6262292SN/A 6273867Sbinkertn@umich.edu while (threads != end) { 6283867Sbinkertn@umich.edu unsigned tid = *threads++; 6293867Sbinkertn@umich.edu 6302292SN/A if (!willWB(tid)) 6312292SN/A return false; 6322292SN/A } 6332292SN/A 6342292SN/A return true; 6352292SN/A} 6362292SN/A 6372292SN/Atemplate<class Impl> 6382292SN/Avoid 6392292SN/ALSQ<Impl>::dumpInsts() 6402292SN/A{ 6413867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 6423867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 6432292SN/A 6443867Sbinkertn@umich.edu while (threads != end) { 6453867Sbinkertn@umich.edu unsigned tid = *threads++; 6463867Sbinkertn@umich.edu 6472292SN/A thread[tid].dumpInsts(); 6482292SN/A } 6492292SN/A} 650