lsq_impl.hh revision 3870
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 372292SN/Atemplate <class Impl> 382907Sktlim@umich.eduTick 392907Sktlim@umich.eduLSQ<Impl>::DcachePort::recvAtomic(PacketPtr pkt) 402907Sktlim@umich.edu{ 412907Sktlim@umich.edu panic("O3CPU model does not work with atomic mode!"); 422907Sktlim@umich.edu return curTick; 432907Sktlim@umich.edu} 442907Sktlim@umich.edu 452907Sktlim@umich.edutemplate <class Impl> 462907Sktlim@umich.eduvoid 472907Sktlim@umich.eduLSQ<Impl>::DcachePort::recvFunctional(PacketPtr pkt) 482907Sktlim@umich.edu{ 493639Sktlim@umich.edu DPRINTF(LSQ, "LSQ doesn't update things on a recvFunctional."); 502907Sktlim@umich.edu} 512907Sktlim@umich.edu 522907Sktlim@umich.edutemplate <class Impl> 532907Sktlim@umich.eduvoid 542907Sktlim@umich.eduLSQ<Impl>::DcachePort::recvStatusChange(Status status) 552907Sktlim@umich.edu{ 563647Srdreslin@umich.edu if (status == RangeChange) { 573647Srdreslin@umich.edu if (!snoopRangeSent) { 583647Srdreslin@umich.edu snoopRangeSent = true; 593647Srdreslin@umich.edu sendStatusChange(Port::RangeChange); 603647Srdreslin@umich.edu } 612907Sktlim@umich.edu return; 623647Srdreslin@umich.edu } 632907Sktlim@umich.edu panic("O3CPU doesn't expect recvStatusChange callback!"); 642907Sktlim@umich.edu} 652907Sktlim@umich.edu 662907Sktlim@umich.edutemplate <class Impl> 672907Sktlim@umich.edubool 682907Sktlim@umich.eduLSQ<Impl>::DcachePort::recvTiming(PacketPtr pkt) 692907Sktlim@umich.edu{ 703310Srdreslin@umich.edu if (pkt->isResponse()) { 713310Srdreslin@umich.edu lsq->thread[pkt->req->getThreadNum()].completeDataAccess(pkt); 723310Srdreslin@umich.edu } 733310Srdreslin@umich.edu else { 743310Srdreslin@umich.edu //else it is a coherence request, maybe you need to do something 753339Srdreslin@umich.edu warn("Recieved a coherence request (Invalidate?), 03CPU doesn't" 763310Srdreslin@umich.edu "update LSQ for these\n"); 773310Srdreslin@umich.edu } 782907Sktlim@umich.edu return true; 792907Sktlim@umich.edu} 802907Sktlim@umich.edu 812907Sktlim@umich.edutemplate <class Impl> 822907Sktlim@umich.eduvoid 832907Sktlim@umich.eduLSQ<Impl>::DcachePort::recvRetry() 842907Sktlim@umich.edu{ 853014Srdreslin@umich.edu if (lsq->retryTid == -1) 863014Srdreslin@umich.edu { 873014Srdreslin@umich.edu //Squashed, so drop it 883014Srdreslin@umich.edu return; 893014Srdreslin@umich.edu } 902907Sktlim@umich.edu lsq->thread[lsq->retryTid].recvRetry(); 912907Sktlim@umich.edu // Speculatively clear the retry Tid. This will get set again if 922907Sktlim@umich.edu // the LSQUnit was unable to complete its access. 932907Sktlim@umich.edu lsq->retryTid = -1; 942907Sktlim@umich.edu} 952907Sktlim@umich.edu 962907Sktlim@umich.edutemplate <class Impl> 972292SN/ALSQ<Impl>::LSQ(Params *params) 982907Sktlim@umich.edu : dcachePort(this), LQEntries(params->LQEntries), 992907Sktlim@umich.edu SQEntries(params->SQEntries), numThreads(params->numberOfThreads), 1002907Sktlim@umich.edu retryTid(-1) 1012292SN/A{ 1022292SN/A DPRINTF(LSQ, "Creating LSQ object.\n"); 1032292SN/A 1043647Srdreslin@umich.edu dcachePort.snoopRangeSent = false; 1053647Srdreslin@umich.edu 1062292SN/A //**********************************************/ 1072292SN/A //************ Handle SMT Parameters ***********/ 1082292SN/A //**********************************************/ 1092980Sgblack@eecs.umich.edu std::string policy = params->smtLSQPolicy; 1102292SN/A 1112292SN/A //Convert string to lowercase 1122292SN/A std::transform(policy.begin(), policy.end(), policy.begin(), 1132292SN/A (int(*)(int)) tolower); 1142292SN/A 1152292SN/A //Figure out fetch policy 1162292SN/A if (policy == "dynamic") { 1172292SN/A lsqPolicy = Dynamic; 1182292SN/A 1192292SN/A maxLQEntries = LQEntries; 1202292SN/A maxSQEntries = SQEntries; 1212292SN/A 1222292SN/A DPRINTF(LSQ, "LSQ sharing policy set to Dynamic\n"); 1232292SN/A 1242292SN/A } else if (policy == "partitioned") { 1252292SN/A lsqPolicy = Partitioned; 1262292SN/A 1272292SN/A //@todo:make work if part_amt doesnt divide evenly. 1282292SN/A maxLQEntries = LQEntries / numThreads; 1292292SN/A maxSQEntries = SQEntries / numThreads; 1302292SN/A 1312292SN/A DPRINTF(Fetch, "LSQ sharing policy set to Partitioned: " 1322292SN/A "%i entries per LQ | %i entries per SQ", 1332292SN/A maxLQEntries,maxSQEntries); 1342292SN/A 1352292SN/A } else if (policy == "threshold") { 1362292SN/A lsqPolicy = Threshold; 1372292SN/A 1382292SN/A assert(params->smtLSQThreshold > LQEntries); 1392292SN/A assert(params->smtLSQThreshold > SQEntries); 1402292SN/A 1412292SN/A //Divide up by threshold amount 1422292SN/A //@todo: Should threads check the max and the total 1432292SN/A //amount of the LSQ 1442292SN/A maxLQEntries = params->smtLSQThreshold; 1452292SN/A maxSQEntries = params->smtLSQThreshold; 1462292SN/A 1472292SN/A DPRINTF(LSQ, "LSQ sharing policy set to Threshold: " 1482292SN/A "%i entries per LQ | %i entries per SQ", 1492292SN/A maxLQEntries,maxSQEntries); 1502292SN/A 1512292SN/A } else { 1522292SN/A assert(0 && "Invalid LSQ Sharing Policy.Options Are:{Dynamic," 1532292SN/A "Partitioned, Threshold}"); 1542292SN/A } 1552292SN/A 1562292SN/A //Initialize LSQs 1572292SN/A for (int tid=0; tid < numThreads; tid++) { 1582907Sktlim@umich.edu thread[tid].init(params, this, maxLQEntries, maxSQEntries, tid); 1592907Sktlim@umich.edu thread[tid].setDcachePort(&dcachePort); 1602292SN/A } 1612292SN/A} 1622292SN/A 1632292SN/A 1642292SN/Atemplate<class Impl> 1652292SN/Astd::string 1662292SN/ALSQ<Impl>::name() const 1672292SN/A{ 1682292SN/A return iewStage->name() + ".lsq"; 1692292SN/A} 1702292SN/A 1712292SN/Atemplate<class Impl> 1722292SN/Avoid 1732727Sktlim@umich.eduLSQ<Impl>::regStats() 1742727Sktlim@umich.edu{ 1752727Sktlim@umich.edu //Initialize LSQs 1762727Sktlim@umich.edu for (int tid=0; tid < numThreads; tid++) { 1772727Sktlim@umich.edu thread[tid].regStats(); 1782727Sktlim@umich.edu } 1792727Sktlim@umich.edu} 1802727Sktlim@umich.edu 1812727Sktlim@umich.edutemplate<class Impl> 1822727Sktlim@umich.eduvoid 1832980Sgblack@eecs.umich.eduLSQ<Impl>::setActiveThreads(std::list<unsigned> *at_ptr) 1842292SN/A{ 1852292SN/A activeThreads = at_ptr; 1862292SN/A assert(activeThreads != 0); 1872292SN/A} 1882292SN/A 1892292SN/Atemplate<class Impl> 1902292SN/Avoid 1912733Sktlim@umich.eduLSQ<Impl>::setCPU(O3CPU *cpu_ptr) 1922292SN/A{ 1932292SN/A cpu = cpu_ptr; 1942292SN/A 1952907Sktlim@umich.edu dcachePort.setName(name()); 1962907Sktlim@umich.edu 1972292SN/A for (int tid=0; tid < numThreads; tid++) { 1982292SN/A thread[tid].setCPU(cpu_ptr); 1992292SN/A } 2002292SN/A} 2012292SN/A 2022292SN/Atemplate<class Impl> 2032292SN/Avoid 2042292SN/ALSQ<Impl>::setIEW(IEW *iew_ptr) 2052292SN/A{ 2062292SN/A iewStage = iew_ptr; 2072292SN/A 2082292SN/A for (int tid=0; tid < numThreads; tid++) { 2092292SN/A thread[tid].setIEW(iew_ptr); 2102292SN/A } 2112292SN/A} 2122292SN/A 2132292SN/Atemplate <class Impl> 2142307SN/Avoid 2152307SN/ALSQ<Impl>::switchOut() 2162307SN/A{ 2172307SN/A for (int tid = 0; tid < numThreads; tid++) { 2182307SN/A thread[tid].switchOut(); 2192307SN/A } 2202307SN/A} 2212307SN/A 2222307SN/Atemplate <class Impl> 2232307SN/Avoid 2242307SN/ALSQ<Impl>::takeOverFrom() 2252307SN/A{ 2262307SN/A for (int tid = 0; tid < numThreads; tid++) { 2272307SN/A thread[tid].takeOverFrom(); 2282307SN/A } 2292307SN/A} 2302307SN/A 2312307SN/Atemplate <class Impl> 2322292SN/Aint 2332292SN/ALSQ<Impl>::entryAmount(int num_threads) 2342292SN/A{ 2352292SN/A if (lsqPolicy == Partitioned) { 2362292SN/A return LQEntries / num_threads; 2372292SN/A } else { 2382292SN/A return 0; 2392292SN/A } 2402292SN/A} 2412292SN/A 2422292SN/Atemplate <class Impl> 2432292SN/Avoid 2442292SN/ALSQ<Impl>::resetEntries() 2452292SN/A{ 2462292SN/A if (lsqPolicy != Dynamic || numThreads > 1) { 2473867Sbinkertn@umich.edu int active_threads = activeThreads->size(); 2482292SN/A 2492292SN/A int maxEntries; 2502292SN/A 2512292SN/A if (lsqPolicy == Partitioned) { 2522292SN/A maxEntries = LQEntries / active_threads; 2532292SN/A } else if (lsqPolicy == Threshold && active_threads == 1) { 2542292SN/A maxEntries = LQEntries; 2552292SN/A } else { 2562292SN/A maxEntries = LQEntries; 2572292SN/A } 2582292SN/A 2593867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 2603867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 2613867Sbinkertn@umich.edu 2623867Sbinkertn@umich.edu while (threads != end) { 2633867Sbinkertn@umich.edu unsigned tid = *threads++; 2643867Sbinkertn@umich.edu 2653867Sbinkertn@umich.edu resizeEntries(maxEntries, tid); 2662292SN/A } 2672292SN/A } 2682292SN/A} 2692292SN/A 2702292SN/Atemplate<class Impl> 2712292SN/Avoid 2722292SN/ALSQ<Impl>::removeEntries(unsigned tid) 2732292SN/A{ 2742292SN/A thread[tid].clearLQ(); 2752292SN/A thread[tid].clearSQ(); 2762292SN/A} 2772292SN/A 2782292SN/Atemplate<class Impl> 2792292SN/Avoid 2802292SN/ALSQ<Impl>::resizeEntries(unsigned size,unsigned tid) 2812292SN/A{ 2822292SN/A thread[tid].resizeLQ(size); 2832292SN/A thread[tid].resizeSQ(size); 2842292SN/A} 2852292SN/A 2862292SN/Atemplate<class Impl> 2872292SN/Avoid 2882292SN/ALSQ<Impl>::tick() 2892292SN/A{ 2903867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 2913867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 2922292SN/A 2933867Sbinkertn@umich.edu while (threads != end) { 2943867Sbinkertn@umich.edu unsigned tid = *threads++; 2952292SN/A 2962292SN/A thread[tid].tick(); 2972292SN/A } 2982292SN/A} 2992292SN/A 3002292SN/Atemplate<class Impl> 3012292SN/Avoid 3022292SN/ALSQ<Impl>::insertLoad(DynInstPtr &load_inst) 3032292SN/A{ 3042292SN/A unsigned tid = load_inst->threadNumber; 3052292SN/A 3062292SN/A thread[tid].insertLoad(load_inst); 3072292SN/A} 3082292SN/A 3092292SN/Atemplate<class Impl> 3102292SN/Avoid 3112292SN/ALSQ<Impl>::insertStore(DynInstPtr &store_inst) 3122292SN/A{ 3132292SN/A unsigned tid = store_inst->threadNumber; 3142292SN/A 3152292SN/A thread[tid].insertStore(store_inst); 3162292SN/A} 3172292SN/A 3182292SN/Atemplate<class Impl> 3192292SN/AFault 3202292SN/ALSQ<Impl>::executeLoad(DynInstPtr &inst) 3212292SN/A{ 3222292SN/A unsigned tid = inst->threadNumber; 3232292SN/A 3242292SN/A return thread[tid].executeLoad(inst); 3252292SN/A} 3262292SN/A 3272292SN/Atemplate<class Impl> 3282292SN/AFault 3292292SN/ALSQ<Impl>::executeStore(DynInstPtr &inst) 3302292SN/A{ 3312292SN/A unsigned tid = inst->threadNumber; 3322292SN/A 3332292SN/A return thread[tid].executeStore(inst); 3342292SN/A} 3352292SN/A 3362292SN/Atemplate<class Impl> 3372292SN/Avoid 3382292SN/ALSQ<Impl>::writebackStores() 3392292SN/A{ 3403867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 3413867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 3422292SN/A 3433867Sbinkertn@umich.edu while (threads != end) { 3443867Sbinkertn@umich.edu unsigned tid = *threads++; 3452292SN/A 3462292SN/A if (numStoresToWB(tid) > 0) { 3472329SN/A DPRINTF(Writeback,"[tid:%i] Writing back stores. %i stores " 3482329SN/A "available for Writeback.\n", tid, numStoresToWB(tid)); 3492292SN/A } 3502292SN/A 3512292SN/A thread[tid].writebackStores(); 3522292SN/A } 3532292SN/A} 3542292SN/A 3552292SN/Atemplate<class Impl> 3562292SN/Abool 3572292SN/ALSQ<Impl>::violation() 3582292SN/A{ 3592292SN/A /* Answers: Does Anybody Have a Violation?*/ 3603867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 3613867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 3622292SN/A 3633867Sbinkertn@umich.edu while (threads != end) { 3643867Sbinkertn@umich.edu unsigned tid = *threads++; 3653867Sbinkertn@umich.edu 3662292SN/A if (thread[tid].violation()) 3672292SN/A return true; 3682292SN/A } 3692292SN/A 3702292SN/A return false; 3712292SN/A} 3722292SN/A 3732292SN/Atemplate<class Impl> 3742292SN/Aint 3752292SN/ALSQ<Impl>::getCount() 3762292SN/A{ 3772292SN/A unsigned total = 0; 3782292SN/A 3793867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 3803867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 3812292SN/A 3823867Sbinkertn@umich.edu while (threads != end) { 3833867Sbinkertn@umich.edu unsigned tid = *threads++; 3843867Sbinkertn@umich.edu 3852292SN/A total += getCount(tid); 3862292SN/A } 3872292SN/A 3882292SN/A return total; 3892292SN/A} 3902292SN/A 3912292SN/Atemplate<class Impl> 3922292SN/Aint 3932292SN/ALSQ<Impl>::numLoads() 3942292SN/A{ 3952292SN/A unsigned total = 0; 3962292SN/A 3973867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 3983867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 3992292SN/A 4003867Sbinkertn@umich.edu while (threads != end) { 4013867Sbinkertn@umich.edu unsigned tid = *threads++; 4023867Sbinkertn@umich.edu 4032292SN/A total += numLoads(tid); 4042292SN/A } 4052292SN/A 4062292SN/A return total; 4072292SN/A} 4082292SN/A 4092292SN/Atemplate<class Impl> 4102292SN/Aint 4112292SN/ALSQ<Impl>::numStores() 4122292SN/A{ 4132292SN/A unsigned total = 0; 4142292SN/A 4153867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 4163867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 4172292SN/A 4183867Sbinkertn@umich.edu while (threads != end) { 4193867Sbinkertn@umich.edu unsigned tid = *threads++; 4203867Sbinkertn@umich.edu 4212292SN/A total += thread[tid].numStores(); 4222292SN/A } 4232292SN/A 4242292SN/A return total; 4252292SN/A} 4262292SN/A 4272292SN/Atemplate<class Impl> 4282292SN/Aint 4292292SN/ALSQ<Impl>::numLoadsReady() 4302292SN/A{ 4312292SN/A unsigned total = 0; 4322292SN/A 4333867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 4343867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 4352292SN/A 4363867Sbinkertn@umich.edu while (threads != end) { 4373867Sbinkertn@umich.edu unsigned tid = *threads++; 4383867Sbinkertn@umich.edu 4392292SN/A total += thread[tid].numLoadsReady(); 4402292SN/A } 4412292SN/A 4422292SN/A return total; 4432292SN/A} 4442292SN/A 4452292SN/Atemplate<class Impl> 4462292SN/Aunsigned 4472292SN/ALSQ<Impl>::numFreeEntries() 4482292SN/A{ 4492292SN/A unsigned total = 0; 4502292SN/A 4513867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 4523867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 4532292SN/A 4543867Sbinkertn@umich.edu while (threads != end) { 4553867Sbinkertn@umich.edu unsigned tid = *threads++; 4563867Sbinkertn@umich.edu 4572292SN/A total += thread[tid].numFreeEntries(); 4582292SN/A } 4592292SN/A 4602292SN/A return total; 4612292SN/A} 4622292SN/A 4632292SN/Atemplate<class Impl> 4642292SN/Aunsigned 4652292SN/ALSQ<Impl>::numFreeEntries(unsigned tid) 4662292SN/A{ 4673870Sbinkertn@umich.edu //if (lsqPolicy == Dynamic) 4682292SN/A //return numFreeEntries(); 4692292SN/A //else 4702292SN/A return thread[tid].numFreeEntries(); 4712292SN/A} 4722292SN/A 4732292SN/Atemplate<class Impl> 4742292SN/Abool 4752292SN/ALSQ<Impl>::isFull() 4762292SN/A{ 4773867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 4783867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 4792292SN/A 4803867Sbinkertn@umich.edu while (threads != end) { 4813867Sbinkertn@umich.edu unsigned tid = *threads++; 4823867Sbinkertn@umich.edu 4833867Sbinkertn@umich.edu if (!(thread[tid].lqFull() || thread[tid].sqFull())) 4842292SN/A return false; 4852292SN/A } 4862292SN/A 4872292SN/A return true; 4882292SN/A} 4892292SN/A 4902292SN/Atemplate<class Impl> 4912292SN/Abool 4922292SN/ALSQ<Impl>::isFull(unsigned tid) 4932292SN/A{ 4942292SN/A //@todo: Change to Calculate All Entries for 4952292SN/A //Dynamic Policy 4963867Sbinkertn@umich.edu if (lsqPolicy == Dynamic) 4972292SN/A return isFull(); 4982292SN/A else 4992292SN/A return thread[tid].lqFull() || thread[tid].sqFull(); 5002292SN/A} 5012292SN/A 5022292SN/Atemplate<class Impl> 5032292SN/Abool 5042292SN/ALSQ<Impl>::lqFull() 5052292SN/A{ 5063867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 5073867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 5082292SN/A 5093867Sbinkertn@umich.edu while (threads != end) { 5103867Sbinkertn@umich.edu unsigned tid = *threads++; 5113867Sbinkertn@umich.edu 5122292SN/A if (!thread[tid].lqFull()) 5132292SN/A return false; 5142292SN/A } 5152292SN/A 5162292SN/A return true; 5172292SN/A} 5182292SN/A 5192292SN/Atemplate<class Impl> 5202292SN/Abool 5212292SN/ALSQ<Impl>::lqFull(unsigned tid) 5222292SN/A{ 5232292SN/A //@todo: Change to Calculate All Entries for 5242292SN/A //Dynamic Policy 5253870Sbinkertn@umich.edu if (lsqPolicy == Dynamic) 5262292SN/A return lqFull(); 5272292SN/A else 5282292SN/A return thread[tid].lqFull(); 5292292SN/A} 5302292SN/A 5312292SN/Atemplate<class Impl> 5322292SN/Abool 5332292SN/ALSQ<Impl>::sqFull() 5342292SN/A{ 5353867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 5363867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 5372292SN/A 5383867Sbinkertn@umich.edu while (threads != end) { 5393867Sbinkertn@umich.edu unsigned tid = *threads++; 5403867Sbinkertn@umich.edu 5412292SN/A if (!sqFull(tid)) 5422292SN/A return false; 5432292SN/A } 5442292SN/A 5452292SN/A return true; 5462292SN/A} 5472292SN/A 5482292SN/Atemplate<class Impl> 5492292SN/Abool 5502292SN/ALSQ<Impl>::sqFull(unsigned tid) 5512292SN/A{ 5522292SN/A //@todo: Change to Calculate All Entries for 5532292SN/A //Dynamic Policy 5543870Sbinkertn@umich.edu if (lsqPolicy == Dynamic) 5552292SN/A return sqFull(); 5562292SN/A else 5572292SN/A return thread[tid].sqFull(); 5582292SN/A} 5592292SN/A 5602292SN/Atemplate<class Impl> 5612292SN/Abool 5622292SN/ALSQ<Impl>::isStalled() 5632292SN/A{ 5643867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 5653867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 5662292SN/A 5673867Sbinkertn@umich.edu while (threads != end) { 5683867Sbinkertn@umich.edu unsigned tid = *threads++; 5693867Sbinkertn@umich.edu 5702292SN/A if (!thread[tid].isStalled()) 5712292SN/A return false; 5722292SN/A } 5732292SN/A 5742292SN/A return true; 5752292SN/A} 5762292SN/A 5772292SN/Atemplate<class Impl> 5782292SN/Abool 5792292SN/ALSQ<Impl>::isStalled(unsigned tid) 5802292SN/A{ 5813870Sbinkertn@umich.edu if (lsqPolicy == Dynamic) 5822292SN/A return isStalled(); 5832292SN/A else 5842292SN/A return thread[tid].isStalled(); 5852292SN/A} 5862292SN/A 5872292SN/Atemplate<class Impl> 5882292SN/Abool 5892292SN/ALSQ<Impl>::hasStoresToWB() 5902292SN/A{ 5913867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 5923867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 5932292SN/A 5943867Sbinkertn@umich.edu if (threads == end) 5952864Sktlim@umich.edu return false; 5962864Sktlim@umich.edu 5973867Sbinkertn@umich.edu while (threads != end) { 5983867Sbinkertn@umich.edu unsigned tid = *threads++; 5993867Sbinkertn@umich.edu 6002292SN/A if (!hasStoresToWB(tid)) 6012292SN/A return false; 6022292SN/A } 6032292SN/A 6042292SN/A return true; 6052292SN/A} 6062292SN/A 6072292SN/Atemplate<class Impl> 6082292SN/Abool 6092292SN/ALSQ<Impl>::willWB() 6102292SN/A{ 6113867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 6123867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 6132292SN/A 6143867Sbinkertn@umich.edu while (threads != end) { 6153867Sbinkertn@umich.edu unsigned tid = *threads++; 6163867Sbinkertn@umich.edu 6172292SN/A if (!willWB(tid)) 6182292SN/A return false; 6192292SN/A } 6202292SN/A 6212292SN/A return true; 6222292SN/A} 6232292SN/A 6242292SN/Atemplate<class Impl> 6252292SN/Avoid 6262292SN/ALSQ<Impl>::dumpInsts() 6272292SN/A{ 6283867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 6293867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 6302292SN/A 6313867Sbinkertn@umich.edu while (threads != end) { 6323867Sbinkertn@umich.edu unsigned tid = *threads++; 6333867Sbinkertn@umich.edu 6342292SN/A thread[tid].dumpInsts(); 6352292SN/A } 6362292SN/A} 637