gem5  v22.1.0.0
tme64.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020-2021 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 #include "arch/arm/insts/tme64.hh"
39 
40 #include <sstream>
41 
42 #include "debug/ArmTme.hh"
43 
44 namespace gem5
45 {
46 
47 using namespace ArmISA;
48 
49 namespace ArmISAInst {
50 
51 std::string
53  Addr pc, const loader::SymbolTable *symtab) const
54 {
55  std::stringstream ss;
56  printMnemonic(ss, "", false);
57  ccprintf(ss, "#0x%x", imm);
58  return ss.str();
59 }
60 
61 std::string
63  Addr pc, const loader::SymbolTable *symtab) const
64 {
65  std::stringstream ss;
66  printMnemonic(ss);
67  printIntReg(ss, dest);
68  return ss.str();
69 }
70 
71 std::string
73  Addr pc, const loader::SymbolTable *symtab) const
74 {
75  std::stringstream ss;
76  printMnemonic(ss);
77  return ss.str();
78 }
79 
81  : MicroTmeBasic64("utfence", machInst, MemReadOp)
82 {
83  _numSrcRegs = 0;
84  _numDestRegs = 0;
85  flags[IsMicroop] = true;
86  flags[IsReadBarrier] = true;
87  flags[IsWriteBarrier] = true;
88 }
89 
90 Fault
92  ExecContext *xc, trace::InstRecord *traceData) const
93 {
94  return NoFault;
95 }
96 
97 Fault
99  trace::InstRecord *traceData) const
100 {
101  panic("tfence should not have memory semantics");
102 
103  return NoFault;
104 }
105 
106 Fault
108  trace::InstRecord *traceData) const
109 {
110  panic("tfence should not have memory semantics");
111 
112  return NoFault;
113 }
114 
116  : TmeRegNone64("tstart", machInst, MemReadOp, _dest)
117 {
119  nullptr,
120  reinterpret_cast<RegIdArrayPtr>(
121  &std::remove_pointer_t<decltype(this)>::destRegIdxArr));
122  ;
123 
124  _numSrcRegs = 0;
125  _numDestRegs = 0;
128  flags[IsHtmStart] = true;
129  flags[IsInteger] = true;
130  flags[IsLoad] = true;
131  flags[IsMicroop] = true;
132  flags[IsNonSpeculative] = true;
133 }
134 
135 Fault
137  ExecContext *xc, trace::InstRecord *traceData) const
138 {
139  panic("TME is not supported with atomic memory");
140 
141  return NoFault;
142 }
143 
145  : TmeRegNone64("ttest", machInst, MemReadOp, _dest)
146 {
148  nullptr,
149  reinterpret_cast<RegIdArrayPtr>(
150  &std::remove_pointer_t<decltype(this)>::destRegIdxArr));
151  ;
152 
153  _numSrcRegs = 0;
154  _numDestRegs = 0;
157  flags[IsInteger] = true;
158  flags[IsMicroop] = true;
159 }
160 
161 Tcancel64::Tcancel64(ExtMachInst machInst, uint64_t _imm)
162  : TmeImmOp64("tcancel", machInst, MemReadOp, _imm)
163 {
164  _numSrcRegs = 0;
165  _numDestRegs = 0;
166  flags[IsLoad] = true;
167  flags[IsMicroop] = true;
168  flags[IsNonSpeculative] = true;
169  flags[IsHtmCancel] = true;
170 }
171 
172 Fault
174  ExecContext *xc, trace::InstRecord *traceData) const
175 {
176  panic("TME is not supported with atomic memory");
177 
178  return NoFault;
179 }
180 
181 MacroTmeOp::MacroTmeOp(const char *mnem,
182  ExtMachInst _machInst,
183  OpClass __opClass) :
184  PredMacroOp(mnem, machInst, __opClass) {
185  _numSrcRegs = 0;
186  _numDestRegs = 0;
187 
188  numMicroops = 0;
189  microOps = nullptr;
190 }
191 
193  : MicroTmeBasic64("utcommit", machInst, MemReadOp)
194 {
195  _numSrcRegs = 0;
196  _numDestRegs = 0;
197  flags[IsHtmStop] = true;
198  flags[IsLoad] = true;
199  flags[IsMicroop] = true;
200  flags[IsNonSpeculative] = true;
201 }
202 
203 Fault
205 {
206  panic("TME is not supported with atomic memory");
207 
208  return NoFault;
209 }
210 
212  MacroTmeOp("tcommit", machInst, MemReadOp)
213 {
214  numMicroops = 2;
216 
217  microOps[0] = new ArmISAInst::MicroTfence64(_machInst);
220 
221  microOps[1] = new ArmISAInst::MicroTcommit64(_machInst);
223  microOps[1]->setLastMicroop();
224 }
225 
226 } // namespace ArmISAInst
227 } // namespace gem5
MacroTmeOp(const char *mnem, ArmISA::ExtMachInst _machInst, OpClass __opClass)
Definition: tme64.cc:181
Fault execute(ExecContext *, trace::InstRecord *) const
Definition: tme64.cc:204
MicroTcommit64(ArmISA::ExtMachInst)
Definition: tme64.cc:192
Fault execute(ExecContext *, trace::InstRecord *) const
Definition: tme64.cc:91
MicroTfence64(ArmISA::ExtMachInst)
Definition: tme64.cc:80
Fault completeAcc(PacketPtr, ExecContext *, trace::InstRecord *) const
Definition: tme64.cc:107
Fault initiateAcc(ExecContext *, trace::InstRecord *) const
Definition: tme64.cc:98
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const
Internal function to generate disassembly string.
Definition: tme64.cc:72
Fault execute(ExecContext *, trace::InstRecord *) const
Definition: tme64.cc:173
Tcancel64(ArmISA::ExtMachInst, uint64_t)
Definition: tme64.cc:161
Tcommit64(ArmISA::ExtMachInst _machInst)
Definition: tme64.cc:211
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const
Internal function to generate disassembly string.
Definition: tme64.cc:52
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const
Internal function to generate disassembly string.
Definition: tme64.cc:62
Fault execute(ExecContext *, trace::InstRecord *) const
Definition: tme64.cc:136
Tstart64(ArmISA::ExtMachInst, RegIndex)
Definition: tme64.cc:115
Ttest64(ArmISA::ExtMachInst, RegIndex)
Definition: tme64.cc:144
Base class for predicated macro-operations.
Definition: pred_inst.hh:343
StaticInstPtr * microOps
Definition: pred_inst.hh:347
The ExecContext is an abstract base class the provides the interface used by the ISA to manipulate th...
Definition: exec_context.hh:72
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:294
void setDestRegIdx(int i, const RegId &val)
Definition: static_inst.hh:218
void setRegIdxArrays(RegIdArrayPtr src, RegIdArrayPtr dest)
Set the pointers which point to the arrays of source and destination register indices.
Definition: static_inst.hh:247
std::array< uint8_t, MiscRegClass+1 > _numTypedDestRegs
Definition: static_inst.hh:114
RegId(StaticInst::*)[] RegIdArrayPtr
Definition: static_inst.hh:91
uint8_t _numSrcRegs
See numSrcRegs().
Definition: static_inst.hh:109
uint8_t _numDestRegs
See numDestRegs().
Definition: static_inst.hh:112
std::bitset< Num_Flags > flags
Flag values for this instruction.
Definition: static_inst.hh:103
void setDelayedCommit()
Definition: static_inst.hh:206
void setFirstMicroop()
Definition: static_inst.hh:204
#define panic(...)
This implements a cprintf based panic() function.
Definition: logging.hh:178
Bitfield< 7, 0 > imm
Definition: types.hh:132
constexpr RegClass intRegClass
Definition: int.hh:173
Bitfield< 21 > ss
Definition: misc_types.hh:60
Bitfield< 4 > pc
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
std::shared_ptr< FaultBase > Fault
Definition: types.hh:248
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
constexpr decltype(nullptr) NoFault
Definition: types.hh:253
@ IntRegClass
Integer register.
Definition: reg_class.hh:60
void ccprintf(cp::Print &print)
Definition: cprintf.hh:130
static const OpClass MemReadOp
Definition: op_class.hh:102

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