lsq_impl.hh revision 5714
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 375529Snate@binkert.org#include "params/DerivO3CPU.hh" 385529Snate@binkert.org 394192Sktlim@umich.edutemplate<class Impl> 404192Sktlim@umich.eduvoid 414192Sktlim@umich.eduLSQ<Impl>::DcachePort::setPeer(Port *port) 424192Sktlim@umich.edu{ 434192Sktlim@umich.edu Port::setPeer(port); 444192Sktlim@umich.edu 454192Sktlim@umich.edu#if FULL_SYSTEM 464192Sktlim@umich.edu // Update the ThreadContext's memory ports (Functional/Virtual 474192Sktlim@umich.edu // Ports) 484192Sktlim@umich.edu lsq->updateMemPorts(); 494192Sktlim@umich.edu#endif 504192Sktlim@umich.edu} 514192Sktlim@umich.edu 522292SN/Atemplate <class Impl> 532907Sktlim@umich.eduTick 542907Sktlim@umich.eduLSQ<Impl>::DcachePort::recvAtomic(PacketPtr pkt) 552907Sktlim@umich.edu{ 562907Sktlim@umich.edu panic("O3CPU model does not work with atomic mode!"); 572907Sktlim@umich.edu return curTick; 582907Sktlim@umich.edu} 592907Sktlim@umich.edu 602907Sktlim@umich.edutemplate <class Impl> 612907Sktlim@umich.eduvoid 622907Sktlim@umich.eduLSQ<Impl>::DcachePort::recvFunctional(PacketPtr pkt) 632907Sktlim@umich.edu{ 643639Sktlim@umich.edu DPRINTF(LSQ, "LSQ doesn't update things on a recvFunctional."); 652907Sktlim@umich.edu} 662907Sktlim@umich.edu 672907Sktlim@umich.edutemplate <class Impl> 682907Sktlim@umich.eduvoid 692907Sktlim@umich.eduLSQ<Impl>::DcachePort::recvStatusChange(Status status) 702907Sktlim@umich.edu{ 713647Srdreslin@umich.edu if (status == RangeChange) { 723647Srdreslin@umich.edu if (!snoopRangeSent) { 733647Srdreslin@umich.edu snoopRangeSent = true; 743647Srdreslin@umich.edu sendStatusChange(Port::RangeChange); 753647Srdreslin@umich.edu } 762907Sktlim@umich.edu return; 773647Srdreslin@umich.edu } 782907Sktlim@umich.edu panic("O3CPU doesn't expect recvStatusChange callback!"); 792907Sktlim@umich.edu} 802907Sktlim@umich.edu 812907Sktlim@umich.edutemplate <class Impl> 822907Sktlim@umich.edubool 832907Sktlim@umich.eduLSQ<Impl>::DcachePort::recvTiming(PacketPtr pkt) 842907Sktlim@umich.edu{ 854986Ssaidi@eecs.umich.edu if (pkt->isError()) 864986Ssaidi@eecs.umich.edu DPRINTF(LSQ, "Got error packet back for address: %#X\n", pkt->getAddr()); 873310Srdreslin@umich.edu if (pkt->isResponse()) { 885714Shsul@eecs.umich.edu lsq->thread[pkt->req->threadId()].completeDataAccess(pkt); 893310Srdreslin@umich.edu } 903310Srdreslin@umich.edu else { 914895Sstever@eecs.umich.edu // must be a snoop 924895Sstever@eecs.umich.edu 934895Sstever@eecs.umich.edu // @TODO someday may need to process invalidations in LSQ here 944895Sstever@eecs.umich.edu // to provide stronger consistency model 953310Srdreslin@umich.edu } 962907Sktlim@umich.edu return true; 972907Sktlim@umich.edu} 982907Sktlim@umich.edu 992907Sktlim@umich.edutemplate <class Impl> 1002907Sktlim@umich.eduvoid 1012907Sktlim@umich.eduLSQ<Impl>::DcachePort::recvRetry() 1022907Sktlim@umich.edu{ 1033014Srdreslin@umich.edu if (lsq->retryTid == -1) 1043014Srdreslin@umich.edu { 1053014Srdreslin@umich.edu //Squashed, so drop it 1063014Srdreslin@umich.edu return; 1073014Srdreslin@umich.edu } 1084985Sktlim@umich.edu int curr_retry_tid = lsq->retryTid; 1092907Sktlim@umich.edu // Speculatively clear the retry Tid. This will get set again if 1102907Sktlim@umich.edu // the LSQUnit was unable to complete its access. 1112907Sktlim@umich.edu lsq->retryTid = -1; 1124985Sktlim@umich.edu lsq->thread[curr_retry_tid].recvRetry(); 1132907Sktlim@umich.edu} 1142907Sktlim@umich.edu 1152907Sktlim@umich.edutemplate <class Impl> 1165529Snate@binkert.orgLSQ<Impl>::LSQ(O3CPU *cpu_ptr, IEW *iew_ptr, DerivO3CPUParams *params) 1175494Sstever@gmail.com : cpu(cpu_ptr), iewStage(iew_ptr), dcachePort(this), 1184329Sktlim@umich.edu LQEntries(params->LQEntries), 1194329Sktlim@umich.edu SQEntries(params->SQEntries), 1205529Snate@binkert.org numThreads(params->numThreads), 1212907Sktlim@umich.edu retryTid(-1) 1222292SN/A{ 1233647Srdreslin@umich.edu dcachePort.snoopRangeSent = false; 1243647Srdreslin@umich.edu 1252292SN/A //**********************************************/ 1262292SN/A //************ Handle SMT Parameters ***********/ 1272292SN/A //**********************************************/ 1282980Sgblack@eecs.umich.edu std::string policy = params->smtLSQPolicy; 1292292SN/A 1302292SN/A //Convert string to lowercase 1312292SN/A std::transform(policy.begin(), policy.end(), policy.begin(), 1322292SN/A (int(*)(int)) tolower); 1332292SN/A 1342292SN/A //Figure out fetch policy 1352292SN/A if (policy == "dynamic") { 1362292SN/A lsqPolicy = Dynamic; 1372292SN/A 1382292SN/A maxLQEntries = LQEntries; 1392292SN/A maxSQEntries = SQEntries; 1404329Sktlim@umich.edu 1412292SN/A DPRINTF(LSQ, "LSQ sharing policy set to Dynamic\n"); 1422292SN/A } else if (policy == "partitioned") { 1432292SN/A lsqPolicy = Partitioned; 1442292SN/A 1452292SN/A //@todo:make work if part_amt doesnt divide evenly. 1462292SN/A maxLQEntries = LQEntries / numThreads; 1472292SN/A maxSQEntries = SQEntries / numThreads; 1484329Sktlim@umich.edu 1492292SN/A DPRINTF(Fetch, "LSQ sharing policy set to Partitioned: " 1502292SN/A "%i entries per LQ | %i entries per SQ", 1512292SN/A maxLQEntries,maxSQEntries); 1522292SN/A } else if (policy == "threshold") { 1532292SN/A lsqPolicy = Threshold; 1542292SN/A 1552292SN/A assert(params->smtLSQThreshold > LQEntries); 1562292SN/A assert(params->smtLSQThreshold > SQEntries); 1572292SN/A 1582292SN/A //Divide up by threshold amount 1592292SN/A //@todo: Should threads check the max and the total 1602292SN/A //amount of the LSQ 1612292SN/A maxLQEntries = params->smtLSQThreshold; 1622292SN/A maxSQEntries = params->smtLSQThreshold; 1634329Sktlim@umich.edu 1642292SN/A DPRINTF(LSQ, "LSQ sharing policy set to Threshold: " 1652292SN/A "%i entries per LQ | %i entries per SQ", 1662292SN/A maxLQEntries,maxSQEntries); 1672292SN/A } else { 1682292SN/A assert(0 && "Invalid LSQ Sharing Policy.Options Are:{Dynamic," 1692292SN/A "Partitioned, Threshold}"); 1702292SN/A } 1712292SN/A 1722292SN/A //Initialize LSQs 1732292SN/A for (int tid=0; tid < numThreads; tid++) { 1744329Sktlim@umich.edu thread[tid].init(cpu, iew_ptr, params, this, 1754329Sktlim@umich.edu maxLQEntries, maxSQEntries, tid); 1762907Sktlim@umich.edu thread[tid].setDcachePort(&dcachePort); 1772292SN/A } 1782292SN/A} 1792292SN/A 1802292SN/A 1812292SN/Atemplate<class Impl> 1822292SN/Astd::string 1832292SN/ALSQ<Impl>::name() const 1842292SN/A{ 1852292SN/A return iewStage->name() + ".lsq"; 1862292SN/A} 1872292SN/A 1882292SN/Atemplate<class Impl> 1892292SN/Avoid 1902727Sktlim@umich.eduLSQ<Impl>::regStats() 1912727Sktlim@umich.edu{ 1922727Sktlim@umich.edu //Initialize LSQs 1932727Sktlim@umich.edu for (int tid=0; tid < numThreads; tid++) { 1942727Sktlim@umich.edu thread[tid].regStats(); 1952727Sktlim@umich.edu } 1962727Sktlim@umich.edu} 1972727Sktlim@umich.edu 1982727Sktlim@umich.edutemplate<class Impl> 1992727Sktlim@umich.eduvoid 2002980Sgblack@eecs.umich.eduLSQ<Impl>::setActiveThreads(std::list<unsigned> *at_ptr) 2012292SN/A{ 2022292SN/A activeThreads = at_ptr; 2032292SN/A assert(activeThreads != 0); 2042292SN/A} 2052292SN/A 2062292SN/Atemplate <class Impl> 2072307SN/Avoid 2082307SN/ALSQ<Impl>::switchOut() 2092307SN/A{ 2102307SN/A for (int tid = 0; tid < numThreads; tid++) { 2112307SN/A thread[tid].switchOut(); 2122307SN/A } 2132307SN/A} 2142307SN/A 2152307SN/Atemplate <class Impl> 2162307SN/Avoid 2172307SN/ALSQ<Impl>::takeOverFrom() 2182307SN/A{ 2192307SN/A for (int tid = 0; tid < numThreads; tid++) { 2202307SN/A thread[tid].takeOverFrom(); 2212307SN/A } 2222307SN/A} 2232307SN/A 2242307SN/Atemplate <class Impl> 2252292SN/Aint 2262292SN/ALSQ<Impl>::entryAmount(int num_threads) 2272292SN/A{ 2282292SN/A if (lsqPolicy == Partitioned) { 2292292SN/A return LQEntries / num_threads; 2302292SN/A } else { 2312292SN/A return 0; 2322292SN/A } 2332292SN/A} 2342292SN/A 2352292SN/Atemplate <class Impl> 2362292SN/Avoid 2372292SN/ALSQ<Impl>::resetEntries() 2382292SN/A{ 2392292SN/A if (lsqPolicy != Dynamic || numThreads > 1) { 2403867Sbinkertn@umich.edu int active_threads = activeThreads->size(); 2412292SN/A 2422292SN/A int maxEntries; 2432292SN/A 2442292SN/A if (lsqPolicy == Partitioned) { 2452292SN/A maxEntries = LQEntries / active_threads; 2462292SN/A } else if (lsqPolicy == Threshold && active_threads == 1) { 2472292SN/A maxEntries = LQEntries; 2482292SN/A } else { 2492292SN/A maxEntries = LQEntries; 2502292SN/A } 2512292SN/A 2523867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 2533867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 2543867Sbinkertn@umich.edu 2553867Sbinkertn@umich.edu while (threads != end) { 2563867Sbinkertn@umich.edu unsigned tid = *threads++; 2573867Sbinkertn@umich.edu 2583867Sbinkertn@umich.edu resizeEntries(maxEntries, tid); 2592292SN/A } 2602292SN/A } 2612292SN/A} 2622292SN/A 2632292SN/Atemplate<class Impl> 2642292SN/Avoid 2652292SN/ALSQ<Impl>::removeEntries(unsigned tid) 2662292SN/A{ 2672292SN/A thread[tid].clearLQ(); 2682292SN/A thread[tid].clearSQ(); 2692292SN/A} 2702292SN/A 2712292SN/Atemplate<class Impl> 2722292SN/Avoid 2732292SN/ALSQ<Impl>::resizeEntries(unsigned size,unsigned tid) 2742292SN/A{ 2752292SN/A thread[tid].resizeLQ(size); 2762292SN/A thread[tid].resizeSQ(size); 2772292SN/A} 2782292SN/A 2792292SN/Atemplate<class Impl> 2802292SN/Avoid 2812292SN/ALSQ<Impl>::tick() 2822292SN/A{ 2833867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 2843867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 2852292SN/A 2863867Sbinkertn@umich.edu while (threads != end) { 2873867Sbinkertn@umich.edu unsigned tid = *threads++; 2882292SN/A 2892292SN/A thread[tid].tick(); 2902292SN/A } 2912292SN/A} 2922292SN/A 2932292SN/Atemplate<class Impl> 2942292SN/Avoid 2952292SN/ALSQ<Impl>::insertLoad(DynInstPtr &load_inst) 2962292SN/A{ 2972292SN/A unsigned tid = load_inst->threadNumber; 2982292SN/A 2992292SN/A thread[tid].insertLoad(load_inst); 3002292SN/A} 3012292SN/A 3022292SN/Atemplate<class Impl> 3032292SN/Avoid 3042292SN/ALSQ<Impl>::insertStore(DynInstPtr &store_inst) 3052292SN/A{ 3062292SN/A unsigned tid = store_inst->threadNumber; 3072292SN/A 3082292SN/A thread[tid].insertStore(store_inst); 3092292SN/A} 3102292SN/A 3112292SN/Atemplate<class Impl> 3122292SN/AFault 3132292SN/ALSQ<Impl>::executeLoad(DynInstPtr &inst) 3142292SN/A{ 3152292SN/A unsigned tid = inst->threadNumber; 3162292SN/A 3172292SN/A return thread[tid].executeLoad(inst); 3182292SN/A} 3192292SN/A 3202292SN/Atemplate<class Impl> 3212292SN/AFault 3222292SN/ALSQ<Impl>::executeStore(DynInstPtr &inst) 3232292SN/A{ 3242292SN/A unsigned tid = inst->threadNumber; 3252292SN/A 3262292SN/A return thread[tid].executeStore(inst); 3272292SN/A} 3282292SN/A 3292292SN/Atemplate<class Impl> 3302292SN/Avoid 3312292SN/ALSQ<Impl>::writebackStores() 3322292SN/A{ 3333867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 3343867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 3352292SN/A 3363867Sbinkertn@umich.edu while (threads != end) { 3373867Sbinkertn@umich.edu unsigned tid = *threads++; 3382292SN/A 3392292SN/A if (numStoresToWB(tid) > 0) { 3402329SN/A DPRINTF(Writeback,"[tid:%i] Writing back stores. %i stores " 3412329SN/A "available for Writeback.\n", tid, numStoresToWB(tid)); 3422292SN/A } 3432292SN/A 3442292SN/A thread[tid].writebackStores(); 3452292SN/A } 3462292SN/A} 3472292SN/A 3482292SN/Atemplate<class Impl> 3492292SN/Abool 3502292SN/ALSQ<Impl>::violation() 3512292SN/A{ 3522292SN/A /* Answers: Does Anybody Have a Violation?*/ 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++; 3583867Sbinkertn@umich.edu 3592292SN/A if (thread[tid].violation()) 3602292SN/A return true; 3612292SN/A } 3622292SN/A 3632292SN/A return false; 3642292SN/A} 3652292SN/A 3662292SN/Atemplate<class Impl> 3672292SN/Aint 3682292SN/ALSQ<Impl>::getCount() 3692292SN/A{ 3702292SN/A unsigned total = 0; 3712292SN/A 3723867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 3733867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 3742292SN/A 3753867Sbinkertn@umich.edu while (threads != end) { 3763867Sbinkertn@umich.edu unsigned tid = *threads++; 3773867Sbinkertn@umich.edu 3782292SN/A total += getCount(tid); 3792292SN/A } 3802292SN/A 3812292SN/A return total; 3822292SN/A} 3832292SN/A 3842292SN/Atemplate<class Impl> 3852292SN/Aint 3862292SN/ALSQ<Impl>::numLoads() 3872292SN/A{ 3882292SN/A unsigned total = 0; 3892292SN/A 3903867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 3913867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 3922292SN/A 3933867Sbinkertn@umich.edu while (threads != end) { 3943867Sbinkertn@umich.edu unsigned tid = *threads++; 3953867Sbinkertn@umich.edu 3962292SN/A total += numLoads(tid); 3972292SN/A } 3982292SN/A 3992292SN/A return total; 4002292SN/A} 4012292SN/A 4022292SN/Atemplate<class Impl> 4032292SN/Aint 4042292SN/ALSQ<Impl>::numStores() 4052292SN/A{ 4062292SN/A unsigned total = 0; 4072292SN/A 4083867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 4093867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 4102292SN/A 4113867Sbinkertn@umich.edu while (threads != end) { 4123867Sbinkertn@umich.edu unsigned tid = *threads++; 4133867Sbinkertn@umich.edu 4142292SN/A total += thread[tid].numStores(); 4152292SN/A } 4162292SN/A 4172292SN/A return total; 4182292SN/A} 4192292SN/A 4202292SN/Atemplate<class Impl> 4212292SN/Aint 4222292SN/ALSQ<Impl>::numLoadsReady() 4232292SN/A{ 4242292SN/A unsigned total = 0; 4252292SN/A 4263867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 4273867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 4282292SN/A 4293867Sbinkertn@umich.edu while (threads != end) { 4303867Sbinkertn@umich.edu unsigned tid = *threads++; 4313867Sbinkertn@umich.edu 4322292SN/A total += thread[tid].numLoadsReady(); 4332292SN/A } 4342292SN/A 4352292SN/A return total; 4362292SN/A} 4372292SN/A 4382292SN/Atemplate<class Impl> 4392292SN/Aunsigned 4402292SN/ALSQ<Impl>::numFreeEntries() 4412292SN/A{ 4422292SN/A unsigned total = 0; 4432292SN/A 4443867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 4453867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 4462292SN/A 4473867Sbinkertn@umich.edu while (threads != end) { 4483867Sbinkertn@umich.edu unsigned tid = *threads++; 4493867Sbinkertn@umich.edu 4502292SN/A total += thread[tid].numFreeEntries(); 4512292SN/A } 4522292SN/A 4532292SN/A return total; 4542292SN/A} 4552292SN/A 4562292SN/Atemplate<class Impl> 4572292SN/Aunsigned 4582292SN/ALSQ<Impl>::numFreeEntries(unsigned tid) 4592292SN/A{ 4603870Sbinkertn@umich.edu //if (lsqPolicy == Dynamic) 4612292SN/A //return numFreeEntries(); 4622292SN/A //else 4632292SN/A return thread[tid].numFreeEntries(); 4642292SN/A} 4652292SN/A 4662292SN/Atemplate<class Impl> 4672292SN/Abool 4682292SN/ALSQ<Impl>::isFull() 4692292SN/A{ 4703867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 4713867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 4722292SN/A 4733867Sbinkertn@umich.edu while (threads != end) { 4743867Sbinkertn@umich.edu unsigned tid = *threads++; 4753867Sbinkertn@umich.edu 4763867Sbinkertn@umich.edu if (!(thread[tid].lqFull() || thread[tid].sqFull())) 4772292SN/A return false; 4782292SN/A } 4792292SN/A 4802292SN/A return true; 4812292SN/A} 4822292SN/A 4832292SN/Atemplate<class Impl> 4842292SN/Abool 4852292SN/ALSQ<Impl>::isFull(unsigned tid) 4862292SN/A{ 4872292SN/A //@todo: Change to Calculate All Entries for 4882292SN/A //Dynamic Policy 4893867Sbinkertn@umich.edu if (lsqPolicy == Dynamic) 4902292SN/A return isFull(); 4912292SN/A else 4922292SN/A return thread[tid].lqFull() || thread[tid].sqFull(); 4932292SN/A} 4942292SN/A 4952292SN/Atemplate<class Impl> 4962292SN/Abool 4972292SN/ALSQ<Impl>::lqFull() 4982292SN/A{ 4993867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 5003867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 5012292SN/A 5023867Sbinkertn@umich.edu while (threads != end) { 5033867Sbinkertn@umich.edu unsigned tid = *threads++; 5043867Sbinkertn@umich.edu 5052292SN/A if (!thread[tid].lqFull()) 5062292SN/A return false; 5072292SN/A } 5082292SN/A 5092292SN/A return true; 5102292SN/A} 5112292SN/A 5122292SN/Atemplate<class Impl> 5132292SN/Abool 5142292SN/ALSQ<Impl>::lqFull(unsigned tid) 5152292SN/A{ 5162292SN/A //@todo: Change to Calculate All Entries for 5172292SN/A //Dynamic Policy 5183870Sbinkertn@umich.edu if (lsqPolicy == Dynamic) 5192292SN/A return lqFull(); 5202292SN/A else 5212292SN/A return thread[tid].lqFull(); 5222292SN/A} 5232292SN/A 5242292SN/Atemplate<class Impl> 5252292SN/Abool 5262292SN/ALSQ<Impl>::sqFull() 5272292SN/A{ 5283867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 5293867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 5302292SN/A 5313867Sbinkertn@umich.edu while (threads != end) { 5323867Sbinkertn@umich.edu unsigned tid = *threads++; 5333867Sbinkertn@umich.edu 5342292SN/A if (!sqFull(tid)) 5352292SN/A return false; 5362292SN/A } 5372292SN/A 5382292SN/A return true; 5392292SN/A} 5402292SN/A 5412292SN/Atemplate<class Impl> 5422292SN/Abool 5432292SN/ALSQ<Impl>::sqFull(unsigned tid) 5442292SN/A{ 5452292SN/A //@todo: Change to Calculate All Entries for 5462292SN/A //Dynamic Policy 5473870Sbinkertn@umich.edu if (lsqPolicy == Dynamic) 5482292SN/A return sqFull(); 5492292SN/A else 5502292SN/A return thread[tid].sqFull(); 5512292SN/A} 5522292SN/A 5532292SN/Atemplate<class Impl> 5542292SN/Abool 5552292SN/ALSQ<Impl>::isStalled() 5562292SN/A{ 5573867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 5583867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 5592292SN/A 5603867Sbinkertn@umich.edu while (threads != end) { 5613867Sbinkertn@umich.edu unsigned tid = *threads++; 5623867Sbinkertn@umich.edu 5632292SN/A if (!thread[tid].isStalled()) 5642292SN/A return false; 5652292SN/A } 5662292SN/A 5672292SN/A return true; 5682292SN/A} 5692292SN/A 5702292SN/Atemplate<class Impl> 5712292SN/Abool 5722292SN/ALSQ<Impl>::isStalled(unsigned tid) 5732292SN/A{ 5743870Sbinkertn@umich.edu if (lsqPolicy == Dynamic) 5752292SN/A return isStalled(); 5762292SN/A else 5772292SN/A return thread[tid].isStalled(); 5782292SN/A} 5792292SN/A 5802292SN/Atemplate<class Impl> 5812292SN/Abool 5822292SN/ALSQ<Impl>::hasStoresToWB() 5832292SN/A{ 5843867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 5853867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 5862292SN/A 5873867Sbinkertn@umich.edu while (threads != end) { 5883867Sbinkertn@umich.edu unsigned tid = *threads++; 5893867Sbinkertn@umich.edu 5905557Sktlim@umich.edu if (hasStoresToWB(tid)) 5915557Sktlim@umich.edu return true; 5922292SN/A } 5932292SN/A 5945557Sktlim@umich.edu return false; 5952292SN/A} 5962292SN/A 5972292SN/Atemplate<class Impl> 5982292SN/Abool 5992292SN/ALSQ<Impl>::willWB() 6002292SN/A{ 6013867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 6023867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 6032292SN/A 6043867Sbinkertn@umich.edu while (threads != end) { 6053867Sbinkertn@umich.edu unsigned tid = *threads++; 6063867Sbinkertn@umich.edu 6075557Sktlim@umich.edu if (willWB(tid)) 6085557Sktlim@umich.edu return true; 6092292SN/A } 6102292SN/A 6115557Sktlim@umich.edu return false; 6122292SN/A} 6132292SN/A 6142292SN/Atemplate<class Impl> 6152292SN/Avoid 6162292SN/ALSQ<Impl>::dumpInsts() 6172292SN/A{ 6183867Sbinkertn@umich.edu std::list<unsigned>::iterator threads = activeThreads->begin(); 6193867Sbinkertn@umich.edu std::list<unsigned>::iterator end = activeThreads->end(); 6202292SN/A 6213867Sbinkertn@umich.edu while (threads != end) { 6223867Sbinkertn@umich.edu unsigned tid = *threads++; 6233867Sbinkertn@umich.edu 6242292SN/A thread[tid].dumpInsts(); 6252292SN/A } 6262292SN/A} 627