lsq_impl.hh revision 4895
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 { 874895Sstever@eecs.umich.edu // must be a snoop 884895Sstever@eecs.umich.edu 894895Sstever@eecs.umich.edu // @TODO someday may need to process invalidations in LSQ here 904895Sstever@eecs.umich.edu // to provide stronger consistency model 913310Srdreslin@umich.edu } 922907Sktlim@umich.edu return true; 932907Sktlim@umich.edu} 942907Sktlim@umich.edu 952907Sktlim@umich.edutemplate <class Impl> 962907Sktlim@umich.eduvoid 972907Sktlim@umich.eduLSQ<Impl>::DcachePort::recvRetry() 982907Sktlim@umich.edu{ 993014Srdreslin@umich.edu if (lsq->retryTid == -1) 1003014Srdreslin@umich.edu { 1013014Srdreslin@umich.edu //Squashed, so drop it 1023014Srdreslin@umich.edu return; 1033014Srdreslin@umich.edu } 1042907Sktlim@umich.edu lsq->thread[lsq->retryTid].recvRetry(); 1052907Sktlim@umich.edu // Speculatively clear the retry Tid. This will get set again if 1062907Sktlim@umich.edu // the LSQUnit was unable to complete its access. 1072907Sktlim@umich.edu lsq->retryTid = -1; 1082907Sktlim@umich.edu} 1092907Sktlim@umich.edu 1102907Sktlim@umich.edutemplate <class Impl> 1114329Sktlim@umich.eduLSQ<Impl>::LSQ(O3CPU *cpu_ptr, IEW *iew_ptr, Params *params) 1124329Sktlim@umich.edu : cpu(cpu_ptr), iewStage(iew_ptr), dcachePort(this), 1134329Sktlim@umich.edu LQEntries(params->LQEntries), 1144329Sktlim@umich.edu SQEntries(params->SQEntries), 1154329Sktlim@umich.edu numThreads(params->numberOfThreads), 1162907Sktlim@umich.edu retryTid(-1) 1172292SN/A{ 1183647Srdreslin@umich.edu dcachePort.snoopRangeSent = false; 1193647Srdreslin@umich.edu 1202292SN/A //**********************************************/ 1212292SN/A //************ Handle SMT Parameters ***********/ 1222292SN/A //**********************************************/ 1232980Sgblack@eecs.umich.edu std::string policy = params->smtLSQPolicy; 1242292SN/A 1252292SN/A //Convert string to lowercase 1262292SN/A std::transform(policy.begin(), policy.end(), policy.begin(), 1272292SN/A (int(*)(int)) tolower); 1282292SN/A 1292292SN/A //Figure out fetch policy 1302292SN/A if (policy == "dynamic") { 1312292SN/A lsqPolicy = Dynamic; 1322292SN/A 1332292SN/A maxLQEntries = LQEntries; 1342292SN/A maxSQEntries = SQEntries; 1354329Sktlim@umich.edu 1362292SN/A DPRINTF(LSQ, "LSQ sharing policy set to Dynamic\n"); 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; 1434329Sktlim@umich.edu 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 } else if (policy == "threshold") { 1482292SN/A lsqPolicy = Threshold; 1492292SN/A 1502292SN/A assert(params->smtLSQThreshold > LQEntries); 1512292SN/A assert(params->smtLSQThreshold > SQEntries); 1522292SN/A 1532292SN/A //Divide up by threshold amount 1542292SN/A //@todo: Should threads check the max and the total 1552292SN/A //amount of the LSQ 1562292SN/A maxLQEntries = params->smtLSQThreshold; 1572292SN/A maxSQEntries = params->smtLSQThreshold; 1584329Sktlim@umich.edu 1592292SN/A DPRINTF(LSQ, "LSQ sharing policy set to Threshold: " 1602292SN/A "%i entries per LQ | %i entries per SQ", 1612292SN/A maxLQEntries,maxSQEntries); 1622292SN/A } else { 1632292SN/A assert(0 && "Invalid LSQ Sharing Policy.Options Are:{Dynamic," 1642292SN/A "Partitioned, Threshold}"); 1652292SN/A } 1662292SN/A 1672292SN/A //Initialize LSQs 1682292SN/A for (int tid=0; tid < numThreads; tid++) { 1694329Sktlim@umich.edu thread[tid].init(cpu, iew_ptr, params, this, 1704329Sktlim@umich.edu maxLQEntries, maxSQEntries, tid); 1712907Sktlim@umich.edu thread[tid].setDcachePort(&dcachePort); 1722292SN/A } 1732292SN/A} 1742292SN/A 1752292SN/A 1762292SN/Atemplate<class Impl> 1772292SN/Astd::string 1782292SN/ALSQ<Impl>::name() const 1792292SN/A{ 1802292SN/A return iewStage->name() + ".lsq"; 1812292SN/A} 1822292SN/A 1832292SN/Atemplate<class Impl> 1842292SN/Avoid 1852727Sktlim@umich.eduLSQ<Impl>::regStats() 1862727Sktlim@umich.edu{ 1872727Sktlim@umich.edu //Initialize LSQs 1882727Sktlim@umich.edu for (int tid=0; tid < numThreads; tid++) { 1892727Sktlim@umich.edu thread[tid].regStats(); 1902727Sktlim@umich.edu } 1912727Sktlim@umich.edu} 1922727Sktlim@umich.edu 1932727Sktlim@umich.edutemplate<class Impl> 1942727Sktlim@umich.eduvoid 1952980Sgblack@eecs.umich.eduLSQ<Impl>::setActiveThreads(std::list<unsigned> *at_ptr) 1962292SN/A{ 1972292SN/A activeThreads = at_ptr; 1982292SN/A assert(activeThreads != 0); 1992292SN/A} 2002292SN/A 2012292SN/Atemplate <class Impl> 2022307SN/Avoid 2032307SN/ALSQ<Impl>::switchOut() 2042307SN/A{ 2052307SN/A for (int tid = 0; tid < numThreads; tid++) { 2062307SN/A thread[tid].switchOut(); 2072307SN/A } 2082307SN/A} 2092307SN/A 2102307SN/Atemplate <class Impl> 2112307SN/Avoid 2122307SN/ALSQ<Impl>::takeOverFrom() 2132307SN/A{ 2142307SN/A for (int tid = 0; tid < numThreads; tid++) { 2152307SN/A thread[tid].takeOverFrom(); 2162307SN/A } 2172307SN/A} 2182307SN/A 2192307SN/Atemplate <class Impl> 2202292SN/Aint 2212292SN/ALSQ<Impl>::entryAmount(int num_threads) 2222292SN/A{ 2232292SN/A if (lsqPolicy == Partitioned) { 2242292SN/A return LQEntries / num_threads; 2252292SN/A } else { 2262292SN/A return 0; 2272292SN/A } 2282292SN/A} 2292292SN/A 2302292SN/Atemplate <class Impl> 2312292SN/Avoid 2322292SN/ALSQ<Impl>::resetEntries() 2332292SN/A{ 2342292SN/A if (lsqPolicy != Dynamic || numThreads > 1) { 2353867Sbinkertn@umich.edu int active_threads = activeThreads->size(); 2362292SN/A 2372292SN/A int maxEntries; 2382292SN/A 2392292SN/A if (lsqPolicy == Partitioned) { 2402292SN/A maxEntries = LQEntries / active_threads; 2412292SN/A } else if (lsqPolicy == Threshold && active_threads == 1) { 2422292SN/A maxEntries = LQEntries; 2432292SN/A } else { 2442292SN/A maxEntries = LQEntries; 2452292SN/A } 2462292SN/A 2473867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 2483867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 2493867Sbinkertn@umich.edu 2503867Sbinkertn@umich.edu while (threads != end) { 2513867Sbinkertn@umich.edu unsigned tid = *threads++; 2523867Sbinkertn@umich.edu 2533867Sbinkertn@umich.edu resizeEntries(maxEntries, tid); 2542292SN/A } 2552292SN/A } 2562292SN/A} 2572292SN/A 2582292SN/Atemplate<class Impl> 2592292SN/Avoid 2602292SN/ALSQ<Impl>::removeEntries(unsigned tid) 2612292SN/A{ 2622292SN/A thread[tid].clearLQ(); 2632292SN/A thread[tid].clearSQ(); 2642292SN/A} 2652292SN/A 2662292SN/Atemplate<class Impl> 2672292SN/Avoid 2682292SN/ALSQ<Impl>::resizeEntries(unsigned size,unsigned tid) 2692292SN/A{ 2702292SN/A thread[tid].resizeLQ(size); 2712292SN/A thread[tid].resizeSQ(size); 2722292SN/A} 2732292SN/A 2742292SN/Atemplate<class Impl> 2752292SN/Avoid 2762292SN/ALSQ<Impl>::tick() 2772292SN/A{ 2783867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 2793867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 2802292SN/A 2813867Sbinkertn@umich.edu while (threads != end) { 2823867Sbinkertn@umich.edu unsigned tid = *threads++; 2832292SN/A 2842292SN/A thread[tid].tick(); 2852292SN/A } 2862292SN/A} 2872292SN/A 2882292SN/Atemplate<class Impl> 2892292SN/Avoid 2902292SN/ALSQ<Impl>::insertLoad(DynInstPtr &load_inst) 2912292SN/A{ 2922292SN/A unsigned tid = load_inst->threadNumber; 2932292SN/A 2942292SN/A thread[tid].insertLoad(load_inst); 2952292SN/A} 2962292SN/A 2972292SN/Atemplate<class Impl> 2982292SN/Avoid 2992292SN/ALSQ<Impl>::insertStore(DynInstPtr &store_inst) 3002292SN/A{ 3012292SN/A unsigned tid = store_inst->threadNumber; 3022292SN/A 3032292SN/A thread[tid].insertStore(store_inst); 3042292SN/A} 3052292SN/A 3062292SN/Atemplate<class Impl> 3072292SN/AFault 3082292SN/ALSQ<Impl>::executeLoad(DynInstPtr &inst) 3092292SN/A{ 3102292SN/A unsigned tid = inst->threadNumber; 3112292SN/A 3122292SN/A return thread[tid].executeLoad(inst); 3132292SN/A} 3142292SN/A 3152292SN/Atemplate<class Impl> 3162292SN/AFault 3172292SN/ALSQ<Impl>::executeStore(DynInstPtr &inst) 3182292SN/A{ 3192292SN/A unsigned tid = inst->threadNumber; 3202292SN/A 3212292SN/A return thread[tid].executeStore(inst); 3222292SN/A} 3232292SN/A 3242292SN/Atemplate<class Impl> 3252292SN/Avoid 3262292SN/ALSQ<Impl>::writebackStores() 3272292SN/A{ 3283867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 3293867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 3302292SN/A 3313867Sbinkertn@umich.edu while (threads != end) { 3323867Sbinkertn@umich.edu unsigned tid = *threads++; 3332292SN/A 3342292SN/A if (numStoresToWB(tid) > 0) { 3352329SN/A DPRINTF(Writeback,"[tid:%i] Writing back stores. %i stores " 3362329SN/A "available for Writeback.\n", tid, numStoresToWB(tid)); 3372292SN/A } 3382292SN/A 3392292SN/A thread[tid].writebackStores(); 3402292SN/A } 3412292SN/A} 3422292SN/A 3432292SN/Atemplate<class Impl> 3442292SN/Abool 3452292SN/ALSQ<Impl>::violation() 3462292SN/A{ 3472292SN/A /* Answers: Does Anybody Have a Violation?*/ 3483867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 3493867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 3502292SN/A 3513867Sbinkertn@umich.edu while (threads != end) { 3523867Sbinkertn@umich.edu unsigned tid = *threads++; 3533867Sbinkertn@umich.edu 3542292SN/A if (thread[tid].violation()) 3552292SN/A return true; 3562292SN/A } 3572292SN/A 3582292SN/A return false; 3592292SN/A} 3602292SN/A 3612292SN/Atemplate<class Impl> 3622292SN/Aint 3632292SN/ALSQ<Impl>::getCount() 3642292SN/A{ 3652292SN/A unsigned total = 0; 3662292SN/A 3673867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 3683867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 3692292SN/A 3703867Sbinkertn@umich.edu while (threads != end) { 3713867Sbinkertn@umich.edu unsigned tid = *threads++; 3723867Sbinkertn@umich.edu 3732292SN/A total += getCount(tid); 3742292SN/A } 3752292SN/A 3762292SN/A return total; 3772292SN/A} 3782292SN/A 3792292SN/Atemplate<class Impl> 3802292SN/Aint 3812292SN/ALSQ<Impl>::numLoads() 3822292SN/A{ 3832292SN/A unsigned total = 0; 3842292SN/A 3853867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 3863867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 3872292SN/A 3883867Sbinkertn@umich.edu while (threads != end) { 3893867Sbinkertn@umich.edu unsigned tid = *threads++; 3903867Sbinkertn@umich.edu 3912292SN/A total += numLoads(tid); 3922292SN/A } 3932292SN/A 3942292SN/A return total; 3952292SN/A} 3962292SN/A 3972292SN/Atemplate<class Impl> 3982292SN/Aint 3992292SN/ALSQ<Impl>::numStores() 4002292SN/A{ 4012292SN/A unsigned total = 0; 4022292SN/A 4033867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 4043867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 4052292SN/A 4063867Sbinkertn@umich.edu while (threads != end) { 4073867Sbinkertn@umich.edu unsigned tid = *threads++; 4083867Sbinkertn@umich.edu 4092292SN/A total += thread[tid].numStores(); 4102292SN/A } 4112292SN/A 4122292SN/A return total; 4132292SN/A} 4142292SN/A 4152292SN/Atemplate<class Impl> 4162292SN/Aint 4172292SN/ALSQ<Impl>::numLoadsReady() 4182292SN/A{ 4192292SN/A unsigned total = 0; 4202292SN/A 4213867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 4223867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 4232292SN/A 4243867Sbinkertn@umich.edu while (threads != end) { 4253867Sbinkertn@umich.edu unsigned tid = *threads++; 4263867Sbinkertn@umich.edu 4272292SN/A total += thread[tid].numLoadsReady(); 4282292SN/A } 4292292SN/A 4302292SN/A return total; 4312292SN/A} 4322292SN/A 4332292SN/Atemplate<class Impl> 4342292SN/Aunsigned 4352292SN/ALSQ<Impl>::numFreeEntries() 4362292SN/A{ 4372292SN/A unsigned total = 0; 4382292SN/A 4393867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 4403867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 4412292SN/A 4423867Sbinkertn@umich.edu while (threads != end) { 4433867Sbinkertn@umich.edu unsigned tid = *threads++; 4443867Sbinkertn@umich.edu 4452292SN/A total += thread[tid].numFreeEntries(); 4462292SN/A } 4472292SN/A 4482292SN/A return total; 4492292SN/A} 4502292SN/A 4512292SN/Atemplate<class Impl> 4522292SN/Aunsigned 4532292SN/ALSQ<Impl>::numFreeEntries(unsigned tid) 4542292SN/A{ 4553870Sbinkertn@umich.edu //if (lsqPolicy == Dynamic) 4562292SN/A //return numFreeEntries(); 4572292SN/A //else 4582292SN/A return thread[tid].numFreeEntries(); 4592292SN/A} 4602292SN/A 4612292SN/Atemplate<class Impl> 4622292SN/Abool 4632292SN/ALSQ<Impl>::isFull() 4642292SN/A{ 4653867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 4663867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 4672292SN/A 4683867Sbinkertn@umich.edu while (threads != end) { 4693867Sbinkertn@umich.edu unsigned tid = *threads++; 4703867Sbinkertn@umich.edu 4713867Sbinkertn@umich.edu if (!(thread[tid].lqFull() || thread[tid].sqFull())) 4722292SN/A return false; 4732292SN/A } 4742292SN/A 4752292SN/A return true; 4762292SN/A} 4772292SN/A 4782292SN/Atemplate<class Impl> 4792292SN/Abool 4802292SN/ALSQ<Impl>::isFull(unsigned tid) 4812292SN/A{ 4822292SN/A //@todo: Change to Calculate All Entries for 4832292SN/A //Dynamic Policy 4843867Sbinkertn@umich.edu if (lsqPolicy == Dynamic) 4852292SN/A return isFull(); 4862292SN/A else 4872292SN/A return thread[tid].lqFull() || thread[tid].sqFull(); 4882292SN/A} 4892292SN/A 4902292SN/Atemplate<class Impl> 4912292SN/Abool 4922292SN/ALSQ<Impl>::lqFull() 4932292SN/A{ 4943867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 4953867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 4962292SN/A 4973867Sbinkertn@umich.edu while (threads != end) { 4983867Sbinkertn@umich.edu unsigned tid = *threads++; 4993867Sbinkertn@umich.edu 5002292SN/A if (!thread[tid].lqFull()) 5012292SN/A return false; 5022292SN/A } 5032292SN/A 5042292SN/A return true; 5052292SN/A} 5062292SN/A 5072292SN/Atemplate<class Impl> 5082292SN/Abool 5092292SN/ALSQ<Impl>::lqFull(unsigned tid) 5102292SN/A{ 5112292SN/A //@todo: Change to Calculate All Entries for 5122292SN/A //Dynamic Policy 5133870Sbinkertn@umich.edu if (lsqPolicy == Dynamic) 5142292SN/A return lqFull(); 5152292SN/A else 5162292SN/A return thread[tid].lqFull(); 5172292SN/A} 5182292SN/A 5192292SN/Atemplate<class Impl> 5202292SN/Abool 5212292SN/ALSQ<Impl>::sqFull() 5222292SN/A{ 5233867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 5243867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 5252292SN/A 5263867Sbinkertn@umich.edu while (threads != end) { 5273867Sbinkertn@umich.edu unsigned tid = *threads++; 5283867Sbinkertn@umich.edu 5292292SN/A if (!sqFull(tid)) 5302292SN/A return false; 5312292SN/A } 5322292SN/A 5332292SN/A return true; 5342292SN/A} 5352292SN/A 5362292SN/Atemplate<class Impl> 5372292SN/Abool 5382292SN/ALSQ<Impl>::sqFull(unsigned tid) 5392292SN/A{ 5402292SN/A //@todo: Change to Calculate All Entries for 5412292SN/A //Dynamic Policy 5423870Sbinkertn@umich.edu if (lsqPolicy == Dynamic) 5432292SN/A return sqFull(); 5442292SN/A else 5452292SN/A return thread[tid].sqFull(); 5462292SN/A} 5472292SN/A 5482292SN/Atemplate<class Impl> 5492292SN/Abool 5502292SN/ALSQ<Impl>::isStalled() 5512292SN/A{ 5523867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 5533867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 5542292SN/A 5553867Sbinkertn@umich.edu while (threads != end) { 5563867Sbinkertn@umich.edu unsigned tid = *threads++; 5573867Sbinkertn@umich.edu 5582292SN/A if (!thread[tid].isStalled()) 5592292SN/A return false; 5602292SN/A } 5612292SN/A 5622292SN/A return true; 5632292SN/A} 5642292SN/A 5652292SN/Atemplate<class Impl> 5662292SN/Abool 5672292SN/ALSQ<Impl>::isStalled(unsigned tid) 5682292SN/A{ 5693870Sbinkertn@umich.edu if (lsqPolicy == Dynamic) 5702292SN/A return isStalled(); 5712292SN/A else 5722292SN/A return thread[tid].isStalled(); 5732292SN/A} 5742292SN/A 5752292SN/Atemplate<class Impl> 5762292SN/Abool 5772292SN/ALSQ<Impl>::hasStoresToWB() 5782292SN/A{ 5793867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 5803867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 5812292SN/A 5823867Sbinkertn@umich.edu if (threads == end) 5832864Sktlim@umich.edu return false; 5842864Sktlim@umich.edu 5853867Sbinkertn@umich.edu while (threads != end) { 5863867Sbinkertn@umich.edu unsigned tid = *threads++; 5873867Sbinkertn@umich.edu 5882292SN/A if (!hasStoresToWB(tid)) 5892292SN/A return false; 5902292SN/A } 5912292SN/A 5922292SN/A return true; 5932292SN/A} 5942292SN/A 5952292SN/Atemplate<class Impl> 5962292SN/Abool 5972292SN/ALSQ<Impl>::willWB() 5982292SN/A{ 5993867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 6003867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 6012292SN/A 6023867Sbinkertn@umich.edu while (threads != end) { 6033867Sbinkertn@umich.edu unsigned tid = *threads++; 6043867Sbinkertn@umich.edu 6052292SN/A if (!willWB(tid)) 6062292SN/A return false; 6072292SN/A } 6082292SN/A 6092292SN/A return true; 6102292SN/A} 6112292SN/A 6122292SN/Atemplate<class Impl> 6132292SN/Avoid 6142292SN/ALSQ<Impl>::dumpInsts() 6152292SN/A{ 6163867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 6173867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 6182292SN/A 6193867Sbinkertn@umich.edu while (threads != end) { 6203867Sbinkertn@umich.edu unsigned tid = *threads++; 6213867Sbinkertn@umich.edu 6222292SN/A thread[tid].dumpInsts(); 6232292SN/A } 6242292SN/A} 625