gem5  v20.1.0.0
microop.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2007 The Hewlett-Packard Development Company
3  * All rights reserved.
4  *
5  * The license below extends only to copyright in the software and shall
6  * not be construed as granting a license to any other intellectual
7  * property including but not limited to intellectual property relating
8  * to a hardware implementation of the functionality of the software
9  * licensed hereunder. You may use the software subject to the license
10  * terms below provided that you ensure that this notice is replicated
11  * unmodified and in its entirety in all distributions of the software,
12  * modified or unmodified, in source code or in binary form.
13  *
14  * Redistribution and use in source and binary forms, with or without
15  * modification, are permitted provided that the following conditions are
16  * met: redistributions of source code must retain the above copyright
17  * notice, this list of conditions and the following disclaimer;
18  * redistributions in binary form must reproduce the above copyright
19  * notice, this list of conditions and the following disclaimer in the
20  * documentation and/or other materials provided with the distribution;
21  * neither the name of the copyright holders nor the names of its
22  * contributors may be used to endorse or promote products derived from
23  * this software without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  */
37 
38 #ifndef __ARCH_X86_INSTS_MICROOP_HH__
39 #define __ARCH_X86_INSTS_MICROOP_HH__
40 
42 
43 namespace X86ISA
44 {
45  namespace ConditionTests
46  {
47  enum CondTest {
50  ECF,
51  EZF,
57  OF,
58  CF,
59  ZF,
61  SF,
62  PF,
65 
83  };
84  }
85 
86  //A class which is the base of all x86 micro ops. It provides a function to
87  //set necessary flags appropriately.
89  {
90  protected:
91  const char * instMnem;
92  uint8_t opSize;
93  uint8_t addrSize;
94 
96  const char *mnem, const char *_instMnem,
97  uint64_t setFlags, OpClass __opClass) :
98  X86ISA::X86StaticInst(mnem, _machInst, __opClass),
99  instMnem(_instMnem)
100  {
101  const int ChunkSize = sizeof(unsigned long);
102  const int Chunks = sizeof(setFlags) / ChunkSize;
103 
104  // Since the bitset constructor can only handle unsigned long
105  // sized chunks, feed it those one at a time while oring them in.
106  for (int i = 0; i < Chunks; i++) {
107  unsigned shift = i * ChunkSize * 8;
108  flags |= (std::bitset<Num_Flags>(setFlags >> shift) << shift);
109  }
110  }
111 
112  std::string
114  const Loader::SymbolTable *symtab) const override
115  {
116  std::stringstream ss;
117 
118  ccprintf(ss, "\t%s.%s", instMnem, mnemonic);
119 
120  return ss.str();
121  }
122 
123  bool checkCondition(uint64_t flags, int condition) const;
124 
125  void
126  advancePC(PCState &pcState) const override
127  {
128  if (flags[IsLastMicroop])
129  pcState.uEnd();
130  else
131  pcState.uAdvance();
132  }
133  };
134 }
135 
136 #endif //__ARCH_X86_INSTS_MICROOP_HH__
X86ISA::ConditionTests::NotSTRZ
@ NotSTRZ
Definition: microop.hh:72
StaticInst::flags
std::bitset< Num_Flags > flags
Flag values for this instruction.
Definition: static_inst.hh:99
X86ISA::ConditionTests::NotCF
@ NotCF
Definition: microop.hh:76
X86ISA::ConditionTests::NotOF
@ NotOF
Definition: microop.hh:75
X86ISA::ConditionTests::NotSF
@ NotSF
Definition: microop.hh:79
X86ISA::ConditionTests::NotEZF
@ NotEZF
Definition: microop.hh:69
X86ISA::ConditionTests::ZF
@ ZF
Definition: microop.hh:59
static_inst.hh
ArmISA::i
Bitfield< 7 > i
Definition: miscregs_types.hh:63
X86ISA::X86MicroopBase::instMnem
const char * instMnem
Definition: microop.hh:91
X86ISA::X86MicroopBase
Definition: microop.hh:88
X86ISA::ConditionTests::NotTrue
@ NotTrue
Definition: microop.hh:67
X86ISA::ConditionTests::MSTRC
@ MSTRC
Definition: microop.hh:55
X86ISA::ConditionTests::SxOF
@ SxOF
Definition: microop.hh:63
X86ISA::ConditionTests::NotFalse
@ NotFalse
Definition: microop.hh:49
Loader::SymbolTable
Definition: symtab.hh:59
X86ISA::ConditionTests::True
@ True
Definition: microop.hh:48
X86ISA::X86MicroopBase::advancePC
void advancePC(PCState &pcState) const override
Definition: microop.hh:126
X86ISA::ConditionTests::SxOvZF
@ SxOvZF
Definition: microop.hh:64
X86ISA::PCState::uEnd
void uEnd()
Definition: types.hh:330
X86ISA::ConditionTests::NotMSTRC
@ NotMSTRC
Definition: microop.hh:73
X86ISA::ConditionTests::NotSZnZF
@ NotSZnZF
Definition: microop.hh:70
GenericISA::UPCState::uAdvance
void uAdvance()
Definition: types.hh:247
X86ISA::X86MicroopBase::opSize
uint8_t opSize
Definition: microop.hh:92
X86ISA::X86MicroopBase::generateDisassembly
std::string generateDisassembly(Addr pc, const Loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: microop.hh:113
X86ISA::ConditionTests::PF
@ PF
Definition: microop.hh:62
ArmISA::ss
Bitfield< 21 > ss
Definition: miscregs_types.hh:56
ArmISA::shift
Bitfield< 6, 5 > shift
Definition: types.hh:126
X86ISA::ConditionTests::NotMSTRZ
@ NotMSTRZ
Definition: microop.hh:71
X86ISA::ConditionTests::NotCvZF
@ NotCvZF
Definition: microop.hh:78
X86ISA::ConditionTests::False
@ False
Definition: microop.hh:66
X86ISA::ConditionTests::CvZF
@ CvZF
Definition: microop.hh:60
X86ISA::ConditionTests::MSTRZ
@ MSTRZ
Definition: microop.hh:53
X86ISA::X86MicroopBase::addrSize
uint8_t addrSize
Definition: microop.hh:93
X86ISA::PCState
Definition: types.hh:287
StaticInst::mnemonic
const char * mnemonic
Base mnemonic (e.g., "add").
Definition: static_inst.hh:258
StaticInst::ExtMachInst
TheISA::ExtMachInst ExtMachInst
Binary extended machine instruction type.
Definition: static_inst.hh:89
X86ISA::ConditionTests::EZF
@ EZF
Definition: microop.hh:51
X86ISA
This is exposed globally, independent of the ISA.
Definition: acpi.hh:55
Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
X86ISA::ConditionTests::ECF
@ ECF
Definition: microop.hh:50
X86ISA::ConditionTests::NotZF
@ NotZF
Definition: microop.hh:77
X86ISA::X86StaticInst
Base class for all X86 static instructions.
Definition: static_inst.hh:79
X86ISA::X86MicroopBase::X86MicroopBase
X86MicroopBase(ExtMachInst _machInst, const char *mnem, const char *_instMnem, uint64_t setFlags, OpClass __opClass)
Definition: microop.hh:95
X86ISA::ConditionTests::STRZnEZF
@ STRZnEZF
Definition: microop.hh:56
X86ISA::ConditionTests::NotSxOvZF
@ NotSxOvZF
Definition: microop.hh:82
X86ISA::ConditionTests::NotSxOF
@ NotSxOF
Definition: microop.hh:81
X86ISA::X86MicroopBase::checkCondition
bool checkCondition(uint64_t flags, int condition) const
Definition: microop.cc:45
X86ISA::ConditionTests::STRnZnEZF
@ STRnZnEZF
Definition: microop.hh:74
X86ISA::ConditionTests::NotECF
@ NotECF
Definition: microop.hh:68
ccprintf
void ccprintf(cp::Print &print)
Definition: cprintf.hh:127
X86ISA::ConditionTests::SF
@ SF
Definition: microop.hh:61
X86ISA::ConditionTests::CondTest
CondTest
Definition: microop.hh:47
X86ISA::ConditionTests::NotPF
@ NotPF
Definition: microop.hh:80
X86ISA::ConditionTests::STRZ
@ STRZ
Definition: microop.hh:54
X86ISA::ConditionTests::OF
@ OF
Definition: microop.hh:57
X86ISA::pc
Bitfield< 19 > pc
Definition: misc.hh:805
X86ISA::ConditionTests::SZnZF
@ SZnZF
Definition: microop.hh:52
X86ISA::ConditionTests::CF
@ CF
Definition: microop.hh:58

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