gem5  [DEVELOP-FOR-23.0]
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
integer.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2006-2007 The Regents of The University of Michigan
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met: redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer;
9  * redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution;
12  * neither the name of the copyright holders nor the names of its
13  * contributors may be used to endorse or promote products derived from
14  * this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #ifndef __ARCH_SPARC_INSTS_INTEGER_HH__
30 #define __ARCH_SPARC_INSTS_INTEGER_HH__
31 
33 
34 namespace gem5
35 {
36 
37 namespace SparcISA
38 {
39 
41 //
42 // Integer operate instructions
43 //
44 
48 class IntOp : public SparcStaticInst
49 {
50  protected:
52 
53  std::string generateDisassembly(
54  Addr pc, const loader::SymbolTable *symtab) const override;
55 
56  virtual bool printPseudoOps(std::ostream &os, Addr pc,
57  const loader::SymbolTable *symtab) const;
58 };
59 
63 class IntOpImm : public IntOp
64 {
65  protected:
66  // Constructor
67  IntOpImm(const char *mnem, ExtMachInst _machInst,
68  OpClass __opClass, int64_t _imm) :
69  IntOp(mnem, _machInst, __opClass), imm(_imm)
70  {}
71 
72  int64_t imm;
73 
74  std::string generateDisassembly(
75  Addr pc, const loader::SymbolTable *symtab) const override;
76 
77  bool printPseudoOps(std::ostream &os, Addr pc,
78  const loader::SymbolTable *symtab) const override;
79 };
80 
84 class IntOpImm10 : public IntOpImm
85 {
86  protected:
87  // Constructor
88  IntOpImm10(const char *mnem, ExtMachInst _machInst, OpClass __opClass) :
89  IntOpImm(mnem, _machInst, __opClass, szext<10>(_machInst))
90  {}
91 };
92 
96 class IntOpImm11 : public IntOpImm
97 {
98  protected:
99  IntOpImm11(const char *mnem, ExtMachInst _machInst, OpClass __opClass) :
100  IntOpImm(mnem, _machInst, __opClass, szext<11>(_machInst))
101  {}
102 };
103 
107 class IntOpImm13 : public IntOpImm
108 {
109  protected:
110  IntOpImm13(const char *mnem, ExtMachInst _machInst, OpClass __opClass) :
111  IntOpImm(mnem, _machInst, __opClass, szext<13>(_machInst))
112  {}
113 };
114 
118 class SetHi : public IntOpImm
119 {
120  protected:
121  // Constructor
122  SetHi(const char *mnem, ExtMachInst _machInst, OpClass __opClass) :
123  IntOpImm(mnem, _machInst, __opClass, bits(_machInst, 21, 0) << 10)
124  {}
125 
126  std::string generateDisassembly(
127  Addr pc, const loader::SymbolTable *symtab) const override;
128 };
129 
130 } // namespace SparcISA
131 } // namespace gem5
132 
133 #endif // __ARCH_SPARCH_INSTS_INTEGER_HH__
gem5::SparcISA::IntOpImm11::IntOpImm11
IntOpImm11(const char *mnem, ExtMachInst _machInst, OpClass __opClass)
Definition: integer.hh:99
gem5::SparcISA::SparcStaticInst
Base class for all SPARC static instructions.
Definition: static_inst.hh:93
gem5::SparcISA::SetHi::generateDisassembly
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: integer.cc:115
gem5::SparcISA::IntOpImm::printPseudoOps
bool printPseudoOps(std::ostream &os, Addr pc, const loader::SymbolTable *symtab) const override
Definition: integer.cc:57
gem5::SparcISA::ExtMachInst
uint64_t ExtMachInst
Definition: types.hh:42
gem5::SparcISA::IntOp::generateDisassembly
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: integer.cc:82
gem5::SparcISA::IntOpImm10::IntOpImm10
IntOpImm10(const char *mnem, ExtMachInst _machInst, OpClass __opClass)
Definition: integer.hh:88
gem5::SparcISA::IntOpImm::imm
int64_t imm
Definition: integer.hh:72
gem5::SparcISA::IntOpImm::IntOpImm
IntOpImm(const char *mnem, ExtMachInst _machInst, OpClass __opClass, int64_t _imm)
Definition: integer.hh:67
gem5::SparcISA::IntOpImm13
Base class for 13 bit immediate integer operations.
Definition: integer.hh:107
gem5::SparcISA::IntOpImm::generateDisassembly
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: integer.cc:97
gem5::loader::SymbolTable
Definition: symtab.hh:64
gem5::SparcISA::IntOp
Base class for integer operations.
Definition: integer.hh:48
gem5::SparcISA::IntOpImm10
Base class for 10 bit immediate integer operations.
Definition: integer.hh:84
gem5::SparcISA::IntOpImm
Base class for immediate integer operations.
Definition: integer.hh:63
gem5::SparcISA::IntOpImm11
Base class for 11 bit immediate integer operations.
Definition: integer.hh:96
gem5::SparcISA::SetHi::SetHi
SetHi(const char *mnem, ExtMachInst _machInst, OpClass __opClass)
Definition: integer.hh:122
gem5::bits
constexpr T bits(T val, unsigned first, unsigned last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it.
Definition: bitfield.hh:76
gem5::Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
gem5::szext
constexpr uint64_t szext(uint64_t val)
Sign-extend an N-bit value to 64 bits.
Definition: bitfield.hh:158
gem5::SparcISA::SparcStaticInst::SparcStaticInst
SparcStaticInst(const char *_mnemonic, ExtMachInst _machInst, OpClass __opClass)
Definition: static_inst.hh:98
gem5::SparcISA::IntOp::printPseudoOps
virtual bool printPseudoOps(std::ostream &os, Addr pc, const loader::SymbolTable *symtab) const
Definition: integer.cc:43
gem5::X86ISA::os
Bitfield< 17 > os
Definition: misc.hh:810
static_inst.hh
gem5::MipsISA::pc
Bitfield< 4 > pc
Definition: pra_constants.hh:243
gem5::SparcISA::IntOpImm13::IntOpImm13
IntOpImm13(const char *mnem, ExtMachInst _machInst, OpClass __opClass)
Definition: integer.hh:110
gem5::SparcISA::SetHi
Base class for sethi.
Definition: integer.hh:118
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: gpu_translation_state.hh:37

Generated on Sun Jul 30 2023 01:56:50 for gem5 by doxygen 1.8.17