cpu.hh revision 9608
11689SN/A/*
29608Sandreas.hansson@arm.com * Copyright (c) 2011-2013 ARM Limited
38707Sandreas.hansson@arm.com * All rights reserved
48707Sandreas.hansson@arm.com *
58707Sandreas.hansson@arm.com * The license below extends only to copyright in the software and shall
68707Sandreas.hansson@arm.com * not be construed as granting a license to any other intellectual
78707Sandreas.hansson@arm.com * property including but not limited to intellectual property relating
88707Sandreas.hansson@arm.com * to a hardware implementation of the functionality of the software
98707Sandreas.hansson@arm.com * licensed hereunder.  You may use the software subject to the license
108707Sandreas.hansson@arm.com * terms below provided that you ensure that this notice is replicated
118707Sandreas.hansson@arm.com * unmodified and in its entirety in all distributions of the software,
128707Sandreas.hansson@arm.com * modified or unmodified, in source code or in binary form.
138707Sandreas.hansson@arm.com *
141689SN/A * Copyright (c) 2004-2005 The Regents of The University of Michigan
157897Shestness@cs.utexas.edu * Copyright (c) 2011 Regents of the University of California
161689SN/A * All rights reserved.
171689SN/A *
181689SN/A * Redistribution and use in source and binary forms, with or without
191689SN/A * modification, are permitted provided that the following conditions are
201689SN/A * met: redistributions of source code must retain the above copyright
211689SN/A * notice, this list of conditions and the following disclaimer;
221689SN/A * redistributions in binary form must reproduce the above copyright
231689SN/A * notice, this list of conditions and the following disclaimer in the
241689SN/A * documentation and/or other materials provided with the distribution;
251689SN/A * neither the name of the copyright holders nor the names of its
261689SN/A * contributors may be used to endorse or promote products derived from
271689SN/A * this software without specific prior written permission.
281689SN/A *
291689SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
301689SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
311689SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
321689SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
331689SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
341689SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
351689SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
361689SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
371689SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
381689SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
391689SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
402665Ssaidi@eecs.umich.edu *
412665Ssaidi@eecs.umich.edu * Authors: Kevin Lim
422756Sksewell@umich.edu *          Korey Sewell
437897Shestness@cs.utexas.edu *          Rick Strong
441689SN/A */
451689SN/A
462325SN/A#ifndef __CPU_O3_CPU_HH__
472325SN/A#define __CPU_O3_CPU_HH__
481060SN/A
491060SN/A#include <iostream>
501060SN/A#include <list>
512292SN/A#include <queue>
522292SN/A#include <set>
531681SN/A#include <vector>
541060SN/A
552980Sgblack@eecs.umich.edu#include "arch/types.hh"
561060SN/A#include "base/statistics.hh"
576658Snate@binkert.org#include "config/the_isa.hh"
581717SN/A#include "cpu/o3/comm.hh"
591717SN/A#include "cpu/o3/cpu_policy.hh"
602292SN/A#include "cpu/o3/scoreboard.hh"
612292SN/A#include "cpu/o3/thread_state.hh"
628229Snate@binkert.org#include "cpu/activity.hh"
638229Snate@binkert.org#include "cpu/base.hh"
648229Snate@binkert.org#include "cpu/simple_thread.hh"
658229Snate@binkert.org#include "cpu/timebuf.hh"
662817Sksewell@umich.edu//#include "cpu/o3/thread_context.hh"
678229Snate@binkert.org#include "params/DerivO3CPU.hh"
681060SN/A#include "sim/process.hh"
691060SN/A
702316SN/Atemplate <class>
712316SN/Aclass Checker;
722680Sktlim@umich.educlass ThreadContext;
732817Sksewell@umich.edutemplate <class>
742817Sksewell@umich.educlass O3ThreadContext;
752843Sktlim@umich.edu
762843Sktlim@umich.educlass Checkpoint;
772669Sktlim@umich.educlass MemObject;
781060SN/Aclass Process;
791060SN/A
808737Skoansin.tan@gmail.comstruct BaseCPUParams;
815529Snate@binkert.org
822733Sktlim@umich.educlass BaseO3CPU : public BaseCPU
831060SN/A{
841060SN/A    //Stuff that's pretty ISA independent will go here.
851060SN/A  public:
865529Snate@binkert.org    BaseO3CPU(BaseCPUParams *params);
872292SN/A
882292SN/A    void regStats();
891060SN/A};
901060SN/A
912348SN/A/**
922348SN/A * FullO3CPU class, has each of the stages (fetch through commit)
932348SN/A * within it, as well as all of the time buffers between stages.  The
942348SN/A * tick() function for the CPU is defined here.
952348SN/A */
961060SN/Atemplate <class Impl>
972733Sktlim@umich.educlass FullO3CPU : public BaseO3CPU
981060SN/A{
991060SN/A  public:
1002325SN/A    // Typedefs from the Impl here.
1011060SN/A    typedef typename Impl::CPUPol CPUPolicy;
1021061SN/A    typedef typename Impl::DynInstPtr DynInstPtr;
1034329Sktlim@umich.edu    typedef typename Impl::O3CPU O3CPU;
1041060SN/A
1055595Sgblack@eecs.umich.edu    typedef O3ThreadState<Impl> ImplState;
1062292SN/A    typedef O3ThreadState<Impl> Thread;
1072292SN/A
1082292SN/A    typedef typename std::list<DynInstPtr>::iterator ListIt;
1092292SN/A
1102817Sksewell@umich.edu    friend class O3ThreadContext<Impl>;
1112829Sksewell@umich.edu
1121060SN/A  public:
1131060SN/A    enum Status {
1141060SN/A        Running,
1151060SN/A        Idle,
1161060SN/A        Halted,
1172307SN/A        Blocked,
1182307SN/A        SwitchedOut
1191060SN/A    };
1201060SN/A
1216022Sgblack@eecs.umich.edu    TheISA::TLB * itb;
1226022Sgblack@eecs.umich.edu    TheISA::TLB * dtb;
1233781Sgblack@eecs.umich.edu
1242292SN/A    /** Overall CPU status. */
1251060SN/A    Status _status;
1261060SN/A
1271060SN/A  private:
1288707Sandreas.hansson@arm.com
1298707Sandreas.hansson@arm.com    /**
1308707Sandreas.hansson@arm.com     * IcachePort class for instruction fetch.
1318707Sandreas.hansson@arm.com     */
1329608Sandreas.hansson@arm.com    class IcachePort : public MasterPort
1338707Sandreas.hansson@arm.com    {
1348707Sandreas.hansson@arm.com      protected:
1358707Sandreas.hansson@arm.com        /** Pointer to fetch. */
1368707Sandreas.hansson@arm.com        DefaultFetch<Impl> *fetch;
1378707Sandreas.hansson@arm.com
1388707Sandreas.hansson@arm.com      public:
1398707Sandreas.hansson@arm.com        /** Default constructor. */
1408707Sandreas.hansson@arm.com        IcachePort(DefaultFetch<Impl> *_fetch, FullO3CPU<Impl>* _cpu)
1419608Sandreas.hansson@arm.com            : MasterPort(_cpu->name() + ".icache_port", _cpu), fetch(_fetch)
1428707Sandreas.hansson@arm.com        { }
1438707Sandreas.hansson@arm.com
1448707Sandreas.hansson@arm.com      protected:
1458707Sandreas.hansson@arm.com
1468707Sandreas.hansson@arm.com        /** Timing version of receive.  Handles setting fetch to the
1478707Sandreas.hansson@arm.com         * proper status to start fetching. */
1488975Sandreas.hansson@arm.com        virtual bool recvTimingResp(PacketPtr pkt);
1498975Sandreas.hansson@arm.com        virtual void recvTimingSnoopReq(PacketPtr pkt) { }
1508707Sandreas.hansson@arm.com
1518707Sandreas.hansson@arm.com        /** Handles doing a retry of a failed fetch. */
1528707Sandreas.hansson@arm.com        virtual void recvRetry();
1538707Sandreas.hansson@arm.com    };
1548707Sandreas.hansson@arm.com
1558707Sandreas.hansson@arm.com    /**
1568707Sandreas.hansson@arm.com     * DcachePort class for the load/store queue.
1578707Sandreas.hansson@arm.com     */
1589608Sandreas.hansson@arm.com    class DcachePort : public MasterPort
1598707Sandreas.hansson@arm.com    {
1608707Sandreas.hansson@arm.com      protected:
1618707Sandreas.hansson@arm.com
1628707Sandreas.hansson@arm.com        /** Pointer to LSQ. */
1638707Sandreas.hansson@arm.com        LSQ<Impl> *lsq;
1648707Sandreas.hansson@arm.com
1658707Sandreas.hansson@arm.com      public:
1668707Sandreas.hansson@arm.com        /** Default constructor. */
1678707Sandreas.hansson@arm.com        DcachePort(LSQ<Impl> *_lsq, FullO3CPU<Impl>* _cpu)
1689608Sandreas.hansson@arm.com            : MasterPort(_cpu->name() + ".dcache_port", _cpu), lsq(_lsq)
1698707Sandreas.hansson@arm.com        { }
1708707Sandreas.hansson@arm.com
1718707Sandreas.hansson@arm.com      protected:
1728707Sandreas.hansson@arm.com
1738707Sandreas.hansson@arm.com        /** Timing version of receive.  Handles writing back and
1748707Sandreas.hansson@arm.com         * completing the load or store that has returned from
1758707Sandreas.hansson@arm.com         * memory. */
1768975Sandreas.hansson@arm.com        virtual bool recvTimingResp(PacketPtr pkt);
1778975Sandreas.hansson@arm.com        virtual void recvTimingSnoopReq(PacketPtr pkt);
1788707Sandreas.hansson@arm.com
1799608Sandreas.hansson@arm.com        virtual void recvFunctionalSnoop(PacketPtr pkt)
1809608Sandreas.hansson@arm.com        {
1819608Sandreas.hansson@arm.com            // @todo: Is there a need for potential invalidation here?
1829608Sandreas.hansson@arm.com        }
1839608Sandreas.hansson@arm.com
1848707Sandreas.hansson@arm.com        /** Handles doing a retry of the previous send. */
1858707Sandreas.hansson@arm.com        virtual void recvRetry();
1868707Sandreas.hansson@arm.com
1878707Sandreas.hansson@arm.com        /**
1888707Sandreas.hansson@arm.com         * As this CPU requires snooping to maintain the load store queue
1898707Sandreas.hansson@arm.com         * change the behaviour from the base CPU port.
1908707Sandreas.hansson@arm.com         *
1918711Sandreas.hansson@arm.com         * @return true since we have to snoop
1928707Sandreas.hansson@arm.com         */
1938922Swilliam.wang@arm.com        virtual bool isSnooping() const { return true; }
1948707Sandreas.hansson@arm.com    };
1958707Sandreas.hansson@arm.com
1961060SN/A    class TickEvent : public Event
1971060SN/A    {
1981060SN/A      private:
1992292SN/A        /** Pointer to the CPU. */
2001755SN/A        FullO3CPU<Impl> *cpu;
2011060SN/A
2021060SN/A      public:
2032292SN/A        /** Constructs a tick event. */
2041755SN/A        TickEvent(FullO3CPU<Impl> *c);
2052292SN/A
2062292SN/A        /** Processes a tick event, calling tick() on the CPU. */
2071060SN/A        void process();
2082292SN/A        /** Returns the description of the tick event. */
2095336Shines@cs.fsu.edu        const char *description() const;
2101060SN/A    };
2111060SN/A
2122292SN/A    /** The tick event used for scheduling CPU ticks. */
2131060SN/A    TickEvent tickEvent;
2141060SN/A
2152292SN/A    /** Schedule tick event, regardless of its current state. */
2169180Sandreas.hansson@arm.com    void scheduleTickEvent(Cycles delay)
2171060SN/A    {
2181060SN/A        if (tickEvent.squashed())
2199179Sandreas.hansson@arm.com            reschedule(tickEvent, clockEdge(delay));
2201060SN/A        else if (!tickEvent.scheduled())
2219179Sandreas.hansson@arm.com            schedule(tickEvent, clockEdge(delay));
2221060SN/A    }
2231060SN/A
2242292SN/A    /** Unschedule tick event, regardless of its current state. */
2251060SN/A    void unscheduleTickEvent()
2261060SN/A    {
2271060SN/A        if (tickEvent.scheduled())
2281060SN/A            tickEvent.squash();
2291060SN/A    }
2301060SN/A
2312829Sksewell@umich.edu    class ActivateThreadEvent : public Event
2322829Sksewell@umich.edu    {
2332829Sksewell@umich.edu      private:
2342829Sksewell@umich.edu        /** Number of Thread to Activate */
2356221Snate@binkert.org        ThreadID tid;
2362829Sksewell@umich.edu
2372829Sksewell@umich.edu        /** Pointer to the CPU. */
2382829Sksewell@umich.edu        FullO3CPU<Impl> *cpu;
2392829Sksewell@umich.edu
2402829Sksewell@umich.edu      public:
2412829Sksewell@umich.edu        /** Constructs the event. */
2422829Sksewell@umich.edu        ActivateThreadEvent();
2432829Sksewell@umich.edu
2442829Sksewell@umich.edu        /** Initialize Event */
2452829Sksewell@umich.edu        void init(int thread_num, FullO3CPU<Impl> *thread_cpu);
2462829Sksewell@umich.edu
2472829Sksewell@umich.edu        /** Processes the event, calling activateThread() on the CPU. */
2482829Sksewell@umich.edu        void process();
2492829Sksewell@umich.edu
2502829Sksewell@umich.edu        /** Returns the description of the event. */
2515336Shines@cs.fsu.edu        const char *description() const;
2522829Sksewell@umich.edu    };
2532829Sksewell@umich.edu
2542829Sksewell@umich.edu    /** Schedule thread to activate , regardless of its current state. */
2556221Snate@binkert.org    void
2569180Sandreas.hansson@arm.com    scheduleActivateThreadEvent(ThreadID tid, Cycles delay)
2572829Sksewell@umich.edu    {
2582829Sksewell@umich.edu        // Schedule thread to activate, regardless of its current state.
2592829Sksewell@umich.edu        if (activateThreadEvent[tid].squashed())
2605606Snate@binkert.org            reschedule(activateThreadEvent[tid],
2619179Sandreas.hansson@arm.com                       clockEdge(delay));
2628518Sgeoffrey.blake@arm.com        else if (!activateThreadEvent[tid].scheduled()) {
2639179Sandreas.hansson@arm.com            Tick when = clockEdge(delay);
2648518Sgeoffrey.blake@arm.com
2658518Sgeoffrey.blake@arm.com            // Check if the deallocateEvent is also scheduled, and make
2668518Sgeoffrey.blake@arm.com            // sure they do not happen at same time causing a sleep that
2678518Sgeoffrey.blake@arm.com            // is never woken from.
2688518Sgeoffrey.blake@arm.com            if (deallocateContextEvent[tid].scheduled() &&
2698518Sgeoffrey.blake@arm.com                deallocateContextEvent[tid].when() == when) {
2708518Sgeoffrey.blake@arm.com                when++;
2718518Sgeoffrey.blake@arm.com            }
2728518Sgeoffrey.blake@arm.com
2738518Sgeoffrey.blake@arm.com            schedule(activateThreadEvent[tid], when);
2748518Sgeoffrey.blake@arm.com        }
2752829Sksewell@umich.edu    }
2762829Sksewell@umich.edu
2772829Sksewell@umich.edu    /** Unschedule actiavte thread event, regardless of its current state. */
2786221Snate@binkert.org    void
2796221Snate@binkert.org    unscheduleActivateThreadEvent(ThreadID tid)
2802829Sksewell@umich.edu    {
2812829Sksewell@umich.edu        if (activateThreadEvent[tid].scheduled())
2822829Sksewell@umich.edu            activateThreadEvent[tid].squash();
2832829Sksewell@umich.edu    }
2842829Sksewell@umich.edu
2852829Sksewell@umich.edu    /** The tick event used for scheduling CPU ticks. */
2862829Sksewell@umich.edu    ActivateThreadEvent activateThreadEvent[Impl::MaxThreads];
2872829Sksewell@umich.edu
2882875Sksewell@umich.edu    class DeallocateContextEvent : public Event
2892875Sksewell@umich.edu    {
2902875Sksewell@umich.edu      private:
2913221Sktlim@umich.edu        /** Number of Thread to deactivate */
2926221Snate@binkert.org        ThreadID tid;
2932875Sksewell@umich.edu
2943221Sktlim@umich.edu        /** Should the thread be removed from the CPU? */
2953221Sktlim@umich.edu        bool remove;
2963221Sktlim@umich.edu
2972875Sksewell@umich.edu        /** Pointer to the CPU. */
2982875Sksewell@umich.edu        FullO3CPU<Impl> *cpu;
2992875Sksewell@umich.edu
3002875Sksewell@umich.edu      public:
3012875Sksewell@umich.edu        /** Constructs the event. */
3022875Sksewell@umich.edu        DeallocateContextEvent();
3032875Sksewell@umich.edu
3042875Sksewell@umich.edu        /** Initialize Event */
3052875Sksewell@umich.edu        void init(int thread_num, FullO3CPU<Impl> *thread_cpu);
3062875Sksewell@umich.edu
3072875Sksewell@umich.edu        /** Processes the event, calling activateThread() on the CPU. */
3082875Sksewell@umich.edu        void process();
3092875Sksewell@umich.edu
3103221Sktlim@umich.edu        /** Sets whether the thread should also be removed from the CPU. */
3113221Sktlim@umich.edu        void setRemove(bool _remove) { remove = _remove; }
3123221Sktlim@umich.edu
3132875Sksewell@umich.edu        /** Returns the description of the event. */
3145336Shines@cs.fsu.edu        const char *description() const;
3152875Sksewell@umich.edu    };
3162875Sksewell@umich.edu
3172875Sksewell@umich.edu    /** Schedule cpu to deallocate thread context.*/
3186221Snate@binkert.org    void
3199180Sandreas.hansson@arm.com    scheduleDeallocateContextEvent(ThreadID tid, bool remove, Cycles delay)
3202875Sksewell@umich.edu    {
3212875Sksewell@umich.edu        // Schedule thread to activate, regardless of its current state.
3222875Sksewell@umich.edu        if (deallocateContextEvent[tid].squashed())
3235606Snate@binkert.org            reschedule(deallocateContextEvent[tid],
3249179Sandreas.hansson@arm.com                       clockEdge(delay));
3252875Sksewell@umich.edu        else if (!deallocateContextEvent[tid].scheduled())
3265606Snate@binkert.org            schedule(deallocateContextEvent[tid],
3279179Sandreas.hansson@arm.com                     clockEdge(delay));
3282875Sksewell@umich.edu    }
3292875Sksewell@umich.edu
3302875Sksewell@umich.edu    /** Unschedule thread deallocation in CPU */
3316221Snate@binkert.org    void
3326221Snate@binkert.org    unscheduleDeallocateContextEvent(ThreadID tid)
3332875Sksewell@umich.edu    {
3342875Sksewell@umich.edu        if (deallocateContextEvent[tid].scheduled())
3352875Sksewell@umich.edu            deallocateContextEvent[tid].squash();
3362875Sksewell@umich.edu    }
3372875Sksewell@umich.edu
3382875Sksewell@umich.edu    /** The tick event used for scheduling CPU ticks. */
3392875Sksewell@umich.edu    DeallocateContextEvent deallocateContextEvent[Impl::MaxThreads];
3402875Sksewell@umich.edu
3419444SAndreas.Sandberg@ARM.com    /**
3429444SAndreas.Sandberg@ARM.com     * Check if the pipeline has drained and signal the DrainManager.
3439444SAndreas.Sandberg@ARM.com     *
3449444SAndreas.Sandberg@ARM.com     * This method checks if a drain has been requested and if the CPU
3459444SAndreas.Sandberg@ARM.com     * has drained successfully (i.e., there are no instructions in
3469444SAndreas.Sandberg@ARM.com     * the pipeline). If the CPU has drained, it deschedules the tick
3479444SAndreas.Sandberg@ARM.com     * event and signals the drain manager.
3489444SAndreas.Sandberg@ARM.com     *
3499444SAndreas.Sandberg@ARM.com     * @return False if a drain hasn't been requested or the CPU
3509444SAndreas.Sandberg@ARM.com     * hasn't drained, true otherwise.
3519444SAndreas.Sandberg@ARM.com     */
3529444SAndreas.Sandberg@ARM.com    bool tryDrain();
3539444SAndreas.Sandberg@ARM.com
3549444SAndreas.Sandberg@ARM.com    /**
3559444SAndreas.Sandberg@ARM.com     * Perform sanity checks after a drain.
3569444SAndreas.Sandberg@ARM.com     *
3579444SAndreas.Sandberg@ARM.com     * This method is called from drain() when it has determined that
3589444SAndreas.Sandberg@ARM.com     * the CPU is fully drained when gem5 is compiled with the NDEBUG
3599444SAndreas.Sandberg@ARM.com     * macro undefined. The intention of this method is to do more
3609444SAndreas.Sandberg@ARM.com     * extensive tests than the isDrained() method to weed out any
3619444SAndreas.Sandberg@ARM.com     * draining bugs.
3629444SAndreas.Sandberg@ARM.com     */
3639444SAndreas.Sandberg@ARM.com    void drainSanityCheck() const;
3649444SAndreas.Sandberg@ARM.com
3659444SAndreas.Sandberg@ARM.com    /** Check if a system is in a drained state. */
3669444SAndreas.Sandberg@ARM.com    bool isDrained() const;
3679444SAndreas.Sandberg@ARM.com
3681060SN/A  public:
3692292SN/A    /** Constructs a CPU with the given parameters. */
3705595Sgblack@eecs.umich.edu    FullO3CPU(DerivO3CPUParams *params);
3712292SN/A    /** Destructor. */
3721755SN/A    ~FullO3CPU();
3731060SN/A
3742292SN/A    /** Registers statistics. */
3755595Sgblack@eecs.umich.edu    void regStats();
3761684SN/A
3775358Sgblack@eecs.umich.edu    void demapPage(Addr vaddr, uint64_t asn)
3785358Sgblack@eecs.umich.edu    {
3795358Sgblack@eecs.umich.edu        this->itb->demapPage(vaddr, asn);
3805358Sgblack@eecs.umich.edu        this->dtb->demapPage(vaddr, asn);
3815358Sgblack@eecs.umich.edu    }
3825358Sgblack@eecs.umich.edu
3835358Sgblack@eecs.umich.edu    void demapInstPage(Addr vaddr, uint64_t asn)
3845358Sgblack@eecs.umich.edu    {
3855358Sgblack@eecs.umich.edu        this->itb->demapPage(vaddr, asn);
3865358Sgblack@eecs.umich.edu    }
3875358Sgblack@eecs.umich.edu
3885358Sgblack@eecs.umich.edu    void demapDataPage(Addr vaddr, uint64_t asn)
3895358Sgblack@eecs.umich.edu    {
3905358Sgblack@eecs.umich.edu        this->dtb->demapPage(vaddr, asn);
3915358Sgblack@eecs.umich.edu    }
3925358Sgblack@eecs.umich.edu
3932292SN/A    /** Ticks CPU, calling tick() on each stage, and checking the overall
3942292SN/A     *  activity to see if the CPU should deschedule itself.
3952292SN/A     */
3961684SN/A    void tick();
3971684SN/A
3982292SN/A    /** Initialize the CPU */
3991060SN/A    void init();
4001060SN/A
4019427SAndreas.Sandberg@ARM.com    void startup();
4029427SAndreas.Sandberg@ARM.com
4032834Sksewell@umich.edu    /** Returns the Number of Active Threads in the CPU */
4042834Sksewell@umich.edu    int numActiveThreads()
4052834Sksewell@umich.edu    { return activeThreads.size(); }
4062834Sksewell@umich.edu
4072829Sksewell@umich.edu    /** Add Thread to Active Threads List */
4086221Snate@binkert.org    void activateThread(ThreadID tid);
4092875Sksewell@umich.edu
4102875Sksewell@umich.edu    /** Remove Thread from Active Threads List */
4116221Snate@binkert.org    void deactivateThread(ThreadID tid);
4122829Sksewell@umich.edu
4132292SN/A    /** Setup CPU to insert a thread's context */
4146221Snate@binkert.org    void insertThread(ThreadID tid);
4151060SN/A
4162292SN/A    /** Remove all of a thread's context from CPU */
4176221Snate@binkert.org    void removeThread(ThreadID tid);
4182292SN/A
4192292SN/A    /** Count the Total Instructions Committed in the CPU. */
4208834Satgutier@umich.edu    virtual Counter totalInsts() const;
4218834Satgutier@umich.edu
4228834Satgutier@umich.edu    /** Count the Total Ops (including micro ops) committed in the CPU. */
4238834Satgutier@umich.edu    virtual Counter totalOps() const;
4242292SN/A
4252292SN/A    /** Add Thread to Active Threads List. */
4269180Sandreas.hansson@arm.com    void activateContext(ThreadID tid, Cycles delay);
4272292SN/A
4282292SN/A    /** Remove Thread from Active Threads List */
4296221Snate@binkert.org    void suspendContext(ThreadID tid);
4302292SN/A
4312292SN/A    /** Remove Thread from Active Threads List &&
4323221Sktlim@umich.edu     *  Possibly Remove Thread Context from CPU.
4332292SN/A     */
4349180Sandreas.hansson@arm.com    bool scheduleDeallocateContext(ThreadID tid, bool remove,
4359180Sandreas.hansson@arm.com                                   Cycles delay = Cycles(1));
4362292SN/A
4372292SN/A    /** Remove Thread from Active Threads List &&
4382292SN/A     *  Remove Thread Context from CPU.
4392292SN/A     */
4406221Snate@binkert.org    void haltContext(ThreadID tid);
4412292SN/A
4422292SN/A    /** Activate a Thread When CPU Resources are Available. */
4436221Snate@binkert.org    void activateWhenReady(ThreadID tid);
4442292SN/A
4452292SN/A    /** Add or Remove a Thread Context in the CPU. */
4462292SN/A    void doContextSwitch();
4472292SN/A
4482292SN/A    /** Update The Order In Which We Process Threads. */
4492292SN/A    void updateThreadPriority();
4502292SN/A
4519444SAndreas.Sandberg@ARM.com    /** Is the CPU draining? */
4529444SAndreas.Sandberg@ARM.com    bool isDraining() const { return getDrainState() == Drainable::Draining; }
4539444SAndreas.Sandberg@ARM.com
4549448SAndreas.Sandberg@ARM.com    void serializeThread(std::ostream &os, ThreadID tid);
4552864Sktlim@umich.edu
4569448SAndreas.Sandberg@ARM.com    void unserializeThread(Checkpoint *cp, const std::string &section,
4579448SAndreas.Sandberg@ARM.com                           ThreadID tid);
4582864Sktlim@umich.edu
4592864Sktlim@umich.edu  public:
4605595Sgblack@eecs.umich.edu    /** Executes a syscall.
4615595Sgblack@eecs.umich.edu     * @todo: Determine if this needs to be virtual.
4622292SN/A     */
4636221Snate@binkert.org    void syscall(int64_t callnum, ThreadID tid);
4642292SN/A
4652843Sktlim@umich.edu    /** Starts draining the CPU's pipeline of all instructions in
4662843Sktlim@umich.edu     * order to stop all memory accesses. */
4679342SAndreas.Sandberg@arm.com    unsigned int drain(DrainManager *drain_manager);
4682843Sktlim@umich.edu
4692843Sktlim@umich.edu    /** Resumes execution after a drain. */
4709342SAndreas.Sandberg@arm.com    void drainResume();
4712292SN/A
4729444SAndreas.Sandberg@ARM.com    /**
4739444SAndreas.Sandberg@ARM.com     * Commit has reached a safe point to drain a thread.
4749444SAndreas.Sandberg@ARM.com     *
4759444SAndreas.Sandberg@ARM.com     * Commit calls this method to inform the pipeline that it has
4769444SAndreas.Sandberg@ARM.com     * reached a point where it is not executed microcode and is about
4779444SAndreas.Sandberg@ARM.com     * to squash uncommitted instructions to fully drain the pipeline.
4789444SAndreas.Sandberg@ARM.com     */
4799444SAndreas.Sandberg@ARM.com    void commitDrained(ThreadID tid);
4802843Sktlim@umich.edu
4812843Sktlim@umich.edu    /** Switches out this CPU. */
4822843Sktlim@umich.edu    virtual void switchOut();
4832316SN/A
4842348SN/A    /** Takes over from another CPU. */
4852843Sktlim@umich.edu    virtual void takeOverFrom(BaseCPU *oldCPU);
4861060SN/A
4879523SAndreas.Sandberg@ARM.com    void verifyMemoryMode() const;
4889523SAndreas.Sandberg@ARM.com
4891060SN/A    /** Get the current instruction sequence number, and increment it. */
4902316SN/A    InstSeqNum getAndIncrementInstSeq()
4912316SN/A    { return globalSeqNum++; }
4921060SN/A
4935595Sgblack@eecs.umich.edu    /** Traps to handle given fault. */
4947684Sgblack@eecs.umich.edu    void trap(Fault fault, ThreadID tid, StaticInstPtr inst);
4955595Sgblack@eecs.umich.edu
4965702Ssaidi@eecs.umich.edu    /** HW return from error interrupt. */
4976221Snate@binkert.org    Fault hwrei(ThreadID tid);
4985702Ssaidi@eecs.umich.edu
4996221Snate@binkert.org    bool simPalCheck(int palFunc, ThreadID tid);
5005702Ssaidi@eecs.umich.edu
5015595Sgblack@eecs.umich.edu    /** Returns the Fault for any valid interrupt. */
5025595Sgblack@eecs.umich.edu    Fault getInterrupts();
5035595Sgblack@eecs.umich.edu
5045595Sgblack@eecs.umich.edu    /** Processes any an interrupt fault. */
5055595Sgblack@eecs.umich.edu    void processInterrupts(Fault interrupt);
5065595Sgblack@eecs.umich.edu
5075595Sgblack@eecs.umich.edu    /** Halts the CPU. */
5085595Sgblack@eecs.umich.edu    void halt() { panic("Halt not implemented!\n"); }
5095595Sgblack@eecs.umich.edu
5101060SN/A    /** Check if this address is a valid instruction address. */
5111060SN/A    bool validInstAddr(Addr addr) { return true; }
5121060SN/A
5131060SN/A    /** Check if this address is a valid data address. */
5141060SN/A    bool validDataAddr(Addr addr) { return true; }
5151060SN/A
5162348SN/A    /** Register accessors.  Index refers to the physical register index. */
5175595Sgblack@eecs.umich.edu
5185595Sgblack@eecs.umich.edu    /** Reads a miscellaneous register. */
5196221Snate@binkert.org    TheISA::MiscReg readMiscRegNoEffect(int misc_reg, ThreadID tid);
5205595Sgblack@eecs.umich.edu
5215595Sgblack@eecs.umich.edu    /** Reads a misc. register, including any side effects the read
5225595Sgblack@eecs.umich.edu     * might have as defined by the architecture.
5235595Sgblack@eecs.umich.edu     */
5246221Snate@binkert.org    TheISA::MiscReg readMiscReg(int misc_reg, ThreadID tid);
5255595Sgblack@eecs.umich.edu
5265595Sgblack@eecs.umich.edu    /** Sets a miscellaneous register. */
5276221Snate@binkert.org    void setMiscRegNoEffect(int misc_reg, const TheISA::MiscReg &val,
5286221Snate@binkert.org            ThreadID tid);
5295595Sgblack@eecs.umich.edu
5305595Sgblack@eecs.umich.edu    /** Sets a misc. register, including any side effects the write
5315595Sgblack@eecs.umich.edu     * might have as defined by the architecture.
5325595Sgblack@eecs.umich.edu     */
5335595Sgblack@eecs.umich.edu    void setMiscReg(int misc_reg, const TheISA::MiscReg &val,
5346221Snate@binkert.org            ThreadID tid);
5355595Sgblack@eecs.umich.edu
5361060SN/A    uint64_t readIntReg(int reg_idx);
5371060SN/A
5383781Sgblack@eecs.umich.edu    TheISA::FloatReg readFloatReg(int reg_idx);
5391060SN/A
5403781Sgblack@eecs.umich.edu    TheISA::FloatRegBits readFloatRegBits(int reg_idx);
5412455SN/A
5421060SN/A    void setIntReg(int reg_idx, uint64_t val);
5431060SN/A
5443781Sgblack@eecs.umich.edu    void setFloatReg(int reg_idx, TheISA::FloatReg val);
5451060SN/A
5463781Sgblack@eecs.umich.edu    void setFloatRegBits(int reg_idx, TheISA::FloatRegBits val);
5472455SN/A
5486221Snate@binkert.org    uint64_t readArchIntReg(int reg_idx, ThreadID tid);
5491060SN/A
5506314Sgblack@eecs.umich.edu    float readArchFloatReg(int reg_idx, ThreadID tid);
5512292SN/A
5526221Snate@binkert.org    uint64_t readArchFloatRegInt(int reg_idx, ThreadID tid);
5532292SN/A
5542348SN/A    /** Architectural register accessors.  Looks up in the commit
5552348SN/A     * rename table to obtain the true physical index of the
5562348SN/A     * architected register first, then accesses that physical
5572348SN/A     * register.
5582348SN/A     */
5596221Snate@binkert.org    void setArchIntReg(int reg_idx, uint64_t val, ThreadID tid);
5602292SN/A
5616314Sgblack@eecs.umich.edu    void setArchFloatReg(int reg_idx, float val, ThreadID tid);
5622292SN/A
5636221Snate@binkert.org    void setArchFloatRegInt(int reg_idx, uint64_t val, ThreadID tid);
5642292SN/A
5657720Sgblack@eecs.umich.edu    /** Sets the commit PC state of a specific thread. */
5667720Sgblack@eecs.umich.edu    void pcState(const TheISA::PCState &newPCState, ThreadID tid);
5677720Sgblack@eecs.umich.edu
5687720Sgblack@eecs.umich.edu    /** Reads the commit PC state of a specific thread. */
5697720Sgblack@eecs.umich.edu    TheISA::PCState pcState(ThreadID tid);
5707720Sgblack@eecs.umich.edu
5712348SN/A    /** Reads the commit PC of a specific thread. */
5727720Sgblack@eecs.umich.edu    Addr instAddr(ThreadID tid);
5732292SN/A
5744636Sgblack@eecs.umich.edu    /** Reads the commit micro PC of a specific thread. */
5757720Sgblack@eecs.umich.edu    MicroPC microPC(ThreadID tid);
5764636Sgblack@eecs.umich.edu
5772348SN/A    /** Reads the next PC of a specific thread. */
5787720Sgblack@eecs.umich.edu    Addr nextInstAddr(ThreadID tid);
5792756Sksewell@umich.edu
5805595Sgblack@eecs.umich.edu    /** Initiates a squash of all in-flight instructions for a given
5815595Sgblack@eecs.umich.edu     * thread.  The source of the squash is an external update of
5825595Sgblack@eecs.umich.edu     * state through the TC.
5835595Sgblack@eecs.umich.edu     */
5846221Snate@binkert.org    void squashFromTC(ThreadID tid);
5855595Sgblack@eecs.umich.edu
5861060SN/A    /** Function to add instruction onto the head of the list of the
5871060SN/A     *  instructions.  Used when new instructions are fetched.
5881060SN/A     */
5892292SN/A    ListIt addInst(DynInstPtr &inst);
5901060SN/A
5911060SN/A    /** Function to tell the CPU that an instruction has completed. */
5928834Satgutier@umich.edu    void instDone(ThreadID tid, DynInstPtr &inst);
5931060SN/A
5942325SN/A    /** Remove an instruction from the front end of the list.  There's
5952325SN/A     *  no restriction on location of the instruction.
5961060SN/A     */
5971061SN/A    void removeFrontInst(DynInstPtr &inst);
5981060SN/A
5992935Sksewell@umich.edu    /** Remove all instructions that are not currently in the ROB.
6002935Sksewell@umich.edu     *  There's also an option to not squash delay slot instructions.*/
6016221Snate@binkert.org    void removeInstsNotInROB(ThreadID tid);
6021060SN/A
6031062SN/A    /** Remove all instructions younger than the given sequence number. */
6046221Snate@binkert.org    void removeInstsUntil(const InstSeqNum &seq_num, ThreadID tid);
6052292SN/A
6062348SN/A    /** Removes the instruction pointed to by the iterator. */
6076221Snate@binkert.org    inline void squashInstIt(const ListIt &instIt, ThreadID tid);
6082292SN/A
6092348SN/A    /** Cleans up all instructions on the remove list. */
6102292SN/A    void cleanUpRemovedInsts();
6111062SN/A
6122348SN/A    /** Debug function to print all instructions on the list. */
6131060SN/A    void dumpInsts();
6141060SN/A
6151060SN/A  public:
6165737Scws3k@cs.virginia.edu#ifndef NDEBUG
6175737Scws3k@cs.virginia.edu    /** Count of total number of dynamic instructions in flight. */
6185737Scws3k@cs.virginia.edu    int instcount;
6195737Scws3k@cs.virginia.edu#endif
6205737Scws3k@cs.virginia.edu
6211060SN/A    /** List of all the instructions in flight. */
6222292SN/A    std::list<DynInstPtr> instList;
6231060SN/A
6242292SN/A    /** List of all the instructions that will be removed at the end of this
6252292SN/A     *  cycle.
6262292SN/A     */
6272292SN/A    std::queue<ListIt> removeList;
6282292SN/A
6292325SN/A#ifdef DEBUG
6302348SN/A    /** Debug structure to keep track of the sequence numbers still in
6312348SN/A     * flight.
6322348SN/A     */
6332292SN/A    std::set<InstSeqNum> snList;
6342325SN/A#endif
6352292SN/A
6362325SN/A    /** Records if instructions need to be removed this cycle due to
6372325SN/A     *  being retired or squashed.
6382292SN/A     */
6392292SN/A    bool removeInstsThisCycle;
6402292SN/A
6411060SN/A  protected:
6421060SN/A    /** The fetch stage. */
6431060SN/A    typename CPUPolicy::Fetch fetch;
6441060SN/A
6451060SN/A    /** The decode stage. */
6461060SN/A    typename CPUPolicy::Decode decode;
6471060SN/A
6481060SN/A    /** The dispatch stage. */
6491060SN/A    typename CPUPolicy::Rename rename;
6501060SN/A
6511060SN/A    /** The issue/execute/writeback stages. */
6521060SN/A    typename CPUPolicy::IEW iew;
6531060SN/A
6541060SN/A    /** The commit stage. */
6551060SN/A    typename CPUPolicy::Commit commit;
6561060SN/A
6571060SN/A    /** The register file. */
6581060SN/A    typename CPUPolicy::RegFile regFile;
6591060SN/A
6601060SN/A    /** The free list. */
6611060SN/A    typename CPUPolicy::FreeList freeList;
6621060SN/A
6631060SN/A    /** The rename map. */
6642292SN/A    typename CPUPolicy::RenameMap renameMap[Impl::MaxThreads];
6652292SN/A
6662292SN/A    /** The commit rename map. */
6672292SN/A    typename CPUPolicy::RenameMap commitRenameMap[Impl::MaxThreads];
6681060SN/A
6691060SN/A    /** The re-order buffer. */
6701060SN/A    typename CPUPolicy::ROB rob;
6711060SN/A
6722292SN/A    /** Active Threads List */
6736221Snate@binkert.org    std::list<ThreadID> activeThreads;
6742292SN/A
6752292SN/A    /** Integer Register Scoreboard */
6762292SN/A    Scoreboard scoreboard;
6772292SN/A
6789384SAndreas.Sandberg@arm.com    std::vector<TheISA::ISA *> isa;
6796313Sgblack@eecs.umich.edu
6808707Sandreas.hansson@arm.com    /** Instruction port. Note that it has to appear after the fetch stage. */
6818707Sandreas.hansson@arm.com    IcachePort icachePort;
6828707Sandreas.hansson@arm.com
6838707Sandreas.hansson@arm.com    /** Data port. Note that it has to appear after the iew stages */
6848707Sandreas.hansson@arm.com    DcachePort dcachePort;
6858707Sandreas.hansson@arm.com
6861060SN/A  public:
6872292SN/A    /** Enum to give each stage a specific index, so when calling
6882292SN/A     *  activateStage() or deactivateStage(), they can specify which stage
6892292SN/A     *  is being activated/deactivated.
6902292SN/A     */
6912292SN/A    enum StageIdx {
6922292SN/A        FetchIdx,
6932292SN/A        DecodeIdx,
6942292SN/A        RenameIdx,
6952292SN/A        IEWIdx,
6962292SN/A        CommitIdx,
6972292SN/A        NumStages };
6982292SN/A
6991060SN/A    /** Typedefs from the Impl to get the structs that each of the
7001060SN/A     *  time buffers should use.
7011060SN/A     */
7021061SN/A    typedef typename CPUPolicy::TimeStruct TimeStruct;
7031060SN/A
7041061SN/A    typedef typename CPUPolicy::FetchStruct FetchStruct;
7051060SN/A
7061061SN/A    typedef typename CPUPolicy::DecodeStruct DecodeStruct;
7071060SN/A
7081061SN/A    typedef typename CPUPolicy::RenameStruct RenameStruct;
7091060SN/A
7101061SN/A    typedef typename CPUPolicy::IEWStruct IEWStruct;
7111060SN/A
7121060SN/A    /** The main time buffer to do backwards communication. */
7131060SN/A    TimeBuffer<TimeStruct> timeBuffer;
7141060SN/A
7151060SN/A    /** The fetch stage's instruction queue. */
7161060SN/A    TimeBuffer<FetchStruct> fetchQueue;
7171060SN/A
7181060SN/A    /** The decode stage's instruction queue. */
7191060SN/A    TimeBuffer<DecodeStruct> decodeQueue;
7201060SN/A
7211060SN/A    /** The rename stage's instruction queue. */
7221060SN/A    TimeBuffer<RenameStruct> renameQueue;
7231060SN/A
7241060SN/A    /** The IEW stage's instruction queue. */
7251060SN/A    TimeBuffer<IEWStruct> iewQueue;
7261060SN/A
7272348SN/A  private:
7282348SN/A    /** The activity recorder; used to tell if the CPU has any
7292348SN/A     * activity remaining or if it can go to idle and deschedule
7302348SN/A     * itself.
7312348SN/A     */
7322325SN/A    ActivityRecorder activityRec;
7331060SN/A
7342348SN/A  public:
7352348SN/A    /** Records that there was time buffer activity this cycle. */
7362325SN/A    void activityThisCycle() { activityRec.activity(); }
7372292SN/A
7382348SN/A    /** Changes a stage's status to active within the activity recorder. */
7392325SN/A    void activateStage(const StageIdx idx)
7402325SN/A    { activityRec.activateStage(idx); }
7412292SN/A
7422348SN/A    /** Changes a stage's status to inactive within the activity recorder. */
7432325SN/A    void deactivateStage(const StageIdx idx)
7442325SN/A    { activityRec.deactivateStage(idx); }
7452292SN/A
7462292SN/A    /** Wakes the CPU, rescheduling the CPU if it's not already active. */
7472292SN/A    void wakeCPU();
7482260SN/A
7495807Snate@binkert.org    virtual void wakeup();
7505807Snate@binkert.org
7512292SN/A    /** Gets a free thread id. Use if thread ids change across system. */
7526221Snate@binkert.org    ThreadID getFreeTid();
7532292SN/A
7542292SN/A  public:
7552680Sktlim@umich.edu    /** Returns a pointer to a thread context. */
7566221Snate@binkert.org    ThreadContext *
7576221Snate@binkert.org    tcBase(ThreadID tid)
7581681SN/A    {
7592680Sktlim@umich.edu        return thread[tid]->getTC();
7602190SN/A    }
7612190SN/A
7622292SN/A    /** The global sequence number counter. */
7633093Sksewell@umich.edu    InstSeqNum globalSeqNum;//[Impl::MaxThreads];
7641060SN/A
7652348SN/A    /** Pointer to the checker, which can dynamically verify
7662348SN/A     * instruction results at run time.  This can be set to NULL if it
7672348SN/A     * is not being used.
7682348SN/A     */
7698733Sgeoffrey.blake@arm.com    Checker<Impl> *checker;
7702316SN/A
7712292SN/A    /** Pointer to the system. */
7721060SN/A    System *system;
7731060SN/A
7749342SAndreas.Sandberg@arm.com    /** DrainManager to notify when draining has completed. */
7759342SAndreas.Sandberg@arm.com    DrainManager *drainManager;
7762843Sktlim@umich.edu
7772348SN/A    /** Pointers to all of the threads in the CPU. */
7782292SN/A    std::vector<Thread *> thread;
7792260SN/A
7802292SN/A    /** Is there a context switch pending? */
7812292SN/A    bool contextSwitch;
7821060SN/A
7832292SN/A    /** Threads Scheduled to Enter CPU */
7842292SN/A    std::list<int> cpuWaitList;
7852292SN/A
7862292SN/A    /** The cycle that the CPU was last running, used for statistics. */
7879180Sandreas.hansson@arm.com    Cycles lastRunningCycle;
7882292SN/A
7892829Sksewell@umich.edu    /** The cycle that the CPU was last activated by a new thread*/
7902829Sksewell@umich.edu    Tick lastActivatedCycle;
7912829Sksewell@umich.edu
7922292SN/A    /** Mapping for system thread id to cpu id */
7936221Snate@binkert.org    std::map<ThreadID, unsigned> threadMap;
7942292SN/A
7952292SN/A    /** Available thread ids in the cpu*/
7966221Snate@binkert.org    std::vector<ThreadID> tids;
7972292SN/A
7985595Sgblack@eecs.umich.edu    /** CPU read function, forwards read to LSQ. */
7996974Stjones1@inf.ed.ac.uk    Fault read(RequestPtr &req, RequestPtr &sreqLow, RequestPtr &sreqHigh,
8007520Sgblack@eecs.umich.edu               uint8_t *data, int load_idx)
8015595Sgblack@eecs.umich.edu    {
8026974Stjones1@inf.ed.ac.uk        return this->iew.ldstQueue.read(req, sreqLow, sreqHigh,
8036974Stjones1@inf.ed.ac.uk                                        data, load_idx);
8045595Sgblack@eecs.umich.edu    }
8055595Sgblack@eecs.umich.edu
8065595Sgblack@eecs.umich.edu    /** CPU write function, forwards write to LSQ. */
8076974Stjones1@inf.ed.ac.uk    Fault write(RequestPtr &req, RequestPtr &sreqLow, RequestPtr &sreqHigh,
8087520Sgblack@eecs.umich.edu                uint8_t *data, int store_idx)
8095595Sgblack@eecs.umich.edu    {
8106974Stjones1@inf.ed.ac.uk        return this->iew.ldstQueue.write(req, sreqLow, sreqHigh,
8116974Stjones1@inf.ed.ac.uk                                         data, store_idx);
8125595Sgblack@eecs.umich.edu    }
8135595Sgblack@eecs.umich.edu
8148707Sandreas.hansson@arm.com    /** Used by the fetch unit to get a hold of the instruction port. */
8159608Sandreas.hansson@arm.com    virtual MasterPort &getInstPort() { return icachePort; }
8168707Sandreas.hansson@arm.com
8176974Stjones1@inf.ed.ac.uk    /** Get the dcache port (used to find block size for translations). */
8189608Sandreas.hansson@arm.com    virtual MasterPort &getDataPort() { return dcachePort; }
8196974Stjones1@inf.ed.ac.uk
8202292SN/A    /** Stat for total number of times the CPU is descheduled. */
8215999Snate@binkert.org    Stats::Scalar timesIdled;
8222292SN/A    /** Stat for total number of cycles the CPU spends descheduled. */
8235999Snate@binkert.org    Stats::Scalar idleCycles;
8248627SAli.Saidi@ARM.com    /** Stat for total number of cycles the CPU spends descheduled due to a
8258627SAli.Saidi@ARM.com     * quiesce operation or waiting for an interrupt. */
8268627SAli.Saidi@ARM.com    Stats::Scalar quiesceCycles;
8272292SN/A    /** Stat for the number of committed instructions per thread. */
8285999Snate@binkert.org    Stats::Vector committedInsts;
8298834Satgutier@umich.edu    /** Stat for the number of committed ops (including micro ops) per thread. */
8308834Satgutier@umich.edu    Stats::Vector committedOps;
8312292SN/A    /** Stat for the total number of committed instructions. */
8325999Snate@binkert.org    Stats::Scalar totalCommittedInsts;
8332292SN/A    /** Stat for the CPI per thread. */
8342292SN/A    Stats::Formula cpi;
8352292SN/A    /** Stat for the total CPI. */
8362292SN/A    Stats::Formula totalCpi;
8372292SN/A    /** Stat for the IPC per thread. */
8382292SN/A    Stats::Formula ipc;
8392292SN/A    /** Stat for the total IPC. */
8402292SN/A    Stats::Formula totalIpc;
8417897Shestness@cs.utexas.edu
8427897Shestness@cs.utexas.edu    //number of integer register file accesses
8437897Shestness@cs.utexas.edu    Stats::Scalar intRegfileReads;
8447897Shestness@cs.utexas.edu    Stats::Scalar intRegfileWrites;
8457897Shestness@cs.utexas.edu    //number of float register file accesses
8467897Shestness@cs.utexas.edu    Stats::Scalar fpRegfileReads;
8477897Shestness@cs.utexas.edu    Stats::Scalar fpRegfileWrites;
8487897Shestness@cs.utexas.edu    //number of misc
8497897Shestness@cs.utexas.edu    Stats::Scalar miscRegfileReads;
8507897Shestness@cs.utexas.edu    Stats::Scalar miscRegfileWrites;
8511060SN/A};
8521060SN/A
8532325SN/A#endif // __CPU_O3_CPU_HH__
854