gem5 v24.0.0.0
Loading...
Searching...
No Matches
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
38#include "cpu/exec_context.hh"
39#include "cpu/static_inst.hh"
40
41namespace gem5
42{
43
44namespace RiscvISA
45{
46
50class RegOp : public RiscvStaticInst
51{
52 protected:
54
55 std::string generateDisassembly(
56 Addr pc, const loader::SymbolTable *symtab) const override;
57};
58
62template<typename I>
63class 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
77{
78 protected:
80
81 std::string generateDisassembly(
82 Addr pc, const loader::SymbolTable *symtab) const override;
83
84 protected:
86};
87
91class 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__
The ExecContext is an abstract base class the provides the interface used by the ISA to manipulate th...
Base class for CSR operations.
Definition standard.hh:92
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition standard.cc:63
CSROp(const char *mnem, ExtMachInst _machInst, OpClass __opClass)
Constructor.
Definition standard.hh:98
Base class for operations with immediates (I is the type of immediate)
Definition standard.hh:64
ImmOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass)
Definition standard.hh:68
Base class for operations that work only on registers.
Definition standard.hh:51
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition standard.cc:50
Base class for all RISC-V static instructions.
RiscvStaticInst(const char *_mnemonic, ExtMachInst _machInst, OpClass __opClass)
Base class for system operations.
Definition standard.hh:77
Fault executeEBreakOrSemihosting(ExecContext *xc) const
Definition standard.cc:93
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition standard.cc:80
std::bitset< Num_Flags > flags
Flag values for this instruction.
Bitfield< 19, 15 > csrimm
Definition types.hh:107
Bitfield< 31, 20 > funct12
Definition types.hh:106
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