lsq_impl.hh revision 8232
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" 368232Snate@binkert.org#include "debug/Fetch.hh" 378232Snate@binkert.org#include "debug/LSQ.hh" 388232Snate@binkert.org#include "debug/Writeback.hh" 396221Snate@binkert.org#include "params/DerivO3CPU.hh" 402292SN/A 416221Snate@binkert.orgusing namespace std; 425529Snate@binkert.org 434192Sktlim@umich.edutemplate<class Impl> 444192Sktlim@umich.eduvoid 454192Sktlim@umich.eduLSQ<Impl>::DcachePort::setPeer(Port *port) 464192Sktlim@umich.edu{ 474192Sktlim@umich.edu Port::setPeer(port); 484192Sktlim@umich.edu 494192Sktlim@umich.edu#if FULL_SYSTEM 504192Sktlim@umich.edu // Update the ThreadContext's memory ports (Functional/Virtual 514192Sktlim@umich.edu // Ports) 524192Sktlim@umich.edu lsq->updateMemPorts(); 534192Sktlim@umich.edu#endif 544192Sktlim@umich.edu} 554192Sktlim@umich.edu 562292SN/Atemplate <class Impl> 572907Sktlim@umich.eduTick 582907Sktlim@umich.eduLSQ<Impl>::DcachePort::recvAtomic(PacketPtr pkt) 592907Sktlim@umich.edu{ 602907Sktlim@umich.edu panic("O3CPU model does not work with atomic mode!"); 617823Ssteve.reinhardt@amd.com return curTick(); 622907Sktlim@umich.edu} 632907Sktlim@umich.edu 642907Sktlim@umich.edutemplate <class Impl> 652907Sktlim@umich.eduvoid 662907Sktlim@umich.eduLSQ<Impl>::DcachePort::recvFunctional(PacketPtr pkt) 672907Sktlim@umich.edu{ 683639Sktlim@umich.edu DPRINTF(LSQ, "LSQ doesn't update things on a recvFunctional."); 692907Sktlim@umich.edu} 702907Sktlim@umich.edu 712907Sktlim@umich.edutemplate <class Impl> 722907Sktlim@umich.eduvoid 732907Sktlim@umich.eduLSQ<Impl>::DcachePort::recvStatusChange(Status status) 742907Sktlim@umich.edu{ 753647Srdreslin@umich.edu if (status == RangeChange) { 763647Srdreslin@umich.edu if (!snoopRangeSent) { 773647Srdreslin@umich.edu snoopRangeSent = true; 783647Srdreslin@umich.edu sendStatusChange(Port::RangeChange); 793647Srdreslin@umich.edu } 802907Sktlim@umich.edu return; 813647Srdreslin@umich.edu } 822907Sktlim@umich.edu panic("O3CPU doesn't expect recvStatusChange callback!"); 832907Sktlim@umich.edu} 842907Sktlim@umich.edu 852907Sktlim@umich.edutemplate <class Impl> 862907Sktlim@umich.edubool 872907Sktlim@umich.eduLSQ<Impl>::DcachePort::recvTiming(PacketPtr pkt) 882907Sktlim@umich.edu{ 894986Ssaidi@eecs.umich.edu if (pkt->isError()) 904986Ssaidi@eecs.umich.edu DPRINTF(LSQ, "Got error packet back for address: %#X\n", pkt->getAddr()); 913310Srdreslin@umich.edu if (pkt->isResponse()) { 925714Shsul@eecs.umich.edu lsq->thread[pkt->req->threadId()].completeDataAccess(pkt); 933310Srdreslin@umich.edu } 943310Srdreslin@umich.edu else { 954895Sstever@eecs.umich.edu // must be a snoop 964895Sstever@eecs.umich.edu 974895Sstever@eecs.umich.edu // @TODO someday may need to process invalidations in LSQ here 984895Sstever@eecs.umich.edu // to provide stronger consistency model 993310Srdreslin@umich.edu } 1002907Sktlim@umich.edu return true; 1012907Sktlim@umich.edu} 1022907Sktlim@umich.edu 1032907Sktlim@umich.edutemplate <class Impl> 1042907Sktlim@umich.eduvoid 1052907Sktlim@umich.eduLSQ<Impl>::DcachePort::recvRetry() 1062907Sktlim@umich.edu{ 1073014Srdreslin@umich.edu if (lsq->retryTid == -1) 1083014Srdreslin@umich.edu { 1093014Srdreslin@umich.edu //Squashed, so drop it 1103014Srdreslin@umich.edu return; 1113014Srdreslin@umich.edu } 1124985Sktlim@umich.edu int curr_retry_tid = lsq->retryTid; 1132907Sktlim@umich.edu // Speculatively clear the retry Tid. This will get set again if 1142907Sktlim@umich.edu // the LSQUnit was unable to complete its access. 1152907Sktlim@umich.edu lsq->retryTid = -1; 1164985Sktlim@umich.edu lsq->thread[curr_retry_tid].recvRetry(); 1172907Sktlim@umich.edu} 1182907Sktlim@umich.edu 1192907Sktlim@umich.edutemplate <class Impl> 1205529Snate@binkert.orgLSQ<Impl>::LSQ(O3CPU *cpu_ptr, IEW *iew_ptr, DerivO3CPUParams *params) 1215494Sstever@gmail.com : cpu(cpu_ptr), iewStage(iew_ptr), dcachePort(this), 1224329Sktlim@umich.edu LQEntries(params->LQEntries), 1234329Sktlim@umich.edu SQEntries(params->SQEntries), 1245529Snate@binkert.org numThreads(params->numThreads), 1252907Sktlim@umich.edu retryTid(-1) 1262292SN/A{ 1273647Srdreslin@umich.edu dcachePort.snoopRangeSent = false; 1283647Srdreslin@umich.edu 1292292SN/A //**********************************************/ 1302292SN/A //************ Handle SMT Parameters ***********/ 1312292SN/A //**********************************************/ 1322980Sgblack@eecs.umich.edu std::string policy = params->smtLSQPolicy; 1332292SN/A 1342292SN/A //Convert string to lowercase 1352292SN/A std::transform(policy.begin(), policy.end(), policy.begin(), 1362292SN/A (int(*)(int)) tolower); 1372292SN/A 1382292SN/A //Figure out fetch policy 1392292SN/A if (policy == "dynamic") { 1402292SN/A lsqPolicy = Dynamic; 1412292SN/A 1422292SN/A maxLQEntries = LQEntries; 1432292SN/A maxSQEntries = SQEntries; 1444329Sktlim@umich.edu 1452292SN/A DPRINTF(LSQ, "LSQ sharing policy set to Dynamic\n"); 1462292SN/A } else if (policy == "partitioned") { 1472292SN/A lsqPolicy = Partitioned; 1482292SN/A 1492292SN/A //@todo:make work if part_amt doesnt divide evenly. 1502292SN/A maxLQEntries = LQEntries / numThreads; 1512292SN/A maxSQEntries = SQEntries / numThreads; 1524329Sktlim@umich.edu 1532292SN/A DPRINTF(Fetch, "LSQ sharing policy set to Partitioned: " 1542292SN/A "%i entries per LQ | %i entries per SQ", 1552292SN/A maxLQEntries,maxSQEntries); 1562292SN/A } else if (policy == "threshold") { 1572292SN/A lsqPolicy = Threshold; 1582292SN/A 1592292SN/A assert(params->smtLSQThreshold > LQEntries); 1602292SN/A assert(params->smtLSQThreshold > SQEntries); 1612292SN/A 1622292SN/A //Divide up by threshold amount 1632292SN/A //@todo: Should threads check the max and the total 1642292SN/A //amount of the LSQ 1652292SN/A maxLQEntries = params->smtLSQThreshold; 1662292SN/A maxSQEntries = params->smtLSQThreshold; 1674329Sktlim@umich.edu 1682292SN/A DPRINTF(LSQ, "LSQ sharing policy set to Threshold: " 1692292SN/A "%i entries per LQ | %i entries per SQ", 1702292SN/A maxLQEntries,maxSQEntries); 1712292SN/A } else { 1722292SN/A assert(0 && "Invalid LSQ Sharing Policy.Options Are:{Dynamic," 1732292SN/A "Partitioned, Threshold}"); 1742292SN/A } 1752292SN/A 1762292SN/A //Initialize LSQs 1776221Snate@binkert.org for (ThreadID tid = 0; tid < numThreads; tid++) { 1784329Sktlim@umich.edu thread[tid].init(cpu, iew_ptr, params, this, 1794329Sktlim@umich.edu maxLQEntries, maxSQEntries, tid); 1802907Sktlim@umich.edu thread[tid].setDcachePort(&dcachePort); 1812292SN/A } 1822292SN/A} 1832292SN/A 1842292SN/A 1852292SN/Atemplate<class Impl> 1862292SN/Astd::string 1872292SN/ALSQ<Impl>::name() const 1882292SN/A{ 1892292SN/A return iewStage->name() + ".lsq"; 1902292SN/A} 1912292SN/A 1922292SN/Atemplate<class Impl> 1932292SN/Avoid 1942727Sktlim@umich.eduLSQ<Impl>::regStats() 1952727Sktlim@umich.edu{ 1962727Sktlim@umich.edu //Initialize LSQs 1976221Snate@binkert.org for (ThreadID tid = 0; tid < numThreads; tid++) { 1982727Sktlim@umich.edu thread[tid].regStats(); 1992727Sktlim@umich.edu } 2002727Sktlim@umich.edu} 2012727Sktlim@umich.edu 2022727Sktlim@umich.edutemplate<class Impl> 2032727Sktlim@umich.eduvoid 2046221Snate@binkert.orgLSQ<Impl>::setActiveThreads(list<ThreadID> *at_ptr) 2052292SN/A{ 2062292SN/A activeThreads = at_ptr; 2072292SN/A assert(activeThreads != 0); 2082292SN/A} 2092292SN/A 2102292SN/Atemplate <class Impl> 2112307SN/Avoid 2122307SN/ALSQ<Impl>::switchOut() 2132307SN/A{ 2146221Snate@binkert.org for (ThreadID tid = 0; tid < numThreads; tid++) { 2152307SN/A thread[tid].switchOut(); 2162307SN/A } 2172307SN/A} 2182307SN/A 2192307SN/Atemplate <class Impl> 2202307SN/Avoid 2212307SN/ALSQ<Impl>::takeOverFrom() 2222307SN/A{ 2236221Snate@binkert.org for (ThreadID tid = 0; tid < numThreads; tid++) { 2242307SN/A thread[tid].takeOverFrom(); 2252307SN/A } 2262307SN/A} 2272307SN/A 2282307SN/Atemplate <class Impl> 2292292SN/Aint 2306221Snate@binkert.orgLSQ<Impl>::entryAmount(ThreadID num_threads) 2312292SN/A{ 2322292SN/A if (lsqPolicy == Partitioned) { 2332292SN/A return LQEntries / num_threads; 2342292SN/A } else { 2352292SN/A return 0; 2362292SN/A } 2372292SN/A} 2382292SN/A 2392292SN/Atemplate <class Impl> 2402292SN/Avoid 2412292SN/ALSQ<Impl>::resetEntries() 2422292SN/A{ 2432292SN/A if (lsqPolicy != Dynamic || numThreads > 1) { 2443867Sbinkertn@umich.edu int active_threads = activeThreads->size(); 2452292SN/A 2462292SN/A int maxEntries; 2472292SN/A 2482292SN/A if (lsqPolicy == Partitioned) { 2492292SN/A maxEntries = LQEntries / active_threads; 2502292SN/A } else if (lsqPolicy == Threshold && active_threads == 1) { 2512292SN/A maxEntries = LQEntries; 2522292SN/A } else { 2532292SN/A maxEntries = LQEntries; 2542292SN/A } 2552292SN/A 2566221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 2576221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 2583867Sbinkertn@umich.edu 2593867Sbinkertn@umich.edu while (threads != end) { 2606221Snate@binkert.org ThreadID tid = *threads++; 2613867Sbinkertn@umich.edu 2623867Sbinkertn@umich.edu resizeEntries(maxEntries, tid); 2632292SN/A } 2642292SN/A } 2652292SN/A} 2662292SN/A 2672292SN/Atemplate<class Impl> 2682292SN/Avoid 2696221Snate@binkert.orgLSQ<Impl>::removeEntries(ThreadID tid) 2702292SN/A{ 2712292SN/A thread[tid].clearLQ(); 2722292SN/A thread[tid].clearSQ(); 2732292SN/A} 2742292SN/A 2752292SN/Atemplate<class Impl> 2762292SN/Avoid 2776221Snate@binkert.orgLSQ<Impl>::resizeEntries(unsigned size, ThreadID tid) 2782292SN/A{ 2792292SN/A thread[tid].resizeLQ(size); 2802292SN/A thread[tid].resizeSQ(size); 2812292SN/A} 2822292SN/A 2832292SN/Atemplate<class Impl> 2842292SN/Avoid 2852292SN/ALSQ<Impl>::tick() 2862292SN/A{ 2876221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 2886221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 2892292SN/A 2903867Sbinkertn@umich.edu while (threads != end) { 2916221Snate@binkert.org ThreadID tid = *threads++; 2922292SN/A 2932292SN/A thread[tid].tick(); 2942292SN/A } 2952292SN/A} 2962292SN/A 2972292SN/Atemplate<class Impl> 2982292SN/Avoid 2992292SN/ALSQ<Impl>::insertLoad(DynInstPtr &load_inst) 3002292SN/A{ 3016221Snate@binkert.org ThreadID tid = load_inst->threadNumber; 3022292SN/A 3032292SN/A thread[tid].insertLoad(load_inst); 3042292SN/A} 3052292SN/A 3062292SN/Atemplate<class Impl> 3072292SN/Avoid 3082292SN/ALSQ<Impl>::insertStore(DynInstPtr &store_inst) 3092292SN/A{ 3106221Snate@binkert.org ThreadID tid = store_inst->threadNumber; 3112292SN/A 3122292SN/A thread[tid].insertStore(store_inst); 3132292SN/A} 3142292SN/A 3152292SN/Atemplate<class Impl> 3162292SN/AFault 3172292SN/ALSQ<Impl>::executeLoad(DynInstPtr &inst) 3182292SN/A{ 3196221Snate@binkert.org ThreadID tid = inst->threadNumber; 3202292SN/A 3212292SN/A return thread[tid].executeLoad(inst); 3222292SN/A} 3232292SN/A 3242292SN/Atemplate<class Impl> 3252292SN/AFault 3262292SN/ALSQ<Impl>::executeStore(DynInstPtr &inst) 3272292SN/A{ 3286221Snate@binkert.org ThreadID tid = inst->threadNumber; 3292292SN/A 3302292SN/A return thread[tid].executeStore(inst); 3312292SN/A} 3322292SN/A 3332292SN/Atemplate<class Impl> 3342292SN/Avoid 3352292SN/ALSQ<Impl>::writebackStores() 3362292SN/A{ 3376221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 3386221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 3392292SN/A 3403867Sbinkertn@umich.edu while (threads != end) { 3416221Snate@binkert.org ThreadID tid = *threads++; 3422292SN/A 3432292SN/A if (numStoresToWB(tid) > 0) { 3442329SN/A DPRINTF(Writeback,"[tid:%i] Writing back stores. %i stores " 3452329SN/A "available for Writeback.\n", tid, numStoresToWB(tid)); 3462292SN/A } 3472292SN/A 3482292SN/A thread[tid].writebackStores(); 3492292SN/A } 3502292SN/A} 3512292SN/A 3522292SN/Atemplate<class Impl> 3532292SN/Abool 3542292SN/ALSQ<Impl>::violation() 3552292SN/A{ 3562292SN/A /* Answers: Does Anybody Have a Violation?*/ 3576221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 3586221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 3592292SN/A 3603867Sbinkertn@umich.edu while (threads != end) { 3616221Snate@binkert.org ThreadID tid = *threads++; 3623867Sbinkertn@umich.edu 3632292SN/A if (thread[tid].violation()) 3642292SN/A return true; 3652292SN/A } 3662292SN/A 3672292SN/A return false; 3682292SN/A} 3692292SN/A 3702292SN/Atemplate<class Impl> 3712292SN/Aint 3722292SN/ALSQ<Impl>::getCount() 3732292SN/A{ 3742292SN/A unsigned total = 0; 3752292SN/A 3766221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 3776221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 3782292SN/A 3793867Sbinkertn@umich.edu while (threads != end) { 3806221Snate@binkert.org ThreadID tid = *threads++; 3813867Sbinkertn@umich.edu 3822292SN/A total += getCount(tid); 3832292SN/A } 3842292SN/A 3852292SN/A return total; 3862292SN/A} 3872292SN/A 3882292SN/Atemplate<class Impl> 3892292SN/Aint 3902292SN/ALSQ<Impl>::numLoads() 3912292SN/A{ 3922292SN/A unsigned total = 0; 3932292SN/A 3946221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 3956221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 3962292SN/A 3973867Sbinkertn@umich.edu while (threads != end) { 3986221Snate@binkert.org ThreadID tid = *threads++; 3993867Sbinkertn@umich.edu 4002292SN/A total += numLoads(tid); 4012292SN/A } 4022292SN/A 4032292SN/A return total; 4042292SN/A} 4052292SN/A 4062292SN/Atemplate<class Impl> 4072292SN/Aint 4082292SN/ALSQ<Impl>::numStores() 4092292SN/A{ 4102292SN/A unsigned total = 0; 4112292SN/A 4126221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 4136221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 4142292SN/A 4153867Sbinkertn@umich.edu while (threads != end) { 4166221Snate@binkert.org ThreadID tid = *threads++; 4173867Sbinkertn@umich.edu 4182292SN/A total += thread[tid].numStores(); 4192292SN/A } 4202292SN/A 4212292SN/A return total; 4222292SN/A} 4232292SN/A 4242292SN/Atemplate<class Impl> 4252292SN/Aint 4262292SN/ALSQ<Impl>::numLoadsReady() 4272292SN/A{ 4282292SN/A unsigned total = 0; 4292292SN/A 4306221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 4316221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 4322292SN/A 4333867Sbinkertn@umich.edu while (threads != end) { 4346221Snate@binkert.org ThreadID tid = *threads++; 4353867Sbinkertn@umich.edu 4362292SN/A total += thread[tid].numLoadsReady(); 4372292SN/A } 4382292SN/A 4392292SN/A return total; 4402292SN/A} 4412292SN/A 4422292SN/Atemplate<class Impl> 4432292SN/Aunsigned 4442292SN/ALSQ<Impl>::numFreeEntries() 4452292SN/A{ 4462292SN/A unsigned total = 0; 4472292SN/A 4486221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 4496221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 4502292SN/A 4513867Sbinkertn@umich.edu while (threads != end) { 4526221Snate@binkert.org ThreadID tid = *threads++; 4533867Sbinkertn@umich.edu 4542292SN/A total += thread[tid].numFreeEntries(); 4552292SN/A } 4562292SN/A 4572292SN/A return total; 4582292SN/A} 4592292SN/A 4602292SN/Atemplate<class Impl> 4612292SN/Aunsigned 4626221Snate@binkert.orgLSQ<Impl>::numFreeEntries(ThreadID tid) 4632292SN/A{ 4643870Sbinkertn@umich.edu //if (lsqPolicy == Dynamic) 4652292SN/A //return numFreeEntries(); 4662292SN/A //else 4672292SN/A return thread[tid].numFreeEntries(); 4682292SN/A} 4692292SN/A 4702292SN/Atemplate<class Impl> 4712292SN/Abool 4722292SN/ALSQ<Impl>::isFull() 4732292SN/A{ 4746221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 4756221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 4762292SN/A 4773867Sbinkertn@umich.edu while (threads != end) { 4786221Snate@binkert.org ThreadID tid = *threads++; 4793867Sbinkertn@umich.edu 4803867Sbinkertn@umich.edu if (!(thread[tid].lqFull() || thread[tid].sqFull())) 4812292SN/A return false; 4822292SN/A } 4832292SN/A 4842292SN/A return true; 4852292SN/A} 4862292SN/A 4872292SN/Atemplate<class Impl> 4882292SN/Abool 4896221Snate@binkert.orgLSQ<Impl>::isFull(ThreadID tid) 4902292SN/A{ 4912292SN/A //@todo: Change to Calculate All Entries for 4922292SN/A //Dynamic Policy 4933867Sbinkertn@umich.edu if (lsqPolicy == Dynamic) 4942292SN/A return isFull(); 4952292SN/A else 4962292SN/A return thread[tid].lqFull() || thread[tid].sqFull(); 4972292SN/A} 4982292SN/A 4992292SN/Atemplate<class Impl> 5002292SN/Abool 5012292SN/ALSQ<Impl>::lqFull() 5022292SN/A{ 5036221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 5046221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 5052292SN/A 5063867Sbinkertn@umich.edu while (threads != end) { 5076221Snate@binkert.org ThreadID tid = *threads++; 5083867Sbinkertn@umich.edu 5092292SN/A if (!thread[tid].lqFull()) 5102292SN/A return false; 5112292SN/A } 5122292SN/A 5132292SN/A return true; 5142292SN/A} 5152292SN/A 5162292SN/Atemplate<class Impl> 5172292SN/Abool 5186221Snate@binkert.orgLSQ<Impl>::lqFull(ThreadID tid) 5192292SN/A{ 5202292SN/A //@todo: Change to Calculate All Entries for 5212292SN/A //Dynamic Policy 5223870Sbinkertn@umich.edu if (lsqPolicy == Dynamic) 5232292SN/A return lqFull(); 5242292SN/A else 5252292SN/A return thread[tid].lqFull(); 5262292SN/A} 5272292SN/A 5282292SN/Atemplate<class Impl> 5292292SN/Abool 5302292SN/ALSQ<Impl>::sqFull() 5312292SN/A{ 5326221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 5336221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 5342292SN/A 5353867Sbinkertn@umich.edu while (threads != end) { 5366221Snate@binkert.org ThreadID tid = *threads++; 5373867Sbinkertn@umich.edu 5382292SN/A if (!sqFull(tid)) 5392292SN/A return false; 5402292SN/A } 5412292SN/A 5422292SN/A return true; 5432292SN/A} 5442292SN/A 5452292SN/Atemplate<class Impl> 5462292SN/Abool 5476221Snate@binkert.orgLSQ<Impl>::sqFull(ThreadID tid) 5482292SN/A{ 5492292SN/A //@todo: Change to Calculate All Entries for 5502292SN/A //Dynamic Policy 5513870Sbinkertn@umich.edu if (lsqPolicy == Dynamic) 5522292SN/A return sqFull(); 5532292SN/A else 5542292SN/A return thread[tid].sqFull(); 5552292SN/A} 5562292SN/A 5572292SN/Atemplate<class Impl> 5582292SN/Abool 5592292SN/ALSQ<Impl>::isStalled() 5602292SN/A{ 5616221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 5626221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 5632292SN/A 5643867Sbinkertn@umich.edu while (threads != end) { 5656221Snate@binkert.org ThreadID tid = *threads++; 5663867Sbinkertn@umich.edu 5672292SN/A if (!thread[tid].isStalled()) 5682292SN/A return false; 5692292SN/A } 5702292SN/A 5712292SN/A return true; 5722292SN/A} 5732292SN/A 5742292SN/Atemplate<class Impl> 5752292SN/Abool 5766221Snate@binkert.orgLSQ<Impl>::isStalled(ThreadID tid) 5772292SN/A{ 5783870Sbinkertn@umich.edu if (lsqPolicy == Dynamic) 5792292SN/A return isStalled(); 5802292SN/A else 5812292SN/A return thread[tid].isStalled(); 5822292SN/A} 5832292SN/A 5842292SN/Atemplate<class Impl> 5852292SN/Abool 5862292SN/ALSQ<Impl>::hasStoresToWB() 5872292SN/A{ 5886221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 5896221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 5902292SN/A 5913867Sbinkertn@umich.edu while (threads != end) { 5926221Snate@binkert.org ThreadID tid = *threads++; 5933867Sbinkertn@umich.edu 5945557Sktlim@umich.edu if (hasStoresToWB(tid)) 5955557Sktlim@umich.edu return true; 5962292SN/A } 5972292SN/A 5985557Sktlim@umich.edu return false; 5992292SN/A} 6002292SN/A 6012292SN/Atemplate<class Impl> 6022292SN/Abool 6032292SN/ALSQ<Impl>::willWB() 6042292SN/A{ 6056221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 6066221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 6072292SN/A 6083867Sbinkertn@umich.edu while (threads != end) { 6096221Snate@binkert.org ThreadID tid = *threads++; 6103867Sbinkertn@umich.edu 6115557Sktlim@umich.edu if (willWB(tid)) 6125557Sktlim@umich.edu return true; 6132292SN/A } 6142292SN/A 6155557Sktlim@umich.edu return false; 6162292SN/A} 6172292SN/A 6182292SN/Atemplate<class Impl> 6192292SN/Avoid 6202292SN/ALSQ<Impl>::dumpInsts() 6212292SN/A{ 6226221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 6236221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 6242292SN/A 6253867Sbinkertn@umich.edu while (threads != end) { 6266221Snate@binkert.org ThreadID tid = *threads++; 6273867Sbinkertn@umich.edu 6282292SN/A thread[tid].dumpInsts(); 6292292SN/A } 6302292SN/A} 631