base.hh revision 10529
12SN/A/*
29448SAndreas.Sandberg@ARM.com * Copyright (c) 2011-2012 ARM Limited
39920Syasuko.eckert@amd.com * Copyright (c) 2013 Advanced Micro Devices, Inc.
48733Sgeoffrey.blake@arm.com * All rights reserved
58733Sgeoffrey.blake@arm.com *
68733Sgeoffrey.blake@arm.com * The license below extends only to copyright in the software and shall
78733Sgeoffrey.blake@arm.com * not be construed as granting a license to any other intellectual
88733Sgeoffrey.blake@arm.com * property including but not limited to intellectual property relating
98733Sgeoffrey.blake@arm.com * to a hardware implementation of the functionality of the software
108733Sgeoffrey.blake@arm.com * licensed hereunder.  You may use the software subject to the license
118733Sgeoffrey.blake@arm.com * terms below provided that you ensure that this notice is replicated
128733Sgeoffrey.blake@arm.com * unmodified and in its entirety in all distributions of the software,
138733Sgeoffrey.blake@arm.com * modified or unmodified, in source code or in binary form.
148733Sgeoffrey.blake@arm.com *
151762SN/A * Copyright (c) 2002-2005 The Regents of The University of Michigan
162SN/A * All rights reserved.
172SN/A *
182SN/A * Redistribution and use in source and binary forms, with or without
192SN/A * modification, are permitted provided that the following conditions are
202SN/A * met: redistributions of source code must retain the above copyright
212SN/A * notice, this list of conditions and the following disclaimer;
222SN/A * redistributions in binary form must reproduce the above copyright
232SN/A * notice, this list of conditions and the following disclaimer in the
242SN/A * documentation and/or other materials provided with the distribution;
252SN/A * neither the name of the copyright holders nor the names of its
262SN/A * contributors may be used to endorse or promote products derived from
272SN/A * this software without specific prior written permission.
282SN/A *
292SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
302SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
312SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
322SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
332SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
342SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
352SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
362SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
372SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
382SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
392SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
402665Ssaidi@eecs.umich.edu *
412665Ssaidi@eecs.umich.edu * Authors: Steve Reinhardt
422665Ssaidi@eecs.umich.edu *          Dave Greene
432665Ssaidi@eecs.umich.edu *          Nathan Binkert
442SN/A */
452SN/A
462623SN/A#ifndef __CPU_SIMPLE_BASE_HH__
472623SN/A#define __CPU_SIMPLE_BASE_HH__
482SN/A
491354SN/A#include "base/statistics.hh"
506658Snate@binkert.org#include "config/the_isa.hh"
511717SN/A#include "cpu/base.hh"
528887Sgeoffrey.blake@arm.com#include "cpu/checker/cpu.hh"
5310319SAndreas.Sandberg@ARM.com#include "cpu/exec_context.hh"
548229Snate@binkert.org#include "cpu/pc_event.hh"
552683Sktlim@umich.edu#include "cpu/simple_thread.hh"
561354SN/A#include "cpu/static_inst.hh"
572387SN/A#include "mem/packet.hh"
582387SN/A#include "mem/port.hh"
592387SN/A#include "mem/request.hh"
6056SN/A#include "sim/eventq.hh"
618779Sgblack@eecs.umich.edu#include "sim/full_system.hh"
625348Ssaidi@eecs.umich.edu#include "sim/system.hh"
632SN/A
642SN/A// forward declarations
658779Sgblack@eecs.umich.educlass Checkpoint;
668779Sgblack@eecs.umich.educlass Process;
672SN/Aclass Processor;
688779Sgblack@eecs.umich.educlass ThreadContext;
692SN/A
704182Sgblack@eecs.umich.edunamespace TheISA
714182Sgblack@eecs.umich.edu{
728779Sgblack@eecs.umich.edu    class DTB;
738779Sgblack@eecs.umich.edu    class ITB;
744182Sgblack@eecs.umich.edu}
752SN/A
762SN/Anamespace Trace {
772SN/A    class InstRecord;
782SN/A}
792SN/A
808737Skoansin.tan@gmail.comstruct BaseSimpleCPUParams;
8110061Sandreas@sandberg.pp.seclass BPredUnit;
822420SN/A
8310319SAndreas.Sandberg@ARM.comclass BaseSimpleCPU : public BaseCPU, public ExecContext
842SN/A{
852107SN/A  protected:
862159SN/A    typedef TheISA::MiscReg MiscReg;
872455SN/A    typedef TheISA::FloatReg FloatReg;
882455SN/A    typedef TheISA::FloatRegBits FloatRegBits;
899920Syasuko.eckert@amd.com    typedef TheISA::CCReg CCReg;
902386SN/A
9110061Sandreas@sandberg.pp.se    BPredUnit *branchPred;
9210061Sandreas@sandberg.pp.se
932623SN/A  protected:
942SN/A    Trace::InstRecord *traceData;
951371SN/A
965348Ssaidi@eecs.umich.edu    inline void checkPcEventQueue() {
977720Sgblack@eecs.umich.edu        Addr oldpc, pc = thread->instAddr();
985348Ssaidi@eecs.umich.edu        do {
997720Sgblack@eecs.umich.edu            oldpc = pc;
1005348Ssaidi@eecs.umich.edu            system->pcEventQueue.service(tc);
1017720Sgblack@eecs.umich.edu            pc = thread->instAddr();
1027720Sgblack@eecs.umich.edu        } while (oldpc != pc);
1035348Ssaidi@eecs.umich.edu    }
1045348Ssaidi@eecs.umich.edu
1052SN/A  public:
1065807Snate@binkert.org    void wakeup();
1072SN/A
1082SN/A    void zero_fill_64(Addr addr) {
1092SN/A      static int warned = 0;
1102SN/A      if (!warned) {
1112SN/A        warn ("WH64 is not implemented");
1122SN/A        warned = 1;
1132SN/A      }
1142SN/A    };
1152SN/A
1161400SN/A  public:
1175529Snate@binkert.org    BaseSimpleCPU(BaseSimpleCPUParams *params);
1182623SN/A    virtual ~BaseSimpleCPU();
1192SN/A
1201400SN/A  public:
1212683Sktlim@umich.edu    /** SimpleThread object, provides all the architectural state. */
1222683Sktlim@umich.edu    SimpleThread *thread;
1232190SN/A
1242683Sktlim@umich.edu    /** ThreadContext object, provides an interface for external
1252683Sktlim@umich.edu     * objects to modify this thread's state.
1262683Sktlim@umich.edu     */
1272680Sktlim@umich.edu    ThreadContext *tc;
1288733Sgeoffrey.blake@arm.com
1298733Sgeoffrey.blake@arm.com    CheckerCPU *checker;
1308887Sgeoffrey.blake@arm.com
1315169Ssaidi@eecs.umich.edu  protected:
1325169Ssaidi@eecs.umich.edu
1335496Ssaidi@eecs.umich.edu    enum Status {
1345496Ssaidi@eecs.umich.edu        Idle,
1355496Ssaidi@eecs.umich.edu        Running,
1368276SAli.Saidi@ARM.com        Faulting,
1375894Sgblack@eecs.umich.edu        ITBWaitResponse,
1385496Ssaidi@eecs.umich.edu        IcacheRetry,
1395496Ssaidi@eecs.umich.edu        IcacheWaitResponse,
1405496Ssaidi@eecs.umich.edu        IcacheWaitSwitch,
1415894Sgblack@eecs.umich.edu        DTBWaitResponse,
1425496Ssaidi@eecs.umich.edu        DcacheRetry,
1435496Ssaidi@eecs.umich.edu        DcacheWaitResponse,
1445496Ssaidi@eecs.umich.edu        DcacheWaitSwitch,
1455496Ssaidi@eecs.umich.edu    };
1465496Ssaidi@eecs.umich.edu
1475496Ssaidi@eecs.umich.edu    Status _status;
1485496Ssaidi@eecs.umich.edu
1495169Ssaidi@eecs.umich.edu  public:
1502SN/A
1512SN/A    Addr dbg_vtophys(Addr addr);
1522SN/A
1532SN/A    bool interval_stats;
1542SN/A
1552SN/A    // current instruction
1564181Sgblack@eecs.umich.edu    TheISA::MachInst inst;
1574181Sgblack@eecs.umich.edu
1582107SN/A    StaticInstPtr curStaticInst;
1593276Sgblack@eecs.umich.edu    StaticInstPtr curMacroStaticInst;
1601469SN/A
1614377Sgblack@eecs.umich.edu    //This is the offset from the current pc that fetch should be performed at
1624377Sgblack@eecs.umich.edu    Addr fetchOffset;
1634377Sgblack@eecs.umich.edu    //This flag says to stay at the current pc. This is useful for
1644377Sgblack@eecs.umich.edu    //instructions which go beyond MachInst boundaries.
1654377Sgblack@eecs.umich.edu    bool stayAtPC;
1664377Sgblack@eecs.umich.edu
1672623SN/A    void checkForInterrupts();
1685894Sgblack@eecs.umich.edu    void setupFetchRequest(Request *req);
1692623SN/A    void preExecute();
1702623SN/A    void postExecute();
17110379Sandreas.hansson@arm.com    void advancePC(const Fault &fault);
172180SN/A
1738737Skoansin.tan@gmail.com    virtual void haltContext(ThreadID thread_num);
1742SN/A
1752SN/A    // statistics
176334SN/A    virtual void regStats();
177334SN/A    virtual void resetStats();
1782SN/A
1799461Snilay@cs.wisc.edu    virtual void startup();
1809461Snilay@cs.wisc.edu
1812SN/A    // number of simulated instructions
1822SN/A    Counter numInst;
183334SN/A    Counter startNumInst;
1845999Snate@binkert.org    Stats::Scalar numInsts;
1858834Satgutier@umich.edu    Counter numOp;
1868834Satgutier@umich.edu    Counter startNumOp;
1878834Satgutier@umich.edu    Stats::Scalar numOps;
188707SN/A
1894998Sgblack@eecs.umich.edu    void countInst()
1904998Sgblack@eecs.umich.edu    {
1918834Satgutier@umich.edu        if (!curStaticInst->isMicroop() || curStaticInst->isLastMicroop()) {
1928834Satgutier@umich.edu            numInst++;
1938834Satgutier@umich.edu            numInsts++;
1948834Satgutier@umich.edu        }
1958834Satgutier@umich.edu        numOp++;
1968834Satgutier@umich.edu        numOps++;
1978834Satgutier@umich.edu
1987897Shestness@cs.utexas.edu        system->totalNumInsts++;
1994998Sgblack@eecs.umich.edu        thread->funcExeInst++;
2004998Sgblack@eecs.umich.edu    }
2014998Sgblack@eecs.umich.edu
2028834Satgutier@umich.edu    virtual Counter totalInsts() const
203707SN/A    {
204707SN/A        return numInst - startNumInst;
205707SN/A    }
2062SN/A
2078834Satgutier@umich.edu    virtual Counter totalOps() const
2088834Satgutier@umich.edu    {
2098834Satgutier@umich.edu        return numOp - startNumOp;
2108834Satgutier@umich.edu    }
2118834Satgutier@umich.edu
2127897Shestness@cs.utexas.edu    //number of integer alu accesses
2137897Shestness@cs.utexas.edu    Stats::Scalar numIntAluAccesses;
2147897Shestness@cs.utexas.edu
2157897Shestness@cs.utexas.edu    //number of float alu accesses
2167897Shestness@cs.utexas.edu    Stats::Scalar numFpAluAccesses;
2177897Shestness@cs.utexas.edu
2187897Shestness@cs.utexas.edu    //number of function calls/returns
2197897Shestness@cs.utexas.edu    Stats::Scalar numCallsReturns;
2207897Shestness@cs.utexas.edu
2217897Shestness@cs.utexas.edu    //conditional control instructions;
2227897Shestness@cs.utexas.edu    Stats::Scalar numCondCtrlInsts;
2237897Shestness@cs.utexas.edu
2247897Shestness@cs.utexas.edu    //number of int instructions
2257897Shestness@cs.utexas.edu    Stats::Scalar numIntInsts;
2267897Shestness@cs.utexas.edu
2277897Shestness@cs.utexas.edu    //number of float instructions
2287897Shestness@cs.utexas.edu    Stats::Scalar numFpInsts;
2297897Shestness@cs.utexas.edu
2307897Shestness@cs.utexas.edu    //number of integer register file accesses
2317897Shestness@cs.utexas.edu    Stats::Scalar numIntRegReads;
2327897Shestness@cs.utexas.edu    Stats::Scalar numIntRegWrites;
2337897Shestness@cs.utexas.edu
2347897Shestness@cs.utexas.edu    //number of float register file accesses
2357897Shestness@cs.utexas.edu    Stats::Scalar numFpRegReads;
2367897Shestness@cs.utexas.edu    Stats::Scalar numFpRegWrites;
2377897Shestness@cs.utexas.edu
2389920Syasuko.eckert@amd.com    //number of condition code register file accesses
2399920Syasuko.eckert@amd.com    Stats::Scalar numCCRegReads;
2409920Syasuko.eckert@amd.com    Stats::Scalar numCCRegWrites;
2419920Syasuko.eckert@amd.com
2422SN/A    // number of simulated memory references
2435999Snate@binkert.org    Stats::Scalar numMemRefs;
2447897Shestness@cs.utexas.edu    Stats::Scalar numLoadInsts;
2457897Shestness@cs.utexas.edu    Stats::Scalar numStoreInsts;
2467897Shestness@cs.utexas.edu
2477897Shestness@cs.utexas.edu    // number of idle cycles
2487897Shestness@cs.utexas.edu    Stats::Formula numIdleCycles;
2497897Shestness@cs.utexas.edu
2507897Shestness@cs.utexas.edu    // number of busy cycles
2517897Shestness@cs.utexas.edu    Stats::Formula numBusyCycles;
2522SN/A
253124SN/A    // number of simulated loads
254124SN/A    Counter numLoad;
255334SN/A    Counter startNumLoad;
256124SN/A
2572SN/A    // number of idle cycles
2585999Snate@binkert.org    Stats::Average notIdleFraction;
259729SN/A    Stats::Formula idleFraction;
2602SN/A
2612390SN/A    // number of cycles stalled for I-cache responses
2625999Snate@binkert.org    Stats::Scalar icacheStallCycles;
2632SN/A    Counter lastIcacheStall;
2642SN/A
2652390SN/A    // number of cycles stalled for I-cache retries
2665999Snate@binkert.org    Stats::Scalar icacheRetryCycles;
2672390SN/A    Counter lastIcacheRetry;
2682390SN/A
2692390SN/A    // number of cycles stalled for D-cache responses
2705999Snate@binkert.org    Stats::Scalar dcacheStallCycles;
2712SN/A    Counter lastDcacheStall;
2722SN/A
2732390SN/A    // number of cycles stalled for D-cache retries
2745999Snate@binkert.org    Stats::Scalar dcacheRetryCycles;
2752390SN/A    Counter lastDcacheRetry;
2762390SN/A
27710061Sandreas@sandberg.pp.se    /// @{
27810061Sandreas@sandberg.pp.se    /// Total number of branches fetched
27910061Sandreas@sandberg.pp.se    Stats::Scalar numBranches;
28010061Sandreas@sandberg.pp.se    /// Number of branches predicted as taken
28110061Sandreas@sandberg.pp.se    Stats::Scalar numPredictedBranches;
28210061Sandreas@sandberg.pp.se    /// Number of misprediced branches
28310061Sandreas@sandberg.pp.se    Stats::Scalar numBranchMispred;
28410061Sandreas@sandberg.pp.se    /// @}
28510061Sandreas@sandberg.pp.se
28610193SCurtis.Dunham@arm.com    // instruction mix histogram by OpClass
28710193SCurtis.Dunham@arm.com    Stats::Vector statExecutedInstType;
28810193SCurtis.Dunham@arm.com
2899448SAndreas.Sandberg@ARM.com    void serializeThread(std::ostream &os, ThreadID tid);
2909448SAndreas.Sandberg@ARM.com    void unserializeThread(Checkpoint *cp, const std::string &section,
2919448SAndreas.Sandberg@ARM.com                           ThreadID tid);
2922SN/A
2931371SN/A    // These functions are only used in CPU models that split
2941371SN/A    // effective address computation from the actual memory access.
2952623SN/A    void setEA(Addr EA) { panic("BaseSimpleCPU::setEA() not implemented\n"); }
29610319SAndreas.Sandberg@ARM.com    Addr getEA() const  { panic("BaseSimpleCPU::getEA() not implemented\n"); }
2971371SN/A
298726SN/A    // The register accessor methods provide the index of the
299726SN/A    // instruction's operand (e.g., 0 or 1), not the architectural
300726SN/A    // register index, to simplify the implementation of register
301726SN/A    // renaming.  We find the architectural register index by indexing
302726SN/A    // into the instruction's own operand index table.  Note that a
303726SN/A    // raw pointer to the StaticInst is provided instead of a
304726SN/A    // ref-counted StaticInstPtr to redice overhead.  This is fine as
305726SN/A    // long as these methods don't copy the pointer into any long-term
306726SN/A    // storage (which is pretty hard to imagine they would have reason
307726SN/A    // to do).
308705SN/A
30910319SAndreas.Sandberg@ARM.com    IntReg readIntRegOperand(const StaticInst *si, int idx)
310726SN/A    {
3117897Shestness@cs.utexas.edu        numIntRegReads++;
3122683Sktlim@umich.edu        return thread->readIntReg(si->srcRegIdx(idx));
313726SN/A    }
314705SN/A
3153735Sstever@eecs.umich.edu    FloatReg readFloatRegOperand(const StaticInst *si, int idx)
316726SN/A    {
3177897Shestness@cs.utexas.edu        numFpRegReads++;
3189918Ssteve.reinhardt@amd.com        int reg_idx = si->srcRegIdx(idx) - TheISA::FP_Reg_Base;
3192683Sktlim@umich.edu        return thread->readFloatReg(reg_idx);
320726SN/A    }
321705SN/A
3223735Sstever@eecs.umich.edu    FloatRegBits readFloatRegOperandBits(const StaticInst *si, int idx)
3232455SN/A    {
3247897Shestness@cs.utexas.edu        numFpRegReads++;
3259918Ssteve.reinhardt@amd.com        int reg_idx = si->srcRegIdx(idx) - TheISA::FP_Reg_Base;
3262683Sktlim@umich.edu        return thread->readFloatRegBits(reg_idx);
327726SN/A    }
328705SN/A
3299920Syasuko.eckert@amd.com    CCReg readCCRegOperand(const StaticInst *si, int idx)
3309920Syasuko.eckert@amd.com    {
3319920Syasuko.eckert@amd.com        numCCRegReads++;
3329920Syasuko.eckert@amd.com        int reg_idx = si->srcRegIdx(idx) - TheISA::CC_Reg_Base;
3339920Syasuko.eckert@amd.com        return thread->readCCReg(reg_idx);
3349920Syasuko.eckert@amd.com    }
3359920Syasuko.eckert@amd.com
33610319SAndreas.Sandberg@ARM.com    void setIntRegOperand(const StaticInst *si, int idx, IntReg val)
337726SN/A    {
3387897Shestness@cs.utexas.edu        numIntRegWrites++;
3392683Sktlim@umich.edu        thread->setIntReg(si->destRegIdx(idx), val);
340726SN/A    }
341705SN/A
3423735Sstever@eecs.umich.edu    void setFloatRegOperand(const StaticInst *si, int idx, FloatReg val)
343726SN/A    {
3447897Shestness@cs.utexas.edu        numFpRegWrites++;
3459918Ssteve.reinhardt@amd.com        int reg_idx = si->destRegIdx(idx) - TheISA::FP_Reg_Base;
3462683Sktlim@umich.edu        thread->setFloatReg(reg_idx, val);
347726SN/A    }
348726SN/A
3493735Sstever@eecs.umich.edu    void setFloatRegOperandBits(const StaticInst *si, int idx,
3503735Sstever@eecs.umich.edu                                FloatRegBits val)
3512455SN/A    {
3527897Shestness@cs.utexas.edu        numFpRegWrites++;
3539918Ssteve.reinhardt@amd.com        int reg_idx = si->destRegIdx(idx) - TheISA::FP_Reg_Base;
3542683Sktlim@umich.edu        thread->setFloatRegBits(reg_idx, val);
355726SN/A    }
356705SN/A
3579920Syasuko.eckert@amd.com    void setCCRegOperand(const StaticInst *si, int idx, CCReg val)
3589920Syasuko.eckert@amd.com    {
3599920Syasuko.eckert@amd.com        numCCRegWrites++;
3609920Syasuko.eckert@amd.com        int reg_idx = si->destRegIdx(idx) - TheISA::CC_Reg_Base;
3619920Syasuko.eckert@amd.com        thread->setCCReg(reg_idx, val);
3629920Syasuko.eckert@amd.com    }
3639920Syasuko.eckert@amd.com
3647597Sminkyu.jeong@arm.com    bool readPredicate() { return thread->readPredicate(); }
3657597Sminkyu.jeong@arm.com    void setPredicate(bool val)
3667600Sminkyu.jeong@arm.com    {
3677600Sminkyu.jeong@arm.com        thread->setPredicate(val);
3687600Sminkyu.jeong@arm.com        if (traceData) {
3697600Sminkyu.jeong@arm.com            traceData->setPredicate(val);
3707600Sminkyu.jeong@arm.com        }
3717600Sminkyu.jeong@arm.com    }
37210319SAndreas.Sandberg@ARM.com    TheISA::PCState pcState() const { return thread->pcState(); }
3737720Sgblack@eecs.umich.edu    void pcState(const TheISA::PCState &val) { thread->pcState(val); }
3747720Sgblack@eecs.umich.edu    Addr instAddr() { return thread->instAddr(); }
3757720Sgblack@eecs.umich.edu    Addr nextInstAddr() { return thread->nextInstAddr(); }
3767720Sgblack@eecs.umich.edu    MicroPC microPC() { return thread->microPC(); }
377705SN/A
3784172Ssaidi@eecs.umich.edu    MiscReg readMiscRegNoEffect(int misc_reg)
3794172Ssaidi@eecs.umich.edu    {
3804172Ssaidi@eecs.umich.edu        return thread->readMiscRegNoEffect(misc_reg);
3814172Ssaidi@eecs.umich.edu    }
3824172Ssaidi@eecs.umich.edu
3832159SN/A    MiscReg readMiscReg(int misc_reg)
3842159SN/A    {
3857897Shestness@cs.utexas.edu        numIntRegReads++;
3862683Sktlim@umich.edu        return thread->readMiscReg(misc_reg);
3872159SN/A    }
388705SN/A
3893468Sgblack@eecs.umich.edu    void setMiscReg(int misc_reg, const MiscReg &val)
3902159SN/A    {
3917897Shestness@cs.utexas.edu        numIntRegWrites++;
3922683Sktlim@umich.edu        return thread->setMiscReg(misc_reg, val);
3932159SN/A    }
3942159SN/A
3954185Ssaidi@eecs.umich.edu    MiscReg readMiscRegOperand(const StaticInst *si, int idx)
3963792Sgblack@eecs.umich.edu    {
3977897Shestness@cs.utexas.edu        numIntRegReads++;
3989918Ssteve.reinhardt@amd.com        int reg_idx = si->srcRegIdx(idx) - TheISA::Misc_Reg_Base;
3993792Sgblack@eecs.umich.edu        return thread->readMiscReg(reg_idx);
4003792Sgblack@eecs.umich.edu    }
4013792Sgblack@eecs.umich.edu
4024185Ssaidi@eecs.umich.edu    void setMiscRegOperand(
4033792Sgblack@eecs.umich.edu            const StaticInst *si, int idx, const MiscReg &val)
4043792Sgblack@eecs.umich.edu    {
4057897Shestness@cs.utexas.edu        numIntRegWrites++;
4069918Ssteve.reinhardt@amd.com        int reg_idx = si->destRegIdx(idx) - TheISA::Misc_Reg_Base;
4074172Ssaidi@eecs.umich.edu        return thread->setMiscReg(reg_idx, val);
4083792Sgblack@eecs.umich.edu    }
4093792Sgblack@eecs.umich.edu
4105358Sgblack@eecs.umich.edu    void demapPage(Addr vaddr, uint64_t asn)
4115358Sgblack@eecs.umich.edu    {
4125358Sgblack@eecs.umich.edu        thread->demapPage(vaddr, asn);
4135358Sgblack@eecs.umich.edu    }
4145358Sgblack@eecs.umich.edu
4155358Sgblack@eecs.umich.edu    void demapInstPage(Addr vaddr, uint64_t asn)
4165358Sgblack@eecs.umich.edu    {
4175358Sgblack@eecs.umich.edu        thread->demapInstPage(vaddr, asn);
4185358Sgblack@eecs.umich.edu    }
4195358Sgblack@eecs.umich.edu
4205358Sgblack@eecs.umich.edu    void demapDataPage(Addr vaddr, uint64_t asn)
4215358Sgblack@eecs.umich.edu    {
4225358Sgblack@eecs.umich.edu        thread->demapDataPage(vaddr, asn);
4235358Sgblack@eecs.umich.edu    }
4245358Sgblack@eecs.umich.edu
42510319SAndreas.Sandberg@ARM.com    unsigned int readStCondFailures() const {
4264027Sstever@eecs.umich.edu        return thread->readStCondFailures();
4274027Sstever@eecs.umich.edu    }
4284027Sstever@eecs.umich.edu
42910319SAndreas.Sandberg@ARM.com    void setStCondFailures(unsigned int sc_failures) {
4304027Sstever@eecs.umich.edu        thread->setStCondFailures(sc_failures);
4314027Sstever@eecs.umich.edu    }
4324027Sstever@eecs.umich.edu
43310319SAndreas.Sandberg@ARM.com    MiscReg readRegOtherThread(int regIdx, ThreadID tid = InvalidThreadID)
43410319SAndreas.Sandberg@ARM.com    {
4354661Sksewell@umich.edu        panic("Simple CPU models do not support multithreaded "
4364661Sksewell@umich.edu              "register access.\n");
43710319SAndreas.Sandberg@ARM.com    }
4384661Sksewell@umich.edu
43910319SAndreas.Sandberg@ARM.com    void setRegOtherThread(int regIdx, MiscReg val,
44010319SAndreas.Sandberg@ARM.com                           ThreadID tid = InvalidThreadID)
44110319SAndreas.Sandberg@ARM.com    {
4424661Sksewell@umich.edu        panic("Simple CPU models do not support multithreaded "
4434661Sksewell@umich.edu              "register access.\n");
44410319SAndreas.Sandberg@ARM.com    }
4454661Sksewell@umich.edu
4465250Sksewell@umich.edu    //Fault CacheOp(uint8_t Op, Addr EA);
4475222Sksewell@umich.edu
4485702Ssaidi@eecs.umich.edu    Fault hwrei() { return thread->hwrei(); }
4495702Ssaidi@eecs.umich.edu    bool simPalCheck(int palFunc) { return thread->simPalCheck(palFunc); }
4508557Sgblack@eecs.umich.edu
4518557Sgblack@eecs.umich.edu    void
4528557Sgblack@eecs.umich.edu    syscall(int64_t callnum)
4538557Sgblack@eecs.umich.edu    {
4548779Sgblack@eecs.umich.edu        if (FullSystem)
4558779Sgblack@eecs.umich.edu            panic("Syscall emulation isn't available in FS mode.\n");
4568806Sgblack@eecs.umich.edu
4578557Sgblack@eecs.umich.edu        thread->syscall(callnum);
4588557Sgblack@eecs.umich.edu    }
459705SN/A
4602683Sktlim@umich.edu    bool misspeculating() { return thread->misspeculating(); }
4612680Sktlim@umich.edu    ThreadContext *tcBase() { return tc; }
46210061Sandreas@sandberg.pp.se
46310061Sandreas@sandberg.pp.se  private:
46410061Sandreas@sandberg.pp.se    TheISA::PCState pred_pc;
46510529Smorr@cs.wisc.edu
46610529Smorr@cs.wisc.edu  public:
46710529Smorr@cs.wisc.edu    // monitor/mwait funtions
46810529Smorr@cs.wisc.edu    void armMonitor(Addr address) { BaseCPU::armMonitor(address); }
46910529Smorr@cs.wisc.edu    bool mwait(PacketPtr pkt) { return BaseCPU::mwait(pkt); }
47010529Smorr@cs.wisc.edu    void mwaitAtomic(ThreadContext *tc)
47110529Smorr@cs.wisc.edu    { return BaseCPU::mwaitAtomic(tc, thread->dtb); }
47210529Smorr@cs.wisc.edu    AddressMonitor *getAddrMonitor() { return BaseCPU::getCpuAddrMonitor(); }
4732SN/A};
4742SN/A
4752623SN/A#endif // __CPU_SIMPLE_BASE_HH__
476