gem5
v24.0.0.0
Loading...
Searching...
No Matches
arch
riscv
insts
standard.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
* Copyright (c) 2020 Barkhausen Institut
5
* All rights reserved.
6
*
7
* Redistribution and use in source and binary forms, with or without
8
* modification, are permitted provided that the following conditions are
9
* met: redistributions of source code must retain the above copyright
10
* notice, this list of conditions and the following disclaimer;
11
* redistributions in binary form must reproduce the above copyright
12
* notice, this list of conditions and the following disclaimer in the
13
* documentation and/or other materials provided with the distribution;
14
* neither the name of the copyright holders nor the names of its
15
* contributors may be used to endorse or promote products derived from
16
* this software without specific prior written permission.
17
*
18
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
*/
30
31
#ifndef __ARCH_RISCV_STANDARD_INST_HH__
32
#define __ARCH_RISCV_STANDARD_INST_HH__
33
34
#include <string>
35
36
#include "
arch/riscv/insts/static_inst.hh
"
37
#include "
arch/riscv/regs/misc.hh
"
38
#include "
cpu/exec_context.hh
"
39
#include "
cpu/static_inst.hh
"
40
41
namespace
gem5
42
{
43
44
namespace
RiscvISA
45
{
46
50
class
RegOp
:
public
RiscvStaticInst
51
{
52
protected
:
53
using
RiscvStaticInst::RiscvStaticInst
;
54
55
std::string
generateDisassembly
(
56
Addr
pc
,
const
loader::SymbolTable
*symtab)
const override
;
57
};
58
62
template
<
typename
I>
63
class
ImmOp
:
public
RiscvStaticInst
64
{
65
protected
:
66
I
imm
;
67
68
ImmOp
(
const
char
*mnem,
ExtMachInst
_machInst, OpClass __opClass)
69
:
RiscvStaticInst
(mnem, _machInst, __opClass),
imm
(0)
70
{}
71
};
72
76
class
SystemOp
:
public
RiscvStaticInst
77
{
78
protected
:
79
using
RiscvStaticInst::RiscvStaticInst
;
80
81
std::string
generateDisassembly
(
82
Addr
pc
,
const
loader::SymbolTable
*symtab)
const override
;
83
84
protected
:
85
Fault
executeEBreakOrSemihosting
(
ExecContext
*xc)
const
;
86
};
87
91
class
CSROp
:
public
RiscvStaticInst
92
{
93
protected
:
94
uint64_t
csr
;
95
uint64_t
uimm
;
96
98
CSROp
(
const
char
*mnem,
ExtMachInst
_machInst, OpClass __opClass)
99
:
RiscvStaticInst
(mnem, _machInst, __opClass),
100
csr
(_machInst.
funct12
),
uimm
(_machInst.
csrimm
)
101
{
102
if
(
csr
==
CSR_SATP
) {
103
flags
[IsSquashAfter] =
true
;
104
}
105
}
106
107
std::string
generateDisassembly
(
108
Addr
pc
,
const
loader::SymbolTable
*symtab)
const override
;
109
};
110
111
}
// namespace RiscvISA
112
}
// namespace gem5
113
114
#endif
// __ARCH_RISCV_STANDARD_INST_HH__
static_inst.hh
misc.hh
gem5::ExecContext
The ExecContext is an abstract base class the provides the interface used by the ISA to manipulate th...
Definition
exec_context.hh:72
gem5::RiscvISA::CSROp
Base class for CSR operations.
Definition
standard.hh:92
gem5::RiscvISA::CSROp::generateDisassembly
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition
standard.cc:63
gem5::RiscvISA::CSROp::csr
uint64_t csr
Definition
standard.hh:94
gem5::RiscvISA::CSROp::uimm
uint64_t uimm
Definition
standard.hh:95
gem5::RiscvISA::CSROp::CSROp
CSROp(const char *mnem, ExtMachInst _machInst, OpClass __opClass)
Constructor.
Definition
standard.hh:98
gem5::RiscvISA::ImmOp
Base class for operations with immediates (I is the type of immediate)
Definition
standard.hh:64
gem5::RiscvISA::ImmOp::ImmOp
ImmOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass)
Definition
standard.hh:68
gem5::RiscvISA::ImmOp::imm
I imm
Definition
standard.hh:66
gem5::RiscvISA::RegOp
Base class for operations that work only on registers.
Definition
standard.hh:51
gem5::RiscvISA::RegOp::generateDisassembly
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition
standard.cc:50
gem5::RiscvISA::RiscvStaticInst
Base class for all RISC-V static instructions.
Definition
static_inst.hh:53
gem5::RiscvISA::RiscvStaticInst::RiscvStaticInst
RiscvStaticInst(const char *_mnemonic, ExtMachInst _machInst, OpClass __opClass)
Definition
static_inst.hh:55
gem5::RiscvISA::SystemOp
Base class for system operations.
Definition
standard.hh:77
gem5::RiscvISA::SystemOp::executeEBreakOrSemihosting
Fault executeEBreakOrSemihosting(ExecContext *xc) const
Definition
standard.cc:93
gem5::RiscvISA::SystemOp::generateDisassembly
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition
standard.cc:80
gem5::StaticInst::flags
std::bitset< Num_Flags > flags
Flag values for this instruction.
Definition
static_inst.hh:103
gem5::loader::SymbolTable
Definition
symtab.hh:152
static_inst.hh
exec_context.hh
gem5::RiscvISA::CSR_SATP
@ CSR_SATP
Definition
misc.hh:362
gem5::RiscvISA::csrimm
Bitfield< 19, 15 > csrimm
Definition
types.hh:107
gem5::RiscvISA::funct12
Bitfield< 31, 20 > funct12
Definition
types.hh:106
gem5::RiscvISA::pc
Bitfield< 4 > pc
Definition
pra_constants.hh:243
gem5
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition
binary32.hh:36
gem5::Fault
std::shared_ptr< FaultBase > Fault
Definition
types.hh:249
gem5::Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition
types.hh:147
gem5::X86ISA::ExtMachInst
Definition
types.hh:213
Generated on Tue Jun 18 2024 16:24:00 for gem5 by
doxygen
1.11.0