gem5 v24.0.0.0
Loading...
Searching...
No Matches
amo.hh
Go to the documentation of this file.
1/*
2 * Copyright (c) 2015 RISC-V Foundation
3 * Copyright (c) 2017 The University of Virginia
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_RISCV_INSTS_AMO_HH__
31#define __ARCH_RISCV_INSTS_AMO_HH__
32
33#include <string>
34
37#include "cpu/static_inst.hh"
38
39namespace gem5
40{
41
42namespace RiscvISA
43{
44
45// memfence micro instruction
47{
48 public:
49 MemFenceMicro(ExtMachInst _machInst, OpClass __opClass)
50 : RiscvMicroInst("fence", _machInst, __opClass)
51 { }
52 protected:
54
55 Fault execute(ExecContext *, trace::InstRecord *) const override;
56 std::string generateDisassembly(
57 Addr pc, const loader::SymbolTable *symtab) const override;
58};
59
60// load-reserved
62{
63 protected:
65
66 std::string generateDisassembly(
67 Addr pc, const loader::SymbolTable *symtab) const override;
68};
69
71{
72 protected:
75
76 std::string generateDisassembly(
77 Addr pc, const loader::SymbolTable *symtab) const override;
78};
79
80// store-cond
82{
83 protected:
85
86 std::string generateDisassembly(
87 Addr pc, const loader::SymbolTable *symtab) const override;
88};
89
91{
92 protected:
95
96 std::string generateDisassembly(
97 Addr pc, const loader::SymbolTable *symtab) const override;
98};
99
100// AMOs
102{
103 protected:
105
106 std::string generateDisassembly(
107 Addr pc, const loader::SymbolTable *symtab) const override;
108};
109
111{
112 protected:
115
116 std::string generateDisassembly(
117 Addr pc, const loader::SymbolTable *symtab) const override;
118};
119
124template<typename T>
126{
127 public:
128 AtomicGenericOp(T _a, std::function<void(T*,T)> _op)
129 : a(_a), op(_op) { }
130 AtomicOpFunctor* clone() { return new AtomicGenericOp<T>(*this); }
131 void execute(T *b) { op(b, a); }
132 private:
133 T a;
134 std::function<void(T*,T)> op;
135};
136
137} // namespace RiscvISA
138} // namespace gem5
139
140#endif // __ARCH_RISCV_INSTS_AMO_HH__
The ExecContext is an abstract base class the provides the interface used by the ISA to manipulate th...
A generic atomic op class.
Definition amo.hh:126
AtomicGenericOp(T _a, std::function< void(T *, T)> _op)
Definition amo.hh:128
std::function< void(T *, T)> op
Definition amo.hh:134
AtomicOpFunctor * clone()
Definition amo.hh:130
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition amo.cc:139
Request::Flags memAccessFlags
Definition amo.hh:113
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition amo.cc:121
Request::Flags memAccessFlags
Definition amo.hh:73
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition amo.cc:80
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition amo.cc:63
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition amo.cc:47
MemFenceMicro(ExtMachInst _machInst, OpClass __opClass)
Definition amo.hh:49
Fault execute(ExecContext *, trace::InstRecord *) const override
Definition amo.cc:55
Base class for all RISC-V Macroops.
RiscvMacroInst(const char *mnem, ExtMachInst _machInst, OpClass __opClass)
Base class for all RISC-V Microops.
RiscvMicroInst(const char *mnem, ExtMachInst _machInst, OpClass __opClass)
Request::Flags memAccessFlags
Definition amo.hh:93
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition amo.cc:109
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition amo.cc:91
Bitfield< 7 > b
Bitfield< 4 > pc
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
std::shared_ptr< FaultBase > Fault
Definition types.hh:249
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition types.hh:147

Generated on Tue Jun 18 2024 16:24:00 for gem5 by doxygen 1.11.0