fetch.hh revision 4302
11689SN/A/*
22329SN/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
292756Sksewell@umich.edu *          Korey Sewell
301689SN/A */
311689SN/A
322292SN/A#ifndef __CPU_O3_FETCH_HH__
332292SN/A#define __CPU_O3_FETCH_HH__
341060SN/A
352669Sktlim@umich.edu#include "arch/utility.hh"
364182Sgblack@eecs.umich.edu#include "arch/predecoder.hh"
371461SN/A#include "base/statistics.hh"
381060SN/A#include "base/timebuf.hh"
391060SN/A#include "cpu/pc_event.hh"
403348Sbinkertn@umich.edu#include "mem/packet.hh"
412669Sktlim@umich.edu#include "mem/port.hh"
421461SN/A#include "sim/eventq.hh"
431060SN/A
441060SN/A/**
452329SN/A * DefaultFetch class handles both single threaded and SMT fetch. Its
462329SN/A * width is specified by the parameters; each cycle it tries to fetch
472329SN/A * that many instructions. It supports using a branch predictor to
482329SN/A * predict direction and targets.
492348SN/A * It supports the idling functionality of the CPU by indicating to
502329SN/A * the CPU when it is active and inactive.
511060SN/A */
521060SN/Atemplate <class Impl>
532292SN/Aclass DefaultFetch
541060SN/A{
551060SN/A  public:
561060SN/A    /** Typedefs from Impl. */
571061SN/A    typedef typename Impl::CPUPol CPUPol;
581060SN/A    typedef typename Impl::DynInst DynInst;
591061SN/A    typedef typename Impl::DynInstPtr DynInstPtr;
602733Sktlim@umich.edu    typedef typename Impl::O3CPU O3CPU;
611060SN/A    typedef typename Impl::Params Params;
621060SN/A
632292SN/A    /** Typedefs from the CPU policy. */
641061SN/A    typedef typename CPUPol::BPredUnit BPredUnit;
651061SN/A    typedef typename CPUPol::FetchStruct FetchStruct;
661061SN/A    typedef typename CPUPol::TimeStruct TimeStruct;
671060SN/A
681060SN/A    /** Typedefs from ISA. */
692107SN/A    typedef TheISA::MachInst MachInst;
702292SN/A    typedef TheISA::ExtMachInst ExtMachInst;
712632Sstever@eecs.umich.edu
722698Sktlim@umich.edu    /** IcachePort class for DefaultFetch.  Handles doing the
732698Sktlim@umich.edu     * communication with the cache/memory.
742698Sktlim@umich.edu     */
752669Sktlim@umich.edu    class IcachePort : public Port
762669Sktlim@umich.edu    {
772669Sktlim@umich.edu      protected:
782698Sktlim@umich.edu        /** Pointer to fetch. */
792669Sktlim@umich.edu        DefaultFetch<Impl> *fetch;
802669Sktlim@umich.edu
812669Sktlim@umich.edu      public:
822698Sktlim@umich.edu        /** Default constructor. */
832669Sktlim@umich.edu        IcachePort(DefaultFetch<Impl> *_fetch)
842669Sktlim@umich.edu            : Port(_fetch->name() + "-iport"), fetch(_fetch)
852669Sktlim@umich.edu        { }
862669Sktlim@umich.edu
873647Srdreslin@umich.edu        bool snoopRangeSent;
883647Srdreslin@umich.edu
894302Sktlim@umich.edu        virtual void setPeer(Port *port);
904302Sktlim@umich.edu
912669Sktlim@umich.edu      protected:
922698Sktlim@umich.edu        /** Atomic version of receive.  Panics. */
932669Sktlim@umich.edu        virtual Tick recvAtomic(PacketPtr pkt);
942669Sktlim@umich.edu
952698Sktlim@umich.edu        /** Functional version of receive.  Panics. */
962669Sktlim@umich.edu        virtual void recvFunctional(PacketPtr pkt);
972669Sktlim@umich.edu
982698Sktlim@umich.edu        /** Receives status change.  Other than range changing, panics. */
992669Sktlim@umich.edu        virtual void recvStatusChange(Status status);
1002669Sktlim@umich.edu
1012698Sktlim@umich.edu        /** Returns the address ranges of this device. */
1022669Sktlim@umich.edu        virtual void getDeviceAddressRanges(AddrRangeList &resp,
1032669Sktlim@umich.edu                                            AddrRangeList &snoop)
1043846Shsul@eecs.umich.edu        { resp.clear(); snoop.clear(); snoop.push_back(RangeSize(0,0)); }
1052669Sktlim@umich.edu
1062698Sktlim@umich.edu        /** Timing version of receive.  Handles setting fetch to the
1072698Sktlim@umich.edu         * proper status to start fetching. */
1082669Sktlim@umich.edu        virtual bool recvTiming(PacketPtr pkt);
1092669Sktlim@umich.edu
1102698Sktlim@umich.edu        /** Handles doing a retry of a failed fetch. */
1112669Sktlim@umich.edu        virtual void recvRetry();
1122669Sktlim@umich.edu    };
1131060SN/A
1142935Sksewell@umich.edu
1151060SN/A  public:
1162329SN/A    /** Overall fetch status. Used to determine if the CPU can
1172329SN/A     * deschedule itsef due to a lack of activity.
1182292SN/A     */
1192292SN/A    enum FetchStatus {
1202292SN/A        Active,
1212292SN/A        Inactive
1222292SN/A    };
1232292SN/A
1242292SN/A    /** Individual thread status. */
1252292SN/A    enum ThreadStatus {
1261060SN/A        Running,
1271060SN/A        Idle,
1281060SN/A        Squashing,
1291060SN/A        Blocked,
1302292SN/A        Fetching,
1312292SN/A        TrapPending,
1322292SN/A        QuiescePending,
1332307SN/A        SwitchOut,
1342669Sktlim@umich.edu        IcacheWaitResponse,
1352696Sktlim@umich.edu        IcacheWaitRetry,
1362669Sktlim@umich.edu        IcacheAccessComplete
1371060SN/A    };
1381060SN/A
1392292SN/A    /** Fetching Policy, Add new policies here.*/
1402292SN/A    enum FetchPriority {
1412292SN/A        SingleThread,
1422292SN/A        RoundRobin,
1432292SN/A        Branch,
1442292SN/A        IQ,
1452292SN/A        LSQ
1462292SN/A    };
1471060SN/A
1482292SN/A  private:
1492292SN/A    /** Fetch status. */
1502292SN/A    FetchStatus _status;
1512292SN/A
1522292SN/A    /** Per-thread status. */
1532292SN/A    ThreadStatus fetchStatus[Impl::MaxThreads];
1542292SN/A
1552292SN/A    /** Fetch policy. */
1562292SN/A    FetchPriority fetchPolicy;
1572292SN/A
1582292SN/A    /** List that has the threads organized by priority. */
1592292SN/A    std::list<unsigned> priorityList;
1601060SN/A
1611060SN/A  public:
1622292SN/A    /** DefaultFetch constructor. */
1632292SN/A    DefaultFetch(Params *params);
1641684SN/A
1652292SN/A    /** Returns the name of fetch. */
1662292SN/A    std::string name() const;
1671684SN/A
1682292SN/A    /** Registers statistics. */
1691062SN/A    void regStats();
1701062SN/A
1712871Sktlim@umich.edu    /** Returns the icache port. */
1722871Sktlim@umich.edu    Port *getIcachePort() { return icachePort; }
1732871Sktlim@umich.edu
1742292SN/A    /** Sets CPU pointer. */
1752733Sktlim@umich.edu    void setCPU(O3CPU *cpu_ptr);
1761060SN/A
1772292SN/A    /** Sets the main backwards communication time buffer pointer. */
1781060SN/A    void setTimeBuffer(TimeBuffer<TimeStruct> *time_buffer);
1791060SN/A
1802292SN/A    /** Sets pointer to list of active threads. */
1812292SN/A    void setActiveThreads(std::list<unsigned> *at_ptr);
1822292SN/A
1832292SN/A    /** Sets pointer to time buffer used to communicate to the next stage. */
1841060SN/A    void setFetchQueue(TimeBuffer<FetchStruct> *fq_ptr);
1851060SN/A
1862292SN/A    /** Initialize stage. */
1872292SN/A    void initStage();
1882292SN/A
1894302Sktlim@umich.edu    /** Tells the fetch stage that the Icache is set. */
1904302Sktlim@umich.edu    void setIcache();
1914302Sktlim@umich.edu
1922292SN/A    /** Processes cache completion event. */
1932669Sktlim@umich.edu    void processCacheCompletion(PacketPtr pkt);
1942292SN/A
1952843Sktlim@umich.edu    /** Begins the drain of the fetch stage. */
1962863Sktlim@umich.edu    bool drain();
1972843Sktlim@umich.edu
1982843Sktlim@umich.edu    /** Resumes execution after a drain. */
1992843Sktlim@umich.edu    void resume();
2002843Sktlim@umich.edu
2012843Sktlim@umich.edu    /** Tells fetch stage to prepare to be switched out. */
2022307SN/A    void switchOut();
2032307SN/A
2042348SN/A    /** Takes over from another CPU's thread. */
2052307SN/A    void takeOverFrom();
2062307SN/A
2072348SN/A    /** Checks if the fetch stage is switched out. */
2082307SN/A    bool isSwitchedOut() { return switchedOut; }
2092307SN/A
2102348SN/A    /** Tells fetch to wake up from a quiesce instruction. */
2112292SN/A    void wakeFromQuiesce();
2121060SN/A
2131061SN/A  private:
2142329SN/A    /** Changes the status of this stage to active, and indicates this
2152329SN/A     * to the CPU.
2162292SN/A     */
2172292SN/A    inline void switchToActive();
2182292SN/A
2192329SN/A    /** Changes the status of this stage to inactive, and indicates
2202329SN/A     * this to the CPU.
2212292SN/A     */
2222292SN/A    inline void switchToInactive();
2232292SN/A
2241061SN/A    /**
2251061SN/A     * Looks up in the branch predictor to see if the next PC should be
2261061SN/A     * either next PC+=MachInst or a branch target.
2271763SN/A     * @param next_PC Next PC variable passed in by reference.  It is
2281061SN/A     * expected to be set to the current PC; it will be updated with what
2291061SN/A     * the next PC will be.
2302935Sksewell@umich.edu     * @param next_NPC Used for ISAs which use delay slots.
2311061SN/A     * @return Whether or not a branch was predicted as taken.
2321061SN/A     */
2332935Sksewell@umich.edu    bool lookupAndUpdateNextPC(DynInstPtr &inst, Addr &next_PC, Addr &next_NPC);
2341062SN/A
2351062SN/A    /**
2361062SN/A     * Fetches the cache line that contains fetch_PC.  Returns any
2371062SN/A     * fault that happened.  Puts the data into the class variable
2381062SN/A     * cacheData.
2391763SN/A     * @param fetch_PC The PC address that is being fetched from.
2402292SN/A     * @param ret_fault The fault reference that will be set to the result of
2412292SN/A     * the icache access.
2422292SN/A     * @param tid Thread id.
2431062SN/A     * @return Any fault that occured.
2441062SN/A     */
2452292SN/A    bool fetchCacheLine(Addr fetch_PC, Fault &ret_fault, unsigned tid);
2461062SN/A
2472292SN/A    /** Squashes a specific thread and resets the PC. */
2483795Sgblack@eecs.umich.edu    inline void doSquash(const Addr &new_PC, const Addr &new_NPC, unsigned tid);
2491684SN/A
2502292SN/A    /** Squashes a specific thread and resets the PC. Also tells the CPU to
2512292SN/A     * remove any instructions between fetch and decode that should be sqaushed.
2522292SN/A     */
2533795Sgblack@eecs.umich.edu    void squashFromDecode(const Addr &new_PC, const Addr &new_NPC,
2543795Sgblack@eecs.umich.edu                          const InstSeqNum &seq_num, unsigned tid);
2552292SN/A
2562292SN/A    /** Checks if a thread is stalled. */
2572292SN/A    bool checkStall(unsigned tid) const;
2582292SN/A
2592292SN/A    /** Updates overall fetch stage status; to be called at the end of each
2602292SN/A     * cycle. */
2612292SN/A    FetchStatus updateFetchStatus();
2621684SN/A
2631684SN/A  public:
2642292SN/A    /** Squashes a specific thread and resets the PC. Also tells the CPU to
2652292SN/A     * remove any instructions that are not in the ROB. The source of this
2662292SN/A     * squash should be the commit stage.
2672292SN/A     */
2683795Sgblack@eecs.umich.edu    void squash(const Addr &new_PC, const Addr &new_NPC,
2693795Sgblack@eecs.umich.edu                const InstSeqNum &seq_num,
2702935Sksewell@umich.edu                bool squash_delay_slot, unsigned tid);
2711684SN/A
2722292SN/A    /** Ticks the fetch stage, processing all inputs signals and fetching
2732292SN/A     * as many instructions as possible.
2742292SN/A     */
2751684SN/A    void tick();
2761684SN/A
2772292SN/A    /** Checks all input signals and updates the status as necessary.
2782292SN/A     *  @return: Returns if the status has changed due to input signals.
2792292SN/A     */
2802292SN/A    bool checkSignalsAndUpdate(unsigned tid);
2811684SN/A
2822292SN/A    /** Does the actual fetching of instructions and passing them on to the
2832292SN/A     * next stage.
2842292SN/A     * @param status_change fetch() sets this variable if there was a status
2852292SN/A     * change (ie switching to IcacheMissStall).
2862292SN/A     */
2872292SN/A    void fetch(bool &status_change);
2882292SN/A
2892292SN/A    /** Align a PC to the start of an I-cache block. */
2901062SN/A    Addr icacheBlockAlignPC(Addr addr)
2911062SN/A    {
2922107SN/A        addr = TheISA::realPCToFetchPC(addr);
2931062SN/A        return (addr & ~(cacheBlkMask));
2941062SN/A    }
2951061SN/A
2961060SN/A  private:
2972698Sktlim@umich.edu    /** Handles retrying the fetch access. */
2982696Sktlim@umich.edu    void recvRetry();
2992696Sktlim@umich.edu
3002292SN/A    /** Returns the appropriate thread to fetch, given the fetch policy. */
3012292SN/A    int getFetchingThread(FetchPriority &fetch_priority);
3022292SN/A
3032292SN/A    /** Returns the appropriate thread to fetch using a round robin policy. */
3042292SN/A    int roundRobin();
3052292SN/A
3062292SN/A    /** Returns the appropriate thread to fetch using the IQ count policy. */
3072292SN/A    int iqCount();
3082292SN/A
3092292SN/A    /** Returns the appropriate thread to fetch using the LSQ count policy. */
3102292SN/A    int lsqCount();
3112292SN/A
3122292SN/A    /** Returns the appropriate thread to fetch using the branch count policy. */
3132292SN/A    int branchCount();
3142292SN/A
3152292SN/A  private:
3162733Sktlim@umich.edu    /** Pointer to the O3CPU. */
3172733Sktlim@umich.edu    O3CPU *cpu;
3181060SN/A
3191060SN/A    /** Time buffer interface. */
3201060SN/A    TimeBuffer<TimeStruct> *timeBuffer;
3211060SN/A
3221060SN/A    /** Wire to get decode's information from backwards time buffer. */
3231060SN/A    typename TimeBuffer<TimeStruct>::wire fromDecode;
3241060SN/A
3251060SN/A    /** Wire to get rename's information from backwards time buffer. */
3261060SN/A    typename TimeBuffer<TimeStruct>::wire fromRename;
3271060SN/A
3281060SN/A    /** Wire to get iew's information from backwards time buffer. */
3291060SN/A    typename TimeBuffer<TimeStruct>::wire fromIEW;
3301060SN/A
3311060SN/A    /** Wire to get commit's information from backwards time buffer. */
3321060SN/A    typename TimeBuffer<TimeStruct>::wire fromCommit;
3331060SN/A
3341060SN/A    /** Internal fetch instruction queue. */
3351060SN/A    TimeBuffer<FetchStruct> *fetchQueue;
3361060SN/A
3371060SN/A    //Might be annoying how this name is different than the queue.
3381060SN/A    /** Wire used to write any information heading to decode. */
3391060SN/A    typename TimeBuffer<FetchStruct>::wire toDecode;
3401060SN/A
3411060SN/A    /** Icache interface. */
3422669Sktlim@umich.edu    IcachePort *icachePort;
3431060SN/A
3441061SN/A    /** BPredUnit. */
3451061SN/A    BPredUnit branchPred;
3461061SN/A
3474182Sgblack@eecs.umich.edu    /** Predecoder. */
3484182Sgblack@eecs.umich.edu    TheISA::Predecoder predecoder;
3494182Sgblack@eecs.umich.edu
3502348SN/A    /** Per-thread fetch PC. */
3512292SN/A    Addr PC[Impl::MaxThreads];
3522292SN/A
3532348SN/A    /** Per-thread next PC. */
3542292SN/A    Addr nextPC[Impl::MaxThreads];
3552292SN/A
3562756Sksewell@umich.edu    /** Per-thread next Next PC.
3572756Sksewell@umich.edu     *  This is not a real register but is used for
3582756Sksewell@umich.edu     *  architectures that use a branch-delay slot.
3592756Sksewell@umich.edu     *  (such as MIPS or Sparc)
3602756Sksewell@umich.edu     */
3612756Sksewell@umich.edu    Addr nextNPC[Impl::MaxThreads];
3622756Sksewell@umich.edu
3632678Sktlim@umich.edu    /** Memory request used to access cache. */
3642678Sktlim@umich.edu    RequestPtr memReq[Impl::MaxThreads];
3652292SN/A
3662292SN/A    /** Variable that tracks if fetch has written to the time buffer this
3672292SN/A     * cycle. Used to tell CPU if there is activity this cycle.
3682292SN/A     */
3692292SN/A    bool wroteToTimeBuffer;
3702292SN/A
3712292SN/A    /** Tracks how many instructions has been fetched this cycle. */
3722292SN/A    int numInst;
3732292SN/A
3742292SN/A    /** Source of possible stalls. */
3752292SN/A    struct Stalls {
3762292SN/A        bool decode;
3772292SN/A        bool rename;
3782292SN/A        bool iew;
3792292SN/A        bool commit;
3802292SN/A    };
3812292SN/A
3822292SN/A    /** Tracks which stages are telling fetch to stall. */
3832292SN/A    Stalls stalls[Impl::MaxThreads];
3841060SN/A
3851060SN/A    /** Decode to fetch delay, in ticks. */
3861060SN/A    unsigned decodeToFetchDelay;
3871060SN/A
3881060SN/A    /** Rename to fetch delay, in ticks. */
3891060SN/A    unsigned renameToFetchDelay;
3901060SN/A
3911060SN/A    /** IEW to fetch delay, in ticks. */
3921060SN/A    unsigned iewToFetchDelay;
3931060SN/A
3941060SN/A    /** Commit to fetch delay, in ticks. */
3951060SN/A    unsigned commitToFetchDelay;
3961060SN/A
3971060SN/A    /** The width of fetch in instructions. */
3981060SN/A    unsigned fetchWidth;
3991060SN/A
4002696Sktlim@umich.edu    /** Is the cache blocked?  If so no threads can access it. */
4012696Sktlim@umich.edu    bool cacheBlocked;
4022696Sktlim@umich.edu
4032696Sktlim@umich.edu    /** The packet that is waiting to be retried. */
4042696Sktlim@umich.edu    PacketPtr retryPkt;
4052696Sktlim@umich.edu
4062696Sktlim@umich.edu    /** The thread that is waiting on the cache to tell fetch to retry. */
4072696Sktlim@umich.edu    int retryTid;
4082696Sktlim@umich.edu
4091060SN/A    /** Cache block size. */
4101062SN/A    int cacheBlkSize;
4111060SN/A
4121060SN/A    /** Mask to get a cache block's address. */
4131062SN/A    Addr cacheBlkMask;
4141060SN/A
4151062SN/A    /** The cache line being fetched. */
4162292SN/A    uint8_t *cacheData[Impl::MaxThreads];
4171060SN/A
4182893Sktlim@umich.edu    /** The PC of the cacheline that has been loaded. */
4192893Sktlim@umich.edu    Addr cacheDataPC[Impl::MaxThreads];
4202893Sktlim@umich.edu
4212906Sktlim@umich.edu    /** Whether or not the cache data is valid. */
4222906Sktlim@umich.edu    bool cacheDataValid[Impl::MaxThreads];
4232906Sktlim@umich.edu
4241060SN/A    /** Size of instructions. */
4251060SN/A    int instSize;
4261060SN/A
4271060SN/A    /** Icache stall statistics. */
4282292SN/A    Counter lastIcacheStall[Impl::MaxThreads];
4291062SN/A
4302292SN/A    /** List of Active Threads */
4312292SN/A    std::list<unsigned> *activeThreads;
4322292SN/A
4332292SN/A    /** Number of threads. */
4342292SN/A    unsigned numThreads;
4352292SN/A
4362292SN/A    /** Number of threads that are actively fetching. */
4372292SN/A    unsigned numFetchingThreads;
4382292SN/A
4392292SN/A    /** Thread ID being fetched. */
4402292SN/A    int threadFetched;
4412292SN/A
4422348SN/A    /** Checks if there is an interrupt pending.  If there is, fetch
4432348SN/A     * must stop once it is not fetching PAL instructions.
4442348SN/A     */
4452292SN/A    bool interruptPending;
4462292SN/A
4472843Sktlim@umich.edu    /** Is there a drain pending. */
4482843Sktlim@umich.edu    bool drainPending;
4492843Sktlim@umich.edu
4502348SN/A    /** Records if fetch is switched out. */
4512307SN/A    bool switchedOut;
4522307SN/A
4532292SN/A    // @todo: Consider making these vectors and tracking on a per thread basis.
4542292SN/A    /** Stat for total number of cycles stalled due to an icache miss. */
4551062SN/A    Stats::Scalar<> icacheStallCycles;
4562292SN/A    /** Stat for total number of fetched instructions. */
4571062SN/A    Stats::Scalar<> fetchedInsts;
4582727Sktlim@umich.edu    /** Total number of fetched branches. */
4592301SN/A    Stats::Scalar<> fetchedBranches;
4602292SN/A    /** Stat for total number of predicted branches. */
4611062SN/A    Stats::Scalar<> predictedBranches;
4622292SN/A    /** Stat for total number of cycles spent fetching. */
4631062SN/A    Stats::Scalar<> fetchCycles;
4642292SN/A    /** Stat for total number of cycles spent squashing. */
4651062SN/A    Stats::Scalar<> fetchSquashCycles;
4662292SN/A    /** Stat for total number of cycles spent blocked due to other stages in
4672292SN/A     * the pipeline.
4682292SN/A     */
4692292SN/A    Stats::Scalar<> fetchIdleCycles;
4702348SN/A    /** Total number of cycles spent blocked. */
4711062SN/A    Stats::Scalar<> fetchBlockedCycles;
4722348SN/A    /** Total number of cycles spent in any other state. */
4732307SN/A    Stats::Scalar<> fetchMiscStallCycles;
4742292SN/A    /** Stat for total number of fetched cache lines. */
4751062SN/A    Stats::Scalar<> fetchedCacheLines;
4762348SN/A    /** Total number of outstanding icache accesses that were dropped
4772348SN/A     * due to a squash.
4782348SN/A     */
4792301SN/A    Stats::Scalar<> fetchIcacheSquashes;
4802292SN/A    /** Distribution of number of instructions fetched each cycle. */
4812292SN/A    Stats::Distribution<> fetchNisnDist;
4822348SN/A    /** Rate of how often fetch was idle. */
4832292SN/A    Stats::Formula idleRate;
4842348SN/A    /** Number of branch fetches per cycle. */
4852292SN/A    Stats::Formula branchRate;
4862348SN/A    /** Number of instruction fetched per cycle. */
4872292SN/A    Stats::Formula fetchRate;
4881060SN/A};
4891060SN/A
4902292SN/A#endif //__CPU_O3_FETCH_HH__
491