gem5  v20.1.0.0
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 
35 #include "arch/riscv/insts/mem.hh"
37 #include "cpu/static_inst.hh"
38 
39 namespace RiscvISA
40 {
41 
42 // memfence micro instruction
44 {
45  public:
46  MemFenceMicro(ExtMachInst _machInst, OpClass __opClass)
47  : RiscvMicroInst("fence", _machInst, __opClass)
48  { }
49  protected:
51 
52  Fault execute(ExecContext *, Trace::InstRecord *) const override;
53  std::string generateDisassembly(
54  Addr pc, const Loader::SymbolTable *symtab) const override;
55 };
56 
57 // load-reserved
59 {
60  protected:
62 
63  std::string generateDisassembly(
64  Addr pc, const Loader::SymbolTable *symtab) const override;
65 };
66 
68 {
69  protected:
72 
73  std::string generateDisassembly(
74  Addr pc, const Loader::SymbolTable *symtab) const override;
75 };
76 
77 // store-cond
78 class StoreCond : public RiscvMacroInst
79 {
80  protected:
82 
83  std::string generateDisassembly(
84  Addr pc, const Loader::SymbolTable *symtab) const override;
85 };
86 
88 {
89  protected:
92 
93  std::string generateDisassembly(
94  Addr pc, const Loader::SymbolTable *symtab) const override;
95 };
96 
97 // AMOs
99 {
100  protected:
102 
103  std::string generateDisassembly(
104  Addr pc, const Loader::SymbolTable *symtab) const override;
105 };
106 
108 {
109  protected:
112 
113  std::string generateDisassembly(
114  Addr pc, const Loader::SymbolTable *symtab) const override;
115 };
116 
121 template<typename T>
123 {
124  public:
125  AtomicGenericOp(T _a, std::function<void(T*,T)> _op)
126  : a(_a), op(_op) { }
127  AtomicOpFunctor* clone() { return new AtomicGenericOp<T>(*this); }
128  void execute(T *b) { op(b, a); }
129  private:
130  T a;
131  std::function<void(T*,T)> op;
132 };
133 
134 }
135 
136 #endif // __ARCH_RISCV_INSTS_AMO_HH__
RiscvISA::RiscvMacroInst::RiscvMacroInst
RiscvMacroInst(const char *mnem, ExtMachInst _machInst, OpClass __opClass)
Definition: static_inst.hh:69
mem.hh
RiscvISA::RiscvMacroInst
Base class for all RISC-V Macroops.
Definition: static_inst.hh:64
RiscvISA::AtomicMemOpMicro::generateDisassembly
std::string generateDisassembly(Addr pc, const Loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: amo.cc:139
RiscvISA::StoreCondMicro
Definition: amo.hh:87
RiscvISA::LoadReservedMicro::memAccessFlags
Request::Flags memAccessFlags
Definition: amo.hh:70
Flags< FlagsType >
RiscvISA::pc
Bitfield< 4 > pc
Definition: pra_constants.hh:240
RiscvISA::AtomicMemOp::generateDisassembly
std::string generateDisassembly(Addr pc, const Loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: amo.cc:121
RiscvISA::LoadReserved::generateDisassembly
std::string generateDisassembly(Addr pc, const Loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: amo.cc:63
RiscvISA::MemFenceMicro::MemFenceMicro
MemFenceMicro(ExtMachInst _machInst, OpClass __opClass)
Definition: amo.hh:46
Loader::SymbolTable
Definition: symtab.hh:59
Trace::InstRecord
Definition: insttracer.hh:55
RiscvISA::AtomicMemOp
Definition: amo.hh:98
RiscvISA::AtomicGenericOp::a
T a
Definition: amo.hh:130
RiscvISA::MemFenceMicro::execute
Fault execute(ExecContext *, Trace::InstRecord *) const override
Definition: amo.cc:55
RiscvISA::StoreCond
Definition: amo.hh:78
RiscvISA::StoreCondMicro::memAccessFlags
Request::Flags memAccessFlags
Definition: amo.hh:90
RiscvISA
Definition: fs_workload.cc:36
AtomicOpFunctor
Definition: amo.hh:40
RiscvISA::StoreCondMicro::generateDisassembly
std::string generateDisassembly(Addr pc, const Loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: amo.cc:109
Fault
std::shared_ptr< FaultBase > Fault
Definition: types.hh:240
ExecContext
The ExecContext is an abstract base class the provides the interface used by the ISA to manipulate th...
Definition: exec_context.hh:70
static_inst.hh
StaticInst::ExtMachInst
TheISA::ExtMachInst ExtMachInst
Binary extended machine instruction type.
Definition: static_inst.hh:89
static_inst.hh
RiscvISA::MemFenceMicro::generateDisassembly
std::string generateDisassembly(Addr pc, const Loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: amo.cc:47
Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
TypedAtomicOpFunctor
Definition: amo.hh:53
RiscvISA::AtomicMemOpMicro::memAccessFlags
Request::Flags memAccessFlags
Definition: amo.hh:110
RiscvISA::AtomicGenericOp::op
std::function< void(T *, T)> op
Definition: amo.hh:131
RiscvISA::LoadReserved
Definition: amo.hh:58
RiscvISA::RiscvMicroInst
Base class for all RISC-V Microops.
Definition: static_inst.hh:107
RiscvISA::LoadReservedMicro::generateDisassembly
std::string generateDisassembly(Addr pc, const Loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: amo.cc:80
RiscvISA::AtomicGenericOp::execute
void execute(T *b)
Definition: amo.hh:128
ArmISA::b
Bitfield< 7 > b
Definition: miscregs_types.hh:376
RiscvISA::StoreCond::generateDisassembly
std::string generateDisassembly(Addr pc, const Loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: amo.cc:91
RiscvISA::LoadReservedMicro
Definition: amo.hh:67
RiscvISA::MemFenceMicro
Definition: amo.hh:43
RiscvISA::AtomicGenericOp
A generic atomic op class.
Definition: amo.hh:122
RiscvISA::AtomicGenericOp::AtomicGenericOp
AtomicGenericOp(T _a, std::function< void(T *, T)> _op)
Definition: amo.hh:125
RiscvISA::AtomicGenericOp::clone
AtomicOpFunctor * clone()
Definition: amo.hh:127
RiscvISA::RiscvMicroInst::RiscvMicroInst
RiscvMicroInst(const char *mnem, ExtMachInst _machInst, OpClass __opClass)
Definition: static_inst.hh:110
RiscvISA::AtomicMemOpMicro
Definition: amo.hh:107

Generated on Wed Sep 30 2020 14:02:07 for gem5 by doxygen 1.8.17