lsq_impl.hh revision 7823
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" 366221Snate@binkert.org#include "params/DerivO3CPU.hh" 372292SN/A 386221Snate@binkert.orgusing namespace std; 395529Snate@binkert.org 404192Sktlim@umich.edutemplate<class Impl> 414192Sktlim@umich.eduvoid 424192Sktlim@umich.eduLSQ<Impl>::DcachePort::setPeer(Port *port) 434192Sktlim@umich.edu{ 444192Sktlim@umich.edu Port::setPeer(port); 454192Sktlim@umich.edu 464192Sktlim@umich.edu#if FULL_SYSTEM 474192Sktlim@umich.edu // Update the ThreadContext's memory ports (Functional/Virtual 484192Sktlim@umich.edu // Ports) 494192Sktlim@umich.edu lsq->updateMemPorts(); 504192Sktlim@umich.edu#endif 514192Sktlim@umich.edu} 524192Sktlim@umich.edu 532292SN/Atemplate <class Impl> 542907Sktlim@umich.eduTick 552907Sktlim@umich.eduLSQ<Impl>::DcachePort::recvAtomic(PacketPtr pkt) 562907Sktlim@umich.edu{ 572907Sktlim@umich.edu panic("O3CPU model does not work with atomic mode!"); 587823Ssteve.reinhardt@amd.com return curTick(); 592907Sktlim@umich.edu} 602907Sktlim@umich.edu 612907Sktlim@umich.edutemplate <class Impl> 622907Sktlim@umich.eduvoid 632907Sktlim@umich.eduLSQ<Impl>::DcachePort::recvFunctional(PacketPtr pkt) 642907Sktlim@umich.edu{ 653639Sktlim@umich.edu DPRINTF(LSQ, "LSQ doesn't update things on a recvFunctional."); 662907Sktlim@umich.edu} 672907Sktlim@umich.edu 682907Sktlim@umich.edutemplate <class Impl> 692907Sktlim@umich.eduvoid 702907Sktlim@umich.eduLSQ<Impl>::DcachePort::recvStatusChange(Status status) 712907Sktlim@umich.edu{ 723647Srdreslin@umich.edu if (status == RangeChange) { 733647Srdreslin@umich.edu if (!snoopRangeSent) { 743647Srdreslin@umich.edu snoopRangeSent = true; 753647Srdreslin@umich.edu sendStatusChange(Port::RangeChange); 763647Srdreslin@umich.edu } 772907Sktlim@umich.edu return; 783647Srdreslin@umich.edu } 792907Sktlim@umich.edu panic("O3CPU doesn't expect recvStatusChange callback!"); 802907Sktlim@umich.edu} 812907Sktlim@umich.edu 822907Sktlim@umich.edutemplate <class Impl> 832907Sktlim@umich.edubool 842907Sktlim@umich.eduLSQ<Impl>::DcachePort::recvTiming(PacketPtr pkt) 852907Sktlim@umich.edu{ 864986Ssaidi@eecs.umich.edu if (pkt->isError()) 874986Ssaidi@eecs.umich.edu DPRINTF(LSQ, "Got error packet back for address: %#X\n", pkt->getAddr()); 883310Srdreslin@umich.edu if (pkt->isResponse()) { 895714Shsul@eecs.umich.edu lsq->thread[pkt->req->threadId()].completeDataAccess(pkt); 903310Srdreslin@umich.edu } 913310Srdreslin@umich.edu else { 924895Sstever@eecs.umich.edu // must be a snoop 934895Sstever@eecs.umich.edu 944895Sstever@eecs.umich.edu // @TODO someday may need to process invalidations in LSQ here 954895Sstever@eecs.umich.edu // to provide stronger consistency model 963310Srdreslin@umich.edu } 972907Sktlim@umich.edu return true; 982907Sktlim@umich.edu} 992907Sktlim@umich.edu 1002907Sktlim@umich.edutemplate <class Impl> 1012907Sktlim@umich.eduvoid 1022907Sktlim@umich.eduLSQ<Impl>::DcachePort::recvRetry() 1032907Sktlim@umich.edu{ 1043014Srdreslin@umich.edu if (lsq->retryTid == -1) 1053014Srdreslin@umich.edu { 1063014Srdreslin@umich.edu //Squashed, so drop it 1073014Srdreslin@umich.edu return; 1083014Srdreslin@umich.edu } 1094985Sktlim@umich.edu int curr_retry_tid = lsq->retryTid; 1102907Sktlim@umich.edu // Speculatively clear the retry Tid. This will get set again if 1112907Sktlim@umich.edu // the LSQUnit was unable to complete its access. 1122907Sktlim@umich.edu lsq->retryTid = -1; 1134985Sktlim@umich.edu lsq->thread[curr_retry_tid].recvRetry(); 1142907Sktlim@umich.edu} 1152907Sktlim@umich.edu 1162907Sktlim@umich.edutemplate <class Impl> 1175529Snate@binkert.orgLSQ<Impl>::LSQ(O3CPU *cpu_ptr, IEW *iew_ptr, DerivO3CPUParams *params) 1185494Sstever@gmail.com : cpu(cpu_ptr), iewStage(iew_ptr), dcachePort(this), 1194329Sktlim@umich.edu LQEntries(params->LQEntries), 1204329Sktlim@umich.edu SQEntries(params->SQEntries), 1215529Snate@binkert.org numThreads(params->numThreads), 1222907Sktlim@umich.edu retryTid(-1) 1232292SN/A{ 1243647Srdreslin@umich.edu dcachePort.snoopRangeSent = false; 1253647Srdreslin@umich.edu 1262292SN/A //**********************************************/ 1272292SN/A //************ Handle SMT Parameters ***********/ 1282292SN/A //**********************************************/ 1292980Sgblack@eecs.umich.edu std::string policy = params->smtLSQPolicy; 1302292SN/A 1312292SN/A //Convert string to lowercase 1322292SN/A std::transform(policy.begin(), policy.end(), policy.begin(), 1332292SN/A (int(*)(int)) tolower); 1342292SN/A 1352292SN/A //Figure out fetch policy 1362292SN/A if (policy == "dynamic") { 1372292SN/A lsqPolicy = Dynamic; 1382292SN/A 1392292SN/A maxLQEntries = LQEntries; 1402292SN/A maxSQEntries = SQEntries; 1414329Sktlim@umich.edu 1422292SN/A DPRINTF(LSQ, "LSQ sharing policy set to Dynamic\n"); 1432292SN/A } else if (policy == "partitioned") { 1442292SN/A lsqPolicy = Partitioned; 1452292SN/A 1462292SN/A //@todo:make work if part_amt doesnt divide evenly. 1472292SN/A maxLQEntries = LQEntries / numThreads; 1482292SN/A maxSQEntries = SQEntries / numThreads; 1494329Sktlim@umich.edu 1502292SN/A DPRINTF(Fetch, "LSQ sharing policy set to Partitioned: " 1512292SN/A "%i entries per LQ | %i entries per SQ", 1522292SN/A maxLQEntries,maxSQEntries); 1532292SN/A } else if (policy == "threshold") { 1542292SN/A lsqPolicy = Threshold; 1552292SN/A 1562292SN/A assert(params->smtLSQThreshold > LQEntries); 1572292SN/A assert(params->smtLSQThreshold > SQEntries); 1582292SN/A 1592292SN/A //Divide up by threshold amount 1602292SN/A //@todo: Should threads check the max and the total 1612292SN/A //amount of the LSQ 1622292SN/A maxLQEntries = params->smtLSQThreshold; 1632292SN/A maxSQEntries = params->smtLSQThreshold; 1644329Sktlim@umich.edu 1652292SN/A DPRINTF(LSQ, "LSQ sharing policy set to Threshold: " 1662292SN/A "%i entries per LQ | %i entries per SQ", 1672292SN/A maxLQEntries,maxSQEntries); 1682292SN/A } else { 1692292SN/A assert(0 && "Invalid LSQ Sharing Policy.Options Are:{Dynamic," 1702292SN/A "Partitioned, Threshold}"); 1712292SN/A } 1722292SN/A 1732292SN/A //Initialize LSQs 1746221Snate@binkert.org for (ThreadID tid = 0; tid < numThreads; tid++) { 1754329Sktlim@umich.edu thread[tid].init(cpu, iew_ptr, params, this, 1764329Sktlim@umich.edu maxLQEntries, maxSQEntries, tid); 1772907Sktlim@umich.edu thread[tid].setDcachePort(&dcachePort); 1782292SN/A } 1792292SN/A} 1802292SN/A 1812292SN/A 1822292SN/Atemplate<class Impl> 1832292SN/Astd::string 1842292SN/ALSQ<Impl>::name() const 1852292SN/A{ 1862292SN/A return iewStage->name() + ".lsq"; 1872292SN/A} 1882292SN/A 1892292SN/Atemplate<class Impl> 1902292SN/Avoid 1912727Sktlim@umich.eduLSQ<Impl>::regStats() 1922727Sktlim@umich.edu{ 1932727Sktlim@umich.edu //Initialize LSQs 1946221Snate@binkert.org for (ThreadID tid = 0; tid < numThreads; tid++) { 1952727Sktlim@umich.edu thread[tid].regStats(); 1962727Sktlim@umich.edu } 1972727Sktlim@umich.edu} 1982727Sktlim@umich.edu 1992727Sktlim@umich.edutemplate<class Impl> 2002727Sktlim@umich.eduvoid 2016221Snate@binkert.orgLSQ<Impl>::setActiveThreads(list<ThreadID> *at_ptr) 2022292SN/A{ 2032292SN/A activeThreads = at_ptr; 2042292SN/A assert(activeThreads != 0); 2052292SN/A} 2062292SN/A 2072292SN/Atemplate <class Impl> 2082307SN/Avoid 2092307SN/ALSQ<Impl>::switchOut() 2102307SN/A{ 2116221Snate@binkert.org for (ThreadID tid = 0; tid < numThreads; tid++) { 2122307SN/A thread[tid].switchOut(); 2132307SN/A } 2142307SN/A} 2152307SN/A 2162307SN/Atemplate <class Impl> 2172307SN/Avoid 2182307SN/ALSQ<Impl>::takeOverFrom() 2192307SN/A{ 2206221Snate@binkert.org for (ThreadID tid = 0; tid < numThreads; tid++) { 2212307SN/A thread[tid].takeOverFrom(); 2222307SN/A } 2232307SN/A} 2242307SN/A 2252307SN/Atemplate <class Impl> 2262292SN/Aint 2276221Snate@binkert.orgLSQ<Impl>::entryAmount(ThreadID num_threads) 2282292SN/A{ 2292292SN/A if (lsqPolicy == Partitioned) { 2302292SN/A return LQEntries / num_threads; 2312292SN/A } else { 2322292SN/A return 0; 2332292SN/A } 2342292SN/A} 2352292SN/A 2362292SN/Atemplate <class Impl> 2372292SN/Avoid 2382292SN/ALSQ<Impl>::resetEntries() 2392292SN/A{ 2402292SN/A if (lsqPolicy != Dynamic || numThreads > 1) { 2413867Sbinkertn@umich.edu int active_threads = activeThreads->size(); 2422292SN/A 2432292SN/A int maxEntries; 2442292SN/A 2452292SN/A if (lsqPolicy == Partitioned) { 2462292SN/A maxEntries = LQEntries / active_threads; 2472292SN/A } else if (lsqPolicy == Threshold && active_threads == 1) { 2482292SN/A maxEntries = LQEntries; 2492292SN/A } else { 2502292SN/A maxEntries = LQEntries; 2512292SN/A } 2522292SN/A 2536221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 2546221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 2553867Sbinkertn@umich.edu 2563867Sbinkertn@umich.edu while (threads != end) { 2576221Snate@binkert.org ThreadID tid = *threads++; 2583867Sbinkertn@umich.edu 2593867Sbinkertn@umich.edu resizeEntries(maxEntries, tid); 2602292SN/A } 2612292SN/A } 2622292SN/A} 2632292SN/A 2642292SN/Atemplate<class Impl> 2652292SN/Avoid 2666221Snate@binkert.orgLSQ<Impl>::removeEntries(ThreadID tid) 2672292SN/A{ 2682292SN/A thread[tid].clearLQ(); 2692292SN/A thread[tid].clearSQ(); 2702292SN/A} 2712292SN/A 2722292SN/Atemplate<class Impl> 2732292SN/Avoid 2746221Snate@binkert.orgLSQ<Impl>::resizeEntries(unsigned size, ThreadID tid) 2752292SN/A{ 2762292SN/A thread[tid].resizeLQ(size); 2772292SN/A thread[tid].resizeSQ(size); 2782292SN/A} 2792292SN/A 2802292SN/Atemplate<class Impl> 2812292SN/Avoid 2822292SN/ALSQ<Impl>::tick() 2832292SN/A{ 2846221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 2856221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 2862292SN/A 2873867Sbinkertn@umich.edu while (threads != end) { 2886221Snate@binkert.org ThreadID tid = *threads++; 2892292SN/A 2902292SN/A thread[tid].tick(); 2912292SN/A } 2922292SN/A} 2932292SN/A 2942292SN/Atemplate<class Impl> 2952292SN/Avoid 2962292SN/ALSQ<Impl>::insertLoad(DynInstPtr &load_inst) 2972292SN/A{ 2986221Snate@binkert.org ThreadID tid = load_inst->threadNumber; 2992292SN/A 3002292SN/A thread[tid].insertLoad(load_inst); 3012292SN/A} 3022292SN/A 3032292SN/Atemplate<class Impl> 3042292SN/Avoid 3052292SN/ALSQ<Impl>::insertStore(DynInstPtr &store_inst) 3062292SN/A{ 3076221Snate@binkert.org ThreadID tid = store_inst->threadNumber; 3082292SN/A 3092292SN/A thread[tid].insertStore(store_inst); 3102292SN/A} 3112292SN/A 3122292SN/Atemplate<class Impl> 3132292SN/AFault 3142292SN/ALSQ<Impl>::executeLoad(DynInstPtr &inst) 3152292SN/A{ 3166221Snate@binkert.org ThreadID tid = inst->threadNumber; 3172292SN/A 3182292SN/A return thread[tid].executeLoad(inst); 3192292SN/A} 3202292SN/A 3212292SN/Atemplate<class Impl> 3222292SN/AFault 3232292SN/ALSQ<Impl>::executeStore(DynInstPtr &inst) 3242292SN/A{ 3256221Snate@binkert.org ThreadID tid = inst->threadNumber; 3262292SN/A 3272292SN/A return thread[tid].executeStore(inst); 3282292SN/A} 3292292SN/A 3302292SN/Atemplate<class Impl> 3312292SN/Avoid 3322292SN/ALSQ<Impl>::writebackStores() 3332292SN/A{ 3346221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 3356221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 3362292SN/A 3373867Sbinkertn@umich.edu while (threads != end) { 3386221Snate@binkert.org ThreadID tid = *threads++; 3392292SN/A 3402292SN/A if (numStoresToWB(tid) > 0) { 3412329SN/A DPRINTF(Writeback,"[tid:%i] Writing back stores. %i stores " 3422329SN/A "available for Writeback.\n", tid, numStoresToWB(tid)); 3432292SN/A } 3442292SN/A 3452292SN/A thread[tid].writebackStores(); 3462292SN/A } 3472292SN/A} 3482292SN/A 3492292SN/Atemplate<class Impl> 3502292SN/Abool 3512292SN/ALSQ<Impl>::violation() 3522292SN/A{ 3532292SN/A /* Answers: Does Anybody Have a Violation?*/ 3546221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 3556221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 3562292SN/A 3573867Sbinkertn@umich.edu while (threads != end) { 3586221Snate@binkert.org ThreadID tid = *threads++; 3593867Sbinkertn@umich.edu 3602292SN/A if (thread[tid].violation()) 3612292SN/A return true; 3622292SN/A } 3632292SN/A 3642292SN/A return false; 3652292SN/A} 3662292SN/A 3672292SN/Atemplate<class Impl> 3682292SN/Aint 3692292SN/ALSQ<Impl>::getCount() 3702292SN/A{ 3712292SN/A unsigned total = 0; 3722292SN/A 3736221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 3746221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 3752292SN/A 3763867Sbinkertn@umich.edu while (threads != end) { 3776221Snate@binkert.org ThreadID tid = *threads++; 3783867Sbinkertn@umich.edu 3792292SN/A total += getCount(tid); 3802292SN/A } 3812292SN/A 3822292SN/A return total; 3832292SN/A} 3842292SN/A 3852292SN/Atemplate<class Impl> 3862292SN/Aint 3872292SN/ALSQ<Impl>::numLoads() 3882292SN/A{ 3892292SN/A unsigned total = 0; 3902292SN/A 3916221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 3926221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 3932292SN/A 3943867Sbinkertn@umich.edu while (threads != end) { 3956221Snate@binkert.org ThreadID tid = *threads++; 3963867Sbinkertn@umich.edu 3972292SN/A total += numLoads(tid); 3982292SN/A } 3992292SN/A 4002292SN/A return total; 4012292SN/A} 4022292SN/A 4032292SN/Atemplate<class Impl> 4042292SN/Aint 4052292SN/ALSQ<Impl>::numStores() 4062292SN/A{ 4072292SN/A unsigned total = 0; 4082292SN/A 4096221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 4106221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 4112292SN/A 4123867Sbinkertn@umich.edu while (threads != end) { 4136221Snate@binkert.org ThreadID tid = *threads++; 4143867Sbinkertn@umich.edu 4152292SN/A total += thread[tid].numStores(); 4162292SN/A } 4172292SN/A 4182292SN/A return total; 4192292SN/A} 4202292SN/A 4212292SN/Atemplate<class Impl> 4222292SN/Aint 4232292SN/ALSQ<Impl>::numLoadsReady() 4242292SN/A{ 4252292SN/A unsigned total = 0; 4262292SN/A 4276221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 4286221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 4292292SN/A 4303867Sbinkertn@umich.edu while (threads != end) { 4316221Snate@binkert.org ThreadID tid = *threads++; 4323867Sbinkertn@umich.edu 4332292SN/A total += thread[tid].numLoadsReady(); 4342292SN/A } 4352292SN/A 4362292SN/A return total; 4372292SN/A} 4382292SN/A 4392292SN/Atemplate<class Impl> 4402292SN/Aunsigned 4412292SN/ALSQ<Impl>::numFreeEntries() 4422292SN/A{ 4432292SN/A unsigned total = 0; 4442292SN/A 4456221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 4466221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 4472292SN/A 4483867Sbinkertn@umich.edu while (threads != end) { 4496221Snate@binkert.org ThreadID tid = *threads++; 4503867Sbinkertn@umich.edu 4512292SN/A total += thread[tid].numFreeEntries(); 4522292SN/A } 4532292SN/A 4542292SN/A return total; 4552292SN/A} 4562292SN/A 4572292SN/Atemplate<class Impl> 4582292SN/Aunsigned 4596221Snate@binkert.orgLSQ<Impl>::numFreeEntries(ThreadID tid) 4602292SN/A{ 4613870Sbinkertn@umich.edu //if (lsqPolicy == Dynamic) 4622292SN/A //return numFreeEntries(); 4632292SN/A //else 4642292SN/A return thread[tid].numFreeEntries(); 4652292SN/A} 4662292SN/A 4672292SN/Atemplate<class Impl> 4682292SN/Abool 4692292SN/ALSQ<Impl>::isFull() 4702292SN/A{ 4716221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 4726221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 4732292SN/A 4743867Sbinkertn@umich.edu while (threads != end) { 4756221Snate@binkert.org ThreadID tid = *threads++; 4763867Sbinkertn@umich.edu 4773867Sbinkertn@umich.edu if (!(thread[tid].lqFull() || thread[tid].sqFull())) 4782292SN/A return false; 4792292SN/A } 4802292SN/A 4812292SN/A return true; 4822292SN/A} 4832292SN/A 4842292SN/Atemplate<class Impl> 4852292SN/Abool 4866221Snate@binkert.orgLSQ<Impl>::isFull(ThreadID tid) 4872292SN/A{ 4882292SN/A //@todo: Change to Calculate All Entries for 4892292SN/A //Dynamic Policy 4903867Sbinkertn@umich.edu if (lsqPolicy == Dynamic) 4912292SN/A return isFull(); 4922292SN/A else 4932292SN/A return thread[tid].lqFull() || thread[tid].sqFull(); 4942292SN/A} 4952292SN/A 4962292SN/Atemplate<class Impl> 4972292SN/Abool 4982292SN/ALSQ<Impl>::lqFull() 4992292SN/A{ 5006221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 5016221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 5022292SN/A 5033867Sbinkertn@umich.edu while (threads != end) { 5046221Snate@binkert.org ThreadID tid = *threads++; 5053867Sbinkertn@umich.edu 5062292SN/A if (!thread[tid].lqFull()) 5072292SN/A return false; 5082292SN/A } 5092292SN/A 5102292SN/A return true; 5112292SN/A} 5122292SN/A 5132292SN/Atemplate<class Impl> 5142292SN/Abool 5156221Snate@binkert.orgLSQ<Impl>::lqFull(ThreadID tid) 5162292SN/A{ 5172292SN/A //@todo: Change to Calculate All Entries for 5182292SN/A //Dynamic Policy 5193870Sbinkertn@umich.edu if (lsqPolicy == Dynamic) 5202292SN/A return lqFull(); 5212292SN/A else 5222292SN/A return thread[tid].lqFull(); 5232292SN/A} 5242292SN/A 5252292SN/Atemplate<class Impl> 5262292SN/Abool 5272292SN/ALSQ<Impl>::sqFull() 5282292SN/A{ 5296221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 5306221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 5312292SN/A 5323867Sbinkertn@umich.edu while (threads != end) { 5336221Snate@binkert.org ThreadID tid = *threads++; 5343867Sbinkertn@umich.edu 5352292SN/A if (!sqFull(tid)) 5362292SN/A return false; 5372292SN/A } 5382292SN/A 5392292SN/A return true; 5402292SN/A} 5412292SN/A 5422292SN/Atemplate<class Impl> 5432292SN/Abool 5446221Snate@binkert.orgLSQ<Impl>::sqFull(ThreadID tid) 5452292SN/A{ 5462292SN/A //@todo: Change to Calculate All Entries for 5472292SN/A //Dynamic Policy 5483870Sbinkertn@umich.edu if (lsqPolicy == Dynamic) 5492292SN/A return sqFull(); 5502292SN/A else 5512292SN/A return thread[tid].sqFull(); 5522292SN/A} 5532292SN/A 5542292SN/Atemplate<class Impl> 5552292SN/Abool 5562292SN/ALSQ<Impl>::isStalled() 5572292SN/A{ 5586221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 5596221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 5602292SN/A 5613867Sbinkertn@umich.edu while (threads != end) { 5626221Snate@binkert.org ThreadID tid = *threads++; 5633867Sbinkertn@umich.edu 5642292SN/A if (!thread[tid].isStalled()) 5652292SN/A return false; 5662292SN/A } 5672292SN/A 5682292SN/A return true; 5692292SN/A} 5702292SN/A 5712292SN/Atemplate<class Impl> 5722292SN/Abool 5736221Snate@binkert.orgLSQ<Impl>::isStalled(ThreadID tid) 5742292SN/A{ 5753870Sbinkertn@umich.edu if (lsqPolicy == Dynamic) 5762292SN/A return isStalled(); 5772292SN/A else 5782292SN/A return thread[tid].isStalled(); 5792292SN/A} 5802292SN/A 5812292SN/Atemplate<class Impl> 5822292SN/Abool 5832292SN/ALSQ<Impl>::hasStoresToWB() 5842292SN/A{ 5856221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 5866221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 5872292SN/A 5883867Sbinkertn@umich.edu while (threads != end) { 5896221Snate@binkert.org ThreadID tid = *threads++; 5903867Sbinkertn@umich.edu 5915557Sktlim@umich.edu if (hasStoresToWB(tid)) 5925557Sktlim@umich.edu return true; 5932292SN/A } 5942292SN/A 5955557Sktlim@umich.edu return false; 5962292SN/A} 5972292SN/A 5982292SN/Atemplate<class Impl> 5992292SN/Abool 6002292SN/ALSQ<Impl>::willWB() 6012292SN/A{ 6026221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 6036221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 6042292SN/A 6053867Sbinkertn@umich.edu while (threads != end) { 6066221Snate@binkert.org ThreadID tid = *threads++; 6073867Sbinkertn@umich.edu 6085557Sktlim@umich.edu if (willWB(tid)) 6095557Sktlim@umich.edu return true; 6102292SN/A } 6112292SN/A 6125557Sktlim@umich.edu return false; 6132292SN/A} 6142292SN/A 6152292SN/Atemplate<class Impl> 6162292SN/Avoid 6172292SN/ALSQ<Impl>::dumpInsts() 6182292SN/A{ 6196221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 6206221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 6212292SN/A 6223867Sbinkertn@umich.edu while (threads != end) { 6236221Snate@binkert.org ThreadID tid = *threads++; 6243867Sbinkertn@umich.edu 6252292SN/A thread[tid].dumpInsts(); 6262292SN/A } 6272292SN/A} 628