lsq_impl.hh revision 9440
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 3228975Sandreas.hansson@arm.comLSQ<Impl>::recvTimingResp(PacketPtr pkt) 3238707Sandreas.hansson@arm.com{ 3248707Sandreas.hansson@arm.com if (pkt->isError()) 3258707Sandreas.hansson@arm.com DPRINTF(LSQ, "Got error packet back for address: %#X\n", 3268707Sandreas.hansson@arm.com pkt->getAddr()); 3278948Sandreas.hansson@arm.com thread[pkt->req->threadId()].completeDataAccess(pkt); 3288948Sandreas.hansson@arm.com return true; 3298948Sandreas.hansson@arm.com} 3308707Sandreas.hansson@arm.com 3318948Sandreas.hansson@arm.comtemplate <class Impl> 3328975Sandreas.hansson@arm.comvoid 3338975Sandreas.hansson@arm.comLSQ<Impl>::recvTimingSnoopReq(PacketPtr pkt) 3348948Sandreas.hansson@arm.com{ 3358948Sandreas.hansson@arm.com DPRINTF(LSQ, "received pkt for addr:%#x %s\n", pkt->getAddr(), 3368948Sandreas.hansson@arm.com pkt->cmdString()); 3378948Sandreas.hansson@arm.com 3388948Sandreas.hansson@arm.com // must be a snoop 3398948Sandreas.hansson@arm.com if (pkt->isInvalidate()) { 3408948Sandreas.hansson@arm.com DPRINTF(LSQ, "received invalidation for addr:%#x\n", 3418948Sandreas.hansson@arm.com pkt->getAddr()); 3428948Sandreas.hansson@arm.com for (ThreadID tid = 0; tid < numThreads; tid++) { 3438948Sandreas.hansson@arm.com thread[tid].checkSnoop(pkt); 3448707Sandreas.hansson@arm.com } 3458707Sandreas.hansson@arm.com } 3468707Sandreas.hansson@arm.com} 3478707Sandreas.hansson@arm.com 3482292SN/Atemplate<class Impl> 3492292SN/Aint 3502292SN/ALSQ<Impl>::getCount() 3512292SN/A{ 3522292SN/A unsigned total = 0; 3532292SN/A 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 total += getCount(tid); 3612292SN/A } 3622292SN/A 3632292SN/A return total; 3642292SN/A} 3652292SN/A 3662292SN/Atemplate<class Impl> 3672292SN/Aint 3682292SN/ALSQ<Impl>::numLoads() 3692292SN/A{ 3702292SN/A unsigned total = 0; 3712292SN/A 3726221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 3736221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 3742292SN/A 3753867Sbinkertn@umich.edu while (threads != end) { 3766221Snate@binkert.org ThreadID tid = *threads++; 3773867Sbinkertn@umich.edu 3782292SN/A total += numLoads(tid); 3792292SN/A } 3802292SN/A 3812292SN/A return total; 3822292SN/A} 3832292SN/A 3842292SN/Atemplate<class Impl> 3852292SN/Aint 3862292SN/ALSQ<Impl>::numStores() 3872292SN/A{ 3882292SN/A unsigned total = 0; 3892292SN/A 3906221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 3916221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 3922292SN/A 3933867Sbinkertn@umich.edu while (threads != end) { 3946221Snate@binkert.org ThreadID tid = *threads++; 3953867Sbinkertn@umich.edu 3962292SN/A total += thread[tid].numStores(); 3972292SN/A } 3982292SN/A 3992292SN/A return total; 4002292SN/A} 4012292SN/A 4022292SN/Atemplate<class Impl> 4032292SN/Aunsigned 4042292SN/ALSQ<Impl>::numFreeEntries() 4052292SN/A{ 4062292SN/A unsigned total = 0; 4072292SN/A 4086221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 4096221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 4102292SN/A 4113867Sbinkertn@umich.edu while (threads != end) { 4126221Snate@binkert.org ThreadID tid = *threads++; 4133867Sbinkertn@umich.edu 4142292SN/A total += thread[tid].numFreeEntries(); 4152292SN/A } 4162292SN/A 4172292SN/A return total; 4182292SN/A} 4192292SN/A 4202292SN/Atemplate<class Impl> 4212292SN/Aunsigned 4226221Snate@binkert.orgLSQ<Impl>::numFreeEntries(ThreadID tid) 4232292SN/A{ 4243870Sbinkertn@umich.edu //if (lsqPolicy == Dynamic) 4252292SN/A //return numFreeEntries(); 4262292SN/A //else 4272292SN/A return thread[tid].numFreeEntries(); 4282292SN/A} 4292292SN/A 4302292SN/Atemplate<class Impl> 4312292SN/Abool 4322292SN/ALSQ<Impl>::isFull() 4332292SN/A{ 4346221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 4356221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 4362292SN/A 4373867Sbinkertn@umich.edu while (threads != end) { 4386221Snate@binkert.org ThreadID tid = *threads++; 4393867Sbinkertn@umich.edu 4403867Sbinkertn@umich.edu if (!(thread[tid].lqFull() || thread[tid].sqFull())) 4412292SN/A return false; 4422292SN/A } 4432292SN/A 4442292SN/A return true; 4452292SN/A} 4462292SN/A 4472292SN/Atemplate<class Impl> 4482292SN/Abool 4496221Snate@binkert.orgLSQ<Impl>::isFull(ThreadID tid) 4502292SN/A{ 4512292SN/A //@todo: Change to Calculate All Entries for 4522292SN/A //Dynamic Policy 4533867Sbinkertn@umich.edu if (lsqPolicy == Dynamic) 4542292SN/A return isFull(); 4552292SN/A else 4562292SN/A return thread[tid].lqFull() || thread[tid].sqFull(); 4572292SN/A} 4582292SN/A 4592292SN/Atemplate<class Impl> 4602292SN/Abool 4612292SN/ALSQ<Impl>::lqFull() 4622292SN/A{ 4636221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 4646221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 4652292SN/A 4663867Sbinkertn@umich.edu while (threads != end) { 4676221Snate@binkert.org ThreadID tid = *threads++; 4683867Sbinkertn@umich.edu 4692292SN/A if (!thread[tid].lqFull()) 4702292SN/A return false; 4712292SN/A } 4722292SN/A 4732292SN/A return true; 4742292SN/A} 4752292SN/A 4762292SN/Atemplate<class Impl> 4772292SN/Abool 4786221Snate@binkert.orgLSQ<Impl>::lqFull(ThreadID tid) 4792292SN/A{ 4802292SN/A //@todo: Change to Calculate All Entries for 4812292SN/A //Dynamic Policy 4823870Sbinkertn@umich.edu if (lsqPolicy == Dynamic) 4832292SN/A return lqFull(); 4842292SN/A else 4852292SN/A return thread[tid].lqFull(); 4862292SN/A} 4872292SN/A 4882292SN/Atemplate<class Impl> 4892292SN/Abool 4902292SN/ALSQ<Impl>::sqFull() 4912292SN/A{ 4926221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 4936221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 4942292SN/A 4953867Sbinkertn@umich.edu while (threads != end) { 4966221Snate@binkert.org ThreadID tid = *threads++; 4973867Sbinkertn@umich.edu 4982292SN/A if (!sqFull(tid)) 4992292SN/A return false; 5002292SN/A } 5012292SN/A 5022292SN/A return true; 5032292SN/A} 5042292SN/A 5052292SN/Atemplate<class Impl> 5062292SN/Abool 5076221Snate@binkert.orgLSQ<Impl>::sqFull(ThreadID tid) 5082292SN/A{ 5092292SN/A //@todo: Change to Calculate All Entries for 5102292SN/A //Dynamic Policy 5113870Sbinkertn@umich.edu if (lsqPolicy == Dynamic) 5122292SN/A return sqFull(); 5132292SN/A else 5142292SN/A return thread[tid].sqFull(); 5152292SN/A} 5162292SN/A 5172292SN/Atemplate<class Impl> 5182292SN/Abool 5192292SN/ALSQ<Impl>::isStalled() 5202292SN/A{ 5216221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 5226221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 5232292SN/A 5243867Sbinkertn@umich.edu while (threads != end) { 5256221Snate@binkert.org ThreadID tid = *threads++; 5263867Sbinkertn@umich.edu 5272292SN/A if (!thread[tid].isStalled()) 5282292SN/A return false; 5292292SN/A } 5302292SN/A 5312292SN/A return true; 5322292SN/A} 5332292SN/A 5342292SN/Atemplate<class Impl> 5352292SN/Abool 5366221Snate@binkert.orgLSQ<Impl>::isStalled(ThreadID tid) 5372292SN/A{ 5383870Sbinkertn@umich.edu if (lsqPolicy == Dynamic) 5392292SN/A return isStalled(); 5402292SN/A else 5412292SN/A return thread[tid].isStalled(); 5422292SN/A} 5432292SN/A 5442292SN/Atemplate<class Impl> 5452292SN/Abool 5462292SN/ALSQ<Impl>::hasStoresToWB() 5472292SN/A{ 5486221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 5496221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 5502292SN/A 5513867Sbinkertn@umich.edu while (threads != end) { 5526221Snate@binkert.org ThreadID tid = *threads++; 5533867Sbinkertn@umich.edu 5545557Sktlim@umich.edu if (hasStoresToWB(tid)) 5555557Sktlim@umich.edu return true; 5562292SN/A } 5572292SN/A 5585557Sktlim@umich.edu return false; 5592292SN/A} 5602292SN/A 5612292SN/Atemplate<class Impl> 5622292SN/Abool 5632292SN/ALSQ<Impl>::willWB() 5642292SN/A{ 5656221Snate@binkert.org list<ThreadID>::iterator threads = activeThreads->begin(); 5666221Snate@binkert.org list<ThreadID>::iterator end = activeThreads->end(); 5672292SN/A 5683867Sbinkertn@umich.edu while (threads != end) { 5696221Snate@binkert.org ThreadID tid = *threads++; 5703867Sbinkertn@umich.edu 5715557Sktlim@umich.edu if (willWB(tid)) 5725557Sktlim@umich.edu return true; 5732292SN/A } 5742292SN/A 5755557Sktlim@umich.edu return false; 5762292SN/A} 5772292SN/A 5782292SN/Atemplate<class Impl> 5792292SN/Avoid 5809440SAndreas.Sandberg@ARM.comLSQ<Impl>::dumpInsts() const 5812292SN/A{ 5829440SAndreas.Sandberg@ARM.com list<ThreadID>::const_iterator threads = activeThreads->begin(); 5839440SAndreas.Sandberg@ARM.com list<ThreadID>::const_iterator end = activeThreads->end(); 5842292SN/A 5853867Sbinkertn@umich.edu while (threads != end) { 5866221Snate@binkert.org ThreadID tid = *threads++; 5873867Sbinkertn@umich.edu 5882292SN/A thread[tid].dumpInsts(); 5892292SN/A } 5902292SN/A} 591