lsq_impl.hh revision 8948
12292SN/A/* 28948Sandreas.hansson@arm.com * Copyright (c) 2011-2012 ARM Limited 38707Sandreas.hansson@arm.com * All rights reserved 48707Sandreas.hansson@arm.com * 58707Sandreas.hansson@arm.com * The license below extends only to copyright in the software and shall 68707Sandreas.hansson@arm.com * not be construed as granting a license to any other intellectual 78707Sandreas.hansson@arm.com * property including but not limited to intellectual property relating 88707Sandreas.hansson@arm.com * to a hardware implementation of the functionality of the software 98707Sandreas.hansson@arm.com * licensed hereunder. You may use the software subject to the license 108707Sandreas.hansson@arm.com * terms below provided that you ensure that this notice is replicated 118707Sandreas.hansson@arm.com * unmodified and in its entirety in all distributions of the software, 128707Sandreas.hansson@arm.com * modified or unmodified, in source code or in binary form. 138707Sandreas.hansson@arm.com * 142727Sktlim@umich.edu * Copyright (c) 2005-2006 The Regents of The University of Michigan 152292SN/A * All rights reserved. 162292SN/A * 172292SN/A * Redistribution and use in source and binary forms, with or without 182292SN/A * modification, are permitted provided that the following conditions are 192292SN/A * met: redistributions of source code must retain the above copyright 202292SN/A * notice, this list of conditions and the following disclaimer; 212292SN/A * redistributions in binary form must reproduce the above copyright 222292SN/A * notice, this list of conditions and the following disclaimer in the 232292SN/A * documentation and/or other materials provided with the distribution; 242292SN/A * neither the name of the copyright holders nor the names of its 252292SN/A * contributors may be used to endorse or promote products derived from 262292SN/A * this software without specific prior written permission. 272292SN/A * 282292SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 292292SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 302292SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 312292SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 322292SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 332292SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 342292SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 352292SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 362292SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 372292SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 382292SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 392689Sktlim@umich.edu * 402689Sktlim@umich.edu * Authors: Korey Sewell 412292SN/A */ 422292SN/A 432329SN/A#include <algorithm> 442980Sgblack@eecs.umich.edu#include <list> 452329SN/A#include <string> 462329SN/A 472292SN/A#include "cpu/o3/lsq.hh" 488232Snate@binkert.org#include "debug/Fetch.hh" 498232Snate@binkert.org#include "debug/LSQ.hh" 508232Snate@binkert.org#include "debug/Writeback.hh" 516221Snate@binkert.org#include "params/DerivO3CPU.hh" 522292SN/A 536221Snate@binkert.orgusing namespace std; 545529Snate@binkert.org 552292SN/Atemplate <class Impl> 565529Snate@binkert.orgLSQ<Impl>::LSQ(O3CPU *cpu_ptr, IEW *iew_ptr, DerivO3CPUParams *params) 578707Sandreas.hansson@arm.com : cpu(cpu_ptr), iewStage(iew_ptr), 584329Sktlim@umich.edu LQEntries(params->LQEntries), 594329Sktlim@umich.edu SQEntries(params->SQEntries), 605529Snate@binkert.org numThreads(params->numThreads), 612907Sktlim@umich.edu retryTid(-1) 622292SN/A{ 632292SN/A //**********************************************/ 642292SN/A //************ Handle SMT Parameters ***********/ 652292SN/A //**********************************************/ 662980Sgblack@eecs.umich.edu std::string policy = params->smtLSQPolicy; 672292SN/A 682292SN/A //Convert string to lowercase 692292SN/A std::transform(policy.begin(), policy.end(), policy.begin(), 702292SN/A (int(*)(int)) tolower); 712292SN/A 722292SN/A //Figure out fetch policy 732292SN/A if (policy == "dynamic") { 742292SN/A lsqPolicy = Dynamic; 752292SN/A 762292SN/A maxLQEntries = LQEntries; 772292SN/A maxSQEntries = SQEntries; 784329Sktlim@umich.edu 792292SN/A DPRINTF(LSQ, "LSQ sharing policy set to Dynamic\n"); 802292SN/A } else if (policy == "partitioned") { 812292SN/A lsqPolicy = Partitioned; 822292SN/A 832292SN/A //@todo:make work if part_amt doesnt divide evenly. 842292SN/A maxLQEntries = LQEntries / numThreads; 852292SN/A maxSQEntries = SQEntries / numThreads; 864329Sktlim@umich.edu 872292SN/A DPRINTF(Fetch, "LSQ sharing policy set to Partitioned: " 888346Sksewell@umich.edu "%i entries per LQ | %i entries per SQ\n", 892292SN/A maxLQEntries,maxSQEntries); 902292SN/A } else if (policy == "threshold") { 912292SN/A lsqPolicy = Threshold; 922292SN/A 932292SN/A assert(params->smtLSQThreshold > LQEntries); 942292SN/A assert(params->smtLSQThreshold > SQEntries); 952292SN/A 962292SN/A //Divide up by threshold amount 972292SN/A //@todo: Should threads check the max and the total 982292SN/A //amount of the LSQ 992292SN/A maxLQEntries = params->smtLSQThreshold; 1002292SN/A maxSQEntries = params->smtLSQThreshold; 1014329Sktlim@umich.edu 1022292SN/A DPRINTF(LSQ, "LSQ sharing policy set to Threshold: " 1038346Sksewell@umich.edu "%i entries per LQ | %i entries per SQ\n", 1042292SN/A maxLQEntries,maxSQEntries); 1052292SN/A } else { 1062292SN/A assert(0 && "Invalid LSQ Sharing Policy.Options Are:{Dynamic," 1072292SN/A "Partitioned, Threshold}"); 1082292SN/A } 1092292SN/A 1102292SN/A //Initialize LSQs 1116221Snate@binkert.org for (ThreadID tid = 0; tid < numThreads; tid++) { 1124329Sktlim@umich.edu thread[tid].init(cpu, iew_ptr, params, this, 1134329Sktlim@umich.edu maxLQEntries, maxSQEntries, tid); 1148850Sandreas.hansson@arm.com thread[tid].setDcachePort(&cpu_ptr->getDataPort()); 1152292SN/A } 1162292SN/A} 1172292SN/A 1182292SN/A 1192292SN/Atemplate<class Impl> 1202292SN/Astd::string 1212292SN/ALSQ<Impl>::name() const 1222292SN/A{ 1232292SN/A return iewStage->name() + ".lsq"; 1242292SN/A} 1252292SN/A 1262292SN/Atemplate<class Impl> 1272292SN/Avoid 1282727Sktlim@umich.eduLSQ<Impl>::regStats() 1292727Sktlim@umich.edu{ 1302727Sktlim@umich.edu //Initialize LSQs 1316221Snate@binkert.org for (ThreadID tid = 0; tid < numThreads; tid++) { 1322727Sktlim@umich.edu thread[tid].regStats(); 1332727Sktlim@umich.edu } 1342727Sktlim@umich.edu} 1352727Sktlim@umich.edu 1362727Sktlim@umich.edutemplate<class Impl> 1372727Sktlim@umich.eduvoid 1386221Snate@binkert.orgLSQ<Impl>::setActiveThreads(list<ThreadID> *at_ptr) 1392292SN/A{ 1402292SN/A activeThreads = at_ptr; 1412292SN/A assert(activeThreads != 0); 1422292SN/A} 1432292SN/A 1442292SN/Atemplate <class Impl> 1452307SN/Avoid 1462307SN/ALSQ<Impl>::switchOut() 1472307SN/A{ 1486221Snate@binkert.org for (ThreadID tid = 0; tid < numThreads; tid++) { 1492307SN/A thread[tid].switchOut(); 1502307SN/A } 1512307SN/A} 1522307SN/A 1532307SN/Atemplate <class Impl> 1542307SN/Avoid 1552307SN/ALSQ<Impl>::takeOverFrom() 1562307SN/A{ 1576221Snate@binkert.org for (ThreadID tid = 0; tid < numThreads; tid++) { 1582307SN/A thread[tid].takeOverFrom(); 1592307SN/A } 1602307SN/A} 1612307SN/A 1622307SN/Atemplate <class Impl> 1632292SN/Aint 1646221Snate@binkert.orgLSQ<Impl>::entryAmount(ThreadID num_threads) 1652292SN/A{ 1662292SN/A if (lsqPolicy == Partitioned) { 1672292SN/A return LQEntries / num_threads; 1682292SN/A } else { 1692292SN/A return 0; 1702292SN/A } 1712292SN/A} 1722292SN/A 1732292SN/Atemplate <class Impl> 1742292SN/Avoid 1752292SN/ALSQ<Impl>::resetEntries() 1762292SN/A{ 1772292SN/A if (lsqPolicy != Dynamic || numThreads > 1) { 1783867Sbinkertn@umich.edu int active_threads = activeThreads->size(); 1792292SN/A 1802292SN/A int maxEntries; 1812292SN/A 1822292SN/A if (lsqPolicy == Partitioned) { 1832292SN/A maxEntries = LQEntries / active_threads; 1842292SN/A } else if (lsqPolicy == Threshold && active_threads == 1) { 1852292SN/A maxEntries = LQEntries; 1862292SN/A } else { 1872292SN/A maxEntries = LQEntries; 1882292SN/A } 1892292SN/A 1906221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 1916221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 1923867Sbinkertn@umich.edu 1933867Sbinkertn@umich.edu while (threads != end) { 1946221Snate@binkert.org ThreadID tid = *threads++; 1953867Sbinkertn@umich.edu 1963867Sbinkertn@umich.edu resizeEntries(maxEntries, tid); 1972292SN/A } 1982292SN/A } 1992292SN/A} 2002292SN/A 2012292SN/Atemplate<class Impl> 2022292SN/Avoid 2036221Snate@binkert.orgLSQ<Impl>::removeEntries(ThreadID tid) 2042292SN/A{ 2052292SN/A thread[tid].clearLQ(); 2062292SN/A thread[tid].clearSQ(); 2072292SN/A} 2082292SN/A 2092292SN/Atemplate<class Impl> 2102292SN/Avoid 2116221Snate@binkert.orgLSQ<Impl>::resizeEntries(unsigned size, ThreadID tid) 2122292SN/A{ 2132292SN/A thread[tid].resizeLQ(size); 2142292SN/A thread[tid].resizeSQ(size); 2152292SN/A} 2162292SN/A 2172292SN/Atemplate<class Impl> 2182292SN/Avoid 2192292SN/ALSQ<Impl>::tick() 2202292SN/A{ 2216221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 2226221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 2232292SN/A 2243867Sbinkertn@umich.edu while (threads != end) { 2256221Snate@binkert.org ThreadID tid = *threads++; 2262292SN/A 2272292SN/A thread[tid].tick(); 2282292SN/A } 2292292SN/A} 2302292SN/A 2312292SN/Atemplate<class Impl> 2322292SN/Avoid 2332292SN/ALSQ<Impl>::insertLoad(DynInstPtr &load_inst) 2342292SN/A{ 2356221Snate@binkert.org ThreadID tid = load_inst->threadNumber; 2362292SN/A 2372292SN/A thread[tid].insertLoad(load_inst); 2382292SN/A} 2392292SN/A 2402292SN/Atemplate<class Impl> 2412292SN/Avoid 2422292SN/ALSQ<Impl>::insertStore(DynInstPtr &store_inst) 2432292SN/A{ 2446221Snate@binkert.org ThreadID tid = store_inst->threadNumber; 2452292SN/A 2462292SN/A thread[tid].insertStore(store_inst); 2472292SN/A} 2482292SN/A 2492292SN/Atemplate<class Impl> 2502292SN/AFault 2512292SN/ALSQ<Impl>::executeLoad(DynInstPtr &inst) 2522292SN/A{ 2536221Snate@binkert.org ThreadID tid = inst->threadNumber; 2542292SN/A 2552292SN/A return thread[tid].executeLoad(inst); 2562292SN/A} 2572292SN/A 2582292SN/Atemplate<class Impl> 2592292SN/AFault 2602292SN/ALSQ<Impl>::executeStore(DynInstPtr &inst) 2612292SN/A{ 2626221Snate@binkert.org ThreadID tid = inst->threadNumber; 2632292SN/A 2642292SN/A return thread[tid].executeStore(inst); 2652292SN/A} 2662292SN/A 2672292SN/Atemplate<class Impl> 2682292SN/Avoid 2692292SN/ALSQ<Impl>::writebackStores() 2702292SN/A{ 2716221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 2726221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 2732292SN/A 2743867Sbinkertn@umich.edu while (threads != end) { 2756221Snate@binkert.org ThreadID tid = *threads++; 2762292SN/A 2772292SN/A if (numStoresToWB(tid) > 0) { 2782329SN/A DPRINTF(Writeback,"[tid:%i] Writing back stores. %i stores " 2792329SN/A "available for Writeback.\n", tid, numStoresToWB(tid)); 2802292SN/A } 2812292SN/A 2822292SN/A thread[tid].writebackStores(); 2832292SN/A } 2842292SN/A} 2852292SN/A 2862292SN/Atemplate<class Impl> 2872292SN/Abool 2882292SN/ALSQ<Impl>::violation() 2892292SN/A{ 2902292SN/A /* Answers: Does Anybody Have a Violation?*/ 2916221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 2926221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 2932292SN/A 2943867Sbinkertn@umich.edu while (threads != end) { 2956221Snate@binkert.org ThreadID tid = *threads++; 2963867Sbinkertn@umich.edu 2972292SN/A if (thread[tid].violation()) 2982292SN/A return true; 2992292SN/A } 3002292SN/A 3012292SN/A return false; 3022292SN/A} 3032292SN/A 3048707Sandreas.hansson@arm.comtemplate <class Impl> 3058707Sandreas.hansson@arm.comvoid 3068707Sandreas.hansson@arm.comLSQ<Impl>::recvRetry() 3078707Sandreas.hansson@arm.com{ 3088707Sandreas.hansson@arm.com if (retryTid == InvalidThreadID) 3098707Sandreas.hansson@arm.com { 3108707Sandreas.hansson@arm.com //Squashed, so drop it 3118707Sandreas.hansson@arm.com return; 3128707Sandreas.hansson@arm.com } 3138707Sandreas.hansson@arm.com int curr_retry_tid = retryTid; 3148707Sandreas.hansson@arm.com // Speculatively clear the retry Tid. This will get set again if 3158707Sandreas.hansson@arm.com // the LSQUnit was unable to complete its access. 3168707Sandreas.hansson@arm.com retryTid = -1; 3178707Sandreas.hansson@arm.com thread[curr_retry_tid].recvRetry(); 3188707Sandreas.hansson@arm.com} 3198707Sandreas.hansson@arm.com 3208707Sandreas.hansson@arm.comtemplate <class Impl> 3218707Sandreas.hansson@arm.combool 3228707Sandreas.hansson@arm.comLSQ<Impl>::recvTiming(PacketPtr pkt) 3238707Sandreas.hansson@arm.com{ 3248948Sandreas.hansson@arm.com assert(pkt->isResponse()); 3258707Sandreas.hansson@arm.com if (pkt->isError()) 3268707Sandreas.hansson@arm.com DPRINTF(LSQ, "Got error packet back for address: %#X\n", 3278707Sandreas.hansson@arm.com pkt->getAddr()); 3288948Sandreas.hansson@arm.com thread[pkt->req->threadId()].completeDataAccess(pkt); 3298948Sandreas.hansson@arm.com return true; 3308948Sandreas.hansson@arm.com} 3318707Sandreas.hansson@arm.com 3328948Sandreas.hansson@arm.comtemplate <class Impl> 3338948Sandreas.hansson@arm.combool 3348948Sandreas.hansson@arm.comLSQ<Impl>::recvTimingSnoop(PacketPtr pkt) 3358948Sandreas.hansson@arm.com{ 3368948Sandreas.hansson@arm.com assert(pkt->isRequest()); 3378948Sandreas.hansson@arm.com DPRINTF(LSQ, "received pkt for addr:%#x %s\n", pkt->getAddr(), 3388948Sandreas.hansson@arm.com pkt->cmdString()); 3398948Sandreas.hansson@arm.com 3408948Sandreas.hansson@arm.com // must be a snoop 3418948Sandreas.hansson@arm.com if (pkt->isInvalidate()) { 3428948Sandreas.hansson@arm.com DPRINTF(LSQ, "received invalidation for addr:%#x\n", 3438948Sandreas.hansson@arm.com pkt->getAddr()); 3448948Sandreas.hansson@arm.com for (ThreadID tid = 0; tid < numThreads; tid++) { 3458948Sandreas.hansson@arm.com thread[tid].checkSnoop(pkt); 3468707Sandreas.hansson@arm.com } 3478707Sandreas.hansson@arm.com } 3488948Sandreas.hansson@arm.com 3498948Sandreas.hansson@arm.com // to provide stronger consistency model 3508707Sandreas.hansson@arm.com return true; 3518707Sandreas.hansson@arm.com} 3528707Sandreas.hansson@arm.com 3532292SN/Atemplate<class Impl> 3542292SN/Aint 3552292SN/ALSQ<Impl>::getCount() 3562292SN/A{ 3572292SN/A unsigned total = 0; 3582292SN/A 3596221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 3606221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 3612292SN/A 3623867Sbinkertn@umich.edu while (threads != end) { 3636221Snate@binkert.org ThreadID tid = *threads++; 3643867Sbinkertn@umich.edu 3652292SN/A total += getCount(tid); 3662292SN/A } 3672292SN/A 3682292SN/A return total; 3692292SN/A} 3702292SN/A 3712292SN/Atemplate<class Impl> 3722292SN/Aint 3732292SN/ALSQ<Impl>::numLoads() 3742292SN/A{ 3752292SN/A unsigned total = 0; 3762292SN/A 3776221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 3786221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 3792292SN/A 3803867Sbinkertn@umich.edu while (threads != end) { 3816221Snate@binkert.org ThreadID tid = *threads++; 3823867Sbinkertn@umich.edu 3832292SN/A total += numLoads(tid); 3842292SN/A } 3852292SN/A 3862292SN/A return total; 3872292SN/A} 3882292SN/A 3892292SN/Atemplate<class Impl> 3902292SN/Aint 3912292SN/ALSQ<Impl>::numStores() 3922292SN/A{ 3932292SN/A unsigned total = 0; 3942292SN/A 3956221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 3966221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 3972292SN/A 3983867Sbinkertn@umich.edu while (threads != end) { 3996221Snate@binkert.org ThreadID tid = *threads++; 4003867Sbinkertn@umich.edu 4012292SN/A total += thread[tid].numStores(); 4022292SN/A } 4032292SN/A 4042292SN/A return total; 4052292SN/A} 4062292SN/A 4072292SN/Atemplate<class Impl> 4082292SN/Aint 4092292SN/ALSQ<Impl>::numLoadsReady() 4102292SN/A{ 4112292SN/A unsigned total = 0; 4122292SN/A 4136221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 4146221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 4152292SN/A 4163867Sbinkertn@umich.edu while (threads != end) { 4176221Snate@binkert.org ThreadID tid = *threads++; 4183867Sbinkertn@umich.edu 4192292SN/A total += thread[tid].numLoadsReady(); 4202292SN/A } 4212292SN/A 4222292SN/A return total; 4232292SN/A} 4242292SN/A 4252292SN/Atemplate<class Impl> 4262292SN/Aunsigned 4272292SN/ALSQ<Impl>::numFreeEntries() 4282292SN/A{ 4292292SN/A unsigned total = 0; 4302292SN/A 4316221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 4326221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 4332292SN/A 4343867Sbinkertn@umich.edu while (threads != end) { 4356221Snate@binkert.org ThreadID tid = *threads++; 4363867Sbinkertn@umich.edu 4372292SN/A total += thread[tid].numFreeEntries(); 4382292SN/A } 4392292SN/A 4402292SN/A return total; 4412292SN/A} 4422292SN/A 4432292SN/Atemplate<class Impl> 4442292SN/Aunsigned 4456221Snate@binkert.orgLSQ<Impl>::numFreeEntries(ThreadID tid) 4462292SN/A{ 4473870Sbinkertn@umich.edu //if (lsqPolicy == Dynamic) 4482292SN/A //return numFreeEntries(); 4492292SN/A //else 4502292SN/A return thread[tid].numFreeEntries(); 4512292SN/A} 4522292SN/A 4532292SN/Atemplate<class Impl> 4542292SN/Abool 4552292SN/ALSQ<Impl>::isFull() 4562292SN/A{ 4576221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 4586221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 4592292SN/A 4603867Sbinkertn@umich.edu while (threads != end) { 4616221Snate@binkert.org ThreadID tid = *threads++; 4623867Sbinkertn@umich.edu 4633867Sbinkertn@umich.edu if (!(thread[tid].lqFull() || thread[tid].sqFull())) 4642292SN/A return false; 4652292SN/A } 4662292SN/A 4672292SN/A return true; 4682292SN/A} 4692292SN/A 4702292SN/Atemplate<class Impl> 4712292SN/Abool 4726221Snate@binkert.orgLSQ<Impl>::isFull(ThreadID tid) 4732292SN/A{ 4742292SN/A //@todo: Change to Calculate All Entries for 4752292SN/A //Dynamic Policy 4763867Sbinkertn@umich.edu if (lsqPolicy == Dynamic) 4772292SN/A return isFull(); 4782292SN/A else 4792292SN/A return thread[tid].lqFull() || thread[tid].sqFull(); 4802292SN/A} 4812292SN/A 4822292SN/Atemplate<class Impl> 4832292SN/Abool 4842292SN/ALSQ<Impl>::lqFull() 4852292SN/A{ 4866221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 4876221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 4882292SN/A 4893867Sbinkertn@umich.edu while (threads != end) { 4906221Snate@binkert.org ThreadID tid = *threads++; 4913867Sbinkertn@umich.edu 4922292SN/A if (!thread[tid].lqFull()) 4932292SN/A return false; 4942292SN/A } 4952292SN/A 4962292SN/A return true; 4972292SN/A} 4982292SN/A 4992292SN/Atemplate<class Impl> 5002292SN/Abool 5016221Snate@binkert.orgLSQ<Impl>::lqFull(ThreadID tid) 5022292SN/A{ 5032292SN/A //@todo: Change to Calculate All Entries for 5042292SN/A //Dynamic Policy 5053870Sbinkertn@umich.edu if (lsqPolicy == Dynamic) 5062292SN/A return lqFull(); 5072292SN/A else 5082292SN/A return thread[tid].lqFull(); 5092292SN/A} 5102292SN/A 5112292SN/Atemplate<class Impl> 5122292SN/Abool 5132292SN/ALSQ<Impl>::sqFull() 5142292SN/A{ 5156221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 5166221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 5172292SN/A 5183867Sbinkertn@umich.edu while (threads != end) { 5196221Snate@binkert.org ThreadID tid = *threads++; 5203867Sbinkertn@umich.edu 5212292SN/A if (!sqFull(tid)) 5222292SN/A return false; 5232292SN/A } 5242292SN/A 5252292SN/A return true; 5262292SN/A} 5272292SN/A 5282292SN/Atemplate<class Impl> 5292292SN/Abool 5306221Snate@binkert.orgLSQ<Impl>::sqFull(ThreadID tid) 5312292SN/A{ 5322292SN/A //@todo: Change to Calculate All Entries for 5332292SN/A //Dynamic Policy 5343870Sbinkertn@umich.edu if (lsqPolicy == Dynamic) 5352292SN/A return sqFull(); 5362292SN/A else 5372292SN/A return thread[tid].sqFull(); 5382292SN/A} 5392292SN/A 5402292SN/Atemplate<class Impl> 5412292SN/Abool 5422292SN/ALSQ<Impl>::isStalled() 5432292SN/A{ 5446221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 5456221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 5462292SN/A 5473867Sbinkertn@umich.edu while (threads != end) { 5486221Snate@binkert.org ThreadID tid = *threads++; 5493867Sbinkertn@umich.edu 5502292SN/A if (!thread[tid].isStalled()) 5512292SN/A return false; 5522292SN/A } 5532292SN/A 5542292SN/A return true; 5552292SN/A} 5562292SN/A 5572292SN/Atemplate<class Impl> 5582292SN/Abool 5596221Snate@binkert.orgLSQ<Impl>::isStalled(ThreadID tid) 5602292SN/A{ 5613870Sbinkertn@umich.edu if (lsqPolicy == Dynamic) 5622292SN/A return isStalled(); 5632292SN/A else 5642292SN/A return thread[tid].isStalled(); 5652292SN/A} 5662292SN/A 5672292SN/Atemplate<class Impl> 5682292SN/Abool 5692292SN/ALSQ<Impl>::hasStoresToWB() 5702292SN/A{ 5716221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 5726221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 5732292SN/A 5743867Sbinkertn@umich.edu while (threads != end) { 5756221Snate@binkert.org ThreadID tid = *threads++; 5763867Sbinkertn@umich.edu 5775557Sktlim@umich.edu if (hasStoresToWB(tid)) 5785557Sktlim@umich.edu return true; 5792292SN/A } 5802292SN/A 5815557Sktlim@umich.edu return false; 5822292SN/A} 5832292SN/A 5842292SN/Atemplate<class Impl> 5852292SN/Abool 5862292SN/ALSQ<Impl>::willWB() 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 (willWB(tid)) 5955557Sktlim@umich.edu return true; 5962292SN/A } 5972292SN/A 5985557Sktlim@umich.edu return false; 5992292SN/A} 6002292SN/A 6012292SN/Atemplate<class Impl> 6022292SN/Avoid 6032292SN/ALSQ<Impl>::dumpInsts() 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 6112292SN/A thread[tid].dumpInsts(); 6122292SN/A } 6132292SN/A} 614