gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
micromediaop.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2009 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  * Authors: Gabe Black
29  */
30 
31 #ifndef __ARCH_X86_INSTS_MICROMEDIAOP_HH__
32 #define __ARCH_X86_INSTS_MICROMEDIAOP_HH__
33 
35 
36 namespace X86ISA
37 {
38  enum MediaFlag {
42  };
43 
44  class MediaOpBase : public X86MicroopBase
45  {
46  protected:
47  const RegIndex src1;
48  const RegIndex dest;
49  const uint8_t srcSize;
50  const uint8_t destSize;
51  const uint8_t ext;
52  static const RegIndex foldOBit = 0;
53 
54  // Constructor
56  const char *mnem, const char *_instMnem, uint64_t setFlags,
57  InstRegIndex _src1, InstRegIndex _dest,
58  uint8_t _srcSize, uint8_t _destSize, uint8_t _ext,
59  OpClass __opClass) :
60  X86MicroopBase(_machInst, mnem, _instMnem, setFlags,
61  __opClass),
62  src1(_src1.idx), dest(_dest.idx),
63  srcSize(_srcSize), destSize(_destSize), ext(_ext)
64  {}
65 
66  bool
67  scalarOp() const
68  {
69  return ext & MediaScalarOp;
70  }
71 
72  int
73  numItems(int size) const
74  {
75  return scalarOp() ? 1 : (sizeof(FloatRegBits) / size);
76  }
77 
78  bool
79  multHi() const
80  {
81  return ext & MediaMultHiOp;
82  }
83 
84  bool
85  signedOp() const
86  {
87  return ext & MediaSignedOp;
88  }
89  };
90 
91  class MediaOpReg : public MediaOpBase
92  {
93  protected:
94  const RegIndex src2;
95 
96  // Constructor
98  const char *mnem, const char *_instMnem, uint64_t setFlags,
99  InstRegIndex _src1, InstRegIndex _src2, InstRegIndex _dest,
100  uint8_t _srcSize, uint8_t _destSize, uint8_t _ext,
101  OpClass __opClass) :
102  MediaOpBase(_machInst, mnem, _instMnem, setFlags,
103  _src1, _dest, _srcSize, _destSize, _ext,
104  __opClass),
105  src2(_src2.idx)
106  {}
107 
108  std::string generateDisassembly(Addr pc,
109  const SymbolTable *symtab) const;
110  };
111 
112  class MediaOpImm : public MediaOpBase
113  {
114  protected:
115  uint8_t imm8;
116 
117  // Constructor
119  const char *mnem, const char *_instMnem, uint64_t setFlags,
120  InstRegIndex _src1, uint8_t _imm8, InstRegIndex _dest,
121  uint8_t _srcSize, uint8_t _destSize, uint8_t _ext,
122  OpClass __opClass) :
123  MediaOpBase(_machInst, mnem, _instMnem, setFlags,
124  _src1, _dest, _srcSize, _destSize, _ext,
125  __opClass),
126  imm8(_imm8)
127  {}
128 
129  std::string generateDisassembly(Addr pc,
130  const SymbolTable *symtab) const;
131  };
132 }
133 
134 #endif //__ARCH_X86_INSTS_MICROMEDIAOP_HH__
bool scalarOp() const
Definition: micromediaop.hh:67
const RegIndex dest
Definition: micromediaop.hh:48
int numItems(int size) const
Definition: micromediaop.hh:73
static const RegIndex foldOBit
Definition: micromediaop.hh:52
uint64_t FloatRegBits
Definition: registers.hh:99
Class for register indices passed to instruction constructors.
Definition: static_inst.hh:54
const uint8_t srcSize
Definition: micromediaop.hh:49
const RegIndex src2
Definition: micromediaop.hh:94
Bitfield< 19 > pc
Definition: misc.hh:806
uint16_t RegIndex
Definition: registers.hh:108
const uint8_t destSize
Definition: micromediaop.hh:50
std::string generateDisassembly(Addr pc, const SymbolTable *symtab) const
Internal function to generate disassembly string.
Definition: micromediaop.cc:39
bool signedOp() const
Definition: micromediaop.hh:85
MediaOpBase(ExtMachInst _machInst, const char *mnem, const char *_instMnem, uint64_t setFlags, InstRegIndex _src1, InstRegIndex _dest, uint8_t _srcSize, uint8_t _destSize, uint8_t _ext, OpClass __opClass)
Definition: micromediaop.hh:55
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
std::string generateDisassembly(Addr pc, const SymbolTable *symtab) const
Internal function to generate disassembly string.
Definition: micromediaop.cc:53
MediaOpReg(ExtMachInst _machInst, const char *mnem, const char *_instMnem, uint64_t setFlags, InstRegIndex _src1, InstRegIndex _src2, InstRegIndex _dest, uint8_t _srcSize, uint8_t _destSize, uint8_t _ext, OpClass __opClass)
Definition: micromediaop.hh:97
const uint8_t ext
Definition: micromediaop.hh:51
bool multHi() const
Definition: micromediaop.hh:79
int size()
Definition: pagetable.hh:146
TheISA::ExtMachInst ExtMachInst
Binary extended machine instruction type.
Definition: static_inst.hh:72
const RegIndex src1
Definition: micromediaop.hh:47
MediaOpImm(ExtMachInst _machInst, const char *mnem, const char *_instMnem, uint64_t setFlags, InstRegIndex _src1, uint8_t _imm8, InstRegIndex _dest, uint8_t _srcSize, uint8_t _destSize, uint8_t _ext, OpClass __opClass)

Generated on Fri Jun 9 2017 13:03:40 for gem5 by doxygen 1.8.6