gem5  v20.1.0.0
static_inst.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  * Copyright 2017 Google Inc.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are
8  * met: redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer;
10  * redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution;
13  * neither the name of the copyright holders nor the names of its
14  * contributors may be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #ifndef __ARCH_SPARC_INSTS_STATIC_INST_HH__
31 #define __ARCH_SPARC_INSTS_STATIC_INST_HH__
32 
33 #include <cstdint>
34 
35 #include "base/trace.hh"
36 #include "cpu/exec_context.hh"
37 #include "cpu/static_inst.hh"
38 
39 namespace SparcISA
40 {
41 
43 {
44  Always=0x8,
45  Never=0x0,
46  NotEqual=0x9,
47  Equal=0x1,
48  Greater=0xA,
51  Less=0x3,
55  CarrySet=0x5,
56  Positive=0xE,
57  Negative=0x6,
60 };
61 
62 extern const char *CondTestAbbrev[];
63 
65 {
66  FAlways=0x8,
67  FNever=0x0,
69  FGreater=0x6,
71  FLess=0x4,
74  FNotEqual=0x1,
75  FEqual=0x9,
82 };
83 
88 {
89  protected:
91 
92  std::string generateDisassembly(
93  Addr pc, const Loader::SymbolTable *symtab) const override;
94 
95  static void printMnemonic(std::ostream &os, const char *mnemonic);
96  static void printReg(std::ostream &os, RegId reg);
97 
98  void printSrcReg(std::ostream &os, int reg) const;
99  void printDestReg(std::ostream &os, int reg) const;
100 
101  void printRegArray(std::ostream &os,
102  const RegId indexArray[], int num) const;
103 
104  void advancePC(PCState &pcState) const override;
105 
106  static bool passesFpCondition(uint32_t fcc, uint32_t condition);
107  static bool passesCondition(uint32_t codes, uint32_t condition);
108 
109  size_t
110  asBytes(void *buf, size_t size) override
111  {
112  return simpleAsBytes(buf, size, machInst);
113  }
114 };
115 
116 }
117 
118 #endif //__ARCH_SPARC_INSTS_STATIC_INST_HH__
SparcISA::FUnorderedOrLessOrEqual
@ FUnorderedOrLessOrEqual
Definition: static_inst.hh:80
SparcISA::FLessOrGreater
@ FLessOrGreater
Definition: static_inst.hh:73
X86ISA::os
Bitfield< 17 > os
Definition: misc.hh:803
SparcISA::CondTestAbbrev
const char * CondTestAbbrev[]
Definition: static_inst.cc:35
SparcISA::Equal
@ Equal
Definition: static_inst.hh:47
SparcISA::SparcStaticInst::printDestReg
void printDestReg(std::ostream &os, int reg) const
Definition: static_inst.cc:88
StaticInst
Base, ISA-independent static instruction class.
Definition: static_inst.hh:85
SparcISA::FUnorderedOrEqual
@ FUnorderedOrEqual
Definition: static_inst.hh:76
SparcISA::CarryClear
@ CarryClear
Definition: static_inst.hh:54
SparcISA::Negative
@ Negative
Definition: static_inst.hh:57
Loader::SymbolTable
Definition: symtab.hh:59
GenericISA::DelaySlotUPCState
Definition: types.hh:391
SparcISA::FpCondTest
FpCondTest
Definition: static_inst.hh:64
SparcISA::LessOrEqualUnsigned
@ LessOrEqualUnsigned
Definition: static_inst.hh:53
SparcISA::SparcStaticInst::asBytes
size_t asBytes(void *buf, size_t size) override
Instruction classes can override this function to return a a representation of themselves as a blob o...
Definition: static_inst.hh:110
SparcISA::FLess
@ FLess
Definition: static_inst.hh:71
SparcISA::Never
@ Never
Definition: static_inst.hh:45
SparcISA::FGreater
@ FGreater
Definition: static_inst.hh:69
X86ISA::reg
Bitfield< 5, 3 > reg
Definition: types.hh:87
SparcISA::FNotEqual
@ FNotEqual
Definition: static_inst.hh:74
SparcISA::GreaterUnsigned
@ GreaterUnsigned
Definition: static_inst.hh:52
RegId
Register ID: describe an architectural register with its class and index.
Definition: reg_class.hh:75
SparcISA::SparcStaticInst::printReg
static void printReg(std::ostream &os, RegId reg)
Definition: static_inst.cc:95
SparcISA::FUnorderedOrLess
@ FUnorderedOrLess
Definition: static_inst.hh:72
SparcISA
Definition: asi.cc:31
SparcISA::SparcStaticInst::printSrcReg
void printSrcReg(std::ostream &os, int reg) const
Definition: static_inst.cc:81
SparcISA::SparcStaticInst::passesCondition
static bool passesCondition(uint32_t codes, uint32_t condition)
Definition: static_inst.cc:323
SparcISA::CondTest
CondTest
Definition: static_inst.hh:42
SparcISA::FOrdered
@ FOrdered
Definition: static_inst.hh:81
StaticInst::StaticInst
StaticInst(const char *_mnemonic, ExtMachInst _machInst, OpClass __opClass)
Constructor.
Definition: static_inst.hh:277
SparcISA::FEqual
@ FEqual
Definition: static_inst.hh:75
MipsISA::pc
Bitfield< 4 > pc
Definition: pra_constants.hh:240
SparcISA::FUnorderedOrGreaterOrEqual
@ FUnorderedOrGreaterOrEqual
Definition: static_inst.hh:78
SparcISA::Greater
@ Greater
Definition: static_inst.hh:48
SparcISA::OverflowClear
@ OverflowClear
Definition: static_inst.hh:58
SparcISA::GreaterOrEqual
@ GreaterOrEqual
Definition: static_inst.hh:50
SparcISA::SparcStaticInst::printRegArray
void printRegArray(std::ostream &os, const RegId indexArray[], int num) const
Definition: static_inst.cc:62
SparcISA::Less
@ Less
Definition: static_inst.hh:51
SparcISA::FNever
@ FNever
Definition: static_inst.hh:67
SparcISA::FAlways
@ FAlways
Definition: static_inst.hh:66
StaticInst::mnemonic
const char * mnemonic
Base mnemonic (e.g., "add").
Definition: static_inst.hh:258
static_inst.hh
SparcISA::SparcStaticInst::generateDisassembly
std::string generateDisassembly(Addr pc, const Loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: static_inst.cc:249
SparcISA::FUnordered
@ FUnordered
Definition: static_inst.hh:68
Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
SparcISA::SparcStaticInst::advancePC
void advancePC(PCState &pcState) const override
Definition: static_inst.cc:75
SparcISA::SparcStaticInst
Base class for all SPARC static instructions.
Definition: static_inst.hh:87
StaticInst::simpleAsBytes
size_t simpleAsBytes(void *buf, size_t max_size, const T &t)
Definition: static_inst.hh:355
SparcISA::SparcStaticInst::printMnemonic
static void printMnemonic(std::ostream &os, const char *mnemonic)
Definition: static_inst.cc:56
SparcISA::SparcStaticInst::passesFpCondition
static bool passesFpCondition(uint32_t fcc, uint32_t condition)
Definition: static_inst.cc:278
StaticInst::machInst
const ExtMachInst machInst
The binary machine instruction.
Definition: static_inst.hh:243
SparcISA::FUnorderedOrGreater
@ FUnorderedOrGreater
Definition: static_inst.hh:70
SparcISA::FLessOrEqual
@ FLessOrEqual
Definition: static_inst.hh:79
exec_context.hh
trace.hh
SparcISA::NotEqual
@ NotEqual
Definition: static_inst.hh:46
SparcISA::CarrySet
@ CarrySet
Definition: static_inst.hh:55
SparcISA::Always
@ Always
Definition: static_inst.hh:44
SparcISA::OverflowSet
@ OverflowSet
Definition: static_inst.hh:59
SparcISA::FGreaterOrEqual
@ FGreaterOrEqual
Definition: static_inst.hh:77
SparcISA::LessOrEqual
@ LessOrEqual
Definition: static_inst.hh:49
SparcISA::Positive
@ Positive
Definition: static_inst.hh:56

Generated on Wed Sep 30 2020 14:02:00 for gem5 by doxygen 1.8.17