lsq_impl.hh revision 4329
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> 1104329Sktlim@umich.eduLSQ<Impl>::LSQ(O3CPU *cpu_ptr, IEW *iew_ptr, Params *params) 1114329Sktlim@umich.edu : cpu(cpu_ptr), iewStage(iew_ptr), dcachePort(this), 1124329Sktlim@umich.edu LQEntries(params->LQEntries), 1134329Sktlim@umich.edu SQEntries(params->SQEntries), 1144329Sktlim@umich.edu numThreads(params->numberOfThreads), 1152907Sktlim@umich.edu retryTid(-1) 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; 1344329Sktlim@umich.edu 1352292SN/A DPRINTF(LSQ, "LSQ sharing policy set to Dynamic\n"); 1362292SN/A } else if (policy == "partitioned") { 1372292SN/A lsqPolicy = Partitioned; 1382292SN/A 1392292SN/A //@todo:make work if part_amt doesnt divide evenly. 1402292SN/A maxLQEntries = LQEntries / numThreads; 1412292SN/A maxSQEntries = SQEntries / numThreads; 1424329Sktlim@umich.edu 1432292SN/A DPRINTF(Fetch, "LSQ sharing policy set to Partitioned: " 1442292SN/A "%i entries per LQ | %i entries per SQ", 1452292SN/A maxLQEntries,maxSQEntries); 1462292SN/A } else if (policy == "threshold") { 1472292SN/A lsqPolicy = Threshold; 1482292SN/A 1492292SN/A assert(params->smtLSQThreshold > LQEntries); 1502292SN/A assert(params->smtLSQThreshold > SQEntries); 1512292SN/A 1522292SN/A //Divide up by threshold amount 1532292SN/A //@todo: Should threads check the max and the total 1542292SN/A //amount of the LSQ 1552292SN/A maxLQEntries = params->smtLSQThreshold; 1562292SN/A maxSQEntries = params->smtLSQThreshold; 1574329Sktlim@umich.edu 1582292SN/A DPRINTF(LSQ, "LSQ sharing policy set to Threshold: " 1592292SN/A "%i entries per LQ | %i entries per SQ", 1602292SN/A maxLQEntries,maxSQEntries); 1612292SN/A } else { 1622292SN/A assert(0 && "Invalid LSQ Sharing Policy.Options Are:{Dynamic," 1632292SN/A "Partitioned, Threshold}"); 1642292SN/A } 1652292SN/A 1662292SN/A //Initialize LSQs 1672292SN/A for (int tid=0; tid < numThreads; tid++) { 1684329Sktlim@umich.edu thread[tid].init(cpu, iew_ptr, params, this, 1694329Sktlim@umich.edu maxLQEntries, maxSQEntries, tid); 1702907Sktlim@umich.edu thread[tid].setDcachePort(&dcachePort); 1712292SN/A } 1722292SN/A} 1732292SN/A 1742292SN/A 1752292SN/Atemplate<class Impl> 1762292SN/Astd::string 1772292SN/ALSQ<Impl>::name() const 1782292SN/A{ 1792292SN/A return iewStage->name() + ".lsq"; 1802292SN/A} 1812292SN/A 1822292SN/Atemplate<class Impl> 1832292SN/Avoid 1842727Sktlim@umich.eduLSQ<Impl>::regStats() 1852727Sktlim@umich.edu{ 1862727Sktlim@umich.edu //Initialize LSQs 1872727Sktlim@umich.edu for (int tid=0; tid < numThreads; tid++) { 1882727Sktlim@umich.edu thread[tid].regStats(); 1892727Sktlim@umich.edu } 1902727Sktlim@umich.edu} 1912727Sktlim@umich.edu 1922727Sktlim@umich.edutemplate<class Impl> 1932727Sktlim@umich.eduvoid 1942980Sgblack@eecs.umich.eduLSQ<Impl>::setActiveThreads(std::list<unsigned> *at_ptr) 1952292SN/A{ 1962292SN/A activeThreads = at_ptr; 1972292SN/A assert(activeThreads != 0); 1982292SN/A} 1992292SN/A 2002292SN/Atemplate <class Impl> 2012307SN/Avoid 2022307SN/ALSQ<Impl>::switchOut() 2032307SN/A{ 2042307SN/A for (int tid = 0; tid < numThreads; tid++) { 2052307SN/A thread[tid].switchOut(); 2062307SN/A } 2072307SN/A} 2082307SN/A 2092307SN/Atemplate <class Impl> 2102307SN/Avoid 2112307SN/ALSQ<Impl>::takeOverFrom() 2122307SN/A{ 2132307SN/A for (int tid = 0; tid < numThreads; tid++) { 2142307SN/A thread[tid].takeOverFrom(); 2152307SN/A } 2162307SN/A} 2172307SN/A 2182307SN/Atemplate <class Impl> 2192292SN/Aint 2202292SN/ALSQ<Impl>::entryAmount(int num_threads) 2212292SN/A{ 2222292SN/A if (lsqPolicy == Partitioned) { 2232292SN/A return LQEntries / num_threads; 2242292SN/A } else { 2252292SN/A return 0; 2262292SN/A } 2272292SN/A} 2282292SN/A 2292292SN/Atemplate <class Impl> 2302292SN/Avoid 2312292SN/ALSQ<Impl>::resetEntries() 2322292SN/A{ 2332292SN/A if (lsqPolicy != Dynamic || numThreads > 1) { 2343867Sbinkertn@umich.edu int active_threads = activeThreads->size(); 2352292SN/A 2362292SN/A int maxEntries; 2372292SN/A 2382292SN/A if (lsqPolicy == Partitioned) { 2392292SN/A maxEntries = LQEntries / active_threads; 2402292SN/A } else if (lsqPolicy == Threshold && active_threads == 1) { 2412292SN/A maxEntries = LQEntries; 2422292SN/A } else { 2432292SN/A maxEntries = LQEntries; 2442292SN/A } 2452292SN/A 2463867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 2473867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 2483867Sbinkertn@umich.edu 2493867Sbinkertn@umich.edu while (threads != end) { 2503867Sbinkertn@umich.edu unsigned tid = *threads++; 2513867Sbinkertn@umich.edu 2523867Sbinkertn@umich.edu resizeEntries(maxEntries, tid); 2532292SN/A } 2542292SN/A } 2552292SN/A} 2562292SN/A 2572292SN/Atemplate<class Impl> 2582292SN/Avoid 2592292SN/ALSQ<Impl>::removeEntries(unsigned tid) 2602292SN/A{ 2612292SN/A thread[tid].clearLQ(); 2622292SN/A thread[tid].clearSQ(); 2632292SN/A} 2642292SN/A 2652292SN/Atemplate<class Impl> 2662292SN/Avoid 2672292SN/ALSQ<Impl>::resizeEntries(unsigned size,unsigned tid) 2682292SN/A{ 2692292SN/A thread[tid].resizeLQ(size); 2702292SN/A thread[tid].resizeSQ(size); 2712292SN/A} 2722292SN/A 2732292SN/Atemplate<class Impl> 2742292SN/Avoid 2752292SN/ALSQ<Impl>::tick() 2762292SN/A{ 2773867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 2783867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 2792292SN/A 2803867Sbinkertn@umich.edu while (threads != end) { 2813867Sbinkertn@umich.edu unsigned tid = *threads++; 2822292SN/A 2832292SN/A thread[tid].tick(); 2842292SN/A } 2852292SN/A} 2862292SN/A 2872292SN/Atemplate<class Impl> 2882292SN/Avoid 2892292SN/ALSQ<Impl>::insertLoad(DynInstPtr &load_inst) 2902292SN/A{ 2912292SN/A unsigned tid = load_inst->threadNumber; 2922292SN/A 2932292SN/A thread[tid].insertLoad(load_inst); 2942292SN/A} 2952292SN/A 2962292SN/Atemplate<class Impl> 2972292SN/Avoid 2982292SN/ALSQ<Impl>::insertStore(DynInstPtr &store_inst) 2992292SN/A{ 3002292SN/A unsigned tid = store_inst->threadNumber; 3012292SN/A 3022292SN/A thread[tid].insertStore(store_inst); 3032292SN/A} 3042292SN/A 3052292SN/Atemplate<class Impl> 3062292SN/AFault 3072292SN/ALSQ<Impl>::executeLoad(DynInstPtr &inst) 3082292SN/A{ 3092292SN/A unsigned tid = inst->threadNumber; 3102292SN/A 3112292SN/A return thread[tid].executeLoad(inst); 3122292SN/A} 3132292SN/A 3142292SN/Atemplate<class Impl> 3152292SN/AFault 3162292SN/ALSQ<Impl>::executeStore(DynInstPtr &inst) 3172292SN/A{ 3182292SN/A unsigned tid = inst->threadNumber; 3192292SN/A 3202292SN/A return thread[tid].executeStore(inst); 3212292SN/A} 3222292SN/A 3232292SN/Atemplate<class Impl> 3242292SN/Avoid 3252292SN/ALSQ<Impl>::writebackStores() 3262292SN/A{ 3273867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 3283867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 3292292SN/A 3303867Sbinkertn@umich.edu while (threads != end) { 3313867Sbinkertn@umich.edu unsigned tid = *threads++; 3322292SN/A 3332292SN/A if (numStoresToWB(tid) > 0) { 3342329SN/A DPRINTF(Writeback,"[tid:%i] Writing back stores. %i stores " 3352329SN/A "available for Writeback.\n", tid, numStoresToWB(tid)); 3362292SN/A } 3372292SN/A 3382292SN/A thread[tid].writebackStores(); 3392292SN/A } 3402292SN/A} 3412292SN/A 3422292SN/Atemplate<class Impl> 3432292SN/Abool 3442292SN/ALSQ<Impl>::violation() 3452292SN/A{ 3462292SN/A /* Answers: Does Anybody Have a Violation?*/ 3473867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 3483867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 3492292SN/A 3503867Sbinkertn@umich.edu while (threads != end) { 3513867Sbinkertn@umich.edu unsigned tid = *threads++; 3523867Sbinkertn@umich.edu 3532292SN/A if (thread[tid].violation()) 3542292SN/A return true; 3552292SN/A } 3562292SN/A 3572292SN/A return false; 3582292SN/A} 3592292SN/A 3602292SN/Atemplate<class Impl> 3612292SN/Aint 3622292SN/ALSQ<Impl>::getCount() 3632292SN/A{ 3642292SN/A unsigned total = 0; 3652292SN/A 3663867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 3673867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 3682292SN/A 3693867Sbinkertn@umich.edu while (threads != end) { 3703867Sbinkertn@umich.edu unsigned tid = *threads++; 3713867Sbinkertn@umich.edu 3722292SN/A total += getCount(tid); 3732292SN/A } 3742292SN/A 3752292SN/A return total; 3762292SN/A} 3772292SN/A 3782292SN/Atemplate<class Impl> 3792292SN/Aint 3802292SN/ALSQ<Impl>::numLoads() 3812292SN/A{ 3822292SN/A unsigned total = 0; 3832292SN/A 3843867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 3853867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 3862292SN/A 3873867Sbinkertn@umich.edu while (threads != end) { 3883867Sbinkertn@umich.edu unsigned tid = *threads++; 3893867Sbinkertn@umich.edu 3902292SN/A total += numLoads(tid); 3912292SN/A } 3922292SN/A 3932292SN/A return total; 3942292SN/A} 3952292SN/A 3962292SN/Atemplate<class Impl> 3972292SN/Aint 3982292SN/ALSQ<Impl>::numStores() 3992292SN/A{ 4002292SN/A unsigned total = 0; 4012292SN/A 4023867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 4033867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 4042292SN/A 4053867Sbinkertn@umich.edu while (threads != end) { 4063867Sbinkertn@umich.edu unsigned tid = *threads++; 4073867Sbinkertn@umich.edu 4082292SN/A total += thread[tid].numStores(); 4092292SN/A } 4102292SN/A 4112292SN/A return total; 4122292SN/A} 4132292SN/A 4142292SN/Atemplate<class Impl> 4152292SN/Aint 4162292SN/ALSQ<Impl>::numLoadsReady() 4172292SN/A{ 4182292SN/A unsigned total = 0; 4192292SN/A 4203867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 4213867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 4222292SN/A 4233867Sbinkertn@umich.edu while (threads != end) { 4243867Sbinkertn@umich.edu unsigned tid = *threads++; 4253867Sbinkertn@umich.edu 4262292SN/A total += thread[tid].numLoadsReady(); 4272292SN/A } 4282292SN/A 4292292SN/A return total; 4302292SN/A} 4312292SN/A 4322292SN/Atemplate<class Impl> 4332292SN/Aunsigned 4342292SN/ALSQ<Impl>::numFreeEntries() 4352292SN/A{ 4362292SN/A unsigned total = 0; 4372292SN/A 4383867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 4393867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 4402292SN/A 4413867Sbinkertn@umich.edu while (threads != end) { 4423867Sbinkertn@umich.edu unsigned tid = *threads++; 4433867Sbinkertn@umich.edu 4442292SN/A total += thread[tid].numFreeEntries(); 4452292SN/A } 4462292SN/A 4472292SN/A return total; 4482292SN/A} 4492292SN/A 4502292SN/Atemplate<class Impl> 4512292SN/Aunsigned 4522292SN/ALSQ<Impl>::numFreeEntries(unsigned tid) 4532292SN/A{ 4543870Sbinkertn@umich.edu //if (lsqPolicy == Dynamic) 4552292SN/A //return numFreeEntries(); 4562292SN/A //else 4572292SN/A return thread[tid].numFreeEntries(); 4582292SN/A} 4592292SN/A 4602292SN/Atemplate<class Impl> 4612292SN/Abool 4622292SN/ALSQ<Impl>::isFull() 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 4703867Sbinkertn@umich.edu if (!(thread[tid].lqFull() || thread[tid].sqFull())) 4712292SN/A return false; 4722292SN/A } 4732292SN/A 4742292SN/A return true; 4752292SN/A} 4762292SN/A 4772292SN/Atemplate<class Impl> 4782292SN/Abool 4792292SN/ALSQ<Impl>::isFull(unsigned tid) 4802292SN/A{ 4812292SN/A //@todo: Change to Calculate All Entries for 4822292SN/A //Dynamic Policy 4833867Sbinkertn@umich.edu if (lsqPolicy == Dynamic) 4842292SN/A return isFull(); 4852292SN/A else 4862292SN/A return thread[tid].lqFull() || thread[tid].sqFull(); 4872292SN/A} 4882292SN/A 4892292SN/Atemplate<class Impl> 4902292SN/Abool 4912292SN/ALSQ<Impl>::lqFull() 4922292SN/A{ 4933867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 4943867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 4952292SN/A 4963867Sbinkertn@umich.edu while (threads != end) { 4973867Sbinkertn@umich.edu unsigned tid = *threads++; 4983867Sbinkertn@umich.edu 4992292SN/A if (!thread[tid].lqFull()) 5002292SN/A return false; 5012292SN/A } 5022292SN/A 5032292SN/A return true; 5042292SN/A} 5052292SN/A 5062292SN/Atemplate<class Impl> 5072292SN/Abool 5082292SN/ALSQ<Impl>::lqFull(unsigned tid) 5092292SN/A{ 5102292SN/A //@todo: Change to Calculate All Entries for 5112292SN/A //Dynamic Policy 5123870Sbinkertn@umich.edu if (lsqPolicy == Dynamic) 5132292SN/A return lqFull(); 5142292SN/A else 5152292SN/A return thread[tid].lqFull(); 5162292SN/A} 5172292SN/A 5182292SN/Atemplate<class Impl> 5192292SN/Abool 5202292SN/ALSQ<Impl>::sqFull() 5212292SN/A{ 5223867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 5233867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 5242292SN/A 5253867Sbinkertn@umich.edu while (threads != end) { 5263867Sbinkertn@umich.edu unsigned tid = *threads++; 5273867Sbinkertn@umich.edu 5282292SN/A if (!sqFull(tid)) 5292292SN/A return false; 5302292SN/A } 5312292SN/A 5322292SN/A return true; 5332292SN/A} 5342292SN/A 5352292SN/Atemplate<class Impl> 5362292SN/Abool 5372292SN/ALSQ<Impl>::sqFull(unsigned tid) 5382292SN/A{ 5392292SN/A //@todo: Change to Calculate All Entries for 5402292SN/A //Dynamic Policy 5413870Sbinkertn@umich.edu if (lsqPolicy == Dynamic) 5422292SN/A return sqFull(); 5432292SN/A else 5442292SN/A return thread[tid].sqFull(); 5452292SN/A} 5462292SN/A 5472292SN/Atemplate<class Impl> 5482292SN/Abool 5492292SN/ALSQ<Impl>::isStalled() 5502292SN/A{ 5513867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 5523867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 5532292SN/A 5543867Sbinkertn@umich.edu while (threads != end) { 5553867Sbinkertn@umich.edu unsigned tid = *threads++; 5563867Sbinkertn@umich.edu 5572292SN/A if (!thread[tid].isStalled()) 5582292SN/A return false; 5592292SN/A } 5602292SN/A 5612292SN/A return true; 5622292SN/A} 5632292SN/A 5642292SN/Atemplate<class Impl> 5652292SN/Abool 5662292SN/ALSQ<Impl>::isStalled(unsigned tid) 5672292SN/A{ 5683870Sbinkertn@umich.edu if (lsqPolicy == Dynamic) 5692292SN/A return isStalled(); 5702292SN/A else 5712292SN/A return thread[tid].isStalled(); 5722292SN/A} 5732292SN/A 5742292SN/Atemplate<class Impl> 5752292SN/Abool 5762292SN/ALSQ<Impl>::hasStoresToWB() 5772292SN/A{ 5783867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 5793867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 5802292SN/A 5813867Sbinkertn@umich.edu if (threads == end) 5822864Sktlim@umich.edu return false; 5832864Sktlim@umich.edu 5843867Sbinkertn@umich.edu while (threads != end) { 5853867Sbinkertn@umich.edu unsigned tid = *threads++; 5863867Sbinkertn@umich.edu 5872292SN/A if (!hasStoresToWB(tid)) 5882292SN/A return false; 5892292SN/A } 5902292SN/A 5912292SN/A return true; 5922292SN/A} 5932292SN/A 5942292SN/Atemplate<class Impl> 5952292SN/Abool 5962292SN/ALSQ<Impl>::willWB() 5972292SN/A{ 5983867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 5993867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 6002292SN/A 6013867Sbinkertn@umich.edu while (threads != end) { 6023867Sbinkertn@umich.edu unsigned tid = *threads++; 6033867Sbinkertn@umich.edu 6042292SN/A if (!willWB(tid)) 6052292SN/A return false; 6062292SN/A } 6072292SN/A 6082292SN/A return true; 6092292SN/A} 6102292SN/A 6112292SN/Atemplate<class Impl> 6122292SN/Avoid 6132292SN/ALSQ<Impl>::dumpInsts() 6142292SN/A{ 6153867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 6163867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 6172292SN/A 6183867Sbinkertn@umich.edu while (threads != end) { 6193867Sbinkertn@umich.edu unsigned tid = *threads++; 6203867Sbinkertn@umich.edu 6212292SN/A thread[tid].dumpInsts(); 6222292SN/A } 6232292SN/A} 624