2 * Copyright (c) 2020 ARM Limited
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.
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.
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.
38 #include "arch/arm/insts/tme64.hh"
39 #include "debug/ArmTme.hh"
43 using namespace ArmISA
;
45 namespace ArmISAInst
{
48 TmeImmOp64::generateDisassembly(
49 Addr pc
, const Loader::SymbolTable
*symtab
) const
52 printMnemonic(ss
, "", false);
53 ccprintf(ss
, "#0x%x", imm
);
58 TmeRegNone64::generateDisassembly(
59 Addr pc
, const Loader::SymbolTable
*symtab
) const
63 printIntReg(ss
, dest
);
68 MicroTmeBasic64::generateDisassembly(
69 Addr pc
, const Loader::SymbolTable
*symtab
) const
76 MicroTfence64::MicroTfence64(ExtMachInst machInst
)
77 : MicroTmeBasic64("utfence", machInst
, MemReadOp
)
83 _numVecElemDestRegs
= 0;
86 flags
[IsMicroop
] = true;
87 flags
[IsReadBarrier
] = true;
88 flags
[IsWriteBarrier
] = true;
92 MicroTfence64::execute(
93 ExecContext
*xc
, Trace::InstRecord
*traceData
) const
99 MicroTfence64::initiateAcc(ExecContext
*xc
,
100 Trace::InstRecord
*traceData
) const
102 panic("tfence should not have memory semantics");
108 MicroTfence64::completeAcc(PacketPtr pkt
, ExecContext
*xc
,
109 Trace::InstRecord
*traceData
) const
111 panic("tfence should not have memory semantics");
116 Tstart64::Tstart64(ExtMachInst machInst
, IntRegIndex _dest
)
117 : TmeRegNone64("tstart", machInst
, MemReadOp
, _dest
)
123 _numVecElemDestRegs
= 0;
126 setDestRegIdx(_numDestRegs
++, RegId(IntRegClass
, dest
));
128 flags
[IsHtmStart
] = true;
129 flags
[IsInteger
] = true;
130 flags
[IsLoad
] = true;
131 flags
[IsMicroop
] = true;
132 flags
[IsNonSpeculative
] = true;
137 ExecContext
*xc
, Trace::InstRecord
*traceData
) const
139 panic("TME is not supported with atomic memory");
144 Ttest64::Ttest64(ExtMachInst machInst
, IntRegIndex _dest
)
145 : TmeRegNone64("ttest", machInst
, MemReadOp
, _dest
)
151 _numVecElemDestRegs
= 0;
154 setDestRegIdx(_numDestRegs
++, RegId(IntRegClass
, dest
));
156 flags
[IsInteger
] = true;
157 flags
[IsMicroop
] = true;
160 Tcancel64::Tcancel64(ExtMachInst machInst
, uint64_t _imm
)
161 : TmeImmOp64("tcancel", machInst
, MemReadOp
, _imm
)
167 _numVecElemDestRegs
= 0;
170 flags
[IsLoad
] = true;
171 flags
[IsMicroop
] = true;
172 flags
[IsNonSpeculative
] = true;
173 flags
[IsHtmCancel
] = true;
178 ExecContext
*xc
, Trace::InstRecord
*traceData
) const
180 panic("TME is not supported with atomic memory");
185 MacroTmeOp::MacroTmeOp(const char *mnem
,
186 ExtMachInst _machInst
,
188 PredMacroOp(mnem
, machInst
, __opClass
) {
193 _numVecElemDestRegs
= 0;
201 MicroTcommit64::MicroTcommit64(ExtMachInst machInst
)
202 : MicroTmeBasic64("utcommit", machInst
, MemReadOp
)
208 _numVecElemDestRegs
= 0;
211 flags
[IsHtmStop
] = true;
212 flags
[IsLoad
] = true;
213 flags
[IsMicroop
] = true;
214 flags
[IsNonSpeculative
] = true;
218 MicroTcommit64::execute(ExecContext
*xc
, Trace::InstRecord
*traceData
) const
220 panic("TME is not supported with atomic memory");
225 Tcommit64::Tcommit64(ExtMachInst _machInst
) :
226 MacroTmeOp("tcommit", machInst
, MemReadOp
)
229 microOps
= new StaticInstPtr
[numMicroops
];
231 microOps
[0] = new ArmISAInst::MicroTfence64(_machInst
);
232 microOps
[0]->setDelayedCommit();
233 microOps
[0]->setFirstMicroop();
235 microOps
[1] = new ArmISAInst::MicroTcommit64(_machInst
);
236 microOps
[1]->setDelayedCommit();
237 microOps
[1]->setLastMicroop();