lsq_impl.hh revision 8975
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/Aint
4042292SN/ALSQ<Impl>::numLoadsReady()
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].numLoadsReady();
4152292SN/A    }
4162292SN/A
4172292SN/A    return total;
4182292SN/A}
4192292SN/A
4202292SN/Atemplate<class Impl>
4212292SN/Aunsigned
4222292SN/ALSQ<Impl>::numFreeEntries()
4232292SN/A{
4242292SN/A    unsigned total = 0;
4252292SN/A
4266221Snate@binkert.org    list<ThreadID>::iterator threads = activeThreads->begin();
4276221Snate@binkert.org    list<ThreadID>::iterator end = activeThreads->end();
4282292SN/A
4293867Sbinkertn@umich.edu    while (threads != end) {
4306221Snate@binkert.org        ThreadID tid = *threads++;
4313867Sbinkertn@umich.edu
4322292SN/A        total += thread[tid].numFreeEntries();
4332292SN/A    }
4342292SN/A
4352292SN/A    return total;
4362292SN/A}
4372292SN/A
4382292SN/Atemplate<class Impl>
4392292SN/Aunsigned
4406221Snate@binkert.orgLSQ<Impl>::numFreeEntries(ThreadID tid)
4412292SN/A{
4423870Sbinkertn@umich.edu    //if (lsqPolicy == Dynamic)
4432292SN/A    //return numFreeEntries();
4442292SN/A    //else
4452292SN/A        return thread[tid].numFreeEntries();
4462292SN/A}
4472292SN/A
4482292SN/Atemplate<class Impl>
4492292SN/Abool
4502292SN/ALSQ<Impl>::isFull()
4512292SN/A{
4526221Snate@binkert.org    list<ThreadID>::iterator threads = activeThreads->begin();
4536221Snate@binkert.org    list<ThreadID>::iterator end = activeThreads->end();
4542292SN/A
4553867Sbinkertn@umich.edu    while (threads != end) {
4566221Snate@binkert.org        ThreadID tid = *threads++;
4573867Sbinkertn@umich.edu
4583867Sbinkertn@umich.edu        if (!(thread[tid].lqFull() || thread[tid].sqFull()))
4592292SN/A            return false;
4602292SN/A    }
4612292SN/A
4622292SN/A    return true;
4632292SN/A}
4642292SN/A
4652292SN/Atemplate<class Impl>
4662292SN/Abool
4676221Snate@binkert.orgLSQ<Impl>::isFull(ThreadID tid)
4682292SN/A{
4692292SN/A    //@todo: Change to Calculate All Entries for
4702292SN/A    //Dynamic Policy
4713867Sbinkertn@umich.edu    if (lsqPolicy == Dynamic)
4722292SN/A        return isFull();
4732292SN/A    else
4742292SN/A        return thread[tid].lqFull() || thread[tid].sqFull();
4752292SN/A}
4762292SN/A
4772292SN/Atemplate<class Impl>
4782292SN/Abool
4792292SN/ALSQ<Impl>::lqFull()
4802292SN/A{
4816221Snate@binkert.org    list<ThreadID>::iterator threads = activeThreads->begin();
4826221Snate@binkert.org    list<ThreadID>::iterator end = activeThreads->end();
4832292SN/A
4843867Sbinkertn@umich.edu    while (threads != end) {
4856221Snate@binkert.org        ThreadID tid = *threads++;
4863867Sbinkertn@umich.edu
4872292SN/A        if (!thread[tid].lqFull())
4882292SN/A            return false;
4892292SN/A    }
4902292SN/A
4912292SN/A    return true;
4922292SN/A}
4932292SN/A
4942292SN/Atemplate<class Impl>
4952292SN/Abool
4966221Snate@binkert.orgLSQ<Impl>::lqFull(ThreadID tid)
4972292SN/A{
4982292SN/A    //@todo: Change to Calculate All Entries for
4992292SN/A    //Dynamic Policy
5003870Sbinkertn@umich.edu    if (lsqPolicy == Dynamic)
5012292SN/A        return lqFull();
5022292SN/A    else
5032292SN/A        return thread[tid].lqFull();
5042292SN/A}
5052292SN/A
5062292SN/Atemplate<class Impl>
5072292SN/Abool
5082292SN/ALSQ<Impl>::sqFull()
5092292SN/A{
5106221Snate@binkert.org    list<ThreadID>::iterator threads = activeThreads->begin();
5116221Snate@binkert.org    list<ThreadID>::iterator end = activeThreads->end();
5122292SN/A
5133867Sbinkertn@umich.edu    while (threads != end) {
5146221Snate@binkert.org        ThreadID tid = *threads++;
5153867Sbinkertn@umich.edu
5162292SN/A        if (!sqFull(tid))
5172292SN/A            return false;
5182292SN/A    }
5192292SN/A
5202292SN/A    return true;
5212292SN/A}
5222292SN/A
5232292SN/Atemplate<class Impl>
5242292SN/Abool
5256221Snate@binkert.orgLSQ<Impl>::sqFull(ThreadID tid)
5262292SN/A{
5272292SN/A     //@todo: Change to Calculate All Entries for
5282292SN/A    //Dynamic Policy
5293870Sbinkertn@umich.edu    if (lsqPolicy == Dynamic)
5302292SN/A        return sqFull();
5312292SN/A    else
5322292SN/A        return thread[tid].sqFull();
5332292SN/A}
5342292SN/A
5352292SN/Atemplate<class Impl>
5362292SN/Abool
5372292SN/ALSQ<Impl>::isStalled()
5382292SN/A{
5396221Snate@binkert.org    list<ThreadID>::iterator threads = activeThreads->begin();
5406221Snate@binkert.org    list<ThreadID>::iterator end = activeThreads->end();
5412292SN/A
5423867Sbinkertn@umich.edu    while (threads != end) {
5436221Snate@binkert.org        ThreadID tid = *threads++;
5443867Sbinkertn@umich.edu
5452292SN/A        if (!thread[tid].isStalled())
5462292SN/A            return false;
5472292SN/A    }
5482292SN/A
5492292SN/A    return true;
5502292SN/A}
5512292SN/A
5522292SN/Atemplate<class Impl>
5532292SN/Abool
5546221Snate@binkert.orgLSQ<Impl>::isStalled(ThreadID tid)
5552292SN/A{
5563870Sbinkertn@umich.edu    if (lsqPolicy == Dynamic)
5572292SN/A        return isStalled();
5582292SN/A    else
5592292SN/A        return thread[tid].isStalled();
5602292SN/A}
5612292SN/A
5622292SN/Atemplate<class Impl>
5632292SN/Abool
5642292SN/ALSQ<Impl>::hasStoresToWB()
5652292SN/A{
5666221Snate@binkert.org    list<ThreadID>::iterator threads = activeThreads->begin();
5676221Snate@binkert.org    list<ThreadID>::iterator end = activeThreads->end();
5682292SN/A
5693867Sbinkertn@umich.edu    while (threads != end) {
5706221Snate@binkert.org        ThreadID tid = *threads++;
5713867Sbinkertn@umich.edu
5725557Sktlim@umich.edu        if (hasStoresToWB(tid))
5735557Sktlim@umich.edu            return true;
5742292SN/A    }
5752292SN/A
5765557Sktlim@umich.edu    return false;
5772292SN/A}
5782292SN/A
5792292SN/Atemplate<class Impl>
5802292SN/Abool
5812292SN/ALSQ<Impl>::willWB()
5822292SN/A{
5836221Snate@binkert.org    list<ThreadID>::iterator threads = activeThreads->begin();
5846221Snate@binkert.org    list<ThreadID>::iterator end = activeThreads->end();
5852292SN/A
5863867Sbinkertn@umich.edu    while (threads != end) {
5876221Snate@binkert.org        ThreadID tid = *threads++;
5883867Sbinkertn@umich.edu
5895557Sktlim@umich.edu        if (willWB(tid))
5905557Sktlim@umich.edu            return true;
5912292SN/A    }
5922292SN/A
5935557Sktlim@umich.edu    return false;
5942292SN/A}
5952292SN/A
5962292SN/Atemplate<class Impl>
5972292SN/Avoid
5982292SN/ALSQ<Impl>::dumpInsts()
5992292SN/A{
6006221Snate@binkert.org    list<ThreadID>::iterator threads = activeThreads->begin();
6016221Snate@binkert.org    list<ThreadID>::iterator end = activeThreads->end();
6022292SN/A
6033867Sbinkertn@umich.edu    while (threads != end) {
6046221Snate@binkert.org        ThreadID tid = *threads++;
6053867Sbinkertn@umich.edu
6062292SN/A        thread[tid].dumpInsts();
6072292SN/A    }
6082292SN/A}
609