gem5  v20.0.0.2
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 SparcISA
35 {
36 
38 //
39 // Integer operate instructions
40 //
41 
45 class IntOp : public SparcStaticInst
46 {
47  protected:
48  using SparcStaticInst::SparcStaticInst;
49 
50  std::string generateDisassembly(
51  Addr pc, const Loader::SymbolTable *symtab) const override;
52 
53  virtual bool printPseudoOps(std::ostream &os, Addr pc,
54  const Loader::SymbolTable *symtab) const;
55 };
56 
60 class IntOpImm : public IntOp
61 {
62  protected:
63  // Constructor
64  IntOpImm(const char *mnem, ExtMachInst _machInst,
65  OpClass __opClass, int64_t _imm) :
66  IntOp(mnem, _machInst, __opClass), imm(_imm)
67  {}
68 
69  int64_t imm;
70 
71  std::string generateDisassembly(
72  Addr pc, const Loader::SymbolTable *symtab) const override;
73 
74  bool printPseudoOps(std::ostream &os, Addr pc,
75  const Loader::SymbolTable *symtab) const override;
76 };
77 
81 class IntOpImm10 : public IntOpImm
82 {
83  protected:
84  // Constructor
85  IntOpImm10(const char *mnem, ExtMachInst _machInst, OpClass __opClass) :
86  IntOpImm(mnem, _machInst, __opClass, sext<10>(bits(_machInst, 9, 0)))
87  {}
88 };
89 
93 class IntOpImm11 : public IntOpImm
94 {
95  protected:
96  IntOpImm11(const char *mnem, ExtMachInst _machInst, OpClass __opClass) :
97  IntOpImm(mnem, _machInst, __opClass, sext<10>(bits(_machInst, 10, 0)))
98  {}
99 };
100 
104 class IntOpImm13 : public IntOpImm
105 {
106  protected:
107  IntOpImm13(const char *mnem, ExtMachInst _machInst, OpClass __opClass) :
108  IntOpImm(mnem, _machInst, __opClass, sext<13>(bits(_machInst, 12, 0)))
109  {}
110 };
111 
115 class SetHi : public IntOpImm
116 {
117  protected:
118  // Constructor
119  SetHi(const char *mnem, ExtMachInst _machInst, OpClass __opClass) :
120  IntOpImm(mnem, _machInst, __opClass, bits(_machInst, 21, 0) << 10)
121  {}
122 
123  std::string generateDisassembly(
124  Addr pc, const Loader::SymbolTable *symtab) const override;
125 };
126 
127 }
128 
129 #endif // __ARCH_SPARCH_INSTS_INTEGER_HH__
IntOpImm10(const char *mnem, ExtMachInst _machInst, OpClass __opClass)
Definition: integer.hh:85
Base class for immediate integer operations.
Definition: integer.hh:60
IntOpImm11(const char *mnem, ExtMachInst _machInst, OpClass __opClass)
Definition: integer.hh:96
std::string generateDisassembly(Addr pc, const Loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: integer.cc:79
Bitfield< 17 > os
Definition: misc.hh:803
IntOpImm13(const char *mnem, ExtMachInst _machInst, OpClass __opClass)
Definition: integer.hh:107
Bitfield< 4 > pc
Base class for 13 bit immediate integer operations.
Definition: integer.hh:104
Base class for 10 bit immediate integer operations.
Definition: integer.hh:81
Base class for all SPARC static instructions.
Definition: static_inst.hh:87
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:140
Bitfield< 7, 0 > imm
Definition: types.hh:140
Base class for integer operations.
Definition: integer.hh:45
Definition: asi.cc:31
virtual bool printPseudoOps(std::ostream &os, Addr pc, const Loader::SymbolTable *symtab) const
Definition: integer.cc:40
TheISA::ExtMachInst ExtMachInst
Binary extended machine instruction type.
Definition: static_inst.hh:89
IntOpImm(const char *mnem, ExtMachInst _machInst, OpClass __opClass, int64_t _imm)
Definition: integer.hh:64
SetHi(const char *mnem, ExtMachInst _machInst, OpClass __opClass)
Definition: integer.hh:119
T bits(T val, int first, int last)
Extract the bitfield from position &#39;first&#39; to &#39;last&#39; (inclusive) from &#39;val&#39; and right justify it...
Definition: bitfield.hh:71
Base class for 11 bit immediate integer operations.
Definition: integer.hh:93
uint64_t sext(uint64_t val)
Sign-extend an N-bit value to 64 bits.
Definition: bitfield.hh:112
Base class for sethi.
Definition: integer.hh:115

Generated on Mon Jun 8 2020 15:45:06 for gem5 by doxygen 1.8.13