iew_impl.hh revision 3093
11689SN/A/* 22326SN/A * Copyright (c) 2004-2006 The Regents of The University of Michigan 31689SN/A * All rights reserved. 41689SN/A * 51689SN/A * Redistribution and use in source and binary forms, with or without 61689SN/A * modification, are permitted provided that the following conditions are 71689SN/A * met: redistributions of source code must retain the above copyright 81689SN/A * notice, this list of conditions and the following disclaimer; 91689SN/A * redistributions in binary form must reproduce the above copyright 101689SN/A * notice, this list of conditions and the following disclaimer in the 111689SN/A * documentation and/or other materials provided with the distribution; 121689SN/A * neither the name of the copyright holders nor the names of its 131689SN/A * contributors may be used to endorse or promote products derived from 141689SN/A * this software without specific prior written permission. 151689SN/A * 161689SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 171689SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 181689SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 191689SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 201689SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 211689SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 221689SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 231689SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 241689SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 251689SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 261689SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 272665Ssaidi@eecs.umich.edu * 282665Ssaidi@eecs.umich.edu * Authors: Kevin Lim 291689SN/A */ 301689SN/A 311060SN/A// @todo: Fix the instantaneous communication among all the stages within 321060SN/A// iew. There's a clear delay between issue and execute, yet backwards 331689SN/A// communication happens simultaneously. 341060SN/A 351060SN/A#include <queue> 361060SN/A 371060SN/A#include "base/timebuf.hh" 382292SN/A#include "cpu/o3/fu_pool.hh" 391717SN/A#include "cpu/o3/iew.hh" 401060SN/A 411681SN/Atemplate<class Impl> 422292SN/ADefaultIEW<Impl>::DefaultIEW(Params *params) 432873Sktlim@umich.edu : issueToExecQueue(params->backComSize, params->forwardComSize), 441060SN/A instQueue(params), 451061SN/A ldstQueue(params), 462292SN/A fuPool(params->fuPool), 472292SN/A commitToIEWDelay(params->commitToIEWDelay), 482292SN/A renameToIEWDelay(params->renameToIEWDelay), 492292SN/A issueToExecuteDelay(params->issueToExecuteDelay), 502820Sktlim@umich.edu dispatchWidth(params->dispatchWidth), 512292SN/A issueWidth(params->issueWidth), 522820Sktlim@umich.edu wbOutstanding(0), 532820Sktlim@umich.edu wbWidth(params->wbWidth), 542307SN/A numThreads(params->numberOfThreads), 552307SN/A switchedOut(false) 561060SN/A{ 572292SN/A _status = Active; 582292SN/A exeStatus = Running; 592292SN/A wbStatus = Idle; 601060SN/A 611060SN/A // Setup wire to read instructions coming from issue. 621060SN/A fromIssue = issueToExecQueue.getWire(-issueToExecuteDelay); 631060SN/A 641060SN/A // Instruction queue needs the queue between issue and execute. 651060SN/A instQueue.setIssueToExecuteQueue(&issueToExecQueue); 661681SN/A 672292SN/A instQueue.setIEW(this); 681681SN/A ldstQueue.setIEW(this); 692292SN/A 702292SN/A for (int i=0; i < numThreads; i++) { 712292SN/A dispatchStatus[i] = Running; 722292SN/A stalls[i].commit = false; 732292SN/A fetchRedirect[i] = false; 742935Sksewell@umich.edu bdelayDoneSeqNum[i] = 0; 752292SN/A } 762292SN/A 772820Sktlim@umich.edu wbMax = wbWidth * params->wbDepth; 782820Sktlim@umich.edu 792292SN/A updateLSQNextCycle = false; 802292SN/A 812820Sktlim@umich.edu ableToIssue = true; 822820Sktlim@umich.edu 832292SN/A skidBufferMax = (3 * (renameToIEWDelay * params->renameWidth)) + issueWidth; 842292SN/A} 852292SN/A 862292SN/Atemplate <class Impl> 872292SN/Astd::string 882292SN/ADefaultIEW<Impl>::name() const 892292SN/A{ 902292SN/A return cpu->name() + ".iew"; 911060SN/A} 921060SN/A 931681SN/Atemplate <class Impl> 941062SN/Avoid 952292SN/ADefaultIEW<Impl>::regStats() 961062SN/A{ 972301SN/A using namespace Stats; 982301SN/A 991062SN/A instQueue.regStats(); 1002727Sktlim@umich.edu ldstQueue.regStats(); 1011062SN/A 1021062SN/A iewIdleCycles 1031062SN/A .name(name() + ".iewIdleCycles") 1041062SN/A .desc("Number of cycles IEW is idle"); 1051062SN/A 1061062SN/A iewSquashCycles 1071062SN/A .name(name() + ".iewSquashCycles") 1081062SN/A .desc("Number of cycles IEW is squashing"); 1091062SN/A 1101062SN/A iewBlockCycles 1111062SN/A .name(name() + ".iewBlockCycles") 1121062SN/A .desc("Number of cycles IEW is blocking"); 1131062SN/A 1141062SN/A iewUnblockCycles 1151062SN/A .name(name() + ".iewUnblockCycles") 1161062SN/A .desc("Number of cycles IEW is unblocking"); 1171062SN/A 1181062SN/A iewDispatchedInsts 1191062SN/A .name(name() + ".iewDispatchedInsts") 1201062SN/A .desc("Number of instructions dispatched to IQ"); 1211062SN/A 1221062SN/A iewDispSquashedInsts 1231062SN/A .name(name() + ".iewDispSquashedInsts") 1241062SN/A .desc("Number of squashed instructions skipped by dispatch"); 1251062SN/A 1261062SN/A iewDispLoadInsts 1271062SN/A .name(name() + ".iewDispLoadInsts") 1281062SN/A .desc("Number of dispatched load instructions"); 1291062SN/A 1301062SN/A iewDispStoreInsts 1311062SN/A .name(name() + ".iewDispStoreInsts") 1321062SN/A .desc("Number of dispatched store instructions"); 1331062SN/A 1341062SN/A iewDispNonSpecInsts 1351062SN/A .name(name() + ".iewDispNonSpecInsts") 1361062SN/A .desc("Number of dispatched non-speculative instructions"); 1371062SN/A 1381062SN/A iewIQFullEvents 1391062SN/A .name(name() + ".iewIQFullEvents") 1401062SN/A .desc("Number of times the IQ has become full, causing a stall"); 1411062SN/A 1422292SN/A iewLSQFullEvents 1432292SN/A .name(name() + ".iewLSQFullEvents") 1442292SN/A .desc("Number of times the LSQ has become full, causing a stall"); 1452292SN/A 1461062SN/A memOrderViolationEvents 1471062SN/A .name(name() + ".memOrderViolationEvents") 1481062SN/A .desc("Number of memory order violations"); 1491062SN/A 1501062SN/A predictedTakenIncorrect 1511062SN/A .name(name() + ".predictedTakenIncorrect") 1521062SN/A .desc("Number of branches that were predicted taken incorrectly"); 1532292SN/A 1542292SN/A predictedNotTakenIncorrect 1552292SN/A .name(name() + ".predictedNotTakenIncorrect") 1562292SN/A .desc("Number of branches that were predicted not taken incorrectly"); 1572292SN/A 1582292SN/A branchMispredicts 1592292SN/A .name(name() + ".branchMispredicts") 1602292SN/A .desc("Number of branch mispredicts detected at execute"); 1612292SN/A 1622292SN/A branchMispredicts = predictedTakenIncorrect + predictedNotTakenIncorrect; 1632301SN/A 1642727Sktlim@umich.edu iewExecutedInsts 1652727Sktlim@umich.edu .name(name() + ".EXEC:insts") 1662727Sktlim@umich.edu .desc("Number of executed instructions"); 1672727Sktlim@umich.edu 1682727Sktlim@umich.edu iewExecLoadInsts 1692727Sktlim@umich.edu .init(cpu->number_of_threads) 1702727Sktlim@umich.edu .name(name() + ".EXEC:loads") 1712727Sktlim@umich.edu .desc("Number of load instructions executed") 1722727Sktlim@umich.edu .flags(total); 1732727Sktlim@umich.edu 1742727Sktlim@umich.edu iewExecSquashedInsts 1752727Sktlim@umich.edu .name(name() + ".EXEC:squashedInsts") 1762727Sktlim@umich.edu .desc("Number of squashed instructions skipped in execute"); 1772727Sktlim@umich.edu 1782727Sktlim@umich.edu iewExecutedSwp 1792301SN/A .init(cpu->number_of_threads) 1802301SN/A .name(name() + ".EXEC:swp") 1812301SN/A .desc("number of swp insts executed") 1822727Sktlim@umich.edu .flags(total); 1832301SN/A 1842727Sktlim@umich.edu iewExecutedNop 1852301SN/A .init(cpu->number_of_threads) 1862301SN/A .name(name() + ".EXEC:nop") 1872301SN/A .desc("number of nop insts executed") 1882727Sktlim@umich.edu .flags(total); 1892301SN/A 1902727Sktlim@umich.edu iewExecutedRefs 1912301SN/A .init(cpu->number_of_threads) 1922301SN/A .name(name() + ".EXEC:refs") 1932301SN/A .desc("number of memory reference insts executed") 1942727Sktlim@umich.edu .flags(total); 1952301SN/A 1962727Sktlim@umich.edu iewExecutedBranches 1972301SN/A .init(cpu->number_of_threads) 1982301SN/A .name(name() + ".EXEC:branches") 1992301SN/A .desc("Number of branches executed") 2002727Sktlim@umich.edu .flags(total); 2012301SN/A 2022301SN/A iewExecStoreInsts 2032301SN/A .name(name() + ".EXEC:stores") 2042301SN/A .desc("Number of stores executed") 2052727Sktlim@umich.edu .flags(total); 2062727Sktlim@umich.edu iewExecStoreInsts = iewExecutedRefs - iewExecLoadInsts; 2072727Sktlim@umich.edu 2082727Sktlim@umich.edu iewExecRate 2092727Sktlim@umich.edu .name(name() + ".EXEC:rate") 2102727Sktlim@umich.edu .desc("Inst execution rate") 2112727Sktlim@umich.edu .flags(total); 2122727Sktlim@umich.edu 2132727Sktlim@umich.edu iewExecRate = iewExecutedInsts / cpu->numCycles; 2142301SN/A 2152301SN/A iewInstsToCommit 2162301SN/A .init(cpu->number_of_threads) 2172301SN/A .name(name() + ".WB:sent") 2182301SN/A .desc("cumulative count of insts sent to commit") 2192727Sktlim@umich.edu .flags(total); 2202301SN/A 2212326SN/A writebackCount 2222301SN/A .init(cpu->number_of_threads) 2232301SN/A .name(name() + ".WB:count") 2242301SN/A .desc("cumulative count of insts written-back") 2252727Sktlim@umich.edu .flags(total); 2262301SN/A 2272326SN/A producerInst 2282301SN/A .init(cpu->number_of_threads) 2292301SN/A .name(name() + ".WB:producers") 2302301SN/A .desc("num instructions producing a value") 2312727Sktlim@umich.edu .flags(total); 2322301SN/A 2332326SN/A consumerInst 2342301SN/A .init(cpu->number_of_threads) 2352301SN/A .name(name() + ".WB:consumers") 2362301SN/A .desc("num instructions consuming a value") 2372727Sktlim@umich.edu .flags(total); 2382301SN/A 2392326SN/A wbPenalized 2402301SN/A .init(cpu->number_of_threads) 2412301SN/A .name(name() + ".WB:penalized") 2422301SN/A .desc("number of instrctions required to write to 'other' IQ") 2432727Sktlim@umich.edu .flags(total); 2442301SN/A 2452326SN/A wbPenalizedRate 2462301SN/A .name(name() + ".WB:penalized_rate") 2472301SN/A .desc ("fraction of instructions written-back that wrote to 'other' IQ") 2482727Sktlim@umich.edu .flags(total); 2492301SN/A 2502326SN/A wbPenalizedRate = wbPenalized / writebackCount; 2512301SN/A 2522326SN/A wbFanout 2532301SN/A .name(name() + ".WB:fanout") 2542301SN/A .desc("average fanout of values written-back") 2552727Sktlim@umich.edu .flags(total); 2562301SN/A 2572326SN/A wbFanout = producerInst / consumerInst; 2582301SN/A 2592326SN/A wbRate 2602301SN/A .name(name() + ".WB:rate") 2612301SN/A .desc("insts written-back per cycle") 2622727Sktlim@umich.edu .flags(total); 2632326SN/A wbRate = writebackCount / cpu->numCycles; 2641062SN/A} 2651062SN/A 2661681SN/Atemplate<class Impl> 2671060SN/Avoid 2682292SN/ADefaultIEW<Impl>::initStage() 2691060SN/A{ 2702292SN/A for (int tid=0; tid < numThreads; tid++) { 2712292SN/A toRename->iewInfo[tid].usedIQ = true; 2722292SN/A toRename->iewInfo[tid].freeIQEntries = 2732292SN/A instQueue.numFreeEntries(tid); 2742292SN/A 2752292SN/A toRename->iewInfo[tid].usedLSQ = true; 2762292SN/A toRename->iewInfo[tid].freeLSQEntries = 2772292SN/A ldstQueue.numFreeEntries(tid); 2782292SN/A } 2792292SN/A} 2802292SN/A 2812292SN/Atemplate<class Impl> 2822292SN/Avoid 2832733Sktlim@umich.eduDefaultIEW<Impl>::setCPU(O3CPU *cpu_ptr) 2842292SN/A{ 2852292SN/A DPRINTF(IEW, "Setting CPU pointer.\n"); 2861060SN/A cpu = cpu_ptr; 2871060SN/A 2881060SN/A instQueue.setCPU(cpu_ptr); 2891061SN/A ldstQueue.setCPU(cpu_ptr); 2902292SN/A 2912733Sktlim@umich.edu cpu->activateStage(O3CPU::IEWIdx); 2921060SN/A} 2931060SN/A 2941681SN/Atemplate<class Impl> 2951060SN/Avoid 2962292SN/ADefaultIEW<Impl>::setTimeBuffer(TimeBuffer<TimeStruct> *tb_ptr) 2971060SN/A{ 2982292SN/A DPRINTF(IEW, "Setting time buffer pointer.\n"); 2991060SN/A timeBuffer = tb_ptr; 3001060SN/A 3011060SN/A // Setup wire to read information from time buffer, from commit. 3021060SN/A fromCommit = timeBuffer->getWire(-commitToIEWDelay); 3031060SN/A 3041060SN/A // Setup wire to write information back to previous stages. 3051060SN/A toRename = timeBuffer->getWire(0); 3061060SN/A 3072292SN/A toFetch = timeBuffer->getWire(0); 3082292SN/A 3091060SN/A // Instruction queue also needs main time buffer. 3101060SN/A instQueue.setTimeBuffer(tb_ptr); 3111060SN/A} 3121060SN/A 3131681SN/Atemplate<class Impl> 3141060SN/Avoid 3152292SN/ADefaultIEW<Impl>::setRenameQueue(TimeBuffer<RenameStruct> *rq_ptr) 3161060SN/A{ 3172292SN/A DPRINTF(IEW, "Setting rename queue pointer.\n"); 3181060SN/A renameQueue = rq_ptr; 3191060SN/A 3201060SN/A // Setup wire to read information from rename queue. 3211060SN/A fromRename = renameQueue->getWire(-renameToIEWDelay); 3221060SN/A} 3231060SN/A 3241681SN/Atemplate<class Impl> 3251060SN/Avoid 3262292SN/ADefaultIEW<Impl>::setIEWQueue(TimeBuffer<IEWStruct> *iq_ptr) 3271060SN/A{ 3282292SN/A DPRINTF(IEW, "Setting IEW queue pointer.\n"); 3291060SN/A iewQueue = iq_ptr; 3301060SN/A 3311060SN/A // Setup wire to write instructions to commit. 3321060SN/A toCommit = iewQueue->getWire(0); 3331060SN/A} 3341060SN/A 3351681SN/Atemplate<class Impl> 3361060SN/Avoid 3372980Sgblack@eecs.umich.eduDefaultIEW<Impl>::setActiveThreads(std::list<unsigned> *at_ptr) 3381060SN/A{ 3392292SN/A DPRINTF(IEW, "Setting active threads list pointer.\n"); 3402292SN/A activeThreads = at_ptr; 3412292SN/A 3422292SN/A ldstQueue.setActiveThreads(at_ptr); 3432292SN/A instQueue.setActiveThreads(at_ptr); 3441060SN/A} 3451060SN/A 3461681SN/Atemplate<class Impl> 3471060SN/Avoid 3482292SN/ADefaultIEW<Impl>::setScoreboard(Scoreboard *sb_ptr) 3491060SN/A{ 3502292SN/A DPRINTF(IEW, "Setting scoreboard pointer.\n"); 3512292SN/A scoreboard = sb_ptr; 3521060SN/A} 3531060SN/A 3542307SN/Atemplate <class Impl> 3552863Sktlim@umich.edubool 3562843Sktlim@umich.eduDefaultIEW<Impl>::drain() 3572307SN/A{ 3582843Sktlim@umich.edu // IEW is ready to drain at any time. 3592843Sktlim@umich.edu cpu->signalDrained(); 3602863Sktlim@umich.edu return true; 3611681SN/A} 3621681SN/A 3632316SN/Atemplate <class Impl> 3641681SN/Avoid 3652843Sktlim@umich.eduDefaultIEW<Impl>::resume() 3662843Sktlim@umich.edu{ 3672843Sktlim@umich.edu} 3682843Sktlim@umich.edu 3692843Sktlim@umich.edutemplate <class Impl> 3702843Sktlim@umich.eduvoid 3712843Sktlim@umich.eduDefaultIEW<Impl>::switchOut() 3721681SN/A{ 3732348SN/A // Clear any state. 3742307SN/A switchedOut = true; 3751681SN/A 3762307SN/A instQueue.switchOut(); 3772307SN/A ldstQueue.switchOut(); 3782307SN/A fuPool->switchOut(); 3792307SN/A 3802307SN/A for (int i = 0; i < numThreads; i++) { 3812307SN/A while (!insts[i].empty()) 3822307SN/A insts[i].pop(); 3832307SN/A while (!skidBuffer[i].empty()) 3842307SN/A skidBuffer[i].pop(); 3852307SN/A } 3861681SN/A} 3871681SN/A 3882307SN/Atemplate <class Impl> 3891681SN/Avoid 3902307SN/ADefaultIEW<Impl>::takeOverFrom() 3911060SN/A{ 3922348SN/A // Reset all state. 3932307SN/A _status = Active; 3942307SN/A exeStatus = Running; 3952307SN/A wbStatus = Idle; 3962307SN/A switchedOut = false; 3971060SN/A 3982307SN/A instQueue.takeOverFrom(); 3992307SN/A ldstQueue.takeOverFrom(); 4002307SN/A fuPool->takeOverFrom(); 4011060SN/A 4022307SN/A initStage(); 4032307SN/A cpu->activityThisCycle(); 4041060SN/A 4052307SN/A for (int i=0; i < numThreads; i++) { 4062307SN/A dispatchStatus[i] = Running; 4072307SN/A stalls[i].commit = false; 4082307SN/A fetchRedirect[i] = false; 4092307SN/A } 4101060SN/A 4112307SN/A updateLSQNextCycle = false; 4122307SN/A 4132307SN/A // @todo: Fix hardcoded number 4142873Sktlim@umich.edu for (int i = 0; i < issueToExecQueue.getSize(); ++i) { 4152307SN/A issueToExecQueue.advance(); 4161060SN/A } 4171060SN/A} 4181060SN/A 4191681SN/Atemplate<class Impl> 4201060SN/Avoid 4212292SN/ADefaultIEW<Impl>::squash(unsigned tid) 4222107SN/A{ 4232292SN/A DPRINTF(IEW, "[tid:%i]: Squashing all instructions.\n", 4242292SN/A tid); 4252107SN/A 4262292SN/A // Tell the IQ to start squashing. 4272292SN/A instQueue.squash(tid); 4282107SN/A 4292292SN/A // Tell the LDSTQ to start squashing. 4303093Sksewell@umich.edu#if ISA_HAS_DELAY_SLOT 4313093Sksewell@umich.edu ldstQueue.squash(fromCommit->commitInfo[tid].bdelayDoneSeqNum, tid); 4323093Sksewell@umich.edu#else 4332326SN/A ldstQueue.squash(fromCommit->commitInfo[tid].doneSeqNum, tid); 4342935Sksewell@umich.edu#endif 4352292SN/A updatedQueues = true; 4362107SN/A 4372292SN/A // Clear the skid buffer in case it has any data in it. 4382935Sksewell@umich.edu DPRINTF(IEW, "[tid:%i]: Removing skidbuffer instructions until [sn:%i].\n", 4392935Sksewell@umich.edu tid, fromCommit->commitInfo[tid].bdelayDoneSeqNum); 4402935Sksewell@umich.edu 4412292SN/A while (!skidBuffer[tid].empty()) { 4423093Sksewell@umich.edu#if ISA_HAS_DELAY_SLOT 4432935Sksewell@umich.edu if (skidBuffer[tid].front()->seqNum <= 4442935Sksewell@umich.edu fromCommit->commitInfo[tid].bdelayDoneSeqNum) { 4452935Sksewell@umich.edu DPRINTF(IEW, "[tid:%i]: Cannot remove skidbuffer instructions " 4462935Sksewell@umich.edu "that occur before delay slot [sn:%i].\n", 4472935Sksewell@umich.edu fromCommit->commitInfo[tid].bdelayDoneSeqNum, 4482935Sksewell@umich.edu tid); 4492935Sksewell@umich.edu break; 4502935Sksewell@umich.edu } else { 4512935Sksewell@umich.edu DPRINTF(IEW, "[tid:%i]: Removing instruction [sn:%i] from " 4522935Sksewell@umich.edu "skidBuffer.\n", tid, skidBuffer[tid].front()->seqNum); 4532935Sksewell@umich.edu } 4542935Sksewell@umich.edu#endif 4552292SN/A if (skidBuffer[tid].front()->isLoad() || 4562292SN/A skidBuffer[tid].front()->isStore() ) { 4572292SN/A toRename->iewInfo[tid].dispatchedToLSQ++; 4582292SN/A } 4592107SN/A 4602292SN/A toRename->iewInfo[tid].dispatched++; 4612107SN/A 4622292SN/A skidBuffer[tid].pop(); 4632292SN/A } 4642107SN/A 4652935Sksewell@umich.edu bdelayDoneSeqNum[tid] = fromCommit->commitInfo[tid].bdelayDoneSeqNum; 4662935Sksewell@umich.edu 4672702Sktlim@umich.edu emptyRenameInsts(tid); 4682107SN/A} 4692107SN/A 4702107SN/Atemplate<class Impl> 4712107SN/Avoid 4722292SN/ADefaultIEW<Impl>::squashDueToBranch(DynInstPtr &inst, unsigned tid) 4732292SN/A{ 4742292SN/A DPRINTF(IEW, "[tid:%i]: Squashing from a specific instruction, PC: %#x " 4752292SN/A "[sn:%i].\n", tid, inst->readPC(), inst->seqNum); 4762292SN/A 4772292SN/A toCommit->squash[tid] = true; 4782292SN/A toCommit->squashedSeqNum[tid] = inst->seqNum; 4792292SN/A toCommit->mispredPC[tid] = inst->readPC(); 4802292SN/A toCommit->branchMispredict[tid] = true; 4812935Sksewell@umich.edu 4823093Sksewell@umich.edu#if ISA_HAS_DELAY_SLOT 4832935Sksewell@umich.edu bool branch_taken = inst->readNextNPC() != 4842935Sksewell@umich.edu (inst->readNextPC() + sizeof(TheISA::MachInst)); 4852935Sksewell@umich.edu 4862935Sksewell@umich.edu toCommit->branchTaken[tid] = branch_taken; 4872935Sksewell@umich.edu 4882935Sksewell@umich.edu toCommit->condDelaySlotBranch[tid] = inst->isCondDelaySlot(); 4892935Sksewell@umich.edu 4902935Sksewell@umich.edu if (inst->isCondDelaySlot() && branch_taken) { 4912935Sksewell@umich.edu toCommit->nextPC[tid] = inst->readNextPC(); 4922935Sksewell@umich.edu } else { 4932935Sksewell@umich.edu toCommit->nextPC[tid] = inst->readNextNPC(); 4942935Sksewell@umich.edu } 4953093Sksewell@umich.edu#else 4963093Sksewell@umich.edu toCommit->branchTaken[tid] = inst->readNextPC() != 4973093Sksewell@umich.edu (inst->readPC() + sizeof(TheISA::MachInst)); 4983093Sksewell@umich.edu toCommit->nextPC[tid] = inst->readNextPC(); 4992935Sksewell@umich.edu#endif 5002292SN/A 5012292SN/A toCommit->includeSquashInst[tid] = false; 5022292SN/A 5032292SN/A wroteToTimeBuffer = true; 5042292SN/A} 5052292SN/A 5062292SN/Atemplate<class Impl> 5072292SN/Avoid 5082292SN/ADefaultIEW<Impl>::squashDueToMemOrder(DynInstPtr &inst, unsigned tid) 5092292SN/A{ 5102292SN/A DPRINTF(IEW, "[tid:%i]: Squashing from a specific instruction, " 5112292SN/A "PC: %#x [sn:%i].\n", tid, inst->readPC(), inst->seqNum); 5122292SN/A 5132292SN/A toCommit->squash[tid] = true; 5142292SN/A toCommit->squashedSeqNum[tid] = inst->seqNum; 5152292SN/A toCommit->nextPC[tid] = inst->readNextPC(); 5162292SN/A 5172292SN/A toCommit->includeSquashInst[tid] = false; 5182292SN/A 5192292SN/A wroteToTimeBuffer = true; 5202292SN/A} 5212292SN/A 5222292SN/Atemplate<class Impl> 5232292SN/Avoid 5242292SN/ADefaultIEW<Impl>::squashDueToMemBlocked(DynInstPtr &inst, unsigned tid) 5252292SN/A{ 5262292SN/A DPRINTF(IEW, "[tid:%i]: Memory blocked, squashing load and younger insts, " 5272292SN/A "PC: %#x [sn:%i].\n", tid, inst->readPC(), inst->seqNum); 5282292SN/A 5292292SN/A toCommit->squash[tid] = true; 5302292SN/A toCommit->squashedSeqNum[tid] = inst->seqNum; 5312292SN/A toCommit->nextPC[tid] = inst->readPC(); 5322292SN/A 5332348SN/A // Must include the broadcasted SN in the squash. 5342292SN/A toCommit->includeSquashInst[tid] = true; 5352292SN/A 5362292SN/A ldstQueue.setLoadBlockedHandled(tid); 5372292SN/A 5382292SN/A wroteToTimeBuffer = true; 5392292SN/A} 5402292SN/A 5412292SN/Atemplate<class Impl> 5422292SN/Avoid 5432292SN/ADefaultIEW<Impl>::block(unsigned tid) 5442292SN/A{ 5452292SN/A DPRINTF(IEW, "[tid:%u]: Blocking.\n", tid); 5462292SN/A 5472292SN/A if (dispatchStatus[tid] != Blocked && 5482292SN/A dispatchStatus[tid] != Unblocking) { 5492292SN/A toRename->iewBlock[tid] = true; 5502292SN/A wroteToTimeBuffer = true; 5512292SN/A } 5522292SN/A 5532292SN/A // Add the current inputs to the skid buffer so they can be 5542292SN/A // reprocessed when this stage unblocks. 5552292SN/A skidInsert(tid); 5562292SN/A 5572292SN/A dispatchStatus[tid] = Blocked; 5582292SN/A} 5592292SN/A 5602292SN/Atemplate<class Impl> 5612292SN/Avoid 5622292SN/ADefaultIEW<Impl>::unblock(unsigned tid) 5632292SN/A{ 5642292SN/A DPRINTF(IEW, "[tid:%i]: Reading instructions out of the skid " 5652292SN/A "buffer %u.\n",tid, tid); 5662292SN/A 5672292SN/A // If the skid bufffer is empty, signal back to previous stages to unblock. 5682292SN/A // Also switch status to running. 5692292SN/A if (skidBuffer[tid].empty()) { 5702292SN/A toRename->iewUnblock[tid] = true; 5712292SN/A wroteToTimeBuffer = true; 5722292SN/A DPRINTF(IEW, "[tid:%i]: Done unblocking.\n",tid); 5732292SN/A dispatchStatus[tid] = Running; 5742292SN/A } 5752292SN/A} 5762292SN/A 5772292SN/Atemplate<class Impl> 5782292SN/Avoid 5792292SN/ADefaultIEW<Impl>::wakeDependents(DynInstPtr &inst) 5801060SN/A{ 5811681SN/A instQueue.wakeDependents(inst); 5821060SN/A} 5831060SN/A 5842292SN/Atemplate<class Impl> 5852292SN/Avoid 5862292SN/ADefaultIEW<Impl>::rescheduleMemInst(DynInstPtr &inst) 5872292SN/A{ 5882292SN/A instQueue.rescheduleMemInst(inst); 5892292SN/A} 5901681SN/A 5911681SN/Atemplate<class Impl> 5921060SN/Avoid 5932292SN/ADefaultIEW<Impl>::replayMemInst(DynInstPtr &inst) 5941060SN/A{ 5952292SN/A instQueue.replayMemInst(inst); 5962292SN/A} 5971060SN/A 5982292SN/Atemplate<class Impl> 5992292SN/Avoid 6002292SN/ADefaultIEW<Impl>::instToCommit(DynInstPtr &inst) 6012292SN/A{ 6022292SN/A // First check the time slot that this instruction will write 6032292SN/A // to. If there are free write ports at the time, then go ahead 6042292SN/A // and write the instruction to that time. If there are not, 6052292SN/A // keep looking back to see where's the first time there's a 6062326SN/A // free slot. 6072292SN/A while ((*iewQueue)[wbCycle].insts[wbNumInst]) { 6082292SN/A ++wbNumInst; 6092820Sktlim@umich.edu if (wbNumInst == wbWidth) { 6102292SN/A ++wbCycle; 6112292SN/A wbNumInst = 0; 6122292SN/A } 6132292SN/A 6142820Sktlim@umich.edu assert((wbCycle * wbWidth + wbNumInst) < wbMax); 6152292SN/A } 6162292SN/A 6172292SN/A // Add finished instruction to queue to commit. 6182292SN/A (*iewQueue)[wbCycle].insts[wbNumInst] = inst; 6192292SN/A (*iewQueue)[wbCycle].size++; 6202292SN/A} 6212292SN/A 6222292SN/Atemplate <class Impl> 6232292SN/Aunsigned 6242292SN/ADefaultIEW<Impl>::validInstsFromRename() 6252292SN/A{ 6262292SN/A unsigned inst_count = 0; 6272292SN/A 6282292SN/A for (int i=0; i<fromRename->size; i++) { 6292731Sktlim@umich.edu if (!fromRename->insts[i]->isSquashed()) 6302292SN/A inst_count++; 6312292SN/A } 6322292SN/A 6332292SN/A return inst_count; 6342292SN/A} 6352292SN/A 6362292SN/Atemplate<class Impl> 6372292SN/Avoid 6382292SN/ADefaultIEW<Impl>::skidInsert(unsigned tid) 6392292SN/A{ 6402292SN/A DynInstPtr inst = NULL; 6412292SN/A 6422292SN/A while (!insts[tid].empty()) { 6432292SN/A inst = insts[tid].front(); 6442292SN/A 6452292SN/A insts[tid].pop(); 6462292SN/A 6472292SN/A DPRINTF(Decode,"[tid:%i]: Inserting [sn:%lli] PC:%#x into " 6482292SN/A "dispatch skidBuffer %i\n",tid, inst->seqNum, 6492292SN/A inst->readPC(),tid); 6502292SN/A 6512292SN/A skidBuffer[tid].push(inst); 6522292SN/A } 6532292SN/A 6542292SN/A assert(skidBuffer[tid].size() <= skidBufferMax && 6552292SN/A "Skidbuffer Exceeded Max Size"); 6562292SN/A} 6572292SN/A 6582292SN/Atemplate<class Impl> 6592292SN/Aint 6602292SN/ADefaultIEW<Impl>::skidCount() 6612292SN/A{ 6622292SN/A int max=0; 6632292SN/A 6642980Sgblack@eecs.umich.edu std::list<unsigned>::iterator threads = (*activeThreads).begin(); 6652292SN/A 6662292SN/A while (threads != (*activeThreads).end()) { 6672292SN/A unsigned thread_count = skidBuffer[*threads++].size(); 6682292SN/A if (max < thread_count) 6692292SN/A max = thread_count; 6702292SN/A } 6712292SN/A 6722292SN/A return max; 6732292SN/A} 6742292SN/A 6752292SN/Atemplate<class Impl> 6762292SN/Abool 6772292SN/ADefaultIEW<Impl>::skidsEmpty() 6782292SN/A{ 6792980Sgblack@eecs.umich.edu std::list<unsigned>::iterator threads = (*activeThreads).begin(); 6802292SN/A 6812292SN/A while (threads != (*activeThreads).end()) { 6822292SN/A if (!skidBuffer[*threads++].empty()) 6832292SN/A return false; 6842292SN/A } 6852292SN/A 6862292SN/A return true; 6871062SN/A} 6881062SN/A 6891681SN/Atemplate <class Impl> 6901062SN/Avoid 6912292SN/ADefaultIEW<Impl>::updateStatus() 6921062SN/A{ 6932292SN/A bool any_unblocking = false; 6941062SN/A 6952980Sgblack@eecs.umich.edu std::list<unsigned>::iterator threads = (*activeThreads).begin(); 6961062SN/A 6972292SN/A threads = (*activeThreads).begin(); 6981062SN/A 6992292SN/A while (threads != (*activeThreads).end()) { 7002292SN/A unsigned tid = *threads++; 7011062SN/A 7022292SN/A if (dispatchStatus[tid] == Unblocking) { 7032292SN/A any_unblocking = true; 7042292SN/A break; 7052292SN/A } 7062292SN/A } 7071062SN/A 7082292SN/A // If there are no ready instructions waiting to be scheduled by the IQ, 7092292SN/A // and there's no stores waiting to write back, and dispatch is not 7102292SN/A // unblocking, then there is no internal activity for the IEW stage. 7112292SN/A if (_status == Active && !instQueue.hasReadyInsts() && 7122292SN/A !ldstQueue.willWB() && !any_unblocking) { 7132292SN/A DPRINTF(IEW, "IEW switching to idle\n"); 7141062SN/A 7152292SN/A deactivateStage(); 7161062SN/A 7172292SN/A _status = Inactive; 7182292SN/A } else if (_status == Inactive && (instQueue.hasReadyInsts() || 7192292SN/A ldstQueue.willWB() || 7202292SN/A any_unblocking)) { 7212292SN/A // Otherwise there is internal activity. Set to active. 7222292SN/A DPRINTF(IEW, "IEW switching to active\n"); 7231062SN/A 7242292SN/A activateStage(); 7251062SN/A 7262292SN/A _status = Active; 7271062SN/A } 7281062SN/A} 7291062SN/A 7301681SN/Atemplate <class Impl> 7311062SN/Avoid 7322292SN/ADefaultIEW<Impl>::resetEntries() 7331062SN/A{ 7342292SN/A instQueue.resetEntries(); 7352292SN/A ldstQueue.resetEntries(); 7362292SN/A} 7371062SN/A 7382292SN/Atemplate <class Impl> 7392292SN/Avoid 7402292SN/ADefaultIEW<Impl>::readStallSignals(unsigned tid) 7412292SN/A{ 7422292SN/A if (fromCommit->commitBlock[tid]) { 7432292SN/A stalls[tid].commit = true; 7442292SN/A } 7451062SN/A 7462292SN/A if (fromCommit->commitUnblock[tid]) { 7472292SN/A assert(stalls[tid].commit); 7482292SN/A stalls[tid].commit = false; 7492292SN/A } 7502292SN/A} 7512292SN/A 7522292SN/Atemplate <class Impl> 7532292SN/Abool 7542292SN/ADefaultIEW<Impl>::checkStall(unsigned tid) 7552292SN/A{ 7562292SN/A bool ret_val(false); 7572292SN/A 7582292SN/A if (stalls[tid].commit) { 7592292SN/A DPRINTF(IEW,"[tid:%i]: Stall from Commit stage detected.\n",tid); 7602292SN/A ret_val = true; 7612292SN/A } else if (instQueue.isFull(tid)) { 7622292SN/A DPRINTF(IEW,"[tid:%i]: Stall: IQ is full.\n",tid); 7632292SN/A ret_val = true; 7642292SN/A } else if (ldstQueue.isFull(tid)) { 7652292SN/A DPRINTF(IEW,"[tid:%i]: Stall: LSQ is full\n",tid); 7662292SN/A 7672292SN/A if (ldstQueue.numLoads(tid) > 0 ) { 7682292SN/A 7692292SN/A DPRINTF(IEW,"[tid:%i]: LSQ oldest load: [sn:%i] \n", 7702292SN/A tid,ldstQueue.getLoadHeadSeqNum(tid)); 7712292SN/A } 7722292SN/A 7732292SN/A if (ldstQueue.numStores(tid) > 0) { 7742292SN/A 7752292SN/A DPRINTF(IEW,"[tid:%i]: LSQ oldest store: [sn:%i] \n", 7762292SN/A tid,ldstQueue.getStoreHeadSeqNum(tid)); 7772292SN/A } 7782292SN/A 7792292SN/A ret_val = true; 7802292SN/A } else if (ldstQueue.isStalled(tid)) { 7812292SN/A DPRINTF(IEW,"[tid:%i]: Stall: LSQ stall detected.\n",tid); 7822292SN/A ret_val = true; 7832292SN/A } 7842292SN/A 7852292SN/A return ret_val; 7862292SN/A} 7872292SN/A 7882292SN/Atemplate <class Impl> 7892292SN/Avoid 7902292SN/ADefaultIEW<Impl>::checkSignalsAndUpdate(unsigned tid) 7912292SN/A{ 7922292SN/A // Check if there's a squash signal, squash if there is 7932292SN/A // Check stall signals, block if there is. 7942292SN/A // If status was Blocked 7952292SN/A // if so then go to unblocking 7962292SN/A // If status was Squashing 7972292SN/A // check if squashing is not high. Switch to running this cycle. 7982292SN/A 7992292SN/A readStallSignals(tid); 8002292SN/A 8012292SN/A if (fromCommit->commitInfo[tid].squash) { 8022292SN/A squash(tid); 8032292SN/A 8042292SN/A if (dispatchStatus[tid] == Blocked || 8052292SN/A dispatchStatus[tid] == Unblocking) { 8062292SN/A toRename->iewUnblock[tid] = true; 8072292SN/A wroteToTimeBuffer = true; 8082292SN/A } 8092292SN/A 8102292SN/A dispatchStatus[tid] = Squashing; 8112292SN/A 8122292SN/A fetchRedirect[tid] = false; 8132292SN/A return; 8142292SN/A } 8152292SN/A 8162292SN/A if (fromCommit->commitInfo[tid].robSquashing) { 8172702Sktlim@umich.edu DPRINTF(IEW, "[tid:%i]: ROB is still squashing.\n", tid); 8182292SN/A 8192292SN/A dispatchStatus[tid] = Squashing; 8202292SN/A 8212702Sktlim@umich.edu emptyRenameInsts(tid); 8222702Sktlim@umich.edu wroteToTimeBuffer = true; 8232292SN/A return; 8242292SN/A } 8252292SN/A 8262292SN/A if (checkStall(tid)) { 8272292SN/A block(tid); 8282292SN/A dispatchStatus[tid] = Blocked; 8292292SN/A return; 8302292SN/A } 8312292SN/A 8322292SN/A if (dispatchStatus[tid] == Blocked) { 8332292SN/A // Status from previous cycle was blocked, but there are no more stall 8342292SN/A // conditions. Switch over to unblocking. 8352292SN/A DPRINTF(IEW, "[tid:%i]: Done blocking, switching to unblocking.\n", 8362292SN/A tid); 8372292SN/A 8382292SN/A dispatchStatus[tid] = Unblocking; 8392292SN/A 8402292SN/A unblock(tid); 8412292SN/A 8422292SN/A return; 8432292SN/A } 8442292SN/A 8452292SN/A if (dispatchStatus[tid] == Squashing) { 8462292SN/A // Switch status to running if rename isn't being told to block or 8472292SN/A // squash this cycle. 8482292SN/A DPRINTF(IEW, "[tid:%i]: Done squashing, switching to running.\n", 8492292SN/A tid); 8502292SN/A 8512292SN/A dispatchStatus[tid] = Running; 8522292SN/A 8532292SN/A return; 8542292SN/A } 8552292SN/A} 8562292SN/A 8572292SN/Atemplate <class Impl> 8582292SN/Avoid 8592292SN/ADefaultIEW<Impl>::sortInsts() 8602292SN/A{ 8612292SN/A int insts_from_rename = fromRename->size; 8622326SN/A#ifdef DEBUG 8633093Sksewell@umich.edu#if !ISA_HAS_DELAY_SLOT 8642292SN/A for (int i = 0; i < numThreads; i++) 8652292SN/A assert(insts[i].empty()); 8662326SN/A#endif 8672935Sksewell@umich.edu#endif 8682292SN/A for (int i = 0; i < insts_from_rename; ++i) { 8692292SN/A insts[fromRename->insts[i]->threadNumber].push(fromRename->insts[i]); 8702292SN/A } 8712292SN/A} 8722292SN/A 8732292SN/Atemplate <class Impl> 8742292SN/Avoid 8752702Sktlim@umich.eduDefaultIEW<Impl>::emptyRenameInsts(unsigned tid) 8762702Sktlim@umich.edu{ 8772935Sksewell@umich.edu DPRINTF(IEW, "[tid:%i]: Removing incoming rename instructions until " 8782935Sksewell@umich.edu "[sn:%i].\n", tid, bdelayDoneSeqNum[tid]); 8792935Sksewell@umich.edu 8802702Sktlim@umich.edu while (!insts[tid].empty()) { 8813093Sksewell@umich.edu#if ISA_HAS_DELAY_SLOT 8822935Sksewell@umich.edu if (insts[tid].front()->seqNum <= bdelayDoneSeqNum[tid]) { 8832935Sksewell@umich.edu DPRINTF(IEW, "[tid:%i]: Done removing, cannot remove instruction" 8842935Sksewell@umich.edu " that occurs at or before delay slot [sn:%i].\n", 8852935Sksewell@umich.edu tid, bdelayDoneSeqNum[tid]); 8862935Sksewell@umich.edu break; 8872935Sksewell@umich.edu } else { 8882935Sksewell@umich.edu DPRINTF(IEW, "[tid:%i]: Removing incoming rename instruction " 8892935Sksewell@umich.edu "[sn:%i].\n", tid, insts[tid].front()->seqNum); 8902935Sksewell@umich.edu } 8912935Sksewell@umich.edu#endif 8922935Sksewell@umich.edu 8932702Sktlim@umich.edu if (insts[tid].front()->isLoad() || 8942702Sktlim@umich.edu insts[tid].front()->isStore() ) { 8952702Sktlim@umich.edu toRename->iewInfo[tid].dispatchedToLSQ++; 8962702Sktlim@umich.edu } 8972702Sktlim@umich.edu 8982702Sktlim@umich.edu toRename->iewInfo[tid].dispatched++; 8992702Sktlim@umich.edu 9002702Sktlim@umich.edu insts[tid].pop(); 9012702Sktlim@umich.edu } 9022702Sktlim@umich.edu} 9032702Sktlim@umich.edu 9042702Sktlim@umich.edutemplate <class Impl> 9052702Sktlim@umich.eduvoid 9062292SN/ADefaultIEW<Impl>::wakeCPU() 9072292SN/A{ 9082292SN/A cpu->wakeCPU(); 9092292SN/A} 9102292SN/A 9112292SN/Atemplate <class Impl> 9122292SN/Avoid 9132292SN/ADefaultIEW<Impl>::activityThisCycle() 9142292SN/A{ 9152292SN/A DPRINTF(Activity, "Activity this cycle.\n"); 9162292SN/A cpu->activityThisCycle(); 9172292SN/A} 9182292SN/A 9192292SN/Atemplate <class Impl> 9202292SN/Ainline void 9212292SN/ADefaultIEW<Impl>::activateStage() 9222292SN/A{ 9232292SN/A DPRINTF(Activity, "Activating stage.\n"); 9242733Sktlim@umich.edu cpu->activateStage(O3CPU::IEWIdx); 9252292SN/A} 9262292SN/A 9272292SN/Atemplate <class Impl> 9282292SN/Ainline void 9292292SN/ADefaultIEW<Impl>::deactivateStage() 9302292SN/A{ 9312292SN/A DPRINTF(Activity, "Deactivating stage.\n"); 9322733Sktlim@umich.edu cpu->deactivateStage(O3CPU::IEWIdx); 9332292SN/A} 9342292SN/A 9352292SN/Atemplate<class Impl> 9362292SN/Avoid 9372292SN/ADefaultIEW<Impl>::dispatch(unsigned tid) 9382292SN/A{ 9392292SN/A // If status is Running or idle, 9402292SN/A // call dispatchInsts() 9412292SN/A // If status is Unblocking, 9422292SN/A // buffer any instructions coming from rename 9432292SN/A // continue trying to empty skid buffer 9442292SN/A // check if stall conditions have passed 9452292SN/A 9462292SN/A if (dispatchStatus[tid] == Blocked) { 9472292SN/A ++iewBlockCycles; 9482292SN/A 9492292SN/A } else if (dispatchStatus[tid] == Squashing) { 9502292SN/A ++iewSquashCycles; 9512292SN/A } 9522292SN/A 9532292SN/A // Dispatch should try to dispatch as many instructions as its bandwidth 9542292SN/A // will allow, as long as it is not currently blocked. 9552292SN/A if (dispatchStatus[tid] == Running || 9562292SN/A dispatchStatus[tid] == Idle) { 9572292SN/A DPRINTF(IEW, "[tid:%i] Not blocked, so attempting to run " 9582292SN/A "dispatch.\n", tid); 9592292SN/A 9602292SN/A dispatchInsts(tid); 9612292SN/A } else if (dispatchStatus[tid] == Unblocking) { 9622292SN/A // Make sure that the skid buffer has something in it if the 9632292SN/A // status is unblocking. 9642292SN/A assert(!skidsEmpty()); 9652292SN/A 9662292SN/A // If the status was unblocking, then instructions from the skid 9672292SN/A // buffer were used. Remove those instructions and handle 9682292SN/A // the rest of unblocking. 9692292SN/A dispatchInsts(tid); 9702292SN/A 9712292SN/A ++iewUnblockCycles; 9722292SN/A 9732292SN/A if (validInstsFromRename() && dispatchedAllInsts) { 9742292SN/A // Add the current inputs to the skid buffer so they can be 9752292SN/A // reprocessed when this stage unblocks. 9762292SN/A skidInsert(tid); 9772292SN/A } 9782292SN/A 9792292SN/A unblock(tid); 9802292SN/A } 9812292SN/A} 9822292SN/A 9832292SN/Atemplate <class Impl> 9842292SN/Avoid 9852292SN/ADefaultIEW<Impl>::dispatchInsts(unsigned tid) 9862292SN/A{ 9872292SN/A dispatchedAllInsts = true; 9882292SN/A 9892292SN/A // Obtain instructions from skid buffer if unblocking, or queue from rename 9902292SN/A // otherwise. 9912292SN/A std::queue<DynInstPtr> &insts_to_dispatch = 9922292SN/A dispatchStatus[tid] == Unblocking ? 9932292SN/A skidBuffer[tid] : insts[tid]; 9942292SN/A 9952292SN/A int insts_to_add = insts_to_dispatch.size(); 9962292SN/A 9972292SN/A DynInstPtr inst; 9982292SN/A bool add_to_iq = false; 9992292SN/A int dis_num_inst = 0; 10002292SN/A 10012292SN/A // Loop through the instructions, putting them in the instruction 10022292SN/A // queue. 10032292SN/A for ( ; dis_num_inst < insts_to_add && 10042820Sktlim@umich.edu dis_num_inst < dispatchWidth; 10052292SN/A ++dis_num_inst) 10062292SN/A { 10072292SN/A inst = insts_to_dispatch.front(); 10082292SN/A 10092292SN/A if (dispatchStatus[tid] == Unblocking) { 10102292SN/A DPRINTF(IEW, "[tid:%i]: Issue: Examining instruction from skid " 10112292SN/A "buffer\n", tid); 10122292SN/A } 10132292SN/A 10142292SN/A // Make sure there's a valid instruction there. 10152292SN/A assert(inst); 10162292SN/A 10172292SN/A DPRINTF(IEW, "[tid:%i]: Issue: Adding PC %#x [sn:%lli] [tid:%i] to " 10182292SN/A "IQ.\n", 10192292SN/A tid, inst->readPC(), inst->seqNum, inst->threadNumber); 10202292SN/A 10212292SN/A // Be sure to mark these instructions as ready so that the 10222292SN/A // commit stage can go ahead and execute them, and mark 10232292SN/A // them as issued so the IQ doesn't reprocess them. 10242292SN/A 10252292SN/A // Check for squashed instructions. 10262292SN/A if (inst->isSquashed()) { 10272292SN/A DPRINTF(IEW, "[tid:%i]: Issue: Squashed instruction encountered, " 10282292SN/A "not adding to IQ.\n", tid); 10292292SN/A 10302292SN/A ++iewDispSquashedInsts; 10312292SN/A 10322292SN/A insts_to_dispatch.pop(); 10332292SN/A 10342292SN/A //Tell Rename That An Instruction has been processed 10352292SN/A if (inst->isLoad() || inst->isStore()) { 10362292SN/A toRename->iewInfo[tid].dispatchedToLSQ++; 10372292SN/A } 10382292SN/A toRename->iewInfo[tid].dispatched++; 10392292SN/A 10402292SN/A continue; 10412292SN/A } 10422292SN/A 10432292SN/A // Check for full conditions. 10442292SN/A if (instQueue.isFull(tid)) { 10452292SN/A DPRINTF(IEW, "[tid:%i]: Issue: IQ has become full.\n", tid); 10462292SN/A 10472292SN/A // Call function to start blocking. 10482292SN/A block(tid); 10492292SN/A 10502292SN/A // Set unblock to false. Special case where we are using 10512292SN/A // skidbuffer (unblocking) instructions but then we still 10522292SN/A // get full in the IQ. 10532292SN/A toRename->iewUnblock[tid] = false; 10542292SN/A 10552292SN/A dispatchedAllInsts = false; 10562292SN/A 10572292SN/A ++iewIQFullEvents; 10582292SN/A break; 10592292SN/A } else if (ldstQueue.isFull(tid)) { 10602292SN/A DPRINTF(IEW, "[tid:%i]: Issue: LSQ has become full.\n",tid); 10612292SN/A 10622292SN/A // Call function to start blocking. 10632292SN/A block(tid); 10642292SN/A 10652292SN/A // Set unblock to false. Special case where we are using 10662292SN/A // skidbuffer (unblocking) instructions but then we still 10672292SN/A // get full in the IQ. 10682292SN/A toRename->iewUnblock[tid] = false; 10692292SN/A 10702292SN/A dispatchedAllInsts = false; 10712292SN/A 10722292SN/A ++iewLSQFullEvents; 10732292SN/A break; 10742292SN/A } 10752292SN/A 10762292SN/A // Otherwise issue the instruction just fine. 10772292SN/A if (inst->isLoad()) { 10782292SN/A DPRINTF(IEW, "[tid:%i]: Issue: Memory instruction " 10792292SN/A "encountered, adding to LSQ.\n", tid); 10802292SN/A 10812292SN/A // Reserve a spot in the load store queue for this 10822292SN/A // memory access. 10832292SN/A ldstQueue.insertLoad(inst); 10842292SN/A 10852292SN/A ++iewDispLoadInsts; 10862292SN/A 10872292SN/A add_to_iq = true; 10882292SN/A 10892292SN/A toRename->iewInfo[tid].dispatchedToLSQ++; 10902292SN/A } else if (inst->isStore()) { 10912292SN/A DPRINTF(IEW, "[tid:%i]: Issue: Memory instruction " 10922292SN/A "encountered, adding to LSQ.\n", tid); 10932292SN/A 10942292SN/A ldstQueue.insertStore(inst); 10952292SN/A 10962292SN/A ++iewDispStoreInsts; 10972292SN/A 10982336SN/A if (inst->isStoreConditional()) { 10992336SN/A // Store conditionals need to be set as "canCommit()" 11002336SN/A // so that commit can process them when they reach the 11012336SN/A // head of commit. 11022348SN/A // @todo: This is somewhat specific to Alpha. 11032292SN/A inst->setCanCommit(); 11042292SN/A instQueue.insertNonSpec(inst); 11052292SN/A add_to_iq = false; 11062292SN/A 11072292SN/A ++iewDispNonSpecInsts; 11082292SN/A } else { 11092292SN/A add_to_iq = true; 11102292SN/A } 11112292SN/A 11122292SN/A toRename->iewInfo[tid].dispatchedToLSQ++; 11132292SN/A#if FULL_SYSTEM 11142292SN/A } else if (inst->isMemBarrier() || inst->isWriteBarrier()) { 11152326SN/A // Same as non-speculative stores. 11162292SN/A inst->setCanCommit(); 11172292SN/A instQueue.insertBarrier(inst); 11182292SN/A add_to_iq = false; 11192292SN/A#endif 11202292SN/A } else if (inst->isNonSpeculative()) { 11212292SN/A DPRINTF(IEW, "[tid:%i]: Issue: Nonspeculative instruction " 11222292SN/A "encountered, skipping.\n", tid); 11232292SN/A 11242326SN/A // Same as non-speculative stores. 11252292SN/A inst->setCanCommit(); 11262292SN/A 11272292SN/A // Specifically insert it as nonspeculative. 11282292SN/A instQueue.insertNonSpec(inst); 11292292SN/A 11302292SN/A ++iewDispNonSpecInsts; 11312292SN/A 11322292SN/A add_to_iq = false; 11332292SN/A } else if (inst->isNop()) { 11342292SN/A DPRINTF(IEW, "[tid:%i]: Issue: Nop instruction encountered, " 11352292SN/A "skipping.\n", tid); 11362292SN/A 11372292SN/A inst->setIssued(); 11382292SN/A inst->setExecuted(); 11392292SN/A inst->setCanCommit(); 11402292SN/A 11412326SN/A instQueue.recordProducer(inst); 11422292SN/A 11432727Sktlim@umich.edu iewExecutedNop[tid]++; 11442301SN/A 11452292SN/A add_to_iq = false; 11462292SN/A } else if (inst->isExecuted()) { 11472292SN/A assert(0 && "Instruction shouldn't be executed.\n"); 11482292SN/A DPRINTF(IEW, "Issue: Executed branch encountered, " 11492292SN/A "skipping.\n"); 11502292SN/A 11512292SN/A inst->setIssued(); 11522292SN/A inst->setCanCommit(); 11532292SN/A 11542326SN/A instQueue.recordProducer(inst); 11552292SN/A 11562292SN/A add_to_iq = false; 11572292SN/A } else { 11582292SN/A add_to_iq = true; 11592292SN/A } 11602292SN/A 11612292SN/A // If the instruction queue is not full, then add the 11622292SN/A // instruction. 11632292SN/A if (add_to_iq) { 11642292SN/A instQueue.insert(inst); 11652292SN/A } 11662292SN/A 11672292SN/A insts_to_dispatch.pop(); 11682292SN/A 11692292SN/A toRename->iewInfo[tid].dispatched++; 11702292SN/A 11712292SN/A ++iewDispatchedInsts; 11722292SN/A } 11732292SN/A 11742292SN/A if (!insts_to_dispatch.empty()) { 11752935Sksewell@umich.edu DPRINTF(IEW,"[tid:%i]: Issue: Bandwidth Full. Blocking.\n", tid); 11762292SN/A block(tid); 11772292SN/A toRename->iewUnblock[tid] = false; 11782292SN/A } 11792292SN/A 11802292SN/A if (dispatchStatus[tid] == Idle && dis_num_inst) { 11812292SN/A dispatchStatus[tid] = Running; 11822292SN/A 11832292SN/A updatedQueues = true; 11842292SN/A } 11852292SN/A 11862292SN/A dis_num_inst = 0; 11872292SN/A} 11882292SN/A 11892292SN/Atemplate <class Impl> 11902292SN/Avoid 11912292SN/ADefaultIEW<Impl>::printAvailableInsts() 11922292SN/A{ 11932292SN/A int inst = 0; 11942292SN/A 11952980Sgblack@eecs.umich.edu std::cout << "Available Instructions: "; 11962292SN/A 11972292SN/A while (fromIssue->insts[inst]) { 11982292SN/A 11992980Sgblack@eecs.umich.edu if (inst%3==0) std::cout << "\n\t"; 12002292SN/A 12012980Sgblack@eecs.umich.edu std::cout << "PC: " << fromIssue->insts[inst]->readPC() 12022292SN/A << " TN: " << fromIssue->insts[inst]->threadNumber 12032292SN/A << " SN: " << fromIssue->insts[inst]->seqNum << " | "; 12042292SN/A 12052292SN/A inst++; 12062292SN/A 12072292SN/A } 12082292SN/A 12092980Sgblack@eecs.umich.edu std::cout << "\n"; 12102292SN/A} 12112292SN/A 12122292SN/Atemplate <class Impl> 12132292SN/Avoid 12142292SN/ADefaultIEW<Impl>::executeInsts() 12152292SN/A{ 12162292SN/A wbNumInst = 0; 12172292SN/A wbCycle = 0; 12182292SN/A 12192980Sgblack@eecs.umich.edu std::list<unsigned>::iterator threads = (*activeThreads).begin(); 12202292SN/A 12212292SN/A while (threads != (*activeThreads).end()) { 12222292SN/A unsigned tid = *threads++; 12232292SN/A fetchRedirect[tid] = false; 12242292SN/A } 12252292SN/A 12262698Sktlim@umich.edu // Uncomment this if you want to see all available instructions. 12272698Sktlim@umich.edu// printAvailableInsts(); 12281062SN/A 12291062SN/A // Execute/writeback any instructions that are available. 12302333SN/A int insts_to_execute = fromIssue->size; 12312292SN/A int inst_num = 0; 12322333SN/A for (; inst_num < insts_to_execute; 12332326SN/A ++inst_num) { 12341062SN/A 12352292SN/A DPRINTF(IEW, "Execute: Executing instructions from IQ.\n"); 12361062SN/A 12372333SN/A DynInstPtr inst = instQueue.getInstToExecute(); 12381062SN/A 12392292SN/A DPRINTF(IEW, "Execute: Processing PC %#x, [tid:%i] [sn:%i].\n", 12402292SN/A inst->readPC(), inst->threadNumber,inst->seqNum); 12411062SN/A 12421062SN/A // Check if the instruction is squashed; if so then skip it 12431062SN/A if (inst->isSquashed()) { 12442292SN/A DPRINTF(IEW, "Execute: Instruction was squashed.\n"); 12451062SN/A 12461062SN/A // Consider this instruction executed so that commit can go 12471062SN/A // ahead and retire the instruction. 12481062SN/A inst->setExecuted(); 12491062SN/A 12502292SN/A // Not sure if I should set this here or just let commit try to 12512292SN/A // commit any squashed instructions. I like the latter a bit more. 12522292SN/A inst->setCanCommit(); 12531062SN/A 12541062SN/A ++iewExecSquashedInsts; 12551062SN/A 12562820Sktlim@umich.edu decrWb(inst->seqNum); 12571062SN/A continue; 12581062SN/A } 12591062SN/A 12602292SN/A Fault fault = NoFault; 12611062SN/A 12621062SN/A // Execute instruction. 12631062SN/A // Note that if the instruction faults, it will be handled 12641062SN/A // at the commit stage. 12652292SN/A if (inst->isMemRef() && 12662292SN/A (!inst->isDataPrefetch() && !inst->isInstPrefetch())) { 12672292SN/A DPRINTF(IEW, "Execute: Calculating address for memory " 12681062SN/A "reference.\n"); 12691062SN/A 12701062SN/A // Tell the LDSTQ to execute this instruction (if it is a load). 12711062SN/A if (inst->isLoad()) { 12722292SN/A // Loads will mark themselves as executed, and their writeback 12732292SN/A // event adds the instruction to the queue to commit 12742292SN/A fault = ldstQueue.executeLoad(inst); 12751062SN/A } else if (inst->isStore()) { 12761681SN/A ldstQueue.executeStore(inst); 12771062SN/A 12782292SN/A // If the store had a fault then it may not have a mem req 12792669Sktlim@umich.edu if (inst->req && !(inst->req->getFlags() & LOCKED)) { 12802292SN/A inst->setExecuted(); 12812292SN/A 12822292SN/A instToCommit(inst); 12832292SN/A } 12842326SN/A 12852326SN/A // Store conditionals will mark themselves as 12862326SN/A // executed, and their writeback event will add the 12872326SN/A // instruction to the queue to commit. 12881062SN/A } else { 12892292SN/A panic("Unexpected memory type!\n"); 12901062SN/A } 12911062SN/A 12921062SN/A } else { 12931062SN/A inst->execute(); 12941062SN/A 12952292SN/A inst->setExecuted(); 12962292SN/A 12972292SN/A instToCommit(inst); 12981062SN/A } 12991062SN/A 13002301SN/A updateExeInstStats(inst); 13011681SN/A 13022326SN/A // Check if branch prediction was correct, if not then we need 13032326SN/A // to tell commit to squash in flight instructions. Only 13042326SN/A // handle this if there hasn't already been something that 13052107SN/A // redirects fetch in this group of instructions. 13061681SN/A 13072292SN/A // This probably needs to prioritize the redirects if a different 13082292SN/A // scheduler is used. Currently the scheduler schedules the oldest 13092292SN/A // instruction first, so the branch resolution order will be correct. 13102292SN/A unsigned tid = inst->threadNumber; 13111062SN/A 13122292SN/A if (!fetchRedirect[tid]) { 13131062SN/A 13141062SN/A if (inst->mispredicted()) { 13152292SN/A fetchRedirect[tid] = true; 13161062SN/A 13172292SN/A DPRINTF(IEW, "Execute: Branch mispredict detected.\n"); 13183093Sksewell@umich.edu#if ISA_HAS_DELAY_SLOT 13193093Sksewell@umich.edu DPRINTF(IEW, "Execute: Redirecting fetch to PC: %#x.\n", 13203093Sksewell@umich.edu inst->nextNPC); 13213093Sksewell@umich.edu#else 13222292SN/A DPRINTF(IEW, "Execute: Redirecting fetch to PC: %#x.\n", 13231062SN/A inst->nextPC); 13242935Sksewell@umich.edu#endif 13251062SN/A // If incorrect, then signal the ROB that it must be squashed. 13262292SN/A squashDueToBranch(inst, tid); 13271062SN/A 13281062SN/A if (inst->predTaken()) { 13291062SN/A predictedTakenIncorrect++; 13302292SN/A } else { 13312292SN/A predictedNotTakenIncorrect++; 13321062SN/A } 13332292SN/A } else if (ldstQueue.violation(tid)) { 13342292SN/A fetchRedirect[tid] = true; 13351062SN/A 13362326SN/A // If there was an ordering violation, then get the 13372326SN/A // DynInst that caused the violation. Note that this 13382292SN/A // clears the violation signal. 13392292SN/A DynInstPtr violator; 13402292SN/A violator = ldstQueue.getMemDepViolator(tid); 13411062SN/A 13422292SN/A DPRINTF(IEW, "LDSTQ detected a violation. Violator PC: " 13431062SN/A "%#x, inst PC: %#x. Addr is: %#x.\n", 13441062SN/A violator->readPC(), inst->readPC(), inst->physEffAddr); 13451062SN/A 13461062SN/A // Tell the instruction queue that a violation has occured. 13471062SN/A instQueue.violation(inst, violator); 13481062SN/A 13491062SN/A // Squash. 13502292SN/A squashDueToMemOrder(inst,tid); 13511062SN/A 13521062SN/A ++memOrderViolationEvents; 13532292SN/A } else if (ldstQueue.loadBlocked(tid) && 13542292SN/A !ldstQueue.isLoadBlockedHandled(tid)) { 13552292SN/A fetchRedirect[tid] = true; 13562292SN/A 13572292SN/A DPRINTF(IEW, "Load operation couldn't execute because the " 13582292SN/A "memory system is blocked. PC: %#x [sn:%lli]\n", 13592292SN/A inst->readPC(), inst->seqNum); 13602292SN/A 13612292SN/A squashDueToMemBlocked(inst, tid); 13621062SN/A } 13631062SN/A } 13641062SN/A } 13652292SN/A 13662348SN/A // Update and record activity if we processed any instructions. 13672292SN/A if (inst_num) { 13682292SN/A if (exeStatus == Idle) { 13692292SN/A exeStatus = Running; 13702292SN/A } 13712292SN/A 13722292SN/A updatedQueues = true; 13732292SN/A 13742292SN/A cpu->activityThisCycle(); 13752292SN/A } 13762292SN/A 13772292SN/A // Need to reset this in case a writeback event needs to write into the 13782292SN/A // iew queue. That way the writeback event will write into the correct 13792292SN/A // spot in the queue. 13802292SN/A wbNumInst = 0; 13812107SN/A} 13822107SN/A 13832292SN/Atemplate <class Impl> 13842107SN/Avoid 13852292SN/ADefaultIEW<Impl>::writebackInsts() 13862107SN/A{ 13872326SN/A // Loop through the head of the time buffer and wake any 13882326SN/A // dependents. These instructions are about to write back. Also 13892326SN/A // mark scoreboard that this instruction is finally complete. 13902326SN/A // Either have IEW have direct access to scoreboard, or have this 13912326SN/A // as part of backwards communication. 13922107SN/A for (int inst_num = 0; inst_num < issueWidth && 13932292SN/A toCommit->insts[inst_num]; inst_num++) { 13942107SN/A DynInstPtr inst = toCommit->insts[inst_num]; 13952301SN/A int tid = inst->threadNumber; 13962107SN/A 13972698Sktlim@umich.edu DPRINTF(IEW, "Sending instructions to commit, [sn:%lli] PC %#x.\n", 13982698Sktlim@umich.edu inst->seqNum, inst->readPC()); 13992107SN/A 14002301SN/A iewInstsToCommit[tid]++; 14012301SN/A 14022292SN/A // Some instructions will be sent to commit without having 14032292SN/A // executed because they need commit to handle them. 14042292SN/A // E.g. Uncached loads have not actually executed when they 14052292SN/A // are first sent to commit. Instead commit must tell the LSQ 14062292SN/A // when it's ready to execute the uncached load. 14072292SN/A if (!inst->isSquashed() && inst->isExecuted()) { 14082301SN/A int dependents = instQueue.wakeDependents(inst); 14092107SN/A 14102292SN/A for (int i = 0; i < inst->numDestRegs(); i++) { 14112292SN/A //mark as Ready 14122292SN/A DPRINTF(IEW,"Setting Destination Register %i\n", 14132292SN/A inst->renamedDestRegIdx(i)); 14142292SN/A scoreboard->setReg(inst->renamedDestRegIdx(i)); 14152107SN/A } 14162301SN/A 14172348SN/A if (dependents) { 14182348SN/A producerInst[tid]++; 14192348SN/A consumerInst[tid]+= dependents; 14202348SN/A } 14212326SN/A writebackCount[tid]++; 14222107SN/A } 14232820Sktlim@umich.edu 14242820Sktlim@umich.edu decrWb(inst->seqNum); 14252107SN/A } 14261060SN/A} 14271060SN/A 14281681SN/Atemplate<class Impl> 14291060SN/Avoid 14302292SN/ADefaultIEW<Impl>::tick() 14311060SN/A{ 14322292SN/A wbNumInst = 0; 14332292SN/A wbCycle = 0; 14341060SN/A 14352292SN/A wroteToTimeBuffer = false; 14362292SN/A updatedQueues = false; 14371060SN/A 14382292SN/A sortInsts(); 14391060SN/A 14402326SN/A // Free function units marked as being freed this cycle. 14412326SN/A fuPool->processFreeUnits(); 14421062SN/A 14432980Sgblack@eecs.umich.edu std::list<unsigned>::iterator threads = (*activeThreads).begin(); 14441060SN/A 14452326SN/A // Check stall and squash signals, dispatch any instructions. 14462292SN/A while (threads != (*activeThreads).end()) { 14472292SN/A unsigned tid = *threads++; 14481060SN/A 14492292SN/A DPRINTF(IEW,"Issue: Processing [tid:%i]\n",tid); 14501060SN/A 14512292SN/A checkSignalsAndUpdate(tid); 14522292SN/A dispatch(tid); 14531060SN/A } 14541060SN/A 14552292SN/A if (exeStatus != Squashing) { 14562292SN/A executeInsts(); 14571060SN/A 14582292SN/A writebackInsts(); 14592292SN/A 14602292SN/A // Have the instruction queue try to schedule any ready instructions. 14612292SN/A // (In actuality, this scheduling is for instructions that will 14622292SN/A // be executed next cycle.) 14632292SN/A instQueue.scheduleReadyInsts(); 14642292SN/A 14652292SN/A // Also should advance its own time buffers if the stage ran. 14662292SN/A // Not the best place for it, but this works (hopefully). 14672292SN/A issueToExecQueue.advance(); 14682292SN/A } 14692292SN/A 14702292SN/A bool broadcast_free_entries = false; 14712292SN/A 14722292SN/A if (updatedQueues || exeStatus == Running || updateLSQNextCycle) { 14732292SN/A exeStatus = Idle; 14742292SN/A updateLSQNextCycle = false; 14752292SN/A 14762292SN/A broadcast_free_entries = true; 14772292SN/A } 14782292SN/A 14792292SN/A // Writeback any stores using any leftover bandwidth. 14801681SN/A ldstQueue.writebackStores(); 14811681SN/A 14821061SN/A // Check the committed load/store signals to see if there's a load 14831061SN/A // or store to commit. Also check if it's being told to execute a 14841061SN/A // nonspeculative instruction. 14851681SN/A // This is pretty inefficient... 14862292SN/A 14872292SN/A threads = (*activeThreads).begin(); 14882292SN/A while (threads != (*activeThreads).end()) { 14892292SN/A unsigned tid = (*threads++); 14902292SN/A 14912292SN/A DPRINTF(IEW,"Processing [tid:%i]\n",tid); 14922292SN/A 14932348SN/A // Update structures based on instructions committed. 14942292SN/A if (fromCommit->commitInfo[tid].doneSeqNum != 0 && 14952292SN/A !fromCommit->commitInfo[tid].squash && 14962292SN/A !fromCommit->commitInfo[tid].robSquashing) { 14972292SN/A 14982292SN/A ldstQueue.commitStores(fromCommit->commitInfo[tid].doneSeqNum,tid); 14992292SN/A 15002292SN/A ldstQueue.commitLoads(fromCommit->commitInfo[tid].doneSeqNum,tid); 15012292SN/A 15022292SN/A updateLSQNextCycle = true; 15032292SN/A instQueue.commit(fromCommit->commitInfo[tid].doneSeqNum,tid); 15042292SN/A } 15052292SN/A 15062292SN/A if (fromCommit->commitInfo[tid].nonSpecSeqNum != 0) { 15072292SN/A 15082292SN/A //DPRINTF(IEW,"NonspecInst from thread %i",tid); 15092292SN/A if (fromCommit->commitInfo[tid].uncached) { 15102292SN/A instQueue.replayMemInst(fromCommit->commitInfo[tid].uncachedLoad); 15112292SN/A } else { 15122292SN/A instQueue.scheduleNonSpec( 15132292SN/A fromCommit->commitInfo[tid].nonSpecSeqNum); 15142292SN/A } 15152292SN/A } 15162292SN/A 15172292SN/A if (broadcast_free_entries) { 15182292SN/A toFetch->iewInfo[tid].iqCount = 15192292SN/A instQueue.getCount(tid); 15202292SN/A toFetch->iewInfo[tid].ldstqCount = 15212292SN/A ldstQueue.getCount(tid); 15222292SN/A 15232292SN/A toRename->iewInfo[tid].usedIQ = true; 15242292SN/A toRename->iewInfo[tid].freeIQEntries = 15252292SN/A instQueue.numFreeEntries(); 15262292SN/A toRename->iewInfo[tid].usedLSQ = true; 15272292SN/A toRename->iewInfo[tid].freeLSQEntries = 15282292SN/A ldstQueue.numFreeEntries(tid); 15292292SN/A 15302292SN/A wroteToTimeBuffer = true; 15312292SN/A } 15322292SN/A 15332292SN/A DPRINTF(IEW, "[tid:%i], Dispatch dispatched %i instructions.\n", 15342292SN/A tid, toRename->iewInfo[tid].dispatched); 15351061SN/A } 15361061SN/A 15372292SN/A DPRINTF(IEW, "IQ has %i free entries (Can schedule: %i). " 15382292SN/A "LSQ has %i free entries.\n", 15392292SN/A instQueue.numFreeEntries(), instQueue.hasReadyInsts(), 15402292SN/A ldstQueue.numFreeEntries()); 15412292SN/A 15422292SN/A updateStatus(); 15432292SN/A 15442292SN/A if (wroteToTimeBuffer) { 15452292SN/A DPRINTF(Activity, "Activity this cycle.\n"); 15462292SN/A cpu->activityThisCycle(); 15471061SN/A } 15481060SN/A} 15491060SN/A 15502301SN/Atemplate <class Impl> 15511060SN/Avoid 15522301SN/ADefaultIEW<Impl>::updateExeInstStats(DynInstPtr &inst) 15531060SN/A{ 15542301SN/A int thread_number = inst->threadNumber; 15551060SN/A 15562301SN/A // 15572301SN/A // Pick off the software prefetches 15582301SN/A // 15592301SN/A#ifdef TARGET_ALPHA 15602301SN/A if (inst->isDataPrefetch()) 15612727Sktlim@umich.edu iewExecutedSwp[thread_number]++; 15622301SN/A else 15632727Sktlim@umich.edu iewIewExecutedcutedInsts++; 15642301SN/A#else 15652669Sktlim@umich.edu iewExecutedInsts++; 15662301SN/A#endif 15671060SN/A 15682301SN/A // 15692301SN/A // Control operations 15702301SN/A // 15712301SN/A if (inst->isControl()) 15722727Sktlim@umich.edu iewExecutedBranches[thread_number]++; 15731060SN/A 15742301SN/A // 15752301SN/A // Memory operations 15762301SN/A // 15772301SN/A if (inst->isMemRef()) { 15782727Sktlim@umich.edu iewExecutedRefs[thread_number]++; 15791060SN/A 15802301SN/A if (inst->isLoad()) { 15812301SN/A iewExecLoadInsts[thread_number]++; 15821060SN/A } 15831060SN/A } 15841060SN/A} 1585