gem5  [DEVELOP-FOR-23.0]
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
mem64.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-2013,2017-2019, 2021-2022 Arm Limited
3  * All rights reserved
4  *
5  * The license below extends only to copyright in the software and shall
6  * not be construed as granting a license to any other intellectual
7  * property including but not limited to intellectual property relating
8  * to a hardware implementation of the functionality of the software
9  * licensed hereunder. You may use the software subject to the license
10  * terms below provided that you ensure that this notice is replicated
11  * unmodified and in its entirety in all distributions of the software,
12  * modified or unmodified, in source code or in binary form.
13  *
14  * Redistribution and use in source and binary forms, with or without
15  * modification, are permitted provided that the following conditions are
16  * met: redistributions of source code must retain the above copyright
17  * notice, this list of conditions and the following disclaimer;
18  * redistributions in binary form must reproduce the above copyright
19  * notice, this list of conditions and the following disclaimer in the
20  * documentation and/or other materials provided with the distribution;
21  * neither the name of the copyright holders nor the names of its
22  * contributors may be used to endorse or promote products derived from
23  * this software without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  */
37 
38 #ifndef __ARCH_ARM_MEM64_HH__
39 #define __ARCH_ARM_MEM64_HH__
40 
41 #include "arch/arm/insts/misc64.hh"
43 #include "arch/arm/pcstate.hh"
44 #include "cpu/thread_context.hh"
45 
46 namespace gem5
47 {
48 
49 namespace ArmISA
50 {
51 
52 class SysDC64 : public MiscRegOp64
53 {
54  protected:
57 
58  // This is used for fault handling only
59  mutable Addr faultAddr;
60 
61  SysDC64(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
62  RegIndex _base, MiscRegIndex _dest)
63  : MiscRegOp64(mnem, _machInst, __opClass, false),
64  base(_base), dest(_dest), faultAddr(0)
65  {}
66 
67  std::string generateDisassembly(
68  Addr pc, const loader::SymbolTable *symtab) const override;
69 
70  uint32_t iss() const override;
71 };
72 
74 {
75  protected:
76  MightBeMicro64(const char *mnem, ExtMachInst _machInst, OpClass __opClass)
77  : ArmStaticInst(mnem, _machInst, __opClass)
78  {}
79 
80  void
81  advancePC(PCStateBase &pcState) const override
82  {
83  auto &apc = pcState.as<PCState>();
84  if (flags[IsLastMicroop]) {
85  apc.uEnd();
86  } else if (flags[IsMicroop]) {
87  apc.uAdvance();
88  } else {
89  apc.advance();
90  }
91  }
92 
93  void
94  advancePC(ThreadContext *tc) const override
95  {
96  PCState pc = tc->pcState().as<PCState>();
97  if (flags[IsLastMicroop]) {
98  pc.uEnd();
99  } else if (flags[IsMicroop]) {
100  pc.uAdvance();
101  } else {
102  pc.advance();
103  }
104  tc->pcState(pc);
105  }
106 };
107 
108 class Memory64 : public MightBeMicro64
109 {
110  public:
111  enum AddrMode
112  {
116  };
117 
118  protected:
119 
123  bool baseIsSP;
124  static const unsigned numMicroops = 3;
125 
127 
128  Memory64(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
129  RegIndex _dest, RegIndex _base)
130  : MightBeMicro64(mnem, _machInst, __opClass),
131  dest(_dest), base(_base), uops(NULL), memAccessFlags(0)
132  {
133  baseIsSP = isSP(_base);
134  }
135 
136  virtual
138  {
139  delete [] uops;
140  }
141 
143  fetchMicroop(MicroPC microPC) const override
144  {
145  assert(uops != NULL && microPC < numMicroops);
146  return uops[microPC];
147  }
148 
149  void startDisassembly(std::ostream &os) const;
150 
151  unsigned memAccessFlags;
152 
153  void setExcAcRel(bool exclusive, bool acrel);
154 };
155 
156 class MemoryImm64 : public Memory64
157 {
158  protected:
159  int64_t imm;
160 
161  MemoryImm64(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
162  RegIndex _dest, RegIndex _base, int64_t _imm)
163  : Memory64(mnem, _machInst, __opClass, _dest, _base), imm(_imm)
164  {}
165 
166  std::string generateDisassembly(
167  Addr pc, const loader::SymbolTable *symtab) const override;
168 };
169 
170 class MemoryDImm64 : public MemoryImm64
171 {
172  protected:
174 
175  MemoryDImm64(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
176  RegIndex _dest, RegIndex _dest2, RegIndex _base,
177  int64_t _imm)
178  : MemoryImm64(mnem, _machInst, __opClass, _dest, _base, _imm),
179  dest2(_dest2)
180  {}
181 
182  std::string generateDisassembly(
183  Addr pc, const loader::SymbolTable *symtab) const override;
184 };
185 
187 {
188  protected:
190 
191  MemoryDImmEx64(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
192  RegIndex _result, RegIndex _dest, RegIndex _dest2,
193  RegIndex _base, int32_t _imm)
194  : MemoryDImm64(mnem, _machInst, __opClass, _dest, _dest2,
195  _base, _imm), result(_result)
196  {}
197 
198  std::string generateDisassembly(
199  Addr pc, const loader::SymbolTable *symtab) const override;
200 };
201 
203 {
204  protected:
205  MemoryPreIndex64(const char *mnem, ExtMachInst _machInst,
206  OpClass __opClass, RegIndex _dest, RegIndex _base,
207  int64_t _imm)
208  : MemoryImm64(mnem, _machInst, __opClass, _dest, _base, _imm)
209  {}
210 
211  std::string generateDisassembly(
212  Addr pc, const loader::SymbolTable *symtab) const override;
213 };
214 
216 {
217  protected:
218  MemoryPostIndex64(const char *mnem, ExtMachInst _machInst,
219  OpClass __opClass, RegIndex _dest, RegIndex _base,
220  int64_t _imm)
221  : MemoryImm64(mnem, _machInst, __opClass, _dest, _base, _imm)
222  {}
223 
224  std::string generateDisassembly(
225  Addr pc, const loader::SymbolTable *symtab) const override;
226 };
227 
228 class MemoryReg64 : public Memory64
229 {
230  protected:
233  uint64_t shiftAmt;
234 
235  MemoryReg64(const char *mnem, ExtMachInst _machInst,
236  OpClass __opClass, RegIndex _dest, RegIndex _base,
237  RegIndex _offset, ArmExtendType _type,
238  uint64_t _shiftAmt)
239  : Memory64(mnem, _machInst, __opClass, _dest, _base),
240  offset(_offset), type(_type), shiftAmt(_shiftAmt)
241  {}
242 
243  std::string generateDisassembly(
244  Addr pc, const loader::SymbolTable *symtab) const override;
245 };
246 
247 class MemoryRaw64 : public Memory64
248 {
249  protected:
250  MemoryRaw64(const char *mnem, ExtMachInst _machInst,
251  OpClass __opClass, RegIndex _dest, RegIndex _base)
252  : Memory64(mnem, _machInst, __opClass, _dest, _base)
253  {}
254 
255  std::string generateDisassembly(
256  Addr pc, const loader::SymbolTable *symtab) const override;
257 };
258 
259 class MemoryEx64 : public Memory64
260 {
261  protected:
263 
264  MemoryEx64(const char *mnem, ExtMachInst _machInst,
265  OpClass __opClass, RegIndex _dest, RegIndex _base,
266  RegIndex _result)
267  : Memory64(mnem, _machInst, __opClass, _dest, _base), result(_result)
268  {}
269 
270  std::string generateDisassembly(
271  Addr pc, const loader::SymbolTable *symtab) const override;
272 };
273 
274 class MemoryLiteral64 : public Memory64
275 {
276  protected:
277  int64_t imm;
278 
279  MemoryLiteral64(const char *mnem, ExtMachInst _machInst,
280  OpClass __opClass, RegIndex _dest, int64_t _imm)
281  : Memory64(mnem, _machInst, __opClass, _dest, int_reg::Zero), imm(_imm)
282  {}
283 
284  std::string generateDisassembly(
285  Addr pc, const loader::SymbolTable *symtab) const override;
286 };
287 
289 {
290  protected:
294 
295  MemoryAtomicPair64(const char *mnem, ExtMachInst _machInst,
296  OpClass __opClass, RegIndex _dest, RegIndex _base,
297  RegIndex _result)
298  : Memory64(mnem, _machInst, __opClass, _dest, _base),
299  dest2((RegIndex)(_dest + (RegIndex)(1))),
300  result(_result),
301  result2((RegIndex)(_result + (RegIndex)(1)))
302  {}
303 
304  std::string generateDisassembly(
305  Addr pc, const loader::SymbolTable *symtab) const override;
306 };
307 
308 } // namespace ArmISA
309 } // namespace gem5
310 
311 #endif //__ARCH_ARM_INSTS_MEM_HH__
gem5::ArmISA::MemoryDImmEx64
Definition: mem64.hh:186
gem5::ArmISA::Memory64::dest
RegIndex dest
Definition: mem64.hh:120
gem5::ArmISA::SysDC64::dest
MiscRegIndex dest
Definition: mem64.hh:56
gem5::ArmISA::MemoryPostIndex64
Definition: mem64.hh:215
gem5::ArmISA::MemoryDImmEx64::generateDisassembly
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: mem64.cc:124
gem5::ArmISA::MemoryAtomicPair64::generateDisassembly
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: mem64.cc:212
gem5::ArmISA::Memory64::setExcAcRel
void setExcAcRel(bool exclusive, bool acrel)
Definition: mem64.cc:82
gem5::ArmISA::MemoryReg64::offset
RegIndex offset
Definition: mem64.hh:231
gem5::ArmISA::MemoryPreIndex64::MemoryPreIndex64
MemoryPreIndex64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, RegIndex _dest, RegIndex _base, int64_t _imm)
Definition: mem64.hh:205
gem5::ArmISA::MightBeMicro64::MightBeMicro64
MightBeMicro64(const char *mnem, ExtMachInst _machInst, OpClass __opClass)
Definition: mem64.hh:76
gem5::ArmISA::SysDC64::iss
uint32_t iss() const override
Definition: mem64.cc:62
gem5::ArmISA::ArmStaticInst
Definition: static_inst.hh:65
gem5::ArmISA::MemoryLiteral64::imm
int64_t imm
Definition: mem64.hh:277
gem5::ArmISA::MemoryAtomicPair64
Definition: mem64.hh:288
gem5::ArmISA::MemoryDImm64::generateDisassembly
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: mem64.cc:107
gem5::PCStateBase::as
Target & as()
Definition: pcstate.hh:72
gem5::ArmISA::Memory64::AddrMd_Offset
@ AddrMd_Offset
Definition: mem64.hh:113
gem5::ThreadContext::pcState
virtual const PCStateBase & pcState() const =0
gem5::ArmISA::SysDC64::faultAddr
Addr faultAddr
Definition: mem64.hh:59
gem5::ArmISA::Memory64::base
RegIndex base
Definition: mem64.hh:121
gem5::ArmISA::ArmExtendType
ArmExtendType
Definition: types.hh:222
gem5::loader::SymbolTable
Definition: symtab.hh:64
gem5::ArmISA::MemoryAtomicPair64::result
RegIndex result
Definition: mem64.hh:292
gem5::ArmISA::Memory64::fetchMicroop
StaticInstPtr fetchMicroop(MicroPC microPC) const override
Return the microop that goes with a particular micropc.
Definition: mem64.hh:143
gem5::ArmISA::MemoryRaw64
Definition: mem64.hh:247
gem5::ArmISA::MemoryRaw64::MemoryRaw64
MemoryRaw64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, RegIndex _dest, RegIndex _base)
Definition: mem64.hh:250
gem5::ArmISA::MemoryPostIndex64::generateDisassembly
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: mem64.cc:153
gem5::ArmISA::MemoryPostIndex64::MemoryPostIndex64
MemoryPostIndex64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, RegIndex _dest, RegIndex _base, int64_t _imm)
Definition: mem64.hh:218
gem5::ArmISA::isSP
static bool isSP(RegIndex reg)
Definition: int.hh:619
gem5::ArmISA::MightBeMicro64::advancePC
void advancePC(PCStateBase &pcState) const override
Definition: mem64.hh:81
gem5::PowerISA::PCState
Definition: pcstate.hh:42
gem5::ArmISA::Memory64::AddrMd_PostIndex
@ AddrMd_PostIndex
Definition: mem64.hh:115
gem5::ArmISA::MightBeMicro64::advancePC
void advancePC(ThreadContext *tc) const override
Definition: mem64.hh:94
gem5::ArmISA::SysDC64::generateDisassembly
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: mem64.cc:51
gem5::ArmISA::MightBeMicro64
Definition: mem64.hh:73
gem5::RefCountingPtr< StaticInst >
gem5::ArmISA::MemoryImm64::imm
int64_t imm
Definition: mem64.hh:159
gem5::ArmISA::MemoryReg64::generateDisassembly
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: mem64.cc:165
gem5::ArmISA::MemoryReg64
Definition: mem64.hh:228
gem5::ArmISA::MemoryRaw64::generateDisassembly
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: mem64.cc:176
gem5::MicroPC
uint16_t MicroPC
Definition: types.hh:149
gem5::ArmISA::MemoryLiteral64
Definition: mem64.hh:274
gem5::ArmISA::MemoryDImmEx64::result
RegIndex result
Definition: mem64.hh:189
gem5::ArmISA::MemoryAtomicPair64::dest2
RegIndex dest2
Definition: mem64.hh:291
misc64.hh
gem5::ThreadContext
ThreadContext is the external interface to all thread state for anything outside of the CPU.
Definition: thread_context.hh:88
gem5::ArmISA::MemoryLiteral64::MemoryLiteral64
MemoryLiteral64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, RegIndex _dest, int64_t _imm)
Definition: mem64.hh:279
gem5::ArmISA::MemoryAtomicPair64::result2
RegIndex result2
Definition: mem64.hh:293
gem5::ArmISA::MemoryReg64::MemoryReg64
MemoryReg64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, RegIndex _dest, RegIndex _base, RegIndex _offset, ArmExtendType _type, uint64_t _shiftAmt)
Definition: mem64.hh:235
gem5::ArmISA::Memory64::~Memory64
virtual ~Memory64()
Definition: mem64.hh:137
gem5::StaticInst::flags
std::bitset< Num_Flags > flags
Flag values for this instruction.
Definition: static_inst.hh:102
gem5::ArmISA::MemoryDImm64::MemoryDImm64
MemoryDImm64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, RegIndex _dest, RegIndex _dest2, RegIndex _base, int64_t _imm)
Definition: mem64.hh:175
gem5::ArmISA::MemoryEx64::MemoryEx64
MemoryEx64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, RegIndex _dest, RegIndex _base, RegIndex _result)
Definition: mem64.hh:264
gem5::ArmISA::Memory64::AddrMode
AddrMode
Definition: mem64.hh:111
gem5::ArmISA::Memory64::startDisassembly
void startDisassembly(std::ostream &os) const
Definition: mem64.cc:69
gem5::ArmISA::MemoryReg64::type
ArmExtendType type
Definition: mem64.hh:232
gem5::ArmISA::MemoryDImmEx64::MemoryDImmEx64
MemoryDImmEx64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, RegIndex _result, RegIndex _dest, RegIndex _dest2, RegIndex _base, int32_t _imm)
Definition: mem64.hh:191
gem5::Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
gem5::MiscRegOp64
This class is implementing the Base class for a generic AArch64 instruction which is making use of sy...
Definition: misc64.hh:156
gem5::ArmISA::MiscRegIndex
MiscRegIndex
Definition: misc.hh:64
pcstate.hh
gem5::ArmISA::MemoryDImm64
Definition: mem64.hh:170
gem5::ArmISA::MemoryImm64
Definition: mem64.hh:156
gem5::ArmISA::MemoryPreIndex64::generateDisassembly
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: mem64.cc:143
gem5::X86ISA::ExtMachInst
Definition: types.hh:212
gem5::ArmISA::SysDC64
Definition: mem64.hh:52
gem5::ArmISA::MemoryEx64::generateDisassembly
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: mem64.cc:186
gem5::ArmISA::cc_reg::Zero
constexpr RegId Zero
Definition: cc.hh:99
gem5::ArmISA::MemoryEx64::result
RegIndex result
Definition: mem64.hh:262
gem5::ArmISA::SysDC64::SysDC64
SysDC64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, RegIndex _base, MiscRegIndex _dest)
Definition: mem64.hh:61
gem5::X86ISA::os
Bitfield< 17 > os
Definition: misc.hh:810
static_inst.hh
gem5::ArmISA::MemoryEx64
Definition: mem64.hh:259
gem5::MipsISA::pc
Bitfield< 4 > pc
Definition: pra_constants.hh:243
gem5::ArmISA::Memory64::numMicroops
static const unsigned numMicroops
Definition: mem64.hh:124
gem5::ArmISA::Memory64::AddrMd_PreIndex
@ AddrMd_PreIndex
Definition: mem64.hh:114
gem5::ArmISA::MemoryAtomicPair64::MemoryAtomicPair64
MemoryAtomicPair64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, RegIndex _dest, RegIndex _base, RegIndex _result)
Definition: mem64.hh:295
gem5::ArmISA::MemoryImm64::MemoryImm64
MemoryImm64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, RegIndex _dest, RegIndex _base, int64_t _imm)
Definition: mem64.hh:161
gem5::ArmISA::SysDC64::base
RegIndex base
Definition: mem64.hh:55
gem5::ArmISA::MemoryDImm64::dest2
RegIndex dest2
Definition: mem64.hh:173
gem5::ArmISA::MemoryReg64::shiftAmt
uint64_t shiftAmt
Definition: mem64.hh:233
gem5::PCStateBase
Definition: pcstate.hh:57
gem5::ArmISA::Memory64::baseIsSP
bool baseIsSP
True if the base register is SP (used for SP alignment checking).
Definition: mem64.hh:123
gem5::RegIndex
uint16_t RegIndex
Definition: types.hh:176
gem5::ArmISA::Memory64
Definition: mem64.hh:108
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: gpu_translation_state.hh:37
gem5::ArmISA::MemoryPreIndex64
Definition: mem64.hh:202
gem5::ArmISA::MemoryLiteral64::generateDisassembly
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: mem64.cc:201
gem5::ArmISA::Memory64::Memory64
Memory64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, RegIndex _dest, RegIndex _base)
Definition: mem64.hh:128
thread_context.hh
gem5::GenericISA::SimplePCState::advance
void advance() override
Definition: pcstate.hh:376
gem5::ArmISA::MemoryImm64::generateDisassembly
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: mem64.cc:95
gem5::ArmISA::Memory64::memAccessFlags
unsigned memAccessFlags
Definition: mem64.hh:151
gem5::ArmISA::Memory64::uops
StaticInstPtr * uops
Definition: mem64.hh:126

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