gem5  v19.0.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
isa.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2009 The Regents of The University of Michigan
3  * All rights reserved.
4  *
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.
15  *
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.
27  *
28  * Authors: Gabe Black
29  */
30 
31 #ifndef __ARCH_MIPS_ISA_HH__
32 #define __ARCH_MIPS_ISA_HH__
33 
34 #include <queue>
35 #include <string>
36 #include <vector>
37 
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"
44 
45 class BaseCPU;
46 class Checkpoint;
47 class EventManager;
48 struct MipsISAParams;
49 class ThreadContext;
50 
51 namespace MipsISA
52 {
53  class ISA : public BaseISA
54  {
55  public:
56  // The MIPS name for this file is CP0 or Coprocessor 0
57  typedef ISA CP0;
58 
59  typedef MipsISAParams Params;
60 
61  protected:
62  // Number of threads and vpes an individual ISA state can handle
63  uint8_t numThreads;
64  uint8_t numVpes;
65 
66  enum BankType {
70  };
71 
75 
76  public:
77  void clear();
78 
79  void configCP();
80 
81  unsigned getVPENum(ThreadID tid) const;
82 
84  //
85  // READ/WRITE CP0 STATE
86  //
87  //
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;
93 
94  //template <class TC>
95  RegVal readMiscReg(int misc_reg, ThreadContext *tc, ThreadID tid = 0);
96 
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);
100 
101  //template <class TC>
102  void setMiscReg(int misc_reg, RegVal val,
103  ThreadContext *tc, ThreadID tid=0);
104 
106  //
107  // DECLARE INTERFACE THAT WILL ALLOW A MiscRegFile (Cop0)
108  // TO SCHEDULE EVENTS
109  //
111 
112  // Flag that is set when CP0 state has been written to.
114 
115  // Enumerated List of CP0 Event Types
118  };
119 
122 
123  // Schedule a CP0 Update Event
124  void scheduleCP0Update(BaseCPU *cpu, Cycles delay = Cycles(0));
125 
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);
129 
130  static std::string miscRegNames[NumMiscRegs];
131 
132  public:
133  void startup(ThreadContext *tc) {}
134 
136  using BaseISA::startup;
137 
138  const Params *params() const;
139 
140  ISA(Params *p);
141 
142  RegId flattenRegId(const RegId& regId) const { return regId; }
143 
144  int
145  flattenIntIndex(int reg) const
146  {
147  return reg;
148  }
149 
150  int
152  {
153  return reg;
154  }
155 
156  int
157  flattenVecIndex(int reg) const
158  {
159  return reg;
160  }
161 
162  int
164  {
165  return reg;
166  }
167 
168  int
170  {
171  return reg;
172  }
173 
174  // dummy
175  int
176  flattenCCIndex(int reg) const
177  {
178  return reg;
179  }
180 
181  int
183  {
184  return reg;
185  }
186 
187  };
188 }
189 
190 #endif
Bitfield< 5, 3 > reg
Definition: types.hh:89
Cycles is a wrapper class for representing cycle counts, i.e.
Definition: types.hh:83
const Params * params() const
Definition: isa.cc:146
void clear()
Definition: isa.cc:152
RegVal readMiscRegNoEffect(int misc_reg, ThreadID tid=0) const
Definition: isa.cc:421
uint64_t RegVal
Definition: types.hh:168
int flattenMiscIndex(int reg) const
Definition: isa.hh:182
void updateCPU(BaseCPU *cpu)
Definition: isa.cc:533
int flattenVecElemIndex(int reg) const
Definition: isa.hh:163
unsigned getVPENum(ThreadID tid) const
Definition: isa.cc:414
ThreadContext is the external interface to all thread state for anything outside of the CPU...
STL vector class.
Definition: stl.hh:40
Bitfield< 63 > val
Definition: misc.hh:771
std::vector< std::vector< RegVal > > miscRegFile_WriteMask
Definition: isa.hh:73
void setMiscRegNoEffect(int misc_reg, RegVal val, ThreadID tid=0)
Definition: isa.cc:448
void processCP0Event(BaseCPU *cpu, CP0EventType)
Process a CP0 event.
Definition: isa.cc:562
void startup(ThreadContext *tc)
Definition: isa.hh:133
int flattenFloatIndex(int reg) const
Definition: isa.hh:151
int flattenVecIndex(int reg) const
Definition: isa.hh:157
CP0EventType
Definition: isa.hh:116
RegVal filterCP0Write(int misc_reg, int reg_sel, RegVal val)
This method doesn&#39;t need to adjust the Control Register Offset since it has already been done in the ...
Definition: isa.cc:499
RegVal readMiscReg(int misc_reg, ThreadContext *tc, ThreadID tid=0)
Definition: isa.cc:435
static std::string miscRegNames[NumMiscRegs]
Definition: isa.hh:130
void updateCP0ReadView(int misc_reg, ThreadID tid)
Definition: isa.hh:91
int flattenVecPredIndex(int reg) const
Definition: isa.hh:169
void scheduleCP0Update(BaseCPU *cpu, Cycles delay=Cycles(0))
Definition: isa.cc:519
int16_t ThreadID
Thread index/ID type.
Definition: types.hh:227
ISA(Params *p)
Definition: isa.cc:92
bool cp0Updated
Definition: isa.hh:113
MipsISAParams Params
Definition: isa.hh:59
int flattenIntIndex(int reg) const
Definition: isa.hh:145
std::vector< std::vector< RegVal > > miscRegFile
Definition: isa.hh:72
uint8_t numThreads
Definition: isa.hh:63
RegId flattenRegId(const RegId &regId) const
Definition: isa.hh:142
uint8_t numVpes
Definition: isa.hh:64
std::vector< BankType > bankType
Definition: isa.hh:74
Register ID: describe an architectural register with its class and index.
Definition: reg_class.hh:79
Definition: isa.hh:35
const int NumMiscRegs
Definition: registers.hh:282
void setRegMask(int misc_reg, RegVal val, ThreadID tid=0)
Definition: isa.cc:461
void configCP()
Definition: isa.cc:165
Bitfield< 0 > p
void setMiscReg(int misc_reg, RegVal val, ThreadContext *tc, ThreadID tid=0)
Definition: isa.cc:476
ISA CP0
Definition: isa.hh:57
int flattenCCIndex(int reg) const
Definition: isa.hh:176
virtual void startup()
startup() is the final initialization call before simulation.
Definition: sim_object.cc:99

Generated on Fri Feb 28 2020 16:26:56 for gem5 by doxygen 1.8.13