gem5  v22.0.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
scoreboard.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2005-2006 The Regents of The University of Michigan
3  * Copyright (c) 2013 Advanced Micro Devices, Inc.
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are
8  * met: redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer;
10  * redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution;
13  * neither the name of the copyright holders nor the names of its
14  * contributors may be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #ifndef __CPU_O3_SCOREBOARD_HH__
31 #define __CPU_O3_SCOREBOARD_HH__
32 
33 #include <cassert>
34 #include <vector>
35 
36 #include "base/compiler.hh"
37 #include "base/logging.hh"
38 #include "base/trace.hh"
39 #include "cpu/reg_class.hh"
40 #include "debug/Scoreboard.hh"
41 
42 namespace gem5
43 {
44 
45 namespace o3
46 {
47 
55 {
56  private:
59  const std::string _name;
60 
64 
67 
68  public:
73  Scoreboard(const std::string &_my_name, unsigned _numPhysicalRegs);
74 
77 
79  std::string name() const { return _name; };
80 
82  bool
83  getReg(PhysRegIdPtr phys_reg) const
84  {
85  if (phys_reg->isFixedMapping()) {
86  // Fixed mapping regs are always ready
87  return true;
88  }
89 
90  assert(phys_reg->flatIndex() < numPhysRegs);
91 
92  return regScoreBoard[phys_reg->flatIndex()];
93  }
94 
96  void
97  setReg(PhysRegIdPtr phys_reg)
98  {
99  if (phys_reg->isFixedMapping()) {
100  // Fixed mapping regs are always ready, ignore attempts to change
101  // that
102  return;
103  }
104 
105  assert(phys_reg->flatIndex() < numPhysRegs);
106 
107  DPRINTF(Scoreboard, "Setting reg %i (%s) as ready\n",
108  phys_reg->index(), phys_reg->className());
109 
110  regScoreBoard[phys_reg->flatIndex()] = true;
111  }
112 
114  void
116  {
117  if (phys_reg->isFixedMapping()) {
118  // Fixed mapping regs are always ready, ignore attempts to
119  // change that
120  return;
121  }
122 
123  assert(phys_reg->flatIndex() < numPhysRegs);
124 
125  regScoreBoard[phys_reg->flatIndex()] = false;
126  }
127 
128 };
129 
130 } // namespace o3
131 } // namespace gem5
132 
133 #endif
gem5::o3::Scoreboard::getReg
bool getReg(PhysRegIdPtr phys_reg) const
Checks if the register is ready.
Definition: scoreboard.hh:83
gem5::o3::Scoreboard
Implements a simple scoreboard to track which registers are ready.
Definition: scoreboard.hh:54
std::vector< bool >
gem5::o3::Scoreboard::regScoreBoard
std::vector< bool > regScoreBoard
Scoreboard of physical integer registers, saying whether or not they are ready.
Definition: scoreboard.hh:63
gem5::o3::Scoreboard::name
std::string name() const
Returns the name of the scoreboard.
Definition: scoreboard.hh:79
GEM5_CLASS_VAR_USED
#define GEM5_CLASS_VAR_USED
Definition: compiler.hh:141
gem5::PhysRegId::flatIndex
const RegIndex & flatIndex() const
Flat index accessor.
Definition: reg_class.hh:302
gem5::o3::Scoreboard::numPhysRegs
GEM5_CLASS_VAR_USED unsigned numPhysRegs
The number of actual physical registers.
Definition: scoreboard.hh:66
DPRINTF
#define DPRINTF(x,...)
Definition: trace.hh:186
gem5::o3::Scoreboard::setReg
void setReg(PhysRegIdPtr phys_reg)
Sets the register as ready.
Definition: scoreboard.hh:97
gem5::PhysRegId::className
constexpr const char * className() const
Return a const char* with the register class name.
Definition: reg_class.hh:194
compiler.hh
gem5::o3::Scoreboard::Scoreboard
Scoreboard(const std::string &_my_name, unsigned _numPhysicalRegs)
Constructs a scoreboard.
Definition: scoreboard.cc:38
gem5::o3::Scoreboard::~Scoreboard
~Scoreboard()
Destructor.
Definition: scoreboard.hh:76
gem5::o3::Scoreboard::unsetReg
void unsetReg(PhysRegIdPtr phys_reg)
Sets the register as not ready.
Definition: scoreboard.hh:115
reg_class.hh
logging.hh
gem5::PhysRegId
Physical register ID.
Definition: reg_class.hh:245
gem5::PhysRegId::index
constexpr RegIndex index() const
Visible RegId methods.
Definition: reg_class.hh:188
gem5::o3::Scoreboard::_name
const std::string _name
The object name, for DPRINTF.
Definition: scoreboard.hh:59
trace.hh
gem5::PhysRegId::isFixedMapping
bool isFixedMapping() const
Returns true if this register is always associated to the same architectural register.
Definition: reg_class.hh:299
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: gpu_translation_state.hh:37

Generated on Thu Jun 16 2022 10:41:47 for gem5 by doxygen 1.8.17