gem5 v23.0.0.1
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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
88class CSROp : public RiscvStaticInst
89{
90 protected:
91 uint64_t csr;
92 uint64_t uimm;
93
95 CSROp(const char *mnem, ExtMachInst _machInst, OpClass __opClass)
96 : RiscvStaticInst(mnem, _machInst, __opClass),
97 csr(_machInst.funct12), uimm(_machInst.csrimm)
98 {
99 if (csr == CSR_SATP) {
100 flags[IsSquashAfter] = true;
101 }
102 }
103
104 std::string generateDisassembly(
105 Addr pc, const loader::SymbolTable *symtab) const override;
106};
107
108} // namespace RiscvISA
109} // namespace gem5
110
111#endif // __ARCH_RISCV_STANDARD_INST_HH__
Base class for CSR operations.
Definition standard.hh:89
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition standard.cc:61
CSROp(const char *mnem, ExtMachInst _machInst, OpClass __opClass)
Constructor.
Definition standard.hh:95
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:48
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
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition standard.cc:78
std::bitset< Num_Flags > flags
Flag values for this instruction.
Bitfield< 19, 15 > csrimm
Definition types.hh:108
Bitfield< 31, 20 > funct12
Definition types.hh:107
Bitfield< 4 > pc
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition types.hh:147

Generated on Mon Jul 10 2023 15:32:00 for gem5 by doxygen 1.9.7