gem5  v21.1.0.2
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
isa.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016-2021 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 
35 
36 #include <numeric>
37 
39 #include "gpu-compute/wavefront.hh"
40 
41 namespace gem5
42 {
43 
44 namespace Gcn3ISA
45 {
46  GPUISA::GPUISA(Wavefront &wf) : wavefront(wf), m0(0)
47  {
48  }
49 
51  GPUISA::readMiscReg(int opIdx) const
52  {
53  switch (opIdx) {
54  case REG_M0:
55  return m0;
56  case REG_ZERO:
57  return 0;
58  case REG_SCC:
59  return statusReg.SCC;
60  default:
61  fatal("attempting to read from unsupported or non-readable "
62  "register. selector val: %i\n", opIdx);
63  return 0;
64  }
65  }
66 
67  void
68  GPUISA::writeMiscReg(int opIdx, ScalarRegU32 operandVal)
69  {
70  switch (opIdx) {
71  case REG_M0:
72  m0 = operandVal;
73  break;
74  case REG_SCC:
75  statusReg.SCC = operandVal ? 1 : 0;
76  break;
77  default:
78  fatal("attempting to write to an unsupported or non-writable "
79  "register. selector val: %i\n", opIdx);
80  break;
81  }
82  }
83 
84  void
86  {
88  + gpuDynInst->staticInstruction()->instSize());
89  }
90 
91  const std::array<const ScalarRegU32, NumPosConstRegs>
93  1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
94  20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
95  37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
96  54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64
97  } };
98 
99  const std::array<const ScalarRegI32, NumNegConstRegs>
101  -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15,
102  -16
103  } };
104 } // namespace Gcn3ISA
105 } // namespace gem5
fatal
#define fatal(...)
This implements a cprintf based fatal() function.
Definition: logging.hh:189
gem5::Gcn3ISA::GPUISA::statusReg
StatusReg statusReg
Definition: gpu_isa.hh:100
gem5::Gcn3ISA::GPUISA::writeMiscReg
void writeMiscReg(int opIdx, ScalarRegU32 operandVal)
Definition: isa.cc:68
gem5::Gcn3ISA::GPUISA::wavefront
Wavefront & wavefront
Definition: gpu_isa.hh:97
gem5::Gcn3ISA::GPUISA::advancePC
void advancePC(GPUDynInstPtr gpuDynInst)
Definition: isa.cc:85
gem5::Gcn3ISA::REG_SCC
@ REG_SCC
Definition: gpu_registers.hh:130
gem5::Wavefront
Definition: wavefront.hh:62
gpu_static_inst.hh
gem5::Gcn3ISA::GPUISA::m0
ScalarRegU32 m0
Definition: gpu_isa.hh:102
gem5::Gcn3ISA::GPUISA::negConstRegs
static const std::array< const ScalarRegI32, NumNegConstRegs > negConstRegs
Definition: gpu_isa.hh:94
gem5::Wavefront::pc
Addr pc() const
Definition: wavefront.cc:1365
gem5::Gcn3ISA::GPUISA::readMiscReg
ScalarRegU32 readMiscReg(int opIdx) const
Definition: isa.cc:51
wavefront.hh
gem5::Gcn3ISA::GPUISA::GPUISA
GPUISA(Wavefront &wf)
Definition: isa.cc:46
gem5::Gcn3ISA::REG_M0
@ REG_M0
Definition: gpu_registers.hh:76
gem5::Gcn3ISA::GPUISA::posConstRegs
static const std::array< const ScalarRegU32, NumPosConstRegs > posConstRegs
Definition: gpu_isa.hh:92
gpu_isa.hh
gem5::Gcn3ISA::StatusReg::SCC
uint32_t SCC
Definition: gpu_registers.hh:194
gem5::GPUDynInstPtr
std::shared_ptr< GPUDynInst > GPUDynInstPtr
Definition: misc.hh:51
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: decoder.cc:40
gem5::Gcn3ISA::REG_ZERO
@ REG_ZERO
Definition: gpu_registers.hh:80
gem5::Gcn3ISA::ScalarRegU32
uint32_t ScalarRegU32
Definition: gpu_registers.hh:155

Generated on Tue Sep 21 2021 12:24:20 for gem5 by doxygen 1.8.17