gem5  v22.1.0.0
mem.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2009 The University of Edinburgh
3  * Copyright (c) 2021 IBM Corporation
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are
8  * met: redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer;
10  * redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution;
13  * neither the name of the copyright holders nor the names of its
14  * contributors may be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #ifndef __ARCH_POWER_MEM_HH__
31 #define __ARCH_POWER_MEM_HH__
32 
34 
35 namespace gem5
36 {
37 
38 namespace PowerISA
39 {
40 
44 class MemOp : public PowerStaticInst
45 {
46  protected:
47 
49  unsigned memAccessFlags;
50 
52  MemOp(const char *mnem, MachInst _machInst, OpClass __opClass)
53  : PowerStaticInst(mnem, _machInst, __opClass),
55  {
56  }
57 
58  std::string generateDisassembly(
59  Addr pc, const loader::SymbolTable *symtab) const override;
60 };
61 
62 
66 class MemDispOp : public MemOp
67 {
68  protected:
69 
70  int64_t d;
71 
73  MemDispOp(const char *mnem, MachInst _machInst, OpClass __opClass)
74  : MemOp(mnem, _machInst, __opClass),
75  d(sext<16>(machInst.d))
76  {
77  }
78 
79  std::string generateDisassembly(
80  Addr pc, const loader::SymbolTable *symtab) const override;
81 };
82 
86 class MemDispShiftOp : public MemOp
87 {
88  protected:
89 
90  int64_t ds;
91 
93  MemDispShiftOp(const char *mnem, MachInst _machInst, OpClass __opClass)
94  : MemOp(mnem, _machInst, __opClass),
95  ds(sext<14>(machInst.ds))
96  {
97  }
98 
99  std::string generateDisassembly(
100  Addr pc, const loader::SymbolTable *symtab) const override;
101 };
102 
103 
107 class MemIndexOp : public MemOp
108 {
109  protected:
110 
112  MemIndexOp(const char *mnem, MachInst _machInst, OpClass __opClass)
113  : MemOp(mnem, _machInst, __opClass)
114  {
115  }
116 
117  std::string generateDisassembly(
118  Addr pc, const loader::SymbolTable *symtab) const override;
119 };
120 
121 } // namespace PowerISA
122 } // namespace gem5
123 
124 #endif //__ARCH_POWER_INSTS_MEM_HH__
Class for memory operations with displacement.
Definition: mem.hh:67
MemDispOp(const char *mnem, MachInst _machInst, OpClass __opClass)
Constructor.
Definition: mem.hh:73
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: mem.cc:47
Class for memory operations with shifted displacement.
Definition: mem.hh:87
MemDispShiftOp(const char *mnem, MachInst _machInst, OpClass __opClass)
Constructor.
Definition: mem.hh:93
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: mem.cc:107
Class for memory operations with register indexed addressing.
Definition: mem.hh:108
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: mem.cc:166
MemIndexOp(const char *mnem, MachInst _machInst, OpClass __opClass)
Constructor.
Definition: mem.hh:112
Base class for memory operations.
Definition: mem.hh:45
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: mem.cc:40
MemOp(const char *mnem, MachInst _machInst, OpClass __opClass)
Constructor.
Definition: mem.hh:52
unsigned memAccessFlags
Memory request flags. See mem_req_base.hh.
Definition: mem.hh:49
constexpr uint64_t sext(uint64_t val)
Sign-extend an N-bit value to 64 bits.
Definition: bitfield.hh:126
Bitfield< 4 > pc
uint32_t MachInst
Definition: types.hh:44
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147

Generated on Wed Dec 21 2022 10:22:25 for gem5 by doxygen 1.9.1