gem5  v22.1.0.0
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__
Base class for 10 bit immediate integer operations.
Definition: integer.hh:85
IntOpImm10(const char *mnem, ExtMachInst _machInst, OpClass __opClass)
Definition: integer.hh:88
Base class for 11 bit immediate integer operations.
Definition: integer.hh:97
IntOpImm11(const char *mnem, ExtMachInst _machInst, OpClass __opClass)
Definition: integer.hh:99
Base class for 13 bit immediate integer operations.
Definition: integer.hh:108
IntOpImm13(const char *mnem, ExtMachInst _machInst, OpClass __opClass)
Definition: integer.hh:110
Base class for immediate integer operations.
Definition: integer.hh:64
IntOpImm(const char *mnem, ExtMachInst _machInst, OpClass __opClass, int64_t _imm)
Definition: integer.hh:67
bool printPseudoOps(std::ostream &os, Addr pc, const loader::SymbolTable *symtab) const override
Definition: integer.cc:57
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: integer.cc:97
Base class for integer operations.
Definition: integer.hh:49
virtual bool printPseudoOps(std::ostream &os, Addr pc, const loader::SymbolTable *symtab) const
Definition: integer.cc:43
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: integer.cc:82
Base class for sethi.
Definition: integer.hh:119
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: integer.cc:115
SetHi(const char *mnem, ExtMachInst _machInst, OpClass __opClass)
Definition: integer.hh:122
Base class for all SPARC static instructions.
Definition: static_inst.hh:94
SparcStaticInst(const char *_mnemonic, ExtMachInst _machInst, OpClass __opClass)
Definition: static_inst.hh:98
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
constexpr uint64_t szext(uint64_t val)
Sign-extend an N-bit value to 64 bits.
Definition: bitfield.hh:142
Bitfield< 4 > pc
uint64_t ExtMachInst
Definition: types.hh:42
Bitfield< 17 > os
Definition: misc.hh:810
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 Wed Dec 21 2022 10:22:27 for gem5 by doxygen 1.9.1