base.hh revision 10319
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();
1712623SN/A    void advancePC(Fault fault);
172180SN/A
1738737Skoansin.tan@gmail.com    virtual void deallocateContext(ThreadID thread_num);
1748737Skoansin.tan@gmail.com    virtual void haltContext(ThreadID thread_num);
1752SN/A
1762SN/A    // statistics
177334SN/A    virtual void regStats();
178334SN/A    virtual void resetStats();
1792SN/A
1809461Snilay@cs.wisc.edu    virtual void startup();
1819461Snilay@cs.wisc.edu
1822SN/A    // number of simulated instructions
1832SN/A    Counter numInst;
184334SN/A    Counter startNumInst;
1855999Snate@binkert.org    Stats::Scalar numInsts;
1868834Satgutier@umich.edu    Counter numOp;
1878834Satgutier@umich.edu    Counter startNumOp;
1888834Satgutier@umich.edu    Stats::Scalar numOps;
189707SN/A
1904998Sgblack@eecs.umich.edu    void countInst()
1914998Sgblack@eecs.umich.edu    {
1928834Satgutier@umich.edu        if (!curStaticInst->isMicroop() || curStaticInst->isLastMicroop()) {
1938834Satgutier@umich.edu            numInst++;
1948834Satgutier@umich.edu            numInsts++;
1958834Satgutier@umich.edu        }
1968834Satgutier@umich.edu        numOp++;
1978834Satgutier@umich.edu        numOps++;
1988834Satgutier@umich.edu
1997897Shestness@cs.utexas.edu        system->totalNumInsts++;
2004998Sgblack@eecs.umich.edu        thread->funcExeInst++;
2014998Sgblack@eecs.umich.edu    }
2024998Sgblack@eecs.umich.edu
2038834Satgutier@umich.edu    virtual Counter totalInsts() const
204707SN/A    {
205707SN/A        return numInst - startNumInst;
206707SN/A    }
2072SN/A
2088834Satgutier@umich.edu    virtual Counter totalOps() const
2098834Satgutier@umich.edu    {
2108834Satgutier@umich.edu        return numOp - startNumOp;
2118834Satgutier@umich.edu    }
2128834Satgutier@umich.edu
2137897Shestness@cs.utexas.edu    //number of integer alu accesses
2147897Shestness@cs.utexas.edu    Stats::Scalar numIntAluAccesses;
2157897Shestness@cs.utexas.edu
2167897Shestness@cs.utexas.edu    //number of float alu accesses
2177897Shestness@cs.utexas.edu    Stats::Scalar numFpAluAccesses;
2187897Shestness@cs.utexas.edu
2197897Shestness@cs.utexas.edu    //number of function calls/returns
2207897Shestness@cs.utexas.edu    Stats::Scalar numCallsReturns;
2217897Shestness@cs.utexas.edu
2227897Shestness@cs.utexas.edu    //conditional control instructions;
2237897Shestness@cs.utexas.edu    Stats::Scalar numCondCtrlInsts;
2247897Shestness@cs.utexas.edu
2257897Shestness@cs.utexas.edu    //number of int instructions
2267897Shestness@cs.utexas.edu    Stats::Scalar numIntInsts;
2277897Shestness@cs.utexas.edu
2287897Shestness@cs.utexas.edu    //number of float instructions
2297897Shestness@cs.utexas.edu    Stats::Scalar numFpInsts;
2307897Shestness@cs.utexas.edu
2317897Shestness@cs.utexas.edu    //number of integer register file accesses
2327897Shestness@cs.utexas.edu    Stats::Scalar numIntRegReads;
2337897Shestness@cs.utexas.edu    Stats::Scalar numIntRegWrites;
2347897Shestness@cs.utexas.edu
2357897Shestness@cs.utexas.edu    //number of float register file accesses
2367897Shestness@cs.utexas.edu    Stats::Scalar numFpRegReads;
2377897Shestness@cs.utexas.edu    Stats::Scalar numFpRegWrites;
2387897Shestness@cs.utexas.edu
2399920Syasuko.eckert@amd.com    //number of condition code register file accesses
2409920Syasuko.eckert@amd.com    Stats::Scalar numCCRegReads;
2419920Syasuko.eckert@amd.com    Stats::Scalar numCCRegWrites;
2429920Syasuko.eckert@amd.com
2432SN/A    // number of simulated memory references
2445999Snate@binkert.org    Stats::Scalar numMemRefs;
2457897Shestness@cs.utexas.edu    Stats::Scalar numLoadInsts;
2467897Shestness@cs.utexas.edu    Stats::Scalar numStoreInsts;
2477897Shestness@cs.utexas.edu
2487897Shestness@cs.utexas.edu    // number of idle cycles
2497897Shestness@cs.utexas.edu    Stats::Formula numIdleCycles;
2507897Shestness@cs.utexas.edu
2517897Shestness@cs.utexas.edu    // number of busy cycles
2527897Shestness@cs.utexas.edu    Stats::Formula numBusyCycles;
2532SN/A
254124SN/A    // number of simulated loads
255124SN/A    Counter numLoad;
256334SN/A    Counter startNumLoad;
257124SN/A
2582SN/A    // number of idle cycles
2595999Snate@binkert.org    Stats::Average notIdleFraction;
260729SN/A    Stats::Formula idleFraction;
2612SN/A
2622390SN/A    // number of cycles stalled for I-cache responses
2635999Snate@binkert.org    Stats::Scalar icacheStallCycles;
2642SN/A    Counter lastIcacheStall;
2652SN/A
2662390SN/A    // number of cycles stalled for I-cache retries
2675999Snate@binkert.org    Stats::Scalar icacheRetryCycles;
2682390SN/A    Counter lastIcacheRetry;
2692390SN/A
2702390SN/A    // number of cycles stalled for D-cache responses
2715999Snate@binkert.org    Stats::Scalar dcacheStallCycles;
2722SN/A    Counter lastDcacheStall;
2732SN/A
2742390SN/A    // number of cycles stalled for D-cache retries
2755999Snate@binkert.org    Stats::Scalar dcacheRetryCycles;
2762390SN/A    Counter lastDcacheRetry;
2772390SN/A
27810061Sandreas@sandberg.pp.se    /// @{
27910061Sandreas@sandberg.pp.se    /// Total number of branches fetched
28010061Sandreas@sandberg.pp.se    Stats::Scalar numBranches;
28110061Sandreas@sandberg.pp.se    /// Number of branches predicted as taken
28210061Sandreas@sandberg.pp.se    Stats::Scalar numPredictedBranches;
28310061Sandreas@sandberg.pp.se    /// Number of misprediced branches
28410061Sandreas@sandberg.pp.se    Stats::Scalar numBranchMispred;
28510061Sandreas@sandberg.pp.se    /// @}
28610061Sandreas@sandberg.pp.se
28710193SCurtis.Dunham@arm.com    // instruction mix histogram by OpClass
28810193SCurtis.Dunham@arm.com    Stats::Vector statExecutedInstType;
28910193SCurtis.Dunham@arm.com
2909448SAndreas.Sandberg@ARM.com    void serializeThread(std::ostream &os, ThreadID tid);
2919448SAndreas.Sandberg@ARM.com    void unserializeThread(Checkpoint *cp, const std::string &section,
2929448SAndreas.Sandberg@ARM.com                           ThreadID tid);
2932SN/A
2941371SN/A    // These functions are only used in CPU models that split
2951371SN/A    // effective address computation from the actual memory access.
2962623SN/A    void setEA(Addr EA) { panic("BaseSimpleCPU::setEA() not implemented\n"); }
29710319SAndreas.Sandberg@ARM.com    Addr getEA() const  { panic("BaseSimpleCPU::getEA() not implemented\n"); }
2981371SN/A
299726SN/A    // The register accessor methods provide the index of the
300726SN/A    // instruction's operand (e.g., 0 or 1), not the architectural
301726SN/A    // register index, to simplify the implementation of register
302726SN/A    // renaming.  We find the architectural register index by indexing
303726SN/A    // into the instruction's own operand index table.  Note that a
304726SN/A    // raw pointer to the StaticInst is provided instead of a
305726SN/A    // ref-counted StaticInstPtr to redice overhead.  This is fine as
306726SN/A    // long as these methods don't copy the pointer into any long-term
307726SN/A    // storage (which is pretty hard to imagine they would have reason
308726SN/A    // to do).
309705SN/A
31010319SAndreas.Sandberg@ARM.com    IntReg readIntRegOperand(const StaticInst *si, int idx)
311726SN/A    {
3127897Shestness@cs.utexas.edu        numIntRegReads++;
3132683Sktlim@umich.edu        return thread->readIntReg(si->srcRegIdx(idx));
314726SN/A    }
315705SN/A
3163735Sstever@eecs.umich.edu    FloatReg readFloatRegOperand(const StaticInst *si, int idx)
317726SN/A    {
3187897Shestness@cs.utexas.edu        numFpRegReads++;
3199918Ssteve.reinhardt@amd.com        int reg_idx = si->srcRegIdx(idx) - TheISA::FP_Reg_Base;
3202683Sktlim@umich.edu        return thread->readFloatReg(reg_idx);
321726SN/A    }
322705SN/A
3233735Sstever@eecs.umich.edu    FloatRegBits readFloatRegOperandBits(const StaticInst *si, int idx)
3242455SN/A    {
3257897Shestness@cs.utexas.edu        numFpRegReads++;
3269918Ssteve.reinhardt@amd.com        int reg_idx = si->srcRegIdx(idx) - TheISA::FP_Reg_Base;
3272683Sktlim@umich.edu        return thread->readFloatRegBits(reg_idx);
328726SN/A    }
329705SN/A
3309920Syasuko.eckert@amd.com    CCReg readCCRegOperand(const StaticInst *si, int idx)
3319920Syasuko.eckert@amd.com    {
3329920Syasuko.eckert@amd.com        numCCRegReads++;
3339920Syasuko.eckert@amd.com        int reg_idx = si->srcRegIdx(idx) - TheISA::CC_Reg_Base;
3349920Syasuko.eckert@amd.com        return thread->readCCReg(reg_idx);
3359920Syasuko.eckert@amd.com    }
3369920Syasuko.eckert@amd.com
33710319SAndreas.Sandberg@ARM.com    void setIntRegOperand(const StaticInst *si, int idx, IntReg val)
338726SN/A    {
3397897Shestness@cs.utexas.edu        numIntRegWrites++;
3402683Sktlim@umich.edu        thread->setIntReg(si->destRegIdx(idx), val);
341726SN/A    }
342705SN/A
3433735Sstever@eecs.umich.edu    void setFloatRegOperand(const StaticInst *si, int idx, FloatReg val)
344726SN/A    {
3457897Shestness@cs.utexas.edu        numFpRegWrites++;
3469918Ssteve.reinhardt@amd.com        int reg_idx = si->destRegIdx(idx) - TheISA::FP_Reg_Base;
3472683Sktlim@umich.edu        thread->setFloatReg(reg_idx, val);
348726SN/A    }
349726SN/A
3503735Sstever@eecs.umich.edu    void setFloatRegOperandBits(const StaticInst *si, int idx,
3513735Sstever@eecs.umich.edu                                FloatRegBits val)
3522455SN/A    {
3537897Shestness@cs.utexas.edu        numFpRegWrites++;
3549918Ssteve.reinhardt@amd.com        int reg_idx = si->destRegIdx(idx) - TheISA::FP_Reg_Base;
3552683Sktlim@umich.edu        thread->setFloatRegBits(reg_idx, val);
356726SN/A    }
357705SN/A
3589920Syasuko.eckert@amd.com    void setCCRegOperand(const StaticInst *si, int idx, CCReg val)
3599920Syasuko.eckert@amd.com    {
3609920Syasuko.eckert@amd.com        numCCRegWrites++;
3619920Syasuko.eckert@amd.com        int reg_idx = si->destRegIdx(idx) - TheISA::CC_Reg_Base;
3629920Syasuko.eckert@amd.com        thread->setCCReg(reg_idx, val);
3639920Syasuko.eckert@amd.com    }
3649920Syasuko.eckert@amd.com
3657597Sminkyu.jeong@arm.com    bool readPredicate() { return thread->readPredicate(); }
3667597Sminkyu.jeong@arm.com    void setPredicate(bool val)
3677600Sminkyu.jeong@arm.com    {
3687600Sminkyu.jeong@arm.com        thread->setPredicate(val);
3697600Sminkyu.jeong@arm.com        if (traceData) {
3707600Sminkyu.jeong@arm.com            traceData->setPredicate(val);
3717600Sminkyu.jeong@arm.com        }
3727600Sminkyu.jeong@arm.com    }
37310319SAndreas.Sandberg@ARM.com    TheISA::PCState pcState() const { return thread->pcState(); }
3747720Sgblack@eecs.umich.edu    void pcState(const TheISA::PCState &val) { thread->pcState(val); }
3757720Sgblack@eecs.umich.edu    Addr instAddr() { return thread->instAddr(); }
3767720Sgblack@eecs.umich.edu    Addr nextInstAddr() { return thread->nextInstAddr(); }
3777720Sgblack@eecs.umich.edu    MicroPC microPC() { return thread->microPC(); }
378705SN/A
3794172Ssaidi@eecs.umich.edu    MiscReg readMiscRegNoEffect(int misc_reg)
3804172Ssaidi@eecs.umich.edu    {
3814172Ssaidi@eecs.umich.edu        return thread->readMiscRegNoEffect(misc_reg);
3824172Ssaidi@eecs.umich.edu    }
3834172Ssaidi@eecs.umich.edu
3842159SN/A    MiscReg readMiscReg(int misc_reg)
3852159SN/A    {
3867897Shestness@cs.utexas.edu        numIntRegReads++;
3872683Sktlim@umich.edu        return thread->readMiscReg(misc_reg);
3882159SN/A    }
389705SN/A
3903468Sgblack@eecs.umich.edu    void setMiscReg(int misc_reg, const MiscReg &val)
3912159SN/A    {
3927897Shestness@cs.utexas.edu        numIntRegWrites++;
3932683Sktlim@umich.edu        return thread->setMiscReg(misc_reg, val);
3942159SN/A    }
3952159SN/A
3964185Ssaidi@eecs.umich.edu    MiscReg readMiscRegOperand(const StaticInst *si, int idx)
3973792Sgblack@eecs.umich.edu    {
3987897Shestness@cs.utexas.edu        numIntRegReads++;
3999918Ssteve.reinhardt@amd.com        int reg_idx = si->srcRegIdx(idx) - TheISA::Misc_Reg_Base;
4003792Sgblack@eecs.umich.edu        return thread->readMiscReg(reg_idx);
4013792Sgblack@eecs.umich.edu    }
4023792Sgblack@eecs.umich.edu
4034185Ssaidi@eecs.umich.edu    void setMiscRegOperand(
4043792Sgblack@eecs.umich.edu            const StaticInst *si, int idx, const MiscReg &val)
4053792Sgblack@eecs.umich.edu    {
4067897Shestness@cs.utexas.edu        numIntRegWrites++;
4079918Ssteve.reinhardt@amd.com        int reg_idx = si->destRegIdx(idx) - TheISA::Misc_Reg_Base;
4084172Ssaidi@eecs.umich.edu        return thread->setMiscReg(reg_idx, val);
4093792Sgblack@eecs.umich.edu    }
4103792Sgblack@eecs.umich.edu
4115358Sgblack@eecs.umich.edu    void demapPage(Addr vaddr, uint64_t asn)
4125358Sgblack@eecs.umich.edu    {
4135358Sgblack@eecs.umich.edu        thread->demapPage(vaddr, asn);
4145358Sgblack@eecs.umich.edu    }
4155358Sgblack@eecs.umich.edu
4165358Sgblack@eecs.umich.edu    void demapInstPage(Addr vaddr, uint64_t asn)
4175358Sgblack@eecs.umich.edu    {
4185358Sgblack@eecs.umich.edu        thread->demapInstPage(vaddr, asn);
4195358Sgblack@eecs.umich.edu    }
4205358Sgblack@eecs.umich.edu
4215358Sgblack@eecs.umich.edu    void demapDataPage(Addr vaddr, uint64_t asn)
4225358Sgblack@eecs.umich.edu    {
4235358Sgblack@eecs.umich.edu        thread->demapDataPage(vaddr, asn);
4245358Sgblack@eecs.umich.edu    }
4255358Sgblack@eecs.umich.edu
42610319SAndreas.Sandberg@ARM.com    unsigned int readStCondFailures() const {
4274027Sstever@eecs.umich.edu        return thread->readStCondFailures();
4284027Sstever@eecs.umich.edu    }
4294027Sstever@eecs.umich.edu
43010319SAndreas.Sandberg@ARM.com    void setStCondFailures(unsigned int sc_failures) {
4314027Sstever@eecs.umich.edu        thread->setStCondFailures(sc_failures);
4324027Sstever@eecs.umich.edu    }
4334027Sstever@eecs.umich.edu
43410319SAndreas.Sandberg@ARM.com    MiscReg readRegOtherThread(int regIdx, ThreadID tid = InvalidThreadID)
43510319SAndreas.Sandberg@ARM.com    {
4364661Sksewell@umich.edu        panic("Simple CPU models do not support multithreaded "
4374661Sksewell@umich.edu              "register access.\n");
43810319SAndreas.Sandberg@ARM.com    }
4394661Sksewell@umich.edu
44010319SAndreas.Sandberg@ARM.com    void setRegOtherThread(int regIdx, MiscReg val,
44110319SAndreas.Sandberg@ARM.com                           ThreadID tid = InvalidThreadID)
44210319SAndreas.Sandberg@ARM.com    {
4434661Sksewell@umich.edu        panic("Simple CPU models do not support multithreaded "
4444661Sksewell@umich.edu              "register access.\n");
44510319SAndreas.Sandberg@ARM.com    }
4464661Sksewell@umich.edu
4475250Sksewell@umich.edu    //Fault CacheOp(uint8_t Op, Addr EA);
4485222Sksewell@umich.edu
4495702Ssaidi@eecs.umich.edu    Fault hwrei() { return thread->hwrei(); }
4505702Ssaidi@eecs.umich.edu    bool simPalCheck(int palFunc) { return thread->simPalCheck(palFunc); }
4518557Sgblack@eecs.umich.edu
4528557Sgblack@eecs.umich.edu    void
4538557Sgblack@eecs.umich.edu    syscall(int64_t callnum)
4548557Sgblack@eecs.umich.edu    {
4558779Sgblack@eecs.umich.edu        if (FullSystem)
4568779Sgblack@eecs.umich.edu            panic("Syscall emulation isn't available in FS mode.\n");
4578806Sgblack@eecs.umich.edu
4588557Sgblack@eecs.umich.edu        thread->syscall(callnum);
4598557Sgblack@eecs.umich.edu    }
460705SN/A
4612683Sktlim@umich.edu    bool misspeculating() { return thread->misspeculating(); }
4622680Sktlim@umich.edu    ThreadContext *tcBase() { return tc; }
46310061Sandreas@sandberg.pp.se
46410061Sandreas@sandberg.pp.se  private:
46510061Sandreas@sandberg.pp.se    TheISA::PCState pred_pc;
4662SN/A};
4672SN/A
4682623SN/A#endif // __CPU_SIMPLE_BASE_HH__
469