2 * Copyright (c) 2009 The Regents of The University of Michigan
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 #ifndef __ARCH_MIPS_ISA_HH__
32 #define __ARCH_MIPS_ISA_HH__
38 #include "arch/generic/isa.hh"
39 #include "arch/mips/registers.hh"
40 #include "arch/mips/types.hh"
41 #include "cpu/reg_class.hh"
42 #include "sim/eventq.hh"
43 #include "sim/sim_object.hh"
53 class ISA : public BaseISA
56 // The MIPS name for this file is CP0 or Coprocessor 0
59 typedef MipsISAParams Params;
62 // Number of threads and vpes an individual ISA state can handle
72 std::vector<std::vector<RegVal> > miscRegFile;
73 std::vector<std::vector<RegVal> > miscRegFile_WriteMask;
74 std::vector<BankType> bankType;
81 unsigned getVPENum(ThreadID tid) const;
83 //////////////////////////////////////////////////////////
85 // READ/WRITE CP0 STATE
88 //////////////////////////////////////////////////////////
89 //@TODO: MIPS MT's register view automatically connects
90 // Status to TCStatus depending on current thread
91 void updateCP0ReadView(int misc_reg, ThreadID tid) { }
92 RegVal readMiscRegNoEffect(int misc_reg, ThreadID tid = 0) const;
95 RegVal readMiscReg(int misc_reg, ThreadContext *tc, ThreadID tid = 0);
97 RegVal filterCP0Write(int misc_reg, int reg_sel, RegVal val);
98 void setRegMask(int misc_reg, RegVal val, ThreadID tid = 0);
99 void setMiscRegNoEffect(int misc_reg, RegVal val, ThreadID tid=0);
101 //template <class TC>
102 void setMiscReg(int misc_reg, RegVal val,
103 ThreadContext *tc, ThreadID tid=0);
105 //////////////////////////////////////////////////////////
107 // DECLARE INTERFACE THAT WILL ALLOW A MiscRegFile (Cop0)
108 // TO SCHEDULE EVENTS
110 //////////////////////////////////////////////////////////
112 // Flag that is set when CP0 state has been written to.
115 // Enumerated List of CP0 Event Types
120 /** Process a CP0 event */
121 void processCP0Event(BaseCPU *cpu, CP0EventType);
123 // Schedule a CP0 Update Event
124 void scheduleCP0Update(BaseCPU *cpu, Cycles delay = Cycles(0));
126 // If any changes have been made, then check the state for changes
127 // and if necessary alert the CPU
128 void updateCPU(BaseCPU *cpu);
130 static std::string miscRegNames[NumMiscRegs];
133 void startup(ThreadContext *tc) {}
135 /// Explicitly import the otherwise hidden startup
136 using BaseISA::startup;
138 const Params *params() const;
142 RegId flattenRegId(const RegId& regId) const { return regId; }
145 flattenIntIndex(int reg) const
151 flattenFloatIndex(int reg) const
157 flattenVecIndex(int reg) const
163 flattenVecElemIndex(int reg) const
169 flattenVecPredIndex(int reg) const
176 flattenCCIndex(int reg) const
182 flattenMiscIndex(int reg) const