base.hh revision 10698
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 D-cache responses
2665999Snate@binkert.org    Stats::Scalar dcacheStallCycles;
2672SN/A    Counter lastDcacheStall;
2682SN/A
26910061Sandreas@sandberg.pp.se    /// @{
27010061Sandreas@sandberg.pp.se    /// Total number of branches fetched
27110061Sandreas@sandberg.pp.se    Stats::Scalar numBranches;
27210061Sandreas@sandberg.pp.se    /// Number of branches predicted as taken
27310061Sandreas@sandberg.pp.se    Stats::Scalar numPredictedBranches;
27410061Sandreas@sandberg.pp.se    /// Number of misprediced branches
27510061Sandreas@sandberg.pp.se    Stats::Scalar numBranchMispred;
27610061Sandreas@sandberg.pp.se    /// @}
27710061Sandreas@sandberg.pp.se
27810193SCurtis.Dunham@arm.com    // instruction mix histogram by OpClass
27910193SCurtis.Dunham@arm.com    Stats::Vector statExecutedInstType;
28010193SCurtis.Dunham@arm.com
2819448SAndreas.Sandberg@ARM.com    void serializeThread(std::ostream &os, ThreadID tid);
2829448SAndreas.Sandberg@ARM.com    void unserializeThread(Checkpoint *cp, const std::string &section,
2839448SAndreas.Sandberg@ARM.com                           ThreadID tid);
2842SN/A
2851371SN/A    // These functions are only used in CPU models that split
2861371SN/A    // effective address computation from the actual memory access.
2872623SN/A    void setEA(Addr EA) { panic("BaseSimpleCPU::setEA() not implemented\n"); }
28810319SAndreas.Sandberg@ARM.com    Addr getEA() const  { panic("BaseSimpleCPU::getEA() not implemented\n"); }
2891371SN/A
290726SN/A    // The register accessor methods provide the index of the
291726SN/A    // instruction's operand (e.g., 0 or 1), not the architectural
292726SN/A    // register index, to simplify the implementation of register
293726SN/A    // renaming.  We find the architectural register index by indexing
294726SN/A    // into the instruction's own operand index table.  Note that a
295726SN/A    // raw pointer to the StaticInst is provided instead of a
296726SN/A    // ref-counted StaticInstPtr to redice overhead.  This is fine as
297726SN/A    // long as these methods don't copy the pointer into any long-term
298726SN/A    // storage (which is pretty hard to imagine they would have reason
299726SN/A    // to do).
300705SN/A
30110319SAndreas.Sandberg@ARM.com    IntReg readIntRegOperand(const StaticInst *si, int idx)
302726SN/A    {
3037897Shestness@cs.utexas.edu        numIntRegReads++;
3042683Sktlim@umich.edu        return thread->readIntReg(si->srcRegIdx(idx));
305726SN/A    }
306705SN/A
3073735Sstever@eecs.umich.edu    FloatReg readFloatRegOperand(const StaticInst *si, int idx)
308726SN/A    {
3097897Shestness@cs.utexas.edu        numFpRegReads++;
3109918Ssteve.reinhardt@amd.com        int reg_idx = si->srcRegIdx(idx) - TheISA::FP_Reg_Base;
3112683Sktlim@umich.edu        return thread->readFloatReg(reg_idx);
312726SN/A    }
313705SN/A
3143735Sstever@eecs.umich.edu    FloatRegBits readFloatRegOperandBits(const StaticInst *si, int idx)
3152455SN/A    {
3167897Shestness@cs.utexas.edu        numFpRegReads++;
3179918Ssteve.reinhardt@amd.com        int reg_idx = si->srcRegIdx(idx) - TheISA::FP_Reg_Base;
3182683Sktlim@umich.edu        return thread->readFloatRegBits(reg_idx);
319726SN/A    }
320705SN/A
3219920Syasuko.eckert@amd.com    CCReg readCCRegOperand(const StaticInst *si, int idx)
3229920Syasuko.eckert@amd.com    {
3239920Syasuko.eckert@amd.com        numCCRegReads++;
3249920Syasuko.eckert@amd.com        int reg_idx = si->srcRegIdx(idx) - TheISA::CC_Reg_Base;
3259920Syasuko.eckert@amd.com        return thread->readCCReg(reg_idx);
3269920Syasuko.eckert@amd.com    }
3279920Syasuko.eckert@amd.com
32810319SAndreas.Sandberg@ARM.com    void setIntRegOperand(const StaticInst *si, int idx, IntReg val)
329726SN/A    {
3307897Shestness@cs.utexas.edu        numIntRegWrites++;
3312683Sktlim@umich.edu        thread->setIntReg(si->destRegIdx(idx), val);
332726SN/A    }
333705SN/A
3343735Sstever@eecs.umich.edu    void setFloatRegOperand(const StaticInst *si, int idx, FloatReg val)
335726SN/A    {
3367897Shestness@cs.utexas.edu        numFpRegWrites++;
3379918Ssteve.reinhardt@amd.com        int reg_idx = si->destRegIdx(idx) - TheISA::FP_Reg_Base;
3382683Sktlim@umich.edu        thread->setFloatReg(reg_idx, val);
339726SN/A    }
340726SN/A
3413735Sstever@eecs.umich.edu    void setFloatRegOperandBits(const StaticInst *si, int idx,
3423735Sstever@eecs.umich.edu                                FloatRegBits val)
3432455SN/A    {
3447897Shestness@cs.utexas.edu        numFpRegWrites++;
3459918Ssteve.reinhardt@amd.com        int reg_idx = si->destRegIdx(idx) - TheISA::FP_Reg_Base;
3462683Sktlim@umich.edu        thread->setFloatRegBits(reg_idx, val);
347726SN/A    }
348705SN/A
3499920Syasuko.eckert@amd.com    void setCCRegOperand(const StaticInst *si, int idx, CCReg val)
3509920Syasuko.eckert@amd.com    {
3519920Syasuko.eckert@amd.com        numCCRegWrites++;
3529920Syasuko.eckert@amd.com        int reg_idx = si->destRegIdx(idx) - TheISA::CC_Reg_Base;
3539920Syasuko.eckert@amd.com        thread->setCCReg(reg_idx, val);
3549920Syasuko.eckert@amd.com    }
3559920Syasuko.eckert@amd.com
3567597Sminkyu.jeong@arm.com    bool readPredicate() { return thread->readPredicate(); }
3577597Sminkyu.jeong@arm.com    void setPredicate(bool val)
3587600Sminkyu.jeong@arm.com    {
3597600Sminkyu.jeong@arm.com        thread->setPredicate(val);
3607600Sminkyu.jeong@arm.com        if (traceData) {
3617600Sminkyu.jeong@arm.com            traceData->setPredicate(val);
3627600Sminkyu.jeong@arm.com        }
3637600Sminkyu.jeong@arm.com    }
36410319SAndreas.Sandberg@ARM.com    TheISA::PCState pcState() const { return thread->pcState(); }
3657720Sgblack@eecs.umich.edu    void pcState(const TheISA::PCState &val) { thread->pcState(val); }
3667720Sgblack@eecs.umich.edu    Addr instAddr() { return thread->instAddr(); }
3677720Sgblack@eecs.umich.edu    Addr nextInstAddr() { return thread->nextInstAddr(); }
3687720Sgblack@eecs.umich.edu    MicroPC microPC() { return thread->microPC(); }
369705SN/A
37010698Sandreas.hansson@arm.com    MiscReg readMiscRegNoEffect(int misc_reg) const
3714172Ssaidi@eecs.umich.edu    {
3724172Ssaidi@eecs.umich.edu        return thread->readMiscRegNoEffect(misc_reg);
3734172Ssaidi@eecs.umich.edu    }
3744172Ssaidi@eecs.umich.edu
3752159SN/A    MiscReg readMiscReg(int misc_reg)
3762159SN/A    {
3777897Shestness@cs.utexas.edu        numIntRegReads++;
3782683Sktlim@umich.edu        return thread->readMiscReg(misc_reg);
3792159SN/A    }
380705SN/A
3813468Sgblack@eecs.umich.edu    void setMiscReg(int misc_reg, const MiscReg &val)
3822159SN/A    {
3837897Shestness@cs.utexas.edu        numIntRegWrites++;
3842683Sktlim@umich.edu        return thread->setMiscReg(misc_reg, val);
3852159SN/A    }
3862159SN/A
3874185Ssaidi@eecs.umich.edu    MiscReg readMiscRegOperand(const StaticInst *si, int idx)
3883792Sgblack@eecs.umich.edu    {
3897897Shestness@cs.utexas.edu        numIntRegReads++;
3909918Ssteve.reinhardt@amd.com        int reg_idx = si->srcRegIdx(idx) - TheISA::Misc_Reg_Base;
3913792Sgblack@eecs.umich.edu        return thread->readMiscReg(reg_idx);
3923792Sgblack@eecs.umich.edu    }
3933792Sgblack@eecs.umich.edu
3944185Ssaidi@eecs.umich.edu    void setMiscRegOperand(
3953792Sgblack@eecs.umich.edu            const StaticInst *si, int idx, const MiscReg &val)
3963792Sgblack@eecs.umich.edu    {
3977897Shestness@cs.utexas.edu        numIntRegWrites++;
3989918Ssteve.reinhardt@amd.com        int reg_idx = si->destRegIdx(idx) - TheISA::Misc_Reg_Base;
3994172Ssaidi@eecs.umich.edu        return thread->setMiscReg(reg_idx, val);
4003792Sgblack@eecs.umich.edu    }
4013792Sgblack@eecs.umich.edu
4025358Sgblack@eecs.umich.edu    void demapPage(Addr vaddr, uint64_t asn)
4035358Sgblack@eecs.umich.edu    {
4045358Sgblack@eecs.umich.edu        thread->demapPage(vaddr, asn);
4055358Sgblack@eecs.umich.edu    }
4065358Sgblack@eecs.umich.edu
4075358Sgblack@eecs.umich.edu    void demapInstPage(Addr vaddr, uint64_t asn)
4085358Sgblack@eecs.umich.edu    {
4095358Sgblack@eecs.umich.edu        thread->demapInstPage(vaddr, asn);
4105358Sgblack@eecs.umich.edu    }
4115358Sgblack@eecs.umich.edu
4125358Sgblack@eecs.umich.edu    void demapDataPage(Addr vaddr, uint64_t asn)
4135358Sgblack@eecs.umich.edu    {
4145358Sgblack@eecs.umich.edu        thread->demapDataPage(vaddr, asn);
4155358Sgblack@eecs.umich.edu    }
4165358Sgblack@eecs.umich.edu
41710319SAndreas.Sandberg@ARM.com    unsigned int readStCondFailures() const {
4184027Sstever@eecs.umich.edu        return thread->readStCondFailures();
4194027Sstever@eecs.umich.edu    }
4204027Sstever@eecs.umich.edu
42110319SAndreas.Sandberg@ARM.com    void setStCondFailures(unsigned int sc_failures) {
4224027Sstever@eecs.umich.edu        thread->setStCondFailures(sc_failures);
4234027Sstever@eecs.umich.edu    }
4244027Sstever@eecs.umich.edu
42510319SAndreas.Sandberg@ARM.com    MiscReg readRegOtherThread(int regIdx, ThreadID tid = InvalidThreadID)
42610319SAndreas.Sandberg@ARM.com    {
4274661Sksewell@umich.edu        panic("Simple CPU models do not support multithreaded "
4284661Sksewell@umich.edu              "register access.\n");
42910319SAndreas.Sandberg@ARM.com    }
4304661Sksewell@umich.edu
43110319SAndreas.Sandberg@ARM.com    void setRegOtherThread(int regIdx, MiscReg val,
43210319SAndreas.Sandberg@ARM.com                           ThreadID tid = InvalidThreadID)
43310319SAndreas.Sandberg@ARM.com    {
4344661Sksewell@umich.edu        panic("Simple CPU models do not support multithreaded "
4354661Sksewell@umich.edu              "register access.\n");
43610319SAndreas.Sandberg@ARM.com    }
4374661Sksewell@umich.edu
4385250Sksewell@umich.edu    //Fault CacheOp(uint8_t Op, Addr EA);
4395222Sksewell@umich.edu
4405702Ssaidi@eecs.umich.edu    Fault hwrei() { return thread->hwrei(); }
4415702Ssaidi@eecs.umich.edu    bool simPalCheck(int palFunc) { return thread->simPalCheck(palFunc); }
4428557Sgblack@eecs.umich.edu
4438557Sgblack@eecs.umich.edu    void
4448557Sgblack@eecs.umich.edu    syscall(int64_t callnum)
4458557Sgblack@eecs.umich.edu    {
4468779Sgblack@eecs.umich.edu        if (FullSystem)
4478779Sgblack@eecs.umich.edu            panic("Syscall emulation isn't available in FS mode.\n");
4488806Sgblack@eecs.umich.edu
4498557Sgblack@eecs.umich.edu        thread->syscall(callnum);
4508557Sgblack@eecs.umich.edu    }
451705SN/A
4522680Sktlim@umich.edu    ThreadContext *tcBase() { return tc; }
45310061Sandreas@sandberg.pp.se
45410061Sandreas@sandberg.pp.se  private:
45510061Sandreas@sandberg.pp.se    TheISA::PCState pred_pc;
45610529Smorr@cs.wisc.edu
45710529Smorr@cs.wisc.edu  public:
45810529Smorr@cs.wisc.edu    // monitor/mwait funtions
45910529Smorr@cs.wisc.edu    void armMonitor(Addr address) { BaseCPU::armMonitor(address); }
46010529Smorr@cs.wisc.edu    bool mwait(PacketPtr pkt) { return BaseCPU::mwait(pkt); }
46110529Smorr@cs.wisc.edu    void mwaitAtomic(ThreadContext *tc)
46210529Smorr@cs.wisc.edu    { return BaseCPU::mwaitAtomic(tc, thread->dtb); }
46310529Smorr@cs.wisc.edu    AddressMonitor *getAddrMonitor() { return BaseCPU::getCpuAddrMonitor(); }
4642SN/A};
4652SN/A
4662623SN/A#endif // __CPU_SIMPLE_BASE_HH__
467