gem5  v20.0.0.2
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
registers.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2017 Advanced Micro Devices, Inc.
3  * All rights reserved.
4  *
5  * For use for simulation and test purposes only
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are met:
9  *
10  * 1. Redistributions of source code must retain the above copyright notice,
11  * this list of conditions and the following disclaimer.
12  *
13  * 2. Redistributions in binary form must reproduce the above copyright notice,
14  * this list of conditions and the following disclaimer in the documentation
15  * and/or other materials provided with the distribution.
16  *
17  * 3. Neither the name of the copyright holder nor the names of its
18  * contributors may be used to endorse or promote products derived from this
19  * software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
25  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  *
33  * Authors: Anthony Gutierrez
34  */
35 
36 #ifndef __ARCH_GCN3_REGISTERS_HH__
37 #define __ARCH_GCN3_REGISTERS_HH__
38 
39 #include <array>
40 #include <cstdint>
41 #include <string>
42 
43 #include "arch/generic/vec_reg.hh"
44 #include "base/intmath.hh"
45 #include "base/logging.hh"
46 
47 namespace Gcn3ISA
48 {
49  enum OpSelector : int
50  {
52  REG_SGPR_MAX = 101,
57  REG_VCC_LO = 106,
58  REG_VCC_HI = 107,
59  REG_TBA_LO = 108,
60  REG_TBA_HI = 109,
61  REG_TMA_LO = 110,
62  REG_TMA_HI = 111,
63  REG_TTMP_0 = 112,
64  REG_TTMP_1 = 113,
65  REG_TTMP_2 = 114,
66  REG_TTMP_3 = 115,
67  REG_TTMP_4 = 116,
68  REG_TTMP_5 = 117,
69  REG_TTMP_6 = 118,
70  REG_TTMP_7 = 119,
71  REG_TTMP_8 = 120,
72  REG_TTMP_9 = 121,
73  REG_TTMP_10 = 122,
74  REG_TTMP_11 = 123,
75  REG_M0 = 124,
77  REG_EXEC_LO = 126,
78  REG_EXEC_HI = 127,
79  REG_ZERO = 128,
117  REG_POS_ONE = 242,
118  REG_NEG_ONE = 243,
119  REG_POS_TWO = 244,
120  REG_NEG_TWO = 245,
123  REG_PI = 248,
124  /* NOTE: SDWA and SWDA both refer to sub d-word addressing */
126  REG_SRC_DPP = 250,
127  REG_VCCZ = 251,
128  REG_EXECZ = 252,
129  REG_SCC = 253,
134  };
135 
136  constexpr size_t MaxOperandDwords(16);
137  const int NumVecElemPerVecReg(64);
138  // op selector values 129 - 192 correspond to const values 1 - 64
140  - REG_INT_CONST_POS_MIN + 1;
141  // op selector values 193 - 208 correspond to const values -1 - 16
143  - REG_INT_CONST_NEG_MIN + 1;
144  const int BITS_PER_BYTE = 8;
145  const int BITS_PER_WORD = 16;
146  const int MSB_PER_BYTE = (BITS_PER_BYTE - 1);
147  const int MSB_PER_WORD = (BITS_PER_WORD - 1);
148 
149  // typedefs for the various sizes/types of scalar regs
150  typedef uint8_t ScalarRegU8;
151  typedef int8_t ScalarRegI8;
152  typedef uint16_t ScalarRegU16;
153  typedef int16_t ScalarRegI16;
154  typedef uint32_t ScalarRegU32;
155  typedef int32_t ScalarRegI32;
156  typedef float ScalarRegF32;
157  typedef uint64_t ScalarRegU64;
158  typedef int64_t ScalarRegI64;
159  typedef double ScalarRegF64;
160 
161  // typedefs for the various sizes/types of vector reg elements
162  typedef uint8_t VecElemU8;
163  typedef int8_t VecElemI8;
164  typedef uint16_t VecElemU16;
165  typedef int16_t VecElemI16;
166  typedef uint32_t VecElemU32;
167  typedef int32_t VecElemI32;
168  typedef float VecElemF32;
169  typedef uint64_t VecElemU64;
170  typedef int64_t VecElemI64;
171  typedef double VecElemF64;
172 
173  // typedefs for the various sizes/types of vector regs
184  // non-writeable versions of vector regs
195 
200 
201  struct StatusReg
202  {
203  StatusReg() : SCC(0), SPI_PRIO(0), USER_PRIO(0), PRIV(0), TRAP_EN(0),
204  TTRACE_EN(0), EXPORT_RDY(0), EXECZ(0), VCCZ(0), IN_TG(0),
205  IN_BARRIER(0), HALT(0), TRAP(0), TTRACE_CU_EN(0), VALID(0),
206  ECC_ERR(0), SKIP_EXPORT(0), PERF_EN(0), COND_DBG_USER(0),
208  MUST_EXPORT(0), RESERVED_1(0)
209  {
210  }
211 
212  uint32_t SCC : 1;
213  uint32_t SPI_PRIO : 2;
214  uint32_t USER_PRIO : 2;
215  uint32_t PRIV : 1;
216  uint32_t TRAP_EN : 1;
217  uint32_t TTRACE_EN : 1;
218  uint32_t EXPORT_RDY : 1;
219  uint32_t EXECZ : 1;
220  uint32_t VCCZ : 1;
221  uint32_t IN_TG : 1;
222  uint32_t IN_BARRIER : 1;
223  uint32_t HALT : 1;
224  uint32_t TRAP : 1;
225  uint32_t TTRACE_CU_EN : 1;
226  uint32_t VALID : 1;
227  uint32_t ECC_ERR : 1;
228  uint32_t SKIP_EXPORT : 1;
229  uint32_t PERF_EN : 1;
230  uint32_t COND_DBG_USER : 1;
231  uint32_t COND_DBG_SYS : 1;
232  uint32_t ALLOW_REPLAY : 1;
233  uint32_t INSTRUCTION_ATC : 1;
234  uint32_t RESERVED : 3;
235  uint32_t MUST_EXPORT : 1;
236  uint32_t RESERVED_1 : 4;
237  };
238 
239  std::string opSelectorToRegSym(int opIdx, int numRegs=0);
240  int opSelectorToRegIdx(int opIdx, int numScalarRegs);
241  bool isLiteral(int opIdx);
242  bool isScalarReg(int opIdx);
243  bool isVectorReg(int opIdx);
244  bool isFlatScratchReg(int opIdx);
245  bool isExecMask(int opIdx);
246  bool isVccReg(int opIdx);
247 } // namespace Gcn3ISA
248 
249 #endif // __ARCH_GCN3_REGISTERS_HH__
double ScalarRegF64
Definition: registers.hh:159
int64_t ScalarRegI64
Definition: registers.hh:158
uint16_t VecElemU16
Definition: registers.hh:164
uint8_t ScalarRegU8
Definition: registers.hh:150
bool isScalarReg(int opIdx)
Definition: registers.cc:190
uint32_t COND_DBG_USER
Definition: registers.hh:230
bool isFlatScratchReg(int opIdx)
Definition: registers.cc:184
int8_t VecElemI8
Definition: registers.hh:163
const int BITS_PER_BYTE
Definition: registers.hh:144
bool isExecMask(int opIdx)
Definition: registers.cc:172
float ScalarRegF32
Definition: registers.hh:156
const int NumNegConstRegs
Definition: registers.hh:142
uint64_t ScalarRegU64
Definition: registers.hh:157
uint32_t RESERVED_1
Definition: registers.hh:236
int16_t ScalarRegI16
Definition: registers.hh:153
uint32_t VecElemU32
Definition: registers.hh:166
uint32_t USER_PRIO
Definition: registers.hh:214
double VecElemF64
Definition: registers.hh:171
bool isVectorReg(int opIdx)
Definition: registers.cc:203
uint32_t ALLOW_REPLAY
Definition: registers.hh:232
int32_t ScalarRegI32
Definition: registers.hh:155
const int MSB_PER_WORD
Definition: registers.hh:147
uint32_t SKIP_EXPORT
Definition: registers.hh:228
bool isVccReg(int opIdx)
Definition: registers.cc:178
VecRegU64::Container VecRegContainerU64
Definition: registers.hh:199
classes that represnt vector/scalar operands in GCN3 ISA.
Definition: decoder.cc:44
int8_t ScalarRegI8
Definition: registers.hh:151
uint32_t EXPORT_RDY
Definition: registers.hh:218
int64_t VecElemI64
Definition: registers.hh:170
int opSelectorToRegIdx(int idx, int numScalarRegs)
Definition: registers.cc:123
VecRegU16::Container VecRegContainerU16
Definition: registers.hh:197
uint32_t MUST_EXPORT
Definition: registers.hh:235
uint32_t TTRACE_CU_EN
Definition: registers.hh:225
const int BITS_PER_WORD
Definition: registers.hh:145
uint32_t TTRACE_EN
Definition: registers.hh:217
typename std::conditional< Const, const VecRegContainer< size()>, VecRegContainer< size()> >::type Container
Container type alias.
Definition: vec_reg.hh:182
uint32_t COND_DBG_SYS
Definition: registers.hh:231
int16_t VecElemI16
Definition: registers.hh:165
uint32_t IN_BARRIER
Definition: registers.hh:222
uint16_t ScalarRegU16
Definition: registers.hh:152
bool isLiteral(int opIdx)
Definition: registers.cc:166
std::string opSelectorToRegSym(int idx, int numRegs)
Definition: registers.cc:41
uint32_t ScalarRegU32
Definition: registers.hh:154
Vector Registers layout specification.
int32_t VecElemI32
Definition: registers.hh:167
const int NumPosConstRegs
Definition: registers.hh:139
float VecElemF32
Definition: registers.hh:168
uint32_t INSTRUCTION_ATC
Definition: registers.hh:233
const int MSB_PER_BYTE
Definition: registers.hh:146
Vector Register Abstraction This generic class is a view in a particularization of MVC...
Definition: vec_reg.hh:170
uint8_t VecElemU8
Definition: registers.hh:162
VecRegU8::Container VecRegContainerU8
Definition: registers.hh:196
VecRegU32::Container VecRegContainerU32
Definition: registers.hh:198
uint64_t VecElemU64
Definition: registers.hh:169
const int NumVecElemPerVecReg(64)
constexpr size_t MaxOperandDwords(16)

Generated on Mon Jun 8 2020 15:34:40 for gem5 by doxygen 1.8.13