gem5  v21.0.1.0
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  * 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 
34 #ifndef __GPU_COMPUTE_SCALAR_REGISTER_FILE_HH__
35 #define __GPU_COMPUTE_SCALAR_REGISTER_FILE_HH__
36 
37 #include "arch/gpu_isa.hh"
38 #include "base/statistics.hh"
39 #include "base/trace.hh"
40 #include "base/types.hh"
41 #include "debug/GPUSRF.hh"
43 #include "gpu-compute/wavefront.hh"
44 
45 struct ScalarRegisterFileParams;
46 
47 // Scalar Register File
49 {
50  public:
52 
53  ScalarRegisterFile(const ScalarRegisterFileParams &p);
55 
56  virtual bool operandsReady(Wavefront *w, GPUDynInstPtr ii) const override;
57  virtual void scheduleWriteOperands(Wavefront *w,
58  GPUDynInstPtr ii) override;
60  GPUDynInstPtr ii) override;
61  virtual void waveExecuteInst(Wavefront *w, GPUDynInstPtr ii) override;
62 
63  void
64  setParent(ComputeUnit *_computeUnit) override
65  {
66  RegisterFile::setParent(_computeUnit);
67  }
68 
69  // Read a register that is writeable (e.g., a DST operand)
71  readWriteable(int regIdx)
72  {
73  return regFile[regIdx];
74  }
75 
76  // Read a register that is not writeable (e.g., src operand)
78  read(int regIdx) const
79  {
80  return regFile[regIdx];
81  }
82 
83  // Write a register
84  void
85  write(int regIdx, ScalarRegU32 value)
86  {
87  regFile[regIdx] = value;
88  }
89 
90  void
91  printReg(Wavefront *wf, int regIdx) const
92  {
93  DPRINTF(GPUSRF, "WF[%d][%d]: Id%d s[%d] = %#x\n", wf->simdId,
94  wf->wfSlotId, wf->wfDynId, regIdx, regFile[regIdx]);
95  }
96 
97  private:
99 };
100 
101 #endif // __GPU_COMPUTE_SCALAR_REGISTER_FILE_HH__
ScalarRegisterFile::regFile
std::vector< ScalarRegU32 > regFile
Definition: scalar_register_file.hh:98
ScalarRegisterFile::ScalarRegisterFile
ScalarRegisterFile(const ScalarRegisterFileParams &p)
Definition: scalar_register_file.cc:44
std::vector< ScalarRegU32 >
ScalarRegisterFile
Definition: scalar_register_file.hh:48
wavefront.hh
Wavefront::wfSlotId
const int wfSlotId
Definition: wavefront.hh:94
ComputeUnit
Definition: compute_unit.hh:200
ScalarRegisterFile::write
void write(int regIdx, ScalarRegU32 value)
Definition: scalar_register_file.hh:85
register_file.hh
MipsISA::w
Bitfield< 0 > w
Definition: pra_constants.hh:278
DPRINTF
#define DPRINTF(x,...)
Definition: trace.hh:237
ScalarRegisterFile::waveExecuteInst
virtual void waveExecuteInst(Wavefront *w, GPUDynInstPtr ii) override
Definition: scalar_register_file.cc:103
ScalarRegisterFile::printReg
void printReg(Wavefront *wf, int regIdx) const
Definition: scalar_register_file.hh:91
ScalarRegisterFile::operandsReady
virtual bool operandsReady(Wavefront *w, GPUDynInstPtr ii) const override
Definition: scalar_register_file.cc:51
statistics.hh
ScalarRegisterFile::ScalarRegU32
TheGpuISA::ScalarRegU32 ScalarRegU32
Definition: scalar_register_file.hh:51
Wavefront::simdId
const int simdId
Definition: wavefront.hh:97
ScalarRegisterFile::scheduleWriteOperands
virtual void scheduleWriteOperands(Wavefront *w, GPUDynInstPtr ii) override
Definition: scalar_register_file.cc:81
ScalarRegisterFile::~ScalarRegisterFile
~ScalarRegisterFile()
Definition: scalar_register_file.hh:54
ScalarRegisterFile::readWriteable
ScalarRegU32 & readWriteable(int regIdx)
Definition: scalar_register_file.hh:71
ScalarRegisterFile::scheduleWriteOperandsFromLoad
virtual void scheduleWriteOperandsFromLoad(Wavefront *w, GPUDynInstPtr ii) override
Definition: scalar_register_file.cc:135
types.hh
Wavefront
Definition: wavefront.hh:59
GPUDynInstPtr
std::shared_ptr< GPUDynInst > GPUDynInstPtr
Definition: misc.hh:48
Gcn3ISA::ScalarRegU32
uint32_t ScalarRegU32
Definition: registers.hh:152
ScalarRegisterFile::read
ScalarRegU32 read(int regIdx) const
Definition: scalar_register_file.hh:78
RegisterFile
Definition: register_file.hh:55
trace.hh
ScalarRegisterFile::setParent
void setParent(ComputeUnit *_computeUnit) override
Definition: scalar_register_file.hh:64
MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:323
RegisterFile::setParent
virtual void setParent(ComputeUnit *_computeUnit)
Definition: register_file.cc:63
Wavefront::wfDynId
uint64_t wfDynId
Definition: wavefront.hh:224

Generated on Tue Jun 22 2021 15:28:28 for gem5 by doxygen 1.8.17