gem5  [DEVELOP-FOR-23.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 
29 #ifndef __ARCH_MIPS_ISA_HH__
30 #define __ARCH_MIPS_ISA_HH__
31 
32 #include <queue>
33 #include <string>
34 #include <vector>
35 
36 #include "arch/generic/isa.hh"
37 #include "arch/mips/pcstate.hh"
38 #include "arch/mips/regs/misc.hh"
39 #include "arch/mips/types.hh"
40 #include "base/types.hh"
41 #include "cpu/reg_class.hh"
42 #include "sim/eventq.hh"
43 #include "sim/sim_object.hh"
44 
45 namespace gem5
46 {
47 
48 class BaseCPU;
49 class Checkpoint;
50 struct MipsISAParams;
51 class ThreadContext;
52 
53 namespace MipsISA
54 {
55  class ISA : public BaseISA
56  {
57  public:
58  // The MIPS name for this file is CP0 or Coprocessor 0
59  typedef ISA CP0;
60 
61  using Params = MipsISAParams;
62 
63  protected:
64  // Number of threads and vpes an individual ISA state can handle
65  uint8_t numThreads;
66  uint8_t numVpes;
67 
68  enum BankType
69  {
73  };
74 
78 
79  public:
80  void clear() override;
81 
82  PCStateBase *
83  newPCState(Addr new_inst_addr=0) const override
84  {
85  return new PCState(new_inst_addr);
86  }
87 
88  public:
89  void configCP();
90 
91  unsigned getVPENum(ThreadID tid) const;
92 
94  //
95  // READ/WRITE CP0 STATE
96  //
97  //
99  //@TODO: MIPS MT's register view automatically connects
100  // Status to TCStatus depending on current thread
103  RegVal
104  readMiscRegNoEffect(RegIndex idx) const override
105  {
106  return readMiscRegNoEffect(idx, 0);
107  }
108 
110  RegVal
111  readMiscReg(RegIndex idx) override
112  {
113  return readMiscReg(idx, 0);
114  }
115 
116  RegVal filterCP0Write(RegIndex idx, int reg_sel, RegVal val);
117  void setRegMask(RegIndex idx, RegVal val, ThreadID tid = 0);
118 
120  void
122  {
123  setMiscRegNoEffect(idx, val, 0);
124  }
125 
126  void setMiscReg(RegIndex idx, RegVal val, ThreadID tid);
127  void
128  setMiscReg(RegIndex idx, RegVal val) override
129  {
130  setMiscReg(idx, val, 0);
131  }
132 
134  //
135  // DECLARE INTERFACE THAT WILL ALLOW A MiscRegFile (Cop0)
136  // TO SCHEDULE EVENTS
137  //
139 
140  // Flag that is set when CP0 state has been written to.
142 
143  // Enumerated List of CP0 Event Types
145  {
147  };
148 
151 
152  // Schedule a CP0 Update Event
153  void scheduleCP0Update(BaseCPU *cpu, Cycles delay = Cycles(0));
154 
155  // If any changes have been made, then check the state for changes
156  // and if necessary alert the CPU
157  void updateCPU(BaseCPU *cpu);
158 
159  static std::string miscRegNames[misc_reg::NumRegs];
160 
161  public:
162  ISA(const Params &p);
163 
164  bool
165  inUserMode() const override
166  {
169 
170  if (// EXL, ERL or CU0 set, CP0 accessible
171  (Stat & 0x10000006) == 0 &&
172  // DM bit set, CP0 accessible
173  (Dbg & 0x40000000) == 0 &&
174  // KSU = 0, kernel mode is base mode
175  (Stat & 0x00000018) != 0) {
176  // Unable to use Status_CU0, etc directly,
177  // using bitfields & masks.
178  return true;
179  } else {
180  return false;
181  }
182  }
183 
184  void copyRegsFrom(ThreadContext *src) override;
185  };
186 } // namespace MipsISA
187 } // namespace gem5
188 
189 #endif
gem5::MipsISA::ISA::bankType
std::vector< BankType > bankType
Definition: isa.hh:77
misc.hh
gem5::RegVal
uint64_t RegVal
Definition: types.hh:173
gem5::MipsISA::ISA::processCP0Event
void processCP0Event(BaseCPU *cpu, CP0EventType)
Process a CP0 event.
Definition: isa.cc:603
gem5::MipsISA::ISA::UpdateCP0
@ UpdateCP0
Definition: isa.hh:146
gem5::MipsISA::ISA::CP0
ISA CP0
Definition: isa.hh:59
gem5::MipsISA::ISA::scheduleCP0Update
void scheduleCP0Update(BaseCPU *cpu, Cycles delay=Cycles(0))
Definition: isa.cc:560
gem5::MipsISA::ISA::numVpes
uint8_t numVpes
Definition: isa.hh:66
types.hh
gem5::MipsISA::ISA::setMiscRegNoEffect
void setMiscRegNoEffect(RegIndex idx, RegVal val, ThreadID tid)
Definition: isa.cc:489
gem5::MipsISA::ISA::inUserMode
bool inUserMode() const override
Definition: isa.hh:165
gem5::X86ISA::val
Bitfield< 63 > val
Definition: misc.hh:776
gem5::MipsISA::ISA::numThreads
uint8_t numThreads
Definition: isa.hh:65
std::vector
STL vector class.
Definition: stl.hh:37
gem5::MipsISA::ISA::ISA
ISA(const Params &p)
Definition: isa.cc:113
gem5::MipsISA::ISA::setMiscReg
void setMiscReg(RegIndex idx, RegVal val) override
Definition: isa.hh:128
gem5::MipsISA::ISA::miscRegFile
std::vector< std::vector< RegVal > > miscRegFile
Definition: isa.hh:75
gem5::Cycles
Cycles is a wrapper class for representing cycle counts, i.e.
Definition: types.hh:78
gem5::MipsISA::misc_reg::NumRegs
@ NumRegs
Definition: misc.hh:198
gem5::MipsISA::ISA::clear
void clear() override
Definition: isa.cc:176
gem5::ThreadContext
ThreadContext is the external interface to all thread state for anything outside of the CPU.
Definition: thread_context.hh:88
sim_object.hh
gem5::MipsISA::PCState
GenericISA::DelaySlotPCState< 4 > PCState
Definition: pcstate.hh:40
gem5::MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:326
gem5::MipsISA::ISA::perVirtProcessor
@ perVirtProcessor
Definition: isa.hh:72
gem5::MipsISA::ISA::miscRegNames
static std::string miscRegNames[misc_reg::NumRegs]
Definition: isa.hh:159
gem5::BaseCPU
Definition: base.hh:104
gem5::MipsISA::misc_reg::Debug
@ Debug
Definition: misc.hh:148
gem5::MipsISA::ISA::copyRegsFrom
void copyRegsFrom(ThreadContext *src) override
Definition: isa.cc:188
gem5::MipsISA::ISA::setRegMask
void setRegMask(RegIndex idx, RegVal val, ThreadID tid=0)
Definition: isa.cc:502
gem5::MipsISA::ISA::filterCP0Write
RegVal filterCP0Write(RegIndex idx, int reg_sel, RegVal val)
This method doesn't need to adjust the Control Register Offset since it has already been done in the ...
Definition: isa.cc:540
gem5::Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
gem5::MipsISA::ISA::newPCState
PCStateBase * newPCState(Addr new_inst_addr=0) const override
Definition: isa.hh:83
gem5::MipsISA::ISA::readMiscReg
RegVal readMiscReg(RegIndex idx, ThreadID tid)
Definition: isa.cc:477
gem5::MipsISA::ISA::setMiscRegNoEffect
void setMiscRegNoEffect(RegIndex idx, RegVal val) override
Definition: isa.hh:121
gem5::MipsISA::ISA::setMiscReg
void setMiscReg(RegIndex idx, RegVal val, ThreadID tid)
Definition: isa.cc:517
gem5::MipsISA::ISA::CP0EventType
CP0EventType
Definition: isa.hh:144
gem5::MipsISA::ISA::configCP
void configCP()
Definition: isa.cc:208
gem5::MipsISA::ISA::updateCP0ReadView
void updateCP0ReadView(RegIndex idx, ThreadID tid)
Definition: isa.hh:101
isa.hh
types.hh
gem5::MipsISA::ISA::getVPENum
unsigned getVPENum(ThreadID tid) const
Definition: isa.cc:457
gem5::MipsISA::ISA::perThreadContext
@ perThreadContext
Definition: isa.hh:71
reg_class.hh
gem5::MipsISA::ISA::perProcessor
@ perProcessor
Definition: isa.hh:70
gem5::MipsISA::ISA::updateCPU
void updateCPU(BaseCPU *cpu)
Definition: isa.cc:574
gem5::MipsISA::ISA::readMiscReg
RegVal readMiscReg(RegIndex idx) override
Definition: isa.hh:111
gem5::MipsISA::ISA
Definition: isa.hh:55
gem5::PCStateBase
Definition: pcstate.hh:57
gem5::BaseISA
Definition: isa.hh:58
gem5::RegIndex
uint16_t RegIndex
Definition: types.hh:176
gem5::MipsISA::ISA::cp0Updated
bool cp0Updated
Definition: isa.hh:141
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: gpu_translation_state.hh:37
gem5::MipsISA::ISA::Params
MipsISAParams Params
Definition: isa.hh:61
pcstate.hh
gem5::MipsISA::ISA::readMiscRegNoEffect
RegVal readMiscRegNoEffect(RegIndex idx) const override
Definition: isa.hh:104
gem5::MipsISA::ISA::BankType
BankType
Definition: isa.hh:68
gem5::ThreadID
int16_t ThreadID
Thread index/ID type.
Definition: types.hh:235
gem5::MipsISA::ISA::miscRegFile_WriteMask
std::vector< std::vector< RegVal > > miscRegFile_WriteMask
Definition: isa.hh:76
gem5::MipsISA::misc_reg::Status
@ Status
Definition: misc.hh:100
gem5::MipsISA::ISA::readMiscRegNoEffect
RegVal readMiscRegNoEffect(RegIndex idx, ThreadID tid) const
Definition: isa.cc:464
eventq.hh

Generated on Sun Jul 30 2023 01:56:47 for gem5 by doxygen 1.8.17