cpu.hh revision 12109
11689SN/A/*
212109SRekai.GonzalezAlberquilla@arm.com * Copyright (c) 2011-2013, 2016 ARM Limited
39919Ssteve.reinhardt@amd.com * Copyright (c) 2013 Advanced Micro Devices, Inc.
48707Sandreas.hansson@arm.com * All rights reserved
58707Sandreas.hansson@arm.com *
68707Sandreas.hansson@arm.com * The license below extends only to copyright in the software and shall
78707Sandreas.hansson@arm.com * not be construed as granting a license to any other intellectual
88707Sandreas.hansson@arm.com * property including but not limited to intellectual property relating
98707Sandreas.hansson@arm.com * to a hardware implementation of the functionality of the software
108707Sandreas.hansson@arm.com * licensed hereunder.  You may use the software subject to the license
118707Sandreas.hansson@arm.com * terms below provided that you ensure that this notice is replicated
128707Sandreas.hansson@arm.com * unmodified and in its entirety in all distributions of the software,
138707Sandreas.hansson@arm.com * modified or unmodified, in source code or in binary form.
148707Sandreas.hansson@arm.com *
151689SN/A * Copyright (c) 2004-2005 The Regents of The University of Michigan
167897Shestness@cs.utexas.edu * Copyright (c) 2011 Regents of the University of California
171689SN/A * All rights reserved.
181689SN/A *
191689SN/A * Redistribution and use in source and binary forms, with or without
201689SN/A * modification, are permitted provided that the following conditions are
211689SN/A * met: redistributions of source code must retain the above copyright
221689SN/A * notice, this list of conditions and the following disclaimer;
231689SN/A * redistributions in binary form must reproduce the above copyright
241689SN/A * notice, this list of conditions and the following disclaimer in the
251689SN/A * documentation and/or other materials provided with the distribution;
261689SN/A * neither the name of the copyright holders nor the names of its
271689SN/A * contributors may be used to endorse or promote products derived from
281689SN/A * this software without specific prior written permission.
291689SN/A *
301689SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
311689SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
321689SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
331689SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
341689SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
351689SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
361689SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
371689SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
381689SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
391689SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
401689SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
412665Ssaidi@eecs.umich.edu *
422665Ssaidi@eecs.umich.edu * Authors: Kevin Lim
432756Sksewell@umich.edu *          Korey Sewell
447897Shestness@cs.utexas.edu *          Rick Strong
451689SN/A */
461689SN/A
472325SN/A#ifndef __CPU_O3_CPU_HH__
482325SN/A#define __CPU_O3_CPU_HH__
491060SN/A
501060SN/A#include <iostream>
511060SN/A#include <list>
522292SN/A#include <queue>
532292SN/A#include <set>
541681SN/A#include <vector>
551060SN/A
5612109SRekai.GonzalezAlberquilla@arm.com#include "arch/generic/types.hh"
572980Sgblack@eecs.umich.edu#include "arch/types.hh"
581060SN/A#include "base/statistics.hh"
596658Snate@binkert.org#include "config/the_isa.hh"
601717SN/A#include "cpu/o3/comm.hh"
611717SN/A#include "cpu/o3/cpu_policy.hh"
622292SN/A#include "cpu/o3/scoreboard.hh"
632292SN/A#include "cpu/o3/thread_state.hh"
648229Snate@binkert.org#include "cpu/activity.hh"
658229Snate@binkert.org#include "cpu/base.hh"
668229Snate@binkert.org#include "cpu/simple_thread.hh"
678229Snate@binkert.org#include "cpu/timebuf.hh"
682817Sksewell@umich.edu//#include "cpu/o3/thread_context.hh"
698229Snate@binkert.org#include "params/DerivO3CPU.hh"
701060SN/A#include "sim/process.hh"
711060SN/A
722316SN/Atemplate <class>
732316SN/Aclass Checker;
742680Sktlim@umich.educlass ThreadContext;
752817Sksewell@umich.edutemplate <class>
762817Sksewell@umich.educlass O3ThreadContext;
772843Sktlim@umich.edu
782843Sktlim@umich.educlass Checkpoint;
792669Sktlim@umich.educlass MemObject;
801060SN/Aclass Process;
811060SN/A
828737Skoansin.tan@gmail.comstruct BaseCPUParams;
835529Snate@binkert.org
842733Sktlim@umich.educlass BaseO3CPU : public BaseCPU
851060SN/A{
861060SN/A    //Stuff that's pretty ISA independent will go here.
871060SN/A  public:
885529Snate@binkert.org    BaseO3CPU(BaseCPUParams *params);
892292SN/A
902292SN/A    void regStats();
911060SN/A};
921060SN/A
932348SN/A/**
942348SN/A * FullO3CPU class, has each of the stages (fetch through commit)
952348SN/A * within it, as well as all of the time buffers between stages.  The
962348SN/A * tick() function for the CPU is defined here.
972348SN/A */
981060SN/Atemplate <class Impl>
992733Sktlim@umich.educlass FullO3CPU : public BaseO3CPU
1001060SN/A{
1011060SN/A  public:
1022325SN/A    // Typedefs from the Impl here.
1031060SN/A    typedef typename Impl::CPUPol CPUPolicy;
1041061SN/A    typedef typename Impl::DynInstPtr DynInstPtr;
1054329Sktlim@umich.edu    typedef typename Impl::O3CPU O3CPU;
1061060SN/A
10712109SRekai.GonzalezAlberquilla@arm.com    using VecElem =  TheISA::VecElem;
10812109SRekai.GonzalezAlberquilla@arm.com    using VecRegContainer =  TheISA::VecRegContainer;
10912109SRekai.GonzalezAlberquilla@arm.com
1105595Sgblack@eecs.umich.edu    typedef O3ThreadState<Impl> ImplState;
1112292SN/A    typedef O3ThreadState<Impl> Thread;
1122292SN/A
1132292SN/A    typedef typename std::list<DynInstPtr>::iterator ListIt;
1142292SN/A
1152817Sksewell@umich.edu    friend class O3ThreadContext<Impl>;
1162829Sksewell@umich.edu
1171060SN/A  public:
1181060SN/A    enum Status {
1191060SN/A        Running,
1201060SN/A        Idle,
1211060SN/A        Halted,
1222307SN/A        Blocked,
1232307SN/A        SwitchedOut
1241060SN/A    };
1251060SN/A
1266022Sgblack@eecs.umich.edu    TheISA::TLB * itb;
1276022Sgblack@eecs.umich.edu    TheISA::TLB * dtb;
1283781Sgblack@eecs.umich.edu
1292292SN/A    /** Overall CPU status. */
1301060SN/A    Status _status;
1311060SN/A
1321060SN/A  private:
1338707Sandreas.hansson@arm.com
1348707Sandreas.hansson@arm.com    /**
1358707Sandreas.hansson@arm.com     * IcachePort class for instruction fetch.
1368707Sandreas.hansson@arm.com     */
1379608Sandreas.hansson@arm.com    class IcachePort : public MasterPort
1388707Sandreas.hansson@arm.com    {
1398707Sandreas.hansson@arm.com      protected:
1408707Sandreas.hansson@arm.com        /** Pointer to fetch. */
1418707Sandreas.hansson@arm.com        DefaultFetch<Impl> *fetch;
1428707Sandreas.hansson@arm.com
1438707Sandreas.hansson@arm.com      public:
1448707Sandreas.hansson@arm.com        /** Default constructor. */
1458707Sandreas.hansson@arm.com        IcachePort(DefaultFetch<Impl> *_fetch, FullO3CPU<Impl>* _cpu)
1469608Sandreas.hansson@arm.com            : MasterPort(_cpu->name() + ".icache_port", _cpu), fetch(_fetch)
1478707Sandreas.hansson@arm.com        { }
1488707Sandreas.hansson@arm.com
1498707Sandreas.hansson@arm.com      protected:
1508707Sandreas.hansson@arm.com
1518707Sandreas.hansson@arm.com        /** Timing version of receive.  Handles setting fetch to the
1528707Sandreas.hansson@arm.com         * proper status to start fetching. */
1538975Sandreas.hansson@arm.com        virtual bool recvTimingResp(PacketPtr pkt);
1548707Sandreas.hansson@arm.com
1558707Sandreas.hansson@arm.com        /** Handles doing a retry of a failed fetch. */
15610713Sandreas.hansson@arm.com        virtual void recvReqRetry();
1578707Sandreas.hansson@arm.com    };
1588707Sandreas.hansson@arm.com
1598707Sandreas.hansson@arm.com    /**
1608707Sandreas.hansson@arm.com     * DcachePort class for the load/store queue.
1618707Sandreas.hansson@arm.com     */
1629608Sandreas.hansson@arm.com    class DcachePort : public MasterPort
1638707Sandreas.hansson@arm.com    {
1648707Sandreas.hansson@arm.com      protected:
1658707Sandreas.hansson@arm.com
1668707Sandreas.hansson@arm.com        /** Pointer to LSQ. */
1678707Sandreas.hansson@arm.com        LSQ<Impl> *lsq;
16810529Smorr@cs.wisc.edu        FullO3CPU<Impl> *cpu;
1698707Sandreas.hansson@arm.com
1708707Sandreas.hansson@arm.com      public:
1718707Sandreas.hansson@arm.com        /** Default constructor. */
1728707Sandreas.hansson@arm.com        DcachePort(LSQ<Impl> *_lsq, FullO3CPU<Impl>* _cpu)
17310529Smorr@cs.wisc.edu            : MasterPort(_cpu->name() + ".dcache_port", _cpu), lsq(_lsq),
17410529Smorr@cs.wisc.edu              cpu(_cpu)
1758707Sandreas.hansson@arm.com        { }
1768707Sandreas.hansson@arm.com
1778707Sandreas.hansson@arm.com      protected:
1788707Sandreas.hansson@arm.com
1798707Sandreas.hansson@arm.com        /** Timing version of receive.  Handles writing back and
1808707Sandreas.hansson@arm.com         * completing the load or store that has returned from
1818707Sandreas.hansson@arm.com         * memory. */
1828975Sandreas.hansson@arm.com        virtual bool recvTimingResp(PacketPtr pkt);
1838975Sandreas.hansson@arm.com        virtual void recvTimingSnoopReq(PacketPtr pkt);
1848707Sandreas.hansson@arm.com
1859608Sandreas.hansson@arm.com        virtual void recvFunctionalSnoop(PacketPtr pkt)
1869608Sandreas.hansson@arm.com        {
1879608Sandreas.hansson@arm.com            // @todo: Is there a need for potential invalidation here?
1889608Sandreas.hansson@arm.com        }
1899608Sandreas.hansson@arm.com
1908707Sandreas.hansson@arm.com        /** Handles doing a retry of the previous send. */
19110713Sandreas.hansson@arm.com        virtual void recvReqRetry();
1928707Sandreas.hansson@arm.com
1938707Sandreas.hansson@arm.com        /**
1948707Sandreas.hansson@arm.com         * As this CPU requires snooping to maintain the load store queue
1958707Sandreas.hansson@arm.com         * change the behaviour from the base CPU port.
1968707Sandreas.hansson@arm.com         *
1978711Sandreas.hansson@arm.com         * @return true since we have to snoop
1988707Sandreas.hansson@arm.com         */
1998922Swilliam.wang@arm.com        virtual bool isSnooping() const { return true; }
2008707Sandreas.hansson@arm.com    };
2018707Sandreas.hansson@arm.com
2021060SN/A    class TickEvent : public Event
2031060SN/A    {
2041060SN/A      private:
2052292SN/A        /** Pointer to the CPU. */
2061755SN/A        FullO3CPU<Impl> *cpu;
2071060SN/A
2081060SN/A      public:
2092292SN/A        /** Constructs a tick event. */
2101755SN/A        TickEvent(FullO3CPU<Impl> *c);
2112292SN/A
2122292SN/A        /** Processes a tick event, calling tick() on the CPU. */
2131060SN/A        void process();
2142292SN/A        /** Returns the description of the tick event. */
2155336Shines@cs.fsu.edu        const char *description() const;
2161060SN/A    };
2171060SN/A
2182292SN/A    /** The tick event used for scheduling CPU ticks. */
2191060SN/A    TickEvent tickEvent;
2201060SN/A
2212292SN/A    /** Schedule tick event, regardless of its current state. */
2229180Sandreas.hansson@arm.com    void scheduleTickEvent(Cycles delay)
2231060SN/A    {
2241060SN/A        if (tickEvent.squashed())
2259179Sandreas.hansson@arm.com            reschedule(tickEvent, clockEdge(delay));
2261060SN/A        else if (!tickEvent.scheduled())
2279179Sandreas.hansson@arm.com            schedule(tickEvent, clockEdge(delay));
2281060SN/A    }
2291060SN/A
2302292SN/A    /** Unschedule tick event, regardless of its current state. */
2311060SN/A    void unscheduleTickEvent()
2321060SN/A    {
2331060SN/A        if (tickEvent.scheduled())
2341060SN/A            tickEvent.squash();
2351060SN/A    }
2361060SN/A
2379444SAndreas.Sandberg@ARM.com    /**
23810913Sandreas.sandberg@arm.com     * Check if the pipeline has drained and signal drain done.
2399444SAndreas.Sandberg@ARM.com     *
2409444SAndreas.Sandberg@ARM.com     * This method checks if a drain has been requested and if the CPU
2419444SAndreas.Sandberg@ARM.com     * has drained successfully (i.e., there are no instructions in
2429444SAndreas.Sandberg@ARM.com     * the pipeline). If the CPU has drained, it deschedules the tick
2439444SAndreas.Sandberg@ARM.com     * event and signals the drain manager.
2449444SAndreas.Sandberg@ARM.com     *
2459444SAndreas.Sandberg@ARM.com     * @return False if a drain hasn't been requested or the CPU
2469444SAndreas.Sandberg@ARM.com     * hasn't drained, true otherwise.
2479444SAndreas.Sandberg@ARM.com     */
2489444SAndreas.Sandberg@ARM.com    bool tryDrain();
2499444SAndreas.Sandberg@ARM.com
2509444SAndreas.Sandberg@ARM.com    /**
2519444SAndreas.Sandberg@ARM.com     * Perform sanity checks after a drain.
2529444SAndreas.Sandberg@ARM.com     *
2539444SAndreas.Sandberg@ARM.com     * This method is called from drain() when it has determined that
2549444SAndreas.Sandberg@ARM.com     * the CPU is fully drained when gem5 is compiled with the NDEBUG
2559444SAndreas.Sandberg@ARM.com     * macro undefined. The intention of this method is to do more
2569444SAndreas.Sandberg@ARM.com     * extensive tests than the isDrained() method to weed out any
2579444SAndreas.Sandberg@ARM.com     * draining bugs.
2589444SAndreas.Sandberg@ARM.com     */
2599444SAndreas.Sandberg@ARM.com    void drainSanityCheck() const;
2609444SAndreas.Sandberg@ARM.com
2619444SAndreas.Sandberg@ARM.com    /** Check if a system is in a drained state. */
2629444SAndreas.Sandberg@ARM.com    bool isDrained() const;
2639444SAndreas.Sandberg@ARM.com
2641060SN/A  public:
2652292SN/A    /** Constructs a CPU with the given parameters. */
2665595Sgblack@eecs.umich.edu    FullO3CPU(DerivO3CPUParams *params);
2672292SN/A    /** Destructor. */
2681755SN/A    ~FullO3CPU();
2691060SN/A
2702292SN/A    /** Registers statistics. */
27111169Sandreas.hansson@arm.com    void regStats() override;
2721684SN/A
27310023Smatt.horsnell@ARM.com    ProbePointArg<PacketPtr> *ppInstAccessComplete;
27410023Smatt.horsnell@ARM.com    ProbePointArg<std::pair<DynInstPtr, PacketPtr> > *ppDataAccessComplete;
27510023Smatt.horsnell@ARM.com
27610023Smatt.horsnell@ARM.com    /** Register probe points. */
27711169Sandreas.hansson@arm.com    void regProbePoints() override;
27810023Smatt.horsnell@ARM.com
2795358Sgblack@eecs.umich.edu    void demapPage(Addr vaddr, uint64_t asn)
2805358Sgblack@eecs.umich.edu    {
2815358Sgblack@eecs.umich.edu        this->itb->demapPage(vaddr, asn);
2825358Sgblack@eecs.umich.edu        this->dtb->demapPage(vaddr, asn);
2835358Sgblack@eecs.umich.edu    }
2845358Sgblack@eecs.umich.edu
2855358Sgblack@eecs.umich.edu    void demapInstPage(Addr vaddr, uint64_t asn)
2865358Sgblack@eecs.umich.edu    {
2875358Sgblack@eecs.umich.edu        this->itb->demapPage(vaddr, asn);
2885358Sgblack@eecs.umich.edu    }
2895358Sgblack@eecs.umich.edu
2905358Sgblack@eecs.umich.edu    void demapDataPage(Addr vaddr, uint64_t asn)
2915358Sgblack@eecs.umich.edu    {
2925358Sgblack@eecs.umich.edu        this->dtb->demapPage(vaddr, asn);
2935358Sgblack@eecs.umich.edu    }
2945358Sgblack@eecs.umich.edu
2952292SN/A    /** Ticks CPU, calling tick() on each stage, and checking the overall
2962292SN/A     *  activity to see if the CPU should deschedule itself.
2972292SN/A     */
2981684SN/A    void tick();
2991684SN/A
3002292SN/A    /** Initialize the CPU */
30111169Sandreas.hansson@arm.com    void init() override;
3021060SN/A
30311169Sandreas.hansson@arm.com    void startup() override;
3049427SAndreas.Sandberg@ARM.com
3052834Sksewell@umich.edu    /** Returns the Number of Active Threads in the CPU */
3062834Sksewell@umich.edu    int numActiveThreads()
3072834Sksewell@umich.edu    { return activeThreads.size(); }
3082834Sksewell@umich.edu
3092829Sksewell@umich.edu    /** Add Thread to Active Threads List */
3106221Snate@binkert.org    void activateThread(ThreadID tid);
3112875Sksewell@umich.edu
3122875Sksewell@umich.edu    /** Remove Thread from Active Threads List */
3136221Snate@binkert.org    void deactivateThread(ThreadID tid);
3142829Sksewell@umich.edu
3152292SN/A    /** Setup CPU to insert a thread's context */
3166221Snate@binkert.org    void insertThread(ThreadID tid);
3171060SN/A
3182292SN/A    /** Remove all of a thread's context from CPU */
3196221Snate@binkert.org    void removeThread(ThreadID tid);
3202292SN/A
3212292SN/A    /** Count the Total Instructions Committed in the CPU. */
32211169Sandreas.hansson@arm.com    Counter totalInsts() const override;
3238834Satgutier@umich.edu
3248834Satgutier@umich.edu    /** Count the Total Ops (including micro ops) committed in the CPU. */
32511169Sandreas.hansson@arm.com    Counter totalOps() const override;
3262292SN/A
3272292SN/A    /** Add Thread to Active Threads List. */
32811169Sandreas.hansson@arm.com    void activateContext(ThreadID tid) override;
3292292SN/A
3302292SN/A    /** Remove Thread from Active Threads List */
33111169Sandreas.hansson@arm.com    void suspendContext(ThreadID tid) override;
3322292SN/A
3332292SN/A    /** Remove Thread from Active Threads List &&
3342292SN/A     *  Remove Thread Context from CPU.
3352292SN/A     */
33611169Sandreas.hansson@arm.com    void haltContext(ThreadID tid) override;
3372292SN/A
3382292SN/A    /** Update The Order In Which We Process Threads. */
3392292SN/A    void updateThreadPriority();
3402292SN/A
3419444SAndreas.Sandberg@ARM.com    /** Is the CPU draining? */
34210913Sandreas.sandberg@arm.com    bool isDraining() const { return drainState() == DrainState::Draining; }
3439444SAndreas.Sandberg@ARM.com
34411168Sandreas.hansson@arm.com    void serializeThread(CheckpointOut &cp, ThreadID tid) const override;
34511168Sandreas.hansson@arm.com    void unserializeThread(CheckpointIn &cp, ThreadID tid) override;
3462864Sktlim@umich.edu
3472864Sktlim@umich.edu  public:
3485595Sgblack@eecs.umich.edu    /** Executes a syscall.
3495595Sgblack@eecs.umich.edu     * @todo: Determine if this needs to be virtual.
3502292SN/A     */
35111877Sbrandon.potter@amd.com    void syscall(int64_t callnum, ThreadID tid, Fault *fault);
3522292SN/A
3532843Sktlim@umich.edu    /** Starts draining the CPU's pipeline of all instructions in
3542843Sktlim@umich.edu     * order to stop all memory accesses. */
35511168Sandreas.hansson@arm.com    DrainState drain() override;
3562843Sktlim@umich.edu
3572843Sktlim@umich.edu    /** Resumes execution after a drain. */
35811168Sandreas.hansson@arm.com    void drainResume() override;
3592292SN/A
3609444SAndreas.Sandberg@ARM.com    /**
3619444SAndreas.Sandberg@ARM.com     * Commit has reached a safe point to drain a thread.
3629444SAndreas.Sandberg@ARM.com     *
3639444SAndreas.Sandberg@ARM.com     * Commit calls this method to inform the pipeline that it has
3649444SAndreas.Sandberg@ARM.com     * reached a point where it is not executed microcode and is about
3659444SAndreas.Sandberg@ARM.com     * to squash uncommitted instructions to fully drain the pipeline.
3669444SAndreas.Sandberg@ARM.com     */
3679444SAndreas.Sandberg@ARM.com    void commitDrained(ThreadID tid);
3682843Sktlim@umich.edu
3692843Sktlim@umich.edu    /** Switches out this CPU. */
37011169Sandreas.hansson@arm.com    void switchOut() override;
3712316SN/A
3722348SN/A    /** Takes over from another CPU. */
37311169Sandreas.hansson@arm.com    void takeOverFrom(BaseCPU *oldCPU) override;
3741060SN/A
37511169Sandreas.hansson@arm.com    void verifyMemoryMode() const override;
3769523SAndreas.Sandberg@ARM.com
3771060SN/A    /** Get the current instruction sequence number, and increment it. */
3782316SN/A    InstSeqNum getAndIncrementInstSeq()
3792316SN/A    { return globalSeqNum++; }
3801060SN/A
3815595Sgblack@eecs.umich.edu    /** Traps to handle given fault. */
38210417Sandreas.hansson@arm.com    void trap(const Fault &fault, ThreadID tid, const StaticInstPtr &inst);
3835595Sgblack@eecs.umich.edu
3845702Ssaidi@eecs.umich.edu    /** HW return from error interrupt. */
3856221Snate@binkert.org    Fault hwrei(ThreadID tid);
3865702Ssaidi@eecs.umich.edu
3876221Snate@binkert.org    bool simPalCheck(int palFunc, ThreadID tid);
3885702Ssaidi@eecs.umich.edu
3895595Sgblack@eecs.umich.edu    /** Returns the Fault for any valid interrupt. */
3905595Sgblack@eecs.umich.edu    Fault getInterrupts();
3915595Sgblack@eecs.umich.edu
3925595Sgblack@eecs.umich.edu    /** Processes any an interrupt fault. */
39310379Sandreas.hansson@arm.com    void processInterrupts(const Fault &interrupt);
3945595Sgblack@eecs.umich.edu
3955595Sgblack@eecs.umich.edu    /** Halts the CPU. */
3965595Sgblack@eecs.umich.edu    void halt() { panic("Halt not implemented!\n"); }
3975595Sgblack@eecs.umich.edu
3982348SN/A    /** Register accessors.  Index refers to the physical register index. */
3995595Sgblack@eecs.umich.edu
4005595Sgblack@eecs.umich.edu    /** Reads a miscellaneous register. */
40110698Sandreas.hansson@arm.com    TheISA::MiscReg readMiscRegNoEffect(int misc_reg, ThreadID tid) const;
4025595Sgblack@eecs.umich.edu
4035595Sgblack@eecs.umich.edu    /** Reads a misc. register, including any side effects the read
4045595Sgblack@eecs.umich.edu     * might have as defined by the architecture.
4055595Sgblack@eecs.umich.edu     */
4066221Snate@binkert.org    TheISA::MiscReg readMiscReg(int misc_reg, ThreadID tid);
4075595Sgblack@eecs.umich.edu
4085595Sgblack@eecs.umich.edu    /** Sets a miscellaneous register. */
4096221Snate@binkert.org    void setMiscRegNoEffect(int misc_reg, const TheISA::MiscReg &val,
4106221Snate@binkert.org            ThreadID tid);
4115595Sgblack@eecs.umich.edu
4125595Sgblack@eecs.umich.edu    /** Sets a misc. register, including any side effects the write
4135595Sgblack@eecs.umich.edu     * might have as defined by the architecture.
4145595Sgblack@eecs.umich.edu     */
4155595Sgblack@eecs.umich.edu    void setMiscReg(int misc_reg, const TheISA::MiscReg &val,
4166221Snate@binkert.org            ThreadID tid);
4175595Sgblack@eecs.umich.edu
41812105Snathanael.premillieu@arm.com    uint64_t readIntReg(PhysRegIdPtr phys_reg);
4191060SN/A
42012105Snathanael.premillieu@arm.com    TheISA::FloatReg readFloatReg(PhysRegIdPtr phys_reg);
4211060SN/A
42212105Snathanael.premillieu@arm.com    TheISA::FloatRegBits readFloatRegBits(PhysRegIdPtr phys_reg);
4232455SN/A
42412109SRekai.GonzalezAlberquilla@arm.com    const VecRegContainer& readVecReg(PhysRegIdPtr reg_idx) const;
42512109SRekai.GonzalezAlberquilla@arm.com
42612109SRekai.GonzalezAlberquilla@arm.com    /**
42712109SRekai.GonzalezAlberquilla@arm.com     * Read physical vector register for modification.
42812109SRekai.GonzalezAlberquilla@arm.com     */
42912109SRekai.GonzalezAlberquilla@arm.com    VecRegContainer& getWritableVecReg(PhysRegIdPtr reg_idx);
43012109SRekai.GonzalezAlberquilla@arm.com
43112109SRekai.GonzalezAlberquilla@arm.com    /**
43212109SRekai.GonzalezAlberquilla@arm.com     * Read physical vector register lane
43312109SRekai.GonzalezAlberquilla@arm.com     */
43412109SRekai.GonzalezAlberquilla@arm.com    template<typename VecElem, int LaneIdx>
43512109SRekai.GonzalezAlberquilla@arm.com    VecLaneT<VecElem, true>
43612109SRekai.GonzalezAlberquilla@arm.com    readVecLane(PhysRegIdPtr phys_reg) const
43712109SRekai.GonzalezAlberquilla@arm.com    {
43812109SRekai.GonzalezAlberquilla@arm.com        vecRegfileReads++;
43912109SRekai.GonzalezAlberquilla@arm.com        return regFile.readVecLane<VecElem, LaneIdx>(phys_reg);
44012109SRekai.GonzalezAlberquilla@arm.com    }
44112109SRekai.GonzalezAlberquilla@arm.com
44212109SRekai.GonzalezAlberquilla@arm.com    /**
44312109SRekai.GonzalezAlberquilla@arm.com     * Read physical vector register lane
44412109SRekai.GonzalezAlberquilla@arm.com     */
44512109SRekai.GonzalezAlberquilla@arm.com    template<typename VecElem>
44612109SRekai.GonzalezAlberquilla@arm.com    VecLaneT<VecElem, true>
44712109SRekai.GonzalezAlberquilla@arm.com    readVecLane(PhysRegIdPtr phys_reg) const
44812109SRekai.GonzalezAlberquilla@arm.com    {
44912109SRekai.GonzalezAlberquilla@arm.com        vecRegfileReads++;
45012109SRekai.GonzalezAlberquilla@arm.com        return regFile.readVecLane<VecElem>(phys_reg);
45112109SRekai.GonzalezAlberquilla@arm.com    }
45212109SRekai.GonzalezAlberquilla@arm.com
45312109SRekai.GonzalezAlberquilla@arm.com    /** Write a lane of the destination vector register. */
45412109SRekai.GonzalezAlberquilla@arm.com    template<typename LD>
45512109SRekai.GonzalezAlberquilla@arm.com    void
45612109SRekai.GonzalezAlberquilla@arm.com    setVecLane(PhysRegIdPtr phys_reg, const LD& val)
45712109SRekai.GonzalezAlberquilla@arm.com    {
45812109SRekai.GonzalezAlberquilla@arm.com        vecRegfileWrites++;
45912109SRekai.GonzalezAlberquilla@arm.com        return regFile.setVecLane(phys_reg, val);
46012109SRekai.GonzalezAlberquilla@arm.com    }
46112109SRekai.GonzalezAlberquilla@arm.com
46212109SRekai.GonzalezAlberquilla@arm.com    const VecElem& readVecElem(PhysRegIdPtr reg_idx) const;
46312109SRekai.GonzalezAlberquilla@arm.com
46412105Snathanael.premillieu@arm.com    TheISA::CCReg readCCReg(PhysRegIdPtr phys_reg);
4659920Syasuko.eckert@amd.com
46612105Snathanael.premillieu@arm.com    void setIntReg(PhysRegIdPtr phys_reg, uint64_t val);
4671060SN/A
46812105Snathanael.premillieu@arm.com    void setFloatReg(PhysRegIdPtr phys_reg, TheISA::FloatReg val);
4691060SN/A
47012105Snathanael.premillieu@arm.com    void setFloatRegBits(PhysRegIdPtr phys_reg, TheISA::FloatRegBits val);
4712455SN/A
47212109SRekai.GonzalezAlberquilla@arm.com    void setVecReg(PhysRegIdPtr reg_idx, const VecRegContainer& val);
47312109SRekai.GonzalezAlberquilla@arm.com
47412109SRekai.GonzalezAlberquilla@arm.com    void setVecElem(PhysRegIdPtr reg_idx, const VecElem& val);
47512109SRekai.GonzalezAlberquilla@arm.com
47612105Snathanael.premillieu@arm.com    void setCCReg(PhysRegIdPtr phys_reg, TheISA::CCReg val);
4779920Syasuko.eckert@amd.com
4786221Snate@binkert.org    uint64_t readArchIntReg(int reg_idx, ThreadID tid);
4791060SN/A
4806314Sgblack@eecs.umich.edu    float readArchFloatReg(int reg_idx, ThreadID tid);
4812292SN/A
4826221Snate@binkert.org    uint64_t readArchFloatRegInt(int reg_idx, ThreadID tid);
4832292SN/A
48412109SRekai.GonzalezAlberquilla@arm.com    const VecRegContainer& readArchVecReg(int reg_idx, ThreadID tid) const;
48512109SRekai.GonzalezAlberquilla@arm.com    /** Read architectural vector register for modification. */
48612109SRekai.GonzalezAlberquilla@arm.com    VecRegContainer& getWritableArchVecReg(int reg_idx, ThreadID tid);
48712109SRekai.GonzalezAlberquilla@arm.com
48812109SRekai.GonzalezAlberquilla@arm.com    /** Read architectural vector register lane. */
48912109SRekai.GonzalezAlberquilla@arm.com    template<typename VecElem>
49012109SRekai.GonzalezAlberquilla@arm.com    VecLaneT<VecElem, true>
49112109SRekai.GonzalezAlberquilla@arm.com    readArchVecLane(int reg_idx, int lId, ThreadID tid) const
49212109SRekai.GonzalezAlberquilla@arm.com    {
49312109SRekai.GonzalezAlberquilla@arm.com        PhysRegIdPtr phys_reg = commitRenameMap[tid].lookup(
49412109SRekai.GonzalezAlberquilla@arm.com                    RegId(VecRegClass, reg_idx));
49512109SRekai.GonzalezAlberquilla@arm.com        return readVecLane<VecElem>(phys_reg);
49612109SRekai.GonzalezAlberquilla@arm.com    }
49712109SRekai.GonzalezAlberquilla@arm.com
49812109SRekai.GonzalezAlberquilla@arm.com
49912109SRekai.GonzalezAlberquilla@arm.com    /** Write a lane of the destination vector register. */
50012109SRekai.GonzalezAlberquilla@arm.com    template<typename LD>
50112109SRekai.GonzalezAlberquilla@arm.com    void
50212109SRekai.GonzalezAlberquilla@arm.com    setArchVecLane(int reg_idx, int lId, ThreadID tid, const LD& val)
50312109SRekai.GonzalezAlberquilla@arm.com    {
50412109SRekai.GonzalezAlberquilla@arm.com        PhysRegIdPtr phys_reg = commitRenameMap[tid].lookup(
50512109SRekai.GonzalezAlberquilla@arm.com                    RegId(VecRegClass, reg_idx));
50612109SRekai.GonzalezAlberquilla@arm.com        setVecLane(phys_reg, val);
50712109SRekai.GonzalezAlberquilla@arm.com    }
50812109SRekai.GonzalezAlberquilla@arm.com
50912109SRekai.GonzalezAlberquilla@arm.com    const VecElem& readArchVecElem(const RegIndex& reg_idx,
51012109SRekai.GonzalezAlberquilla@arm.com                                   const ElemIndex& ldx, ThreadID tid) const;
51112109SRekai.GonzalezAlberquilla@arm.com
5129920Syasuko.eckert@amd.com    TheISA::CCReg readArchCCReg(int reg_idx, ThreadID tid);
5139920Syasuko.eckert@amd.com
5142348SN/A    /** Architectural register accessors.  Looks up in the commit
5152348SN/A     * rename table to obtain the true physical index of the
5162348SN/A     * architected register first, then accesses that physical
5172348SN/A     * register.
5182348SN/A     */
5196221Snate@binkert.org    void setArchIntReg(int reg_idx, uint64_t val, ThreadID tid);
5202292SN/A
5216314Sgblack@eecs.umich.edu    void setArchFloatReg(int reg_idx, float val, ThreadID tid);
5222292SN/A
5236221Snate@binkert.org    void setArchFloatRegInt(int reg_idx, uint64_t val, ThreadID tid);
5242292SN/A
52512109SRekai.GonzalezAlberquilla@arm.com    void setArchVecReg(int reg_idx, const VecRegContainer& val, ThreadID tid);
52612109SRekai.GonzalezAlberquilla@arm.com
52712109SRekai.GonzalezAlberquilla@arm.com    void setArchVecElem(const RegIndex& reg_idx, const ElemIndex& ldx,
52812109SRekai.GonzalezAlberquilla@arm.com                        const VecElem& val, ThreadID tid);
52912109SRekai.GonzalezAlberquilla@arm.com
5309920Syasuko.eckert@amd.com    void setArchCCReg(int reg_idx, TheISA::CCReg val, ThreadID tid);
5319920Syasuko.eckert@amd.com
5327720Sgblack@eecs.umich.edu    /** Sets the commit PC state of a specific thread. */
5337720Sgblack@eecs.umich.edu    void pcState(const TheISA::PCState &newPCState, ThreadID tid);
5347720Sgblack@eecs.umich.edu
5357720Sgblack@eecs.umich.edu    /** Reads the commit PC state of a specific thread. */
5367720Sgblack@eecs.umich.edu    TheISA::PCState pcState(ThreadID tid);
5377720Sgblack@eecs.umich.edu
5382348SN/A    /** Reads the commit PC of a specific thread. */
5397720Sgblack@eecs.umich.edu    Addr instAddr(ThreadID tid);
5402292SN/A
5414636Sgblack@eecs.umich.edu    /** Reads the commit micro PC of a specific thread. */
5427720Sgblack@eecs.umich.edu    MicroPC microPC(ThreadID tid);
5434636Sgblack@eecs.umich.edu
5442348SN/A    /** Reads the next PC of a specific thread. */
5457720Sgblack@eecs.umich.edu    Addr nextInstAddr(ThreadID tid);
5462756Sksewell@umich.edu
5475595Sgblack@eecs.umich.edu    /** Initiates a squash of all in-flight instructions for a given
5485595Sgblack@eecs.umich.edu     * thread.  The source of the squash is an external update of
5495595Sgblack@eecs.umich.edu     * state through the TC.
5505595Sgblack@eecs.umich.edu     */
5516221Snate@binkert.org    void squashFromTC(ThreadID tid);
5525595Sgblack@eecs.umich.edu
5531060SN/A    /** Function to add instruction onto the head of the list of the
5541060SN/A     *  instructions.  Used when new instructions are fetched.
5551060SN/A     */
5562292SN/A    ListIt addInst(DynInstPtr &inst);
5571060SN/A
5581060SN/A    /** Function to tell the CPU that an instruction has completed. */
5598834Satgutier@umich.edu    void instDone(ThreadID tid, DynInstPtr &inst);
5601060SN/A
5612325SN/A    /** Remove an instruction from the front end of the list.  There's
5622325SN/A     *  no restriction on location of the instruction.
5631060SN/A     */
5641061SN/A    void removeFrontInst(DynInstPtr &inst);
5651060SN/A
5662935Sksewell@umich.edu    /** Remove all instructions that are not currently in the ROB.
5672935Sksewell@umich.edu     *  There's also an option to not squash delay slot instructions.*/
5686221Snate@binkert.org    void removeInstsNotInROB(ThreadID tid);
5691060SN/A
5701062SN/A    /** Remove all instructions younger than the given sequence number. */
5716221Snate@binkert.org    void removeInstsUntil(const InstSeqNum &seq_num, ThreadID tid);
5722292SN/A
5732348SN/A    /** Removes the instruction pointed to by the iterator. */
5746221Snate@binkert.org    inline void squashInstIt(const ListIt &instIt, ThreadID tid);
5752292SN/A
5762348SN/A    /** Cleans up all instructions on the remove list. */
5772292SN/A    void cleanUpRemovedInsts();
5781062SN/A
5792348SN/A    /** Debug function to print all instructions on the list. */
5801060SN/A    void dumpInsts();
5811060SN/A
5821060SN/A  public:
5835737Scws3k@cs.virginia.edu#ifndef NDEBUG
5845737Scws3k@cs.virginia.edu    /** Count of total number of dynamic instructions in flight. */
5855737Scws3k@cs.virginia.edu    int instcount;
5865737Scws3k@cs.virginia.edu#endif
5875737Scws3k@cs.virginia.edu
5881060SN/A    /** List of all the instructions in flight. */
5892292SN/A    std::list<DynInstPtr> instList;
5901060SN/A
5912292SN/A    /** List of all the instructions that will be removed at the end of this
5922292SN/A     *  cycle.
5932292SN/A     */
5942292SN/A    std::queue<ListIt> removeList;
5952292SN/A
5962325SN/A#ifdef DEBUG
5972348SN/A    /** Debug structure to keep track of the sequence numbers still in
5982348SN/A     * flight.
5992348SN/A     */
6002292SN/A    std::set<InstSeqNum> snList;
6012325SN/A#endif
6022292SN/A
6032325SN/A    /** Records if instructions need to be removed this cycle due to
6042325SN/A     *  being retired or squashed.
6052292SN/A     */
6062292SN/A    bool removeInstsThisCycle;
6072292SN/A
6081060SN/A  protected:
6091060SN/A    /** The fetch stage. */
6101060SN/A    typename CPUPolicy::Fetch fetch;
6111060SN/A
6121060SN/A    /** The decode stage. */
6131060SN/A    typename CPUPolicy::Decode decode;
6141060SN/A
6151060SN/A    /** The dispatch stage. */
6161060SN/A    typename CPUPolicy::Rename rename;
6171060SN/A
6181060SN/A    /** The issue/execute/writeback stages. */
6191060SN/A    typename CPUPolicy::IEW iew;
6201060SN/A
6211060SN/A    /** The commit stage. */
6221060SN/A    typename CPUPolicy::Commit commit;
6231060SN/A
62412109SRekai.GonzalezAlberquilla@arm.com    /** The rename mode of the vector registers */
62512109SRekai.GonzalezAlberquilla@arm.com    Enums::VecRegRenameMode vecMode;
62612109SRekai.GonzalezAlberquilla@arm.com
6271060SN/A    /** The register file. */
6289919Ssteve.reinhardt@amd.com    PhysRegFile regFile;
6291060SN/A
6301060SN/A    /** The free list. */
6311060SN/A    typename CPUPolicy::FreeList freeList;
6321060SN/A
6331060SN/A    /** The rename map. */
6342292SN/A    typename CPUPolicy::RenameMap renameMap[Impl::MaxThreads];
6352292SN/A
6362292SN/A    /** The commit rename map. */
6372292SN/A    typename CPUPolicy::RenameMap commitRenameMap[Impl::MaxThreads];
6381060SN/A
6391060SN/A    /** The re-order buffer. */
6401060SN/A    typename CPUPolicy::ROB rob;
6411060SN/A
6422292SN/A    /** Active Threads List */
6436221Snate@binkert.org    std::list<ThreadID> activeThreads;
6442292SN/A
6452292SN/A    /** Integer Register Scoreboard */
6462292SN/A    Scoreboard scoreboard;
6472292SN/A
6489384SAndreas.Sandberg@arm.com    std::vector<TheISA::ISA *> isa;
6496313Sgblack@eecs.umich.edu
6508707Sandreas.hansson@arm.com    /** Instruction port. Note that it has to appear after the fetch stage. */
6518707Sandreas.hansson@arm.com    IcachePort icachePort;
6528707Sandreas.hansson@arm.com
6538707Sandreas.hansson@arm.com    /** Data port. Note that it has to appear after the iew stages */
6548707Sandreas.hansson@arm.com    DcachePort dcachePort;
6558707Sandreas.hansson@arm.com
6561060SN/A  public:
6572292SN/A    /** Enum to give each stage a specific index, so when calling
6582292SN/A     *  activateStage() or deactivateStage(), they can specify which stage
6592292SN/A     *  is being activated/deactivated.
6602292SN/A     */
6612292SN/A    enum StageIdx {
6622292SN/A        FetchIdx,
6632292SN/A        DecodeIdx,
6642292SN/A        RenameIdx,
6652292SN/A        IEWIdx,
6662292SN/A        CommitIdx,
6672292SN/A        NumStages };
6682292SN/A
6691060SN/A    /** Typedefs from the Impl to get the structs that each of the
6701060SN/A     *  time buffers should use.
6711060SN/A     */
6721061SN/A    typedef typename CPUPolicy::TimeStruct TimeStruct;
6731060SN/A
6741061SN/A    typedef typename CPUPolicy::FetchStruct FetchStruct;
6751060SN/A
6761061SN/A    typedef typename CPUPolicy::DecodeStruct DecodeStruct;
6771060SN/A
6781061SN/A    typedef typename CPUPolicy::RenameStruct RenameStruct;
6791060SN/A
6801061SN/A    typedef typename CPUPolicy::IEWStruct IEWStruct;
6811060SN/A
6821060SN/A    /** The main time buffer to do backwards communication. */
6831060SN/A    TimeBuffer<TimeStruct> timeBuffer;
6841060SN/A
6851060SN/A    /** The fetch stage's instruction queue. */
6861060SN/A    TimeBuffer<FetchStruct> fetchQueue;
6871060SN/A
6881060SN/A    /** The decode stage's instruction queue. */
6891060SN/A    TimeBuffer<DecodeStruct> decodeQueue;
6901060SN/A
6911060SN/A    /** The rename stage's instruction queue. */
6921060SN/A    TimeBuffer<RenameStruct> renameQueue;
6931060SN/A
6941060SN/A    /** The IEW stage's instruction queue. */
6951060SN/A    TimeBuffer<IEWStruct> iewQueue;
6961060SN/A
6972348SN/A  private:
6982348SN/A    /** The activity recorder; used to tell if the CPU has any
6992348SN/A     * activity remaining or if it can go to idle and deschedule
7002348SN/A     * itself.
7012348SN/A     */
7022325SN/A    ActivityRecorder activityRec;
7031060SN/A
7042348SN/A  public:
7052348SN/A    /** Records that there was time buffer activity this cycle. */
7062325SN/A    void activityThisCycle() { activityRec.activity(); }
7072292SN/A
7082348SN/A    /** Changes a stage's status to active within the activity recorder. */
7092325SN/A    void activateStage(const StageIdx idx)
7102325SN/A    { activityRec.activateStage(idx); }
7112292SN/A
7122348SN/A    /** Changes a stage's status to inactive within the activity recorder. */
7132325SN/A    void deactivateStage(const StageIdx idx)
7142325SN/A    { activityRec.deactivateStage(idx); }
7152292SN/A
7162292SN/A    /** Wakes the CPU, rescheduling the CPU if it's not already active. */
7172292SN/A    void wakeCPU();
7182260SN/A
71911168Sandreas.hansson@arm.com    virtual void wakeup(ThreadID tid) override;
7205807Snate@binkert.org
7212292SN/A    /** Gets a free thread id. Use if thread ids change across system. */
7226221Snate@binkert.org    ThreadID getFreeTid();
7232292SN/A
7242292SN/A  public:
7252680Sktlim@umich.edu    /** Returns a pointer to a thread context. */
7266221Snate@binkert.org    ThreadContext *
7276221Snate@binkert.org    tcBase(ThreadID tid)
7281681SN/A    {
7292680Sktlim@umich.edu        return thread[tid]->getTC();
7302190SN/A    }
7312190SN/A
7322292SN/A    /** The global sequence number counter. */
7333093Sksewell@umich.edu    InstSeqNum globalSeqNum;//[Impl::MaxThreads];
7341060SN/A
7352348SN/A    /** Pointer to the checker, which can dynamically verify
7362348SN/A     * instruction results at run time.  This can be set to NULL if it
7372348SN/A     * is not being used.
7382348SN/A     */
7398733Sgeoffrey.blake@arm.com    Checker<Impl> *checker;
7402316SN/A
7412292SN/A    /** Pointer to the system. */
7421060SN/A    System *system;
7431060SN/A
7442348SN/A    /** Pointers to all of the threads in the CPU. */
7452292SN/A    std::vector<Thread *> thread;
7462260SN/A
7472292SN/A    /** Threads Scheduled to Enter CPU */
7482292SN/A    std::list<int> cpuWaitList;
7492292SN/A
7502292SN/A    /** The cycle that the CPU was last running, used for statistics. */
7519180Sandreas.hansson@arm.com    Cycles lastRunningCycle;
7522292SN/A
7532829Sksewell@umich.edu    /** The cycle that the CPU was last activated by a new thread*/
7542829Sksewell@umich.edu    Tick lastActivatedCycle;
7552829Sksewell@umich.edu
7562292SN/A    /** Mapping for system thread id to cpu id */
7576221Snate@binkert.org    std::map<ThreadID, unsigned> threadMap;
7582292SN/A
7592292SN/A    /** Available thread ids in the cpu*/
7606221Snate@binkert.org    std::vector<ThreadID> tids;
7612292SN/A
7625595Sgblack@eecs.umich.edu    /** CPU read function, forwards read to LSQ. */
7636974Stjones1@inf.ed.ac.uk    Fault read(RequestPtr &req, RequestPtr &sreqLow, RequestPtr &sreqHigh,
76411302Ssteve.reinhardt@amd.com               int load_idx)
7655595Sgblack@eecs.umich.edu    {
76611302Ssteve.reinhardt@amd.com        return this->iew.ldstQueue.read(req, sreqLow, sreqHigh, load_idx);
7675595Sgblack@eecs.umich.edu    }
7685595Sgblack@eecs.umich.edu
7695595Sgblack@eecs.umich.edu    /** CPU write function, forwards write to LSQ. */
7706974Stjones1@inf.ed.ac.uk    Fault write(RequestPtr &req, RequestPtr &sreqLow, RequestPtr &sreqHigh,
7717520Sgblack@eecs.umich.edu                uint8_t *data, int store_idx)
7725595Sgblack@eecs.umich.edu    {
7736974Stjones1@inf.ed.ac.uk        return this->iew.ldstQueue.write(req, sreqLow, sreqHigh,
7746974Stjones1@inf.ed.ac.uk                                         data, store_idx);
7755595Sgblack@eecs.umich.edu    }
7765595Sgblack@eecs.umich.edu
7778707Sandreas.hansson@arm.com    /** Used by the fetch unit to get a hold of the instruction port. */
77811169Sandreas.hansson@arm.com    MasterPort &getInstPort() override { return icachePort; }
7798707Sandreas.hansson@arm.com
7806974Stjones1@inf.ed.ac.uk    /** Get the dcache port (used to find block size for translations). */
78111169Sandreas.hansson@arm.com    MasterPort &getDataPort() override { return dcachePort; }
7826974Stjones1@inf.ed.ac.uk
7832292SN/A    /** Stat for total number of times the CPU is descheduled. */
7845999Snate@binkert.org    Stats::Scalar timesIdled;
7852292SN/A    /** Stat for total number of cycles the CPU spends descheduled. */
7865999Snate@binkert.org    Stats::Scalar idleCycles;
7878627SAli.Saidi@ARM.com    /** Stat for total number of cycles the CPU spends descheduled due to a
7888627SAli.Saidi@ARM.com     * quiesce operation or waiting for an interrupt. */
7898627SAli.Saidi@ARM.com    Stats::Scalar quiesceCycles;
7902292SN/A    /** Stat for the number of committed instructions per thread. */
7915999Snate@binkert.org    Stats::Vector committedInsts;
7928834Satgutier@umich.edu    /** Stat for the number of committed ops (including micro ops) per thread. */
7938834Satgutier@umich.edu    Stats::Vector committedOps;
7942292SN/A    /** Stat for the CPI per thread. */
7952292SN/A    Stats::Formula cpi;
7962292SN/A    /** Stat for the total CPI. */
7972292SN/A    Stats::Formula totalCpi;
7982292SN/A    /** Stat for the IPC per thread. */
7992292SN/A    Stats::Formula ipc;
8002292SN/A    /** Stat for the total IPC. */
8012292SN/A    Stats::Formula totalIpc;
8027897Shestness@cs.utexas.edu
8037897Shestness@cs.utexas.edu    //number of integer register file accesses
8047897Shestness@cs.utexas.edu    Stats::Scalar intRegfileReads;
8057897Shestness@cs.utexas.edu    Stats::Scalar intRegfileWrites;
8067897Shestness@cs.utexas.edu    //number of float register file accesses
8077897Shestness@cs.utexas.edu    Stats::Scalar fpRegfileReads;
8087897Shestness@cs.utexas.edu    Stats::Scalar fpRegfileWrites;
80912109SRekai.GonzalezAlberquilla@arm.com    //number of vector register file accesses
81012109SRekai.GonzalezAlberquilla@arm.com    mutable Stats::Scalar vecRegfileReads;
81112109SRekai.GonzalezAlberquilla@arm.com    Stats::Scalar vecRegfileWrites;
8129920Syasuko.eckert@amd.com    //number of CC register file accesses
8139920Syasuko.eckert@amd.com    Stats::Scalar ccRegfileReads;
8149920Syasuko.eckert@amd.com    Stats::Scalar ccRegfileWrites;
8157897Shestness@cs.utexas.edu    //number of misc
8167897Shestness@cs.utexas.edu    Stats::Scalar miscRegfileReads;
8177897Shestness@cs.utexas.edu    Stats::Scalar miscRegfileWrites;
8181060SN/A};
8191060SN/A
8202325SN/A#endif // __CPU_O3_CPU_HH__
821