gem5 v24.0.0.0
Loading...
Searching...
No Matches
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
43#include "arch/arm/pcstate.hh"
44#include "cpu/thread_context.hh"
45
46namespace gem5
47{
48
49namespace ArmISA
50{
51
52class 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
109{
110 public:
117
118 protected:
119
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
152
153 void setExcAcRel(bool exclusive, bool acrel);
154};
155
156class 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
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
228class 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
247class 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
259class 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
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__
virtual ~Memory64()
Definition mem64.hh:137
static const unsigned numMicroops
Definition mem64.hh:124
Memory64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, RegIndex _dest, RegIndex _base)
Definition mem64.hh:128
bool baseIsSP
True if the base register is SP (used for SP alignment checking).
Definition mem64.hh:123
void setExcAcRel(bool exclusive, bool acrel)
Definition mem64.cc:82
unsigned memAccessFlags
Definition mem64.hh:151
void startDisassembly(std::ostream &os) const
Definition mem64.cc:69
StaticInstPtr fetchMicroop(MicroPC microPC) const override
Return the microop that goes with a particular micropc.
Definition mem64.hh:143
StaticInstPtr * uops
Definition mem64.hh:126
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition mem64.cc:212
MemoryAtomicPair64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, RegIndex _dest, RegIndex _base, RegIndex _result)
Definition mem64.hh:295
MemoryDImm64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, RegIndex _dest, RegIndex _dest2, RegIndex _base, int64_t _imm)
Definition mem64.hh:175
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition mem64.cc:107
MemoryDImmEx64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, RegIndex _result, RegIndex _dest, RegIndex _dest2, RegIndex _base, int32_t _imm)
Definition mem64.hh:191
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition mem64.cc:124
MemoryEx64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, RegIndex _dest, RegIndex _base, RegIndex _result)
Definition mem64.hh:264
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition mem64.cc:186
MemoryImm64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, RegIndex _dest, RegIndex _base, int64_t _imm)
Definition mem64.hh:161
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition mem64.cc:95
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition mem64.cc:201
MemoryLiteral64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, RegIndex _dest, int64_t _imm)
Definition mem64.hh:279
MemoryPostIndex64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, RegIndex _dest, RegIndex _base, int64_t _imm)
Definition mem64.hh:218
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition mem64.cc:153
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition mem64.cc:143
MemoryPreIndex64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, RegIndex _dest, RegIndex _base, int64_t _imm)
Definition mem64.hh:205
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition mem64.cc:176
MemoryRaw64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, RegIndex _dest, RegIndex _base)
Definition mem64.hh:250
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition mem64.cc:165
ArmExtendType type
Definition mem64.hh:232
MemoryReg64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, RegIndex _dest, RegIndex _base, RegIndex _offset, ArmExtendType _type, uint64_t _shiftAmt)
Definition mem64.hh:235
void advancePC(PCStateBase &pcState) const override
Definition mem64.hh:81
void advancePC(ThreadContext *tc) const override
Definition mem64.hh:94
MightBeMicro64(const char *mnem, ExtMachInst _machInst, OpClass __opClass)
Definition mem64.hh:76
SysDC64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, RegIndex _base, MiscRegIndex _dest)
Definition mem64.hh:61
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition mem64.cc:51
MiscRegIndex dest
Definition mem64.hh:56
uint32_t iss() const override
Definition mem64.cc:62
This class is implementing the Base class for a generic AArch64 instruction which is making use of sy...
Definition misc64.hh:158
Target & as()
Definition pcstate.hh:73
std::bitset< Num_Flags > flags
Flag values for this instruction.
ThreadContext is the external interface to all thread state for anything outside of the CPU.
virtual const PCStateBase & pcState() const =0
static bool isSP(RegIndex reg)
Definition int.hh:619
Bitfield< 4 > pc
Bitfield< 17 > os
Definition misc.hh:838
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
uint16_t RegIndex
Definition types.hh:176
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition types.hh:147
uint16_t MicroPC
Definition types.hh:149

Generated on Tue Jun 18 2024 16:23:56 for gem5 by doxygen 1.11.0