lsq_impl.hh revision 2980
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
372292SN/Atemplate <class Impl>
382907Sktlim@umich.eduTick
392907Sktlim@umich.eduLSQ<Impl>::DcachePort::recvAtomic(PacketPtr pkt)
402907Sktlim@umich.edu{
412907Sktlim@umich.edu    panic("O3CPU model does not work with atomic mode!");
422907Sktlim@umich.edu    return curTick;
432907Sktlim@umich.edu}
442907Sktlim@umich.edu
452907Sktlim@umich.edutemplate <class Impl>
462907Sktlim@umich.eduvoid
472907Sktlim@umich.eduLSQ<Impl>::DcachePort::recvFunctional(PacketPtr pkt)
482907Sktlim@umich.edu{
492907Sktlim@umich.edu    panic("O3CPU doesn't expect recvFunctional callback!");
502907Sktlim@umich.edu}
512907Sktlim@umich.edu
522907Sktlim@umich.edutemplate <class Impl>
532907Sktlim@umich.eduvoid
542907Sktlim@umich.eduLSQ<Impl>::DcachePort::recvStatusChange(Status status)
552907Sktlim@umich.edu{
562907Sktlim@umich.edu    if (status == RangeChange)
572907Sktlim@umich.edu        return;
582907Sktlim@umich.edu
592907Sktlim@umich.edu    panic("O3CPU doesn't expect recvStatusChange callback!");
602907Sktlim@umich.edu}
612907Sktlim@umich.edu
622907Sktlim@umich.edutemplate <class Impl>
632907Sktlim@umich.edubool
642907Sktlim@umich.eduLSQ<Impl>::DcachePort::recvTiming(PacketPtr pkt)
652907Sktlim@umich.edu{
662907Sktlim@umich.edu    lsq->thread[pkt->req->getThreadNum()].completeDataAccess(pkt);
672907Sktlim@umich.edu    return true;
682907Sktlim@umich.edu}
692907Sktlim@umich.edu
702907Sktlim@umich.edutemplate <class Impl>
712907Sktlim@umich.eduvoid
722907Sktlim@umich.eduLSQ<Impl>::DcachePort::recvRetry()
732907Sktlim@umich.edu{
742907Sktlim@umich.edu    lsq->thread[lsq->retryTid].recvRetry();
752907Sktlim@umich.edu    // Speculatively clear the retry Tid.  This will get set again if
762907Sktlim@umich.edu    // the LSQUnit was unable to complete its access.
772907Sktlim@umich.edu    lsq->retryTid = -1;
782907Sktlim@umich.edu}
792907Sktlim@umich.edu
802907Sktlim@umich.edutemplate <class Impl>
812292SN/ALSQ<Impl>::LSQ(Params *params)
822907Sktlim@umich.edu    : dcachePort(this), LQEntries(params->LQEntries),
832907Sktlim@umich.edu      SQEntries(params->SQEntries), numThreads(params->numberOfThreads),
842907Sktlim@umich.edu      retryTid(-1)
852292SN/A{
862292SN/A    DPRINTF(LSQ, "Creating LSQ object.\n");
872292SN/A
882292SN/A    //**********************************************/
892292SN/A    //************ Handle SMT Parameters ***********/
902292SN/A    //**********************************************/
912980Sgblack@eecs.umich.edu    std::string policy = params->smtLSQPolicy;
922292SN/A
932292SN/A    //Convert string to lowercase
942292SN/A    std::transform(policy.begin(), policy.end(), policy.begin(),
952292SN/A                   (int(*)(int)) tolower);
962292SN/A
972292SN/A    //Figure out fetch policy
982292SN/A    if (policy == "dynamic") {
992292SN/A        lsqPolicy = Dynamic;
1002292SN/A
1012292SN/A        maxLQEntries = LQEntries;
1022292SN/A        maxSQEntries = SQEntries;
1032292SN/A
1042292SN/A        DPRINTF(LSQ, "LSQ sharing policy set to Dynamic\n");
1052292SN/A
1062292SN/A    } else if (policy == "partitioned") {
1072292SN/A        lsqPolicy = Partitioned;
1082292SN/A
1092292SN/A        //@todo:make work if part_amt doesnt divide evenly.
1102292SN/A        maxLQEntries = LQEntries / numThreads;
1112292SN/A        maxSQEntries = SQEntries / numThreads;
1122292SN/A
1132292SN/A        DPRINTF(Fetch, "LSQ sharing policy set to Partitioned: "
1142292SN/A                "%i entries per LQ | %i entries per SQ",
1152292SN/A                maxLQEntries,maxSQEntries);
1162292SN/A
1172292SN/A    } else if (policy == "threshold") {
1182292SN/A        lsqPolicy = Threshold;
1192292SN/A
1202292SN/A        assert(params->smtLSQThreshold > LQEntries);
1212292SN/A        assert(params->smtLSQThreshold > SQEntries);
1222292SN/A
1232292SN/A        //Divide up by threshold amount
1242292SN/A        //@todo: Should threads check the max and the total
1252292SN/A        //amount of the LSQ
1262292SN/A        maxLQEntries  = params->smtLSQThreshold;
1272292SN/A        maxSQEntries  = params->smtLSQThreshold;
1282292SN/A
1292292SN/A        DPRINTF(LSQ, "LSQ sharing policy set to Threshold: "
1302292SN/A                "%i entries per LQ | %i entries per SQ",
1312292SN/A                maxLQEntries,maxSQEntries);
1322292SN/A
1332292SN/A    } else {
1342292SN/A        assert(0 && "Invalid LSQ Sharing Policy.Options Are:{Dynamic,"
1352292SN/A                    "Partitioned, Threshold}");
1362292SN/A    }
1372292SN/A
1382292SN/A    //Initialize LSQs
1392292SN/A    for (int tid=0; tid < numThreads; tid++) {
1402907Sktlim@umich.edu        thread[tid].init(params, this, maxLQEntries, maxSQEntries, tid);
1412907Sktlim@umich.edu        thread[tid].setDcachePort(&dcachePort);
1422292SN/A    }
1432292SN/A}
1442292SN/A
1452292SN/A
1462292SN/Atemplate<class Impl>
1472292SN/Astd::string
1482292SN/ALSQ<Impl>::name() const
1492292SN/A{
1502292SN/A    return iewStage->name() + ".lsq";
1512292SN/A}
1522292SN/A
1532292SN/Atemplate<class Impl>
1542292SN/Avoid
1552727Sktlim@umich.eduLSQ<Impl>::regStats()
1562727Sktlim@umich.edu{
1572727Sktlim@umich.edu    //Initialize LSQs
1582727Sktlim@umich.edu    for (int tid=0; tid < numThreads; tid++) {
1592727Sktlim@umich.edu        thread[tid].regStats();
1602727Sktlim@umich.edu    }
1612727Sktlim@umich.edu}
1622727Sktlim@umich.edu
1632727Sktlim@umich.edutemplate<class Impl>
1642727Sktlim@umich.eduvoid
1652980Sgblack@eecs.umich.eduLSQ<Impl>::setActiveThreads(std::list<unsigned> *at_ptr)
1662292SN/A{
1672292SN/A    activeThreads = at_ptr;
1682292SN/A    assert(activeThreads != 0);
1692292SN/A}
1702292SN/A
1712292SN/Atemplate<class Impl>
1722292SN/Avoid
1732733Sktlim@umich.eduLSQ<Impl>::setCPU(O3CPU *cpu_ptr)
1742292SN/A{
1752292SN/A    cpu = cpu_ptr;
1762292SN/A
1772907Sktlim@umich.edu    dcachePort.setName(name());
1782907Sktlim@umich.edu
1792292SN/A    for (int tid=0; tid < numThreads; tid++) {
1802292SN/A        thread[tid].setCPU(cpu_ptr);
1812292SN/A    }
1822292SN/A}
1832292SN/A
1842292SN/Atemplate<class Impl>
1852292SN/Avoid
1862292SN/ALSQ<Impl>::setIEW(IEW *iew_ptr)
1872292SN/A{
1882292SN/A    iewStage = iew_ptr;
1892292SN/A
1902292SN/A    for (int tid=0; tid < numThreads; tid++) {
1912292SN/A        thread[tid].setIEW(iew_ptr);
1922292SN/A    }
1932292SN/A}
1942292SN/A
1952292SN/Atemplate <class Impl>
1962307SN/Avoid
1972307SN/ALSQ<Impl>::switchOut()
1982307SN/A{
1992307SN/A    for (int tid = 0; tid < numThreads; tid++) {
2002307SN/A        thread[tid].switchOut();
2012307SN/A    }
2022307SN/A}
2032307SN/A
2042307SN/Atemplate <class Impl>
2052307SN/Avoid
2062307SN/ALSQ<Impl>::takeOverFrom()
2072307SN/A{
2082307SN/A    for (int tid = 0; tid < numThreads; tid++) {
2092307SN/A        thread[tid].takeOverFrom();
2102307SN/A    }
2112307SN/A}
2122307SN/A
2132307SN/Atemplate <class Impl>
2142292SN/Aint
2152292SN/ALSQ<Impl>::entryAmount(int num_threads)
2162292SN/A{
2172292SN/A    if (lsqPolicy == Partitioned) {
2182292SN/A        return LQEntries / num_threads;
2192292SN/A    } else {
2202292SN/A        return 0;
2212292SN/A    }
2222292SN/A}
2232292SN/A
2242292SN/Atemplate <class Impl>
2252292SN/Avoid
2262292SN/ALSQ<Impl>::resetEntries()
2272292SN/A{
2282292SN/A    if (lsqPolicy != Dynamic || numThreads > 1) {
2292292SN/A        int active_threads = (*activeThreads).size();
2302292SN/A
2312980Sgblack@eecs.umich.edu        std::list<unsigned>::iterator threads  = (*activeThreads).begin();
2322980Sgblack@eecs.umich.edu        std::list<unsigned>::iterator list_end = (*activeThreads).end();
2332292SN/A
2342292SN/A        int maxEntries;
2352292SN/A
2362292SN/A        if (lsqPolicy == Partitioned) {
2372292SN/A            maxEntries = LQEntries / active_threads;
2382292SN/A        } else if (lsqPolicy == Threshold && active_threads == 1) {
2392292SN/A            maxEntries = LQEntries;
2402292SN/A        } else {
2412292SN/A            maxEntries = LQEntries;
2422292SN/A        }
2432292SN/A
2442292SN/A        while (threads != list_end) {
2452292SN/A            resizeEntries(maxEntries,*threads++);
2462292SN/A        }
2472292SN/A    }
2482292SN/A}
2492292SN/A
2502292SN/Atemplate<class Impl>
2512292SN/Avoid
2522292SN/ALSQ<Impl>::removeEntries(unsigned tid)
2532292SN/A{
2542292SN/A    thread[tid].clearLQ();
2552292SN/A    thread[tid].clearSQ();
2562292SN/A}
2572292SN/A
2582292SN/Atemplate<class Impl>
2592292SN/Avoid
2602292SN/ALSQ<Impl>::resizeEntries(unsigned size,unsigned tid)
2612292SN/A{
2622292SN/A    thread[tid].resizeLQ(size);
2632292SN/A    thread[tid].resizeSQ(size);
2642292SN/A}
2652292SN/A
2662292SN/Atemplate<class Impl>
2672292SN/Avoid
2682292SN/ALSQ<Impl>::tick()
2692292SN/A{
2702980Sgblack@eecs.umich.edu    std::list<unsigned>::iterator active_threads = (*activeThreads).begin();
2712292SN/A
2722292SN/A    while (active_threads != (*activeThreads).end()) {
2732292SN/A        unsigned tid = *active_threads++;
2742292SN/A
2752292SN/A        thread[tid].tick();
2762292SN/A    }
2772292SN/A}
2782292SN/A
2792292SN/Atemplate<class Impl>
2802292SN/Avoid
2812292SN/ALSQ<Impl>::insertLoad(DynInstPtr &load_inst)
2822292SN/A{
2832292SN/A    unsigned tid = load_inst->threadNumber;
2842292SN/A
2852292SN/A    thread[tid].insertLoad(load_inst);
2862292SN/A}
2872292SN/A
2882292SN/Atemplate<class Impl>
2892292SN/Avoid
2902292SN/ALSQ<Impl>::insertStore(DynInstPtr &store_inst)
2912292SN/A{
2922292SN/A    unsigned tid = store_inst->threadNumber;
2932292SN/A
2942292SN/A    thread[tid].insertStore(store_inst);
2952292SN/A}
2962292SN/A
2972292SN/Atemplate<class Impl>
2982292SN/AFault
2992292SN/ALSQ<Impl>::executeLoad(DynInstPtr &inst)
3002292SN/A{
3012292SN/A    unsigned tid = inst->threadNumber;
3022292SN/A
3032292SN/A    return thread[tid].executeLoad(inst);
3042292SN/A}
3052292SN/A
3062292SN/Atemplate<class Impl>
3072292SN/AFault
3082292SN/ALSQ<Impl>::executeStore(DynInstPtr &inst)
3092292SN/A{
3102292SN/A    unsigned tid = inst->threadNumber;
3112292SN/A
3122292SN/A    return thread[tid].executeStore(inst);
3132292SN/A}
3142292SN/A
3152292SN/Atemplate<class Impl>
3162292SN/Avoid
3172292SN/ALSQ<Impl>::writebackStores()
3182292SN/A{
3192980Sgblack@eecs.umich.edu    std::list<unsigned>::iterator active_threads = (*activeThreads).begin();
3202292SN/A
3212292SN/A    while (active_threads != (*activeThreads).end()) {
3222292SN/A        unsigned tid = *active_threads++;
3232292SN/A
3242292SN/A        if (numStoresToWB(tid) > 0) {
3252329SN/A            DPRINTF(Writeback,"[tid:%i] Writing back stores. %i stores "
3262329SN/A                "available for Writeback.\n", tid, numStoresToWB(tid));
3272292SN/A        }
3282292SN/A
3292292SN/A        thread[tid].writebackStores();
3302292SN/A    }
3312292SN/A}
3322292SN/A
3332292SN/Atemplate<class Impl>
3342292SN/Abool
3352292SN/ALSQ<Impl>::violation()
3362292SN/A{
3372292SN/A    /* Answers: Does Anybody Have a Violation?*/
3382980Sgblack@eecs.umich.edu    std::list<unsigned>::iterator active_threads = (*activeThreads).begin();
3392292SN/A
3402292SN/A    while (active_threads != (*activeThreads).end()) {
3412292SN/A        unsigned tid = *active_threads++;
3422292SN/A        if (thread[tid].violation())
3432292SN/A            return true;
3442292SN/A    }
3452292SN/A
3462292SN/A    return false;
3472292SN/A}
3482292SN/A
3492292SN/Atemplate<class Impl>
3502292SN/Aint
3512292SN/ALSQ<Impl>::getCount()
3522292SN/A{
3532292SN/A    unsigned total = 0;
3542292SN/A
3552980Sgblack@eecs.umich.edu    std::list<unsigned>::iterator active_threads = (*activeThreads).begin();
3562292SN/A
3572292SN/A    while (active_threads != (*activeThreads).end()) {
3582292SN/A        unsigned tid = *active_threads++;
3592292SN/A        total += getCount(tid);
3602292SN/A    }
3612292SN/A
3622292SN/A    return total;
3632292SN/A}
3642292SN/A
3652292SN/Atemplate<class Impl>
3662292SN/Aint
3672292SN/ALSQ<Impl>::numLoads()
3682292SN/A{
3692292SN/A    unsigned total = 0;
3702292SN/A
3712980Sgblack@eecs.umich.edu    std::list<unsigned>::iterator active_threads = (*activeThreads).begin();
3722292SN/A
3732292SN/A    while (active_threads != (*activeThreads).end()) {
3742292SN/A        unsigned tid = *active_threads++;
3752292SN/A        total += numLoads(tid);
3762292SN/A    }
3772292SN/A
3782292SN/A    return total;
3792292SN/A}
3802292SN/A
3812292SN/Atemplate<class Impl>
3822292SN/Aint
3832292SN/ALSQ<Impl>::numStores()
3842292SN/A{
3852292SN/A    unsigned total = 0;
3862292SN/A
3872980Sgblack@eecs.umich.edu    std::list<unsigned>::iterator active_threads = (*activeThreads).begin();
3882292SN/A
3892292SN/A    while (active_threads != (*activeThreads).end()) {
3902292SN/A        unsigned tid = *active_threads++;
3912292SN/A        total += thread[tid].numStores();
3922292SN/A    }
3932292SN/A
3942292SN/A    return total;
3952292SN/A}
3962292SN/A
3972292SN/Atemplate<class Impl>
3982292SN/Aint
3992292SN/ALSQ<Impl>::numLoadsReady()
4002292SN/A{
4012292SN/A    unsigned total = 0;
4022292SN/A
4032980Sgblack@eecs.umich.edu    std::list<unsigned>::iterator active_threads = (*activeThreads).begin();
4042292SN/A
4052292SN/A    while (active_threads != (*activeThreads).end()) {
4062292SN/A        unsigned tid = *active_threads++;
4072292SN/A        total += thread[tid].numLoadsReady();
4082292SN/A    }
4092292SN/A
4102292SN/A    return total;
4112292SN/A}
4122292SN/A
4132292SN/Atemplate<class Impl>
4142292SN/Aunsigned
4152292SN/ALSQ<Impl>::numFreeEntries()
4162292SN/A{
4172292SN/A    unsigned total = 0;
4182292SN/A
4192980Sgblack@eecs.umich.edu    std::list<unsigned>::iterator active_threads = (*activeThreads).begin();
4202292SN/A
4212292SN/A    while (active_threads != (*activeThreads).end()) {
4222292SN/A        unsigned tid = *active_threads++;
4232292SN/A        total += thread[tid].numFreeEntries();
4242292SN/A    }
4252292SN/A
4262292SN/A    return total;
4272292SN/A}
4282292SN/A
4292292SN/Atemplate<class Impl>
4302292SN/Aunsigned
4312292SN/ALSQ<Impl>::numFreeEntries(unsigned tid)
4322292SN/A{
4332292SN/A    //if( lsqPolicy == Dynamic )
4342292SN/A    //return numFreeEntries();
4352292SN/A    //else
4362292SN/A        return thread[tid].numFreeEntries();
4372292SN/A}
4382292SN/A
4392292SN/Atemplate<class Impl>
4402292SN/Abool
4412292SN/ALSQ<Impl>::isFull()
4422292SN/A{
4432980Sgblack@eecs.umich.edu    std::list<unsigned>::iterator active_threads = (*activeThreads).begin();
4442292SN/A
4452292SN/A    while (active_threads != (*activeThreads).end()) {
4462292SN/A        unsigned tid = *active_threads++;
4472292SN/A        if (! (thread[tid].lqFull() || thread[tid].sqFull()) )
4482292SN/A            return false;
4492292SN/A    }
4502292SN/A
4512292SN/A    return true;
4522292SN/A}
4532292SN/A
4542292SN/Atemplate<class Impl>
4552292SN/Abool
4562292SN/ALSQ<Impl>::isFull(unsigned tid)
4572292SN/A{
4582292SN/A    //@todo: Change to Calculate All Entries for
4592292SN/A    //Dynamic Policy
4602292SN/A    if( lsqPolicy == Dynamic )
4612292SN/A        return isFull();
4622292SN/A    else
4632292SN/A        return thread[tid].lqFull() || thread[tid].sqFull();
4642292SN/A}
4652292SN/A
4662292SN/Atemplate<class Impl>
4672292SN/Abool
4682292SN/ALSQ<Impl>::lqFull()
4692292SN/A{
4702980Sgblack@eecs.umich.edu    std::list<unsigned>::iterator active_threads = (*activeThreads).begin();
4712292SN/A
4722292SN/A    while (active_threads != (*activeThreads).end()) {
4732292SN/A        unsigned tid = *active_threads++;
4742292SN/A        if (!thread[tid].lqFull())
4752292SN/A            return false;
4762292SN/A    }
4772292SN/A
4782292SN/A    return true;
4792292SN/A}
4802292SN/A
4812292SN/Atemplate<class Impl>
4822292SN/Abool
4832292SN/ALSQ<Impl>::lqFull(unsigned tid)
4842292SN/A{
4852292SN/A    //@todo: Change to Calculate All Entries for
4862292SN/A    //Dynamic Policy
4872292SN/A    if( lsqPolicy == Dynamic )
4882292SN/A        return lqFull();
4892292SN/A    else
4902292SN/A        return thread[tid].lqFull();
4912292SN/A}
4922292SN/A
4932292SN/Atemplate<class Impl>
4942292SN/Abool
4952292SN/ALSQ<Impl>::sqFull()
4962292SN/A{
4972980Sgblack@eecs.umich.edu    std::list<unsigned>::iterator active_threads = (*activeThreads).begin();
4982292SN/A
4992292SN/A    while (active_threads != (*activeThreads).end()) {
5002292SN/A        unsigned tid = *active_threads++;
5012292SN/A        if (!sqFull(tid))
5022292SN/A            return false;
5032292SN/A    }
5042292SN/A
5052292SN/A    return true;
5062292SN/A}
5072292SN/A
5082292SN/Atemplate<class Impl>
5092292SN/Abool
5102292SN/ALSQ<Impl>::sqFull(unsigned tid)
5112292SN/A{
5122292SN/A     //@todo: Change to Calculate All Entries for
5132292SN/A    //Dynamic Policy
5142292SN/A    if( lsqPolicy == Dynamic )
5152292SN/A        return sqFull();
5162292SN/A    else
5172292SN/A        return thread[tid].sqFull();
5182292SN/A}
5192292SN/A
5202292SN/Atemplate<class Impl>
5212292SN/Abool
5222292SN/ALSQ<Impl>::isStalled()
5232292SN/A{
5242980Sgblack@eecs.umich.edu    std::list<unsigned>::iterator active_threads = (*activeThreads).begin();
5252292SN/A
5262292SN/A    while (active_threads != (*activeThreads).end()) {
5272292SN/A        unsigned tid = *active_threads++;
5282292SN/A        if (!thread[tid].isStalled())
5292292SN/A            return false;
5302292SN/A    }
5312292SN/A
5322292SN/A    return true;
5332292SN/A}
5342292SN/A
5352292SN/Atemplate<class Impl>
5362292SN/Abool
5372292SN/ALSQ<Impl>::isStalled(unsigned tid)
5382292SN/A{
5392292SN/A    if( lsqPolicy == Dynamic )
5402292SN/A        return isStalled();
5412292SN/A    else
5422292SN/A        return thread[tid].isStalled();
5432292SN/A}
5442292SN/A
5452292SN/Atemplate<class Impl>
5462292SN/Abool
5472292SN/ALSQ<Impl>::hasStoresToWB()
5482292SN/A{
5492980Sgblack@eecs.umich.edu    std::list<unsigned>::iterator active_threads = (*activeThreads).begin();
5502292SN/A
5512864Sktlim@umich.edu    if ((*activeThreads).empty())
5522864Sktlim@umich.edu        return false;
5532864Sktlim@umich.edu
5542292SN/A    while (active_threads != (*activeThreads).end()) {
5552292SN/A        unsigned tid = *active_threads++;
5562292SN/A        if (!hasStoresToWB(tid))
5572292SN/A            return false;
5582292SN/A    }
5592292SN/A
5602292SN/A    return true;
5612292SN/A}
5622292SN/A
5632292SN/Atemplate<class Impl>
5642292SN/Abool
5652292SN/ALSQ<Impl>::willWB()
5662292SN/A{
5672980Sgblack@eecs.umich.edu    std::list<unsigned>::iterator active_threads = (*activeThreads).begin();
5682292SN/A
5692292SN/A    while (active_threads != (*activeThreads).end()) {
5702292SN/A        unsigned tid = *active_threads++;
5712292SN/A        if (!willWB(tid))
5722292SN/A            return false;
5732292SN/A    }
5742292SN/A
5752292SN/A    return true;
5762292SN/A}
5772292SN/A
5782292SN/Atemplate<class Impl>
5792292SN/Avoid
5802292SN/ALSQ<Impl>::dumpInsts()
5812292SN/A{
5822980Sgblack@eecs.umich.edu    std::list<unsigned>::iterator active_threads = (*activeThreads).begin();
5832292SN/A
5842292SN/A    while (active_threads != (*activeThreads).end()) {
5852292SN/A        unsigned tid = *active_threads++;
5862292SN/A        thread[tid].dumpInsts();
5872292SN/A    }
5882292SN/A}
589