gem5 [DEVELOP-FOR-25.0]
Loading...
Searching...
No Matches
scalar_register_file.hh
Go to the documentation of this file.
1/*
2 * Copyright (c) 2015-2017 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 __GPU_COMPUTE_SCALAR_REGISTER_FILE_HH__
33#define __GPU_COMPUTE_SCALAR_REGISTER_FILE_HH__
34
35#include "arch/gpu_isa.hh"
36#include "base/statistics.hh"
37#include "base/trace.hh"
38#include "base/types.hh"
39#include "debug/GPUSRF.hh"
40#include "debug/GPUTrace.hh"
43
44namespace gem5
45{
46
47struct ScalarRegisterFileParams;
48
49// Scalar Register File
51{
52 public:
53 using ScalarRegU32 = TheGpuISA::ScalarRegU32;
54
55 ScalarRegisterFile(const ScalarRegisterFileParams &p);
57
58 virtual bool operandsReady(Wavefront *w, GPUDynInstPtr ii) const override;
59 virtual void scheduleWriteOperands(Wavefront *w,
60 GPUDynInstPtr ii) override;
62 GPUDynInstPtr ii) override;
63 virtual void waveExecuteInst(Wavefront *w, GPUDynInstPtr ii) override;
64
65 void
66 setParent(ComputeUnit *_computeUnit) override
67 {
68 RegisterFile::setParent(_computeUnit);
69 }
70
71 // Read a register that is writeable (e.g., a DST operand)
73 readWriteable(int regIdx)
74 {
75 return regFile[regIdx];
76 }
77
78 // Read a register that is not writeable (e.g., src operand)
80 read(int regIdx) const
81 {
82 return regFile[regIdx];
83 }
84
85 // Write a register
86 void
87 write(int regIdx, ScalarRegU32 value)
88 {
89 regFile[regIdx] = value;
90 }
91
92 void
93 printReg(Wavefront *wf, int regIdx) const
94 {
95 DPRINTF(GPUSRF, "WF[%d][%d]: Id%d s[%d] = %#x\n", wf->simdId,
96 wf->wfSlotId, wf->wfDynId, regIdx, regFile[regIdx]);
97 DPRINTF(GPUTrace, "WF[%d][%d]: Id%d s[%d] = %#x (%f)\n", wf->simdId,
98 wf->wfSlotId, wf->wfDynId, regIdx, regFile[regIdx],
99 *reinterpret_cast<const float*>(&regFile[regIdx]));
100 }
101
102 private:
104};
105
106} // namespace gem5
107
108#endif // __GPU_COMPUTE_SCALAR_REGISTER_FILE_HH__
#define DPRINTF(x,...)
Definition trace.hh:209
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,...
RegisterFile(const RegisterFileParams &p)
virtual void setParent(ComputeUnit *_computeUnit)
void printReg(Wavefront *wf, int regIdx) const
virtual void scheduleWriteOperandsFromLoad(Wavefront *w, GPUDynInstPtr ii) override
ScalarRegisterFile(const ScalarRegisterFileParams &p)
void write(int regIdx, ScalarRegU32 value)
virtual bool operandsReady(Wavefront *w, GPUDynInstPtr ii) const override
ScalarRegU32 read(int regIdx) const
virtual void scheduleWriteOperands(Wavefront *w, GPUDynInstPtr ii) override
TheGpuISA::ScalarRegU32 ScalarRegU32
void setParent(ComputeUnit *_computeUnit) override
std::vector< ScalarRegU32 > regFile
virtual void waveExecuteInst(Wavefront *w, GPUDynInstPtr ii) override
ScalarRegU32 & readWriteable(int regIdx)
const int simdId
Definition wavefront.hh:102
const int wfSlotId
Definition wavefront.hh:99
uint64_t wfDynId
Definition wavefront.hh:235
STL vector class.
Definition stl.hh:37
Bitfield< 0 > p
Bitfield< 0 > w
Copyright (c) 2024 Arm Limited All rights reserved.
Definition binary32.hh:36
std::shared_ptr< GPUDynInst > GPUDynInstPtr
Definition misc.hh:49
Declaration of Statistics objects.

Generated on Mon May 26 2025 09:19:11 for gem5 by doxygen 1.13.2