lsq_impl.hh revision 8707
12292SN/A/*
28707Sandreas.hansson@arm.com * Copyright (c) 2011 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);
1148707Sandreas.hansson@arm.com        thread[tid].setDcachePort(cpu_ptr->getDcachePort());
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{
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());
3278707Sandreas.hansson@arm.com    if (pkt->isResponse()) {
3288707Sandreas.hansson@arm.com        thread[pkt->req->threadId()].completeDataAccess(pkt);
3298707Sandreas.hansson@arm.com    } else {
3308707Sandreas.hansson@arm.com        DPRINTF(LSQ, "received pkt for addr:%#x %s\n", pkt->getAddr(),
3318707Sandreas.hansson@arm.com                pkt->cmdString());
3328707Sandreas.hansson@arm.com
3338707Sandreas.hansson@arm.com        // must be a snoop
3348707Sandreas.hansson@arm.com        if (pkt->isInvalidate()) {
3358707Sandreas.hansson@arm.com            DPRINTF(LSQ, "received invalidation for addr:%#x\n",
3368707Sandreas.hansson@arm.com                    pkt->getAddr());
3378707Sandreas.hansson@arm.com            for (ThreadID tid = 0; tid < numThreads; tid++) {
3388707Sandreas.hansson@arm.com                thread[tid].checkSnoop(pkt);
3398707Sandreas.hansson@arm.com            }
3408707Sandreas.hansson@arm.com        }
3418707Sandreas.hansson@arm.com        // to provide stronger consistency model
3428707Sandreas.hansson@arm.com    }
3438707Sandreas.hansson@arm.com    return true;
3448707Sandreas.hansson@arm.com}
3458707Sandreas.hansson@arm.com
3462292SN/Atemplate<class Impl>
3472292SN/Aint
3482292SN/ALSQ<Impl>::getCount()
3492292SN/A{
3502292SN/A    unsigned total = 0;
3512292SN/A
3526221Snate@binkert.org    list<ThreadID>::iterator threads = activeThreads->begin();
3536221Snate@binkert.org    list<ThreadID>::iterator end = activeThreads->end();
3542292SN/A
3553867Sbinkertn@umich.edu    while (threads != end) {
3566221Snate@binkert.org        ThreadID tid = *threads++;
3573867Sbinkertn@umich.edu
3582292SN/A        total += getCount(tid);
3592292SN/A    }
3602292SN/A
3612292SN/A    return total;
3622292SN/A}
3632292SN/A
3642292SN/Atemplate<class Impl>
3652292SN/Aint
3662292SN/ALSQ<Impl>::numLoads()
3672292SN/A{
3682292SN/A    unsigned total = 0;
3692292SN/A
3706221Snate@binkert.org    list<ThreadID>::iterator threads = activeThreads->begin();
3716221Snate@binkert.org    list<ThreadID>::iterator end = activeThreads->end();
3722292SN/A
3733867Sbinkertn@umich.edu    while (threads != end) {
3746221Snate@binkert.org        ThreadID tid = *threads++;
3753867Sbinkertn@umich.edu
3762292SN/A        total += numLoads(tid);
3772292SN/A    }
3782292SN/A
3792292SN/A    return total;
3802292SN/A}
3812292SN/A
3822292SN/Atemplate<class Impl>
3832292SN/Aint
3842292SN/ALSQ<Impl>::numStores()
3852292SN/A{
3862292SN/A    unsigned total = 0;
3872292SN/A
3886221Snate@binkert.org    list<ThreadID>::iterator threads = activeThreads->begin();
3896221Snate@binkert.org    list<ThreadID>::iterator end = activeThreads->end();
3902292SN/A
3913867Sbinkertn@umich.edu    while (threads != end) {
3926221Snate@binkert.org        ThreadID tid = *threads++;
3933867Sbinkertn@umich.edu
3942292SN/A        total += thread[tid].numStores();
3952292SN/A    }
3962292SN/A
3972292SN/A    return total;
3982292SN/A}
3992292SN/A
4002292SN/Atemplate<class Impl>
4012292SN/Aint
4022292SN/ALSQ<Impl>::numLoadsReady()
4032292SN/A{
4042292SN/A    unsigned total = 0;
4052292SN/A
4066221Snate@binkert.org    list<ThreadID>::iterator threads = activeThreads->begin();
4076221Snate@binkert.org    list<ThreadID>::iterator end = activeThreads->end();
4082292SN/A
4093867Sbinkertn@umich.edu    while (threads != end) {
4106221Snate@binkert.org        ThreadID tid = *threads++;
4113867Sbinkertn@umich.edu
4122292SN/A        total += thread[tid].numLoadsReady();
4132292SN/A    }
4142292SN/A
4152292SN/A    return total;
4162292SN/A}
4172292SN/A
4182292SN/Atemplate<class Impl>
4192292SN/Aunsigned
4202292SN/ALSQ<Impl>::numFreeEntries()
4212292SN/A{
4222292SN/A    unsigned total = 0;
4232292SN/A
4246221Snate@binkert.org    list<ThreadID>::iterator threads = activeThreads->begin();
4256221Snate@binkert.org    list<ThreadID>::iterator end = activeThreads->end();
4262292SN/A
4273867Sbinkertn@umich.edu    while (threads != end) {
4286221Snate@binkert.org        ThreadID tid = *threads++;
4293867Sbinkertn@umich.edu
4302292SN/A        total += thread[tid].numFreeEntries();
4312292SN/A    }
4322292SN/A
4332292SN/A    return total;
4342292SN/A}
4352292SN/A
4362292SN/Atemplate<class Impl>
4372292SN/Aunsigned
4386221Snate@binkert.orgLSQ<Impl>::numFreeEntries(ThreadID tid)
4392292SN/A{
4403870Sbinkertn@umich.edu    //if (lsqPolicy == Dynamic)
4412292SN/A    //return numFreeEntries();
4422292SN/A    //else
4432292SN/A        return thread[tid].numFreeEntries();
4442292SN/A}
4452292SN/A
4462292SN/Atemplate<class Impl>
4472292SN/Abool
4482292SN/ALSQ<Impl>::isFull()
4492292SN/A{
4506221Snate@binkert.org    list<ThreadID>::iterator threads = activeThreads->begin();
4516221Snate@binkert.org    list<ThreadID>::iterator end = activeThreads->end();
4522292SN/A
4533867Sbinkertn@umich.edu    while (threads != end) {
4546221Snate@binkert.org        ThreadID tid = *threads++;
4553867Sbinkertn@umich.edu
4563867Sbinkertn@umich.edu        if (!(thread[tid].lqFull() || thread[tid].sqFull()))
4572292SN/A            return false;
4582292SN/A    }
4592292SN/A
4602292SN/A    return true;
4612292SN/A}
4622292SN/A
4632292SN/Atemplate<class Impl>
4642292SN/Abool
4656221Snate@binkert.orgLSQ<Impl>::isFull(ThreadID tid)
4662292SN/A{
4672292SN/A    //@todo: Change to Calculate All Entries for
4682292SN/A    //Dynamic Policy
4693867Sbinkertn@umich.edu    if (lsqPolicy == Dynamic)
4702292SN/A        return isFull();
4712292SN/A    else
4722292SN/A        return thread[tid].lqFull() || thread[tid].sqFull();
4732292SN/A}
4742292SN/A
4752292SN/Atemplate<class Impl>
4762292SN/Abool
4772292SN/ALSQ<Impl>::lqFull()
4782292SN/A{
4796221Snate@binkert.org    list<ThreadID>::iterator threads = activeThreads->begin();
4806221Snate@binkert.org    list<ThreadID>::iterator end = activeThreads->end();
4812292SN/A
4823867Sbinkertn@umich.edu    while (threads != end) {
4836221Snate@binkert.org        ThreadID tid = *threads++;
4843867Sbinkertn@umich.edu
4852292SN/A        if (!thread[tid].lqFull())
4862292SN/A            return false;
4872292SN/A    }
4882292SN/A
4892292SN/A    return true;
4902292SN/A}
4912292SN/A
4922292SN/Atemplate<class Impl>
4932292SN/Abool
4946221Snate@binkert.orgLSQ<Impl>::lqFull(ThreadID tid)
4952292SN/A{
4962292SN/A    //@todo: Change to Calculate All Entries for
4972292SN/A    //Dynamic Policy
4983870Sbinkertn@umich.edu    if (lsqPolicy == Dynamic)
4992292SN/A        return lqFull();
5002292SN/A    else
5012292SN/A        return thread[tid].lqFull();
5022292SN/A}
5032292SN/A
5042292SN/Atemplate<class Impl>
5052292SN/Abool
5062292SN/ALSQ<Impl>::sqFull()
5072292SN/A{
5086221Snate@binkert.org    list<ThreadID>::iterator threads = activeThreads->begin();
5096221Snate@binkert.org    list<ThreadID>::iterator end = activeThreads->end();
5102292SN/A
5113867Sbinkertn@umich.edu    while (threads != end) {
5126221Snate@binkert.org        ThreadID tid = *threads++;
5133867Sbinkertn@umich.edu
5142292SN/A        if (!sqFull(tid))
5152292SN/A            return false;
5162292SN/A    }
5172292SN/A
5182292SN/A    return true;
5192292SN/A}
5202292SN/A
5212292SN/Atemplate<class Impl>
5222292SN/Abool
5236221Snate@binkert.orgLSQ<Impl>::sqFull(ThreadID tid)
5242292SN/A{
5252292SN/A     //@todo: Change to Calculate All Entries for
5262292SN/A    //Dynamic Policy
5273870Sbinkertn@umich.edu    if (lsqPolicy == Dynamic)
5282292SN/A        return sqFull();
5292292SN/A    else
5302292SN/A        return thread[tid].sqFull();
5312292SN/A}
5322292SN/A
5332292SN/Atemplate<class Impl>
5342292SN/Abool
5352292SN/ALSQ<Impl>::isStalled()
5362292SN/A{
5376221Snate@binkert.org    list<ThreadID>::iterator threads = activeThreads->begin();
5386221Snate@binkert.org    list<ThreadID>::iterator end = activeThreads->end();
5392292SN/A
5403867Sbinkertn@umich.edu    while (threads != end) {
5416221Snate@binkert.org        ThreadID tid = *threads++;
5423867Sbinkertn@umich.edu
5432292SN/A        if (!thread[tid].isStalled())
5442292SN/A            return false;
5452292SN/A    }
5462292SN/A
5472292SN/A    return true;
5482292SN/A}
5492292SN/A
5502292SN/Atemplate<class Impl>
5512292SN/Abool
5526221Snate@binkert.orgLSQ<Impl>::isStalled(ThreadID tid)
5532292SN/A{
5543870Sbinkertn@umich.edu    if (lsqPolicy == Dynamic)
5552292SN/A        return isStalled();
5562292SN/A    else
5572292SN/A        return thread[tid].isStalled();
5582292SN/A}
5592292SN/A
5602292SN/Atemplate<class Impl>
5612292SN/Abool
5622292SN/ALSQ<Impl>::hasStoresToWB()
5632292SN/A{
5646221Snate@binkert.org    list<ThreadID>::iterator threads = activeThreads->begin();
5656221Snate@binkert.org    list<ThreadID>::iterator end = activeThreads->end();
5662292SN/A
5673867Sbinkertn@umich.edu    while (threads != end) {
5686221Snate@binkert.org        ThreadID tid = *threads++;
5693867Sbinkertn@umich.edu
5705557Sktlim@umich.edu        if (hasStoresToWB(tid))
5715557Sktlim@umich.edu            return true;
5722292SN/A    }
5732292SN/A
5745557Sktlim@umich.edu    return false;
5752292SN/A}
5762292SN/A
5772292SN/Atemplate<class Impl>
5782292SN/Abool
5792292SN/ALSQ<Impl>::willWB()
5802292SN/A{
5816221Snate@binkert.org    list<ThreadID>::iterator threads = activeThreads->begin();
5826221Snate@binkert.org    list<ThreadID>::iterator end = activeThreads->end();
5832292SN/A
5843867Sbinkertn@umich.edu    while (threads != end) {
5856221Snate@binkert.org        ThreadID tid = *threads++;
5863867Sbinkertn@umich.edu
5875557Sktlim@umich.edu        if (willWB(tid))
5885557Sktlim@umich.edu            return true;
5892292SN/A    }
5902292SN/A
5915557Sktlim@umich.edu    return false;
5922292SN/A}
5932292SN/A
5942292SN/Atemplate<class Impl>
5952292SN/Avoid
5962292SN/ALSQ<Impl>::dumpInsts()
5972292SN/A{
5986221Snate@binkert.org    list<ThreadID>::iterator threads = activeThreads->begin();
5996221Snate@binkert.org    list<ThreadID>::iterator end = activeThreads->end();
6002292SN/A
6013867Sbinkertn@umich.edu    while (threads != end) {
6026221Snate@binkert.org        ThreadID tid = *threads++;
6033867Sbinkertn@umich.edu
6042292SN/A        thread[tid].dumpInsts();
6052292SN/A    }
6062292SN/A}
607