gem5  v21.2.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
gpu_isa.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016-2021 Advanced Micro Devices, Inc.
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 met:
7  *
8  * 1. Redistributions of source code must retain the above copyright notice,
9  * this list of conditions and the following disclaimer.
10  *
11  * 2. Redistributions in binary form must reproduce the above copyright notice,
12  * this list of conditions and the following disclaimer in the documentation
13  * and/or other materials provided with the distribution.
14  *
15  * 3. Neither the name of the copyright holder nor the names of its
16  * contributors may be used to endorse or promote products derived from this
17  * software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 #ifndef __ARCH_VEGA_GPU_ISA_HH__
33 #define __ARCH_VEGA_GPU_ISA_HH__
34 
35 #include <array>
36 #include <type_traits>
37 
41 #include "gpu-compute/misc.hh"
42 
43 namespace gem5
44 {
45 
46 class Wavefront;
47 
48 namespace VegaISA
49 {
50  class GPUISA
51  {
52  public:
53  GPUISA(Wavefront &wf);
54 
55  template<typename T> T
56  readConstVal(int opIdx) const
57  {
58  panic_if(!std::is_integral_v<T>,
59  "Constant values must be an integer.");
60  T val(0);
61 
62  if (isPosConstVal(opIdx)) {
63  val = (T)readPosConstReg(opIdx);
64  }
65 
66  if (isNegConstVal(opIdx)) {
67  val = (T)readNegConstReg(opIdx);
68  }
69 
70  return val;
71  }
72 
73  ScalarRegU32 readMiscReg(int opIdx) const;
74  void writeMiscReg(int opIdx, ScalarRegU32 operandVal);
75  bool hasScalarUnit() const { return true; }
76  void advancePC(GPUDynInstPtr gpuDynInst);
77 
78  private:
79  ScalarRegU32 readPosConstReg(int opIdx) const
80  {
81  return posConstRegs[opIdx - REG_INT_CONST_POS_MIN];
82  }
83 
84  ScalarRegI32 readNegConstReg(int opIdx) const
85  {
86  return negConstRegs[opIdx - REG_INT_CONST_NEG_MIN];
87  }
88 
89  static const std::array<const ScalarRegU32, NumPosConstRegs>
91  static const std::array<const ScalarRegI32, NumNegConstRegs>
93 
94  // parent wavefront
96 
97  // shader status bits
99  // memory descriptor reg
101  };
102 } // namespace VegaISA
103 } // namespace gem5
104 
105 #endif // __ARCH_VEGA_GPU_ISA_HH__
hsa_queue_entry.hh
gem5::VegaISA::GPUISA::hasScalarUnit
bool hasScalarUnit() const
Definition: gpu_isa.hh:75
gem5::VegaISA::isNegConstVal
bool isNegConstVal(int opIdx)
Definition: registers.cc:185
gem5::VegaISA::GPUISA::GPUISA
GPUISA(Wavefront &wf)
Definition: isa.cc:44
gem5::Wavefront
Definition: wavefront.hh:60
gem5::VegaISA::GPUISA
Definition: gpu_isa.hh:50
misc.hh
gem5::X86ISA::val
Bitfield< 63 > val
Definition: misc.hh:775
gem5::VegaISA::GPUISA::readConstVal
T readConstVal(int opIdx) const
Definition: gpu_isa.hh:56
gem5::VegaISA::REG_INT_CONST_NEG_MIN
@ REG_INT_CONST_NEG_MIN
Definition: gpu_registers.hh:81
gem5::VegaISA::GPUISA::readNegConstReg
ScalarRegI32 readNegConstReg(int opIdx) const
Definition: gpu_isa.hh:84
gem5::VegaISA::GPUISA::readMiscReg
ScalarRegU32 readMiscReg(int opIdx) const
Definition: isa.cc:49
gem5::VegaISA::GPUISA::statusReg
StatusReg statusReg
Definition: gpu_isa.hh:98
gem5::VegaISA::GPUISA::readPosConstReg
ScalarRegU32 readPosConstReg(int opIdx) const
Definition: gpu_isa.hh:79
gem5::VegaISA::isPosConstVal
bool isPosConstVal(int opIdx)
Definition: registers.cc:176
gem5::VegaISA::REG_INT_CONST_POS_MIN
@ REG_INT_CONST_POS_MIN
Definition: gpu_registers.hh:79
gem5::VegaISA::StatusReg
Definition: gpu_registers.hh:183
gem5::VegaISA::GPUISA::advancePC
void advancePC(GPUDynInstPtr gpuDynInst)
Definition: isa.cc:83
gpu_registers.hh
gem5::VegaISA::GPUISA::posConstRegs
static const std::array< const ScalarRegU32, NumPosConstRegs > posConstRegs
Definition: gpu_isa.hh:90
gem5::VegaISA::GPUISA::negConstRegs
static const std::array< const ScalarRegI32, NumNegConstRegs > negConstRegs
Definition: gpu_isa.hh:92
gem5::GPUDynInstPtr
std::shared_ptr< GPUDynInst > GPUDynInstPtr
Definition: misc.hh:49
gem5::VegaISA::ScalarRegI32
int32_t ScalarRegI32
Definition: gpu_registers.hh:154
panic_if
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
Definition: logging.hh:204
gem5::VegaISA::GPUISA::writeMiscReg
void writeMiscReg(int opIdx, ScalarRegU32 operandVal)
Definition: isa.cc:66
gem5::VegaISA::GPUISA::wavefront
Wavefront & wavefront
Definition: gpu_isa.hh:95
gem5::VegaISA::ScalarRegU32
uint32_t ScalarRegU32
Definition: gpu_registers.hh:153
dispatcher.hh
gem5::VegaISA::GPUISA::m0
ScalarRegU32 m0
Definition: gpu_isa.hh:100
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: tlb.cc:60

Generated on Tue Dec 21 2021 11:34:06 for gem5 by doxygen 1.8.17