gem5 v24.0.0.0
Loading...
Searching...
No Matches
gpu_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 * 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
33
34#include <numeric>
35
38
39namespace gem5
40{
41
42namespace VegaISA
43{
44 GPUISA::GPUISA(Wavefront &wf) : wavefront(wf), m0(0)
45 {
46 }
47
49 GPUISA::readMiscReg(int opIdx) const
50 {
51 switch (opIdx) {
52 case REG_M0:
53 return m0;
54 case REG_ZERO:
55 return 0;
56 case REG_SCC:
57 return statusReg.SCC;
58 default:
59 fatal("attempting to read from unsupported or non-readable "
60 "register. selector val: %i\n", opIdx);
61 return 0;
62 }
63 }
64
65 void
66 GPUISA::writeMiscReg(int opIdx, ScalarRegU32 operandVal)
67 {
68 switch (opIdx) {
69 case REG_M0:
70 m0 = operandVal;
71 break;
72 case REG_SCC:
73 statusReg.SCC = operandVal ? 1 : 0;
74 break;
75 default:
76 fatal("attempting to write to an unsupported or non-writable "
77 "register. selector val: %i\n", opIdx);
78 break;
79 }
80 }
81
82 void
84 {
86 + gpuDynInst->staticInstruction()->instSize());
87 }
88
89 const std::array<const ScalarRegU32, NumPosConstRegs>
91 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
92 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
93 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
94 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64
95 } };
96
97 const std::array<const ScalarRegI32, NumNegConstRegs>
99 -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15,
100 -16
101 } };
102} // namespace VegaISA
103} // namespace gem5
static const std::array< const ScalarRegU32, NumPosConstRegs > posConstRegs
Definition gpu_isa.hh:91
ScalarRegU32 readMiscReg(int opIdx) const
Definition gpu_isa.cc:49
void advancePC(GPUDynInstPtr gpuDynInst)
Definition gpu_isa.cc:83
Wavefront & wavefront
Definition gpu_isa.hh:96
ScalarRegU32 m0
Definition gpu_isa.hh:101
void writeMiscReg(int opIdx, ScalarRegU32 operandVal)
Definition gpu_isa.cc:66
GPUISA(Wavefront &wf)
Definition gpu_isa.cc:44
StatusReg statusReg
Definition gpu_isa.hh:99
static const std::array< const ScalarRegI32, NumNegConstRegs > negConstRegs
Definition gpu_isa.hh:93
Addr pc() const
#define fatal(...)
This implements a cprintf based fatal() function.
Definition logging.hh:200
uint32_t ScalarRegU32
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
std::shared_ptr< GPUDynInst > GPUDynInstPtr
Definition misc.hh:49

Generated on Tue Jun 18 2024 16:23:39 for gem5 by doxygen 1.11.0