gem5  v21.2.0.0
scoreboard.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013-2014, 2016-2017 ARM Limited
3  * All rights reserved
4  *
5  * The license below extends only to copyright in the software and shall
6  * not be construed as granting a license to any other intellectual
7  * property including but not limited to intellectual property relating
8  * to a hardware implementation of the functionality of the software
9  * licensed hereunder. You may use the software subject to the license
10  * terms below provided that you ensure that this notice is replicated
11  * unmodified and in its entirety in all distributions of the software,
12  * modified or unmodified, in source code or in binary form.
13  *
14  * Redistribution and use in source and binary forms, with or without
15  * modification, are permitted provided that the following conditions are
16  * met: redistributions of source code must retain the above copyright
17  * notice, this list of conditions and the following disclaimer;
18  * redistributions in binary form must reproduce the above copyright
19  * notice, this list of conditions and the following disclaimer in the
20  * documentation and/or other materials provided with the distribution;
21  * neither the name of the copyright holders nor the names of its
22  * contributors may be used to endorse or promote products derived from
23  * this software without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  */
37 
44 #ifndef __CPU_MINOR_SCOREBOARD_HH__
45 #define __CPU_MINOR_SCOREBOARD_HH__
46 
47 #include <vector>
48 
49 #include "base/named.hh"
50 #include "base/types.hh"
51 #include "cpu/minor/cpu.hh"
52 #include "cpu/minor/dyn_inst.hh"
53 #include "cpu/minor/trace.hh"
54 #include "cpu/reg_class.hh"
55 
56 namespace gem5
57 {
58 
60 namespace minor
61 {
62 
66 class Scoreboard : public Named
67 {
68  public:
70 
71  const unsigned intRegOffset;
72  const unsigned floatRegOffset;
73  const unsigned ccRegOffset;
74  const unsigned vecRegOffset;
75  const unsigned vecPredRegOffset;
76 
83  const unsigned numRegs;
84 
86 
88  typedef unsigned short int Index;
89 
93 
96 
99  static constexpr int invalidFUIndex = -1;
100 
106 
110 
111  public:
112  Scoreboard(const std::string &name,
113  const BaseISA::RegClasses& reg_classes) :
114  Named(name),
115  regClasses(reg_classes),
116  intRegOffset(0),
117  floatRegOffset(intRegOffset + reg_classes.at(IntRegClass).size()),
118  ccRegOffset(floatRegOffset + reg_classes.at(FloatRegClass).size()),
119  vecRegOffset(ccRegOffset + reg_classes.at(CCRegClass).size()),
120  vecPredRegOffset(vecRegOffset + reg_classes.at(VecElemClass).size()),
121  numRegs(vecPredRegOffset + reg_classes.at(VecPredRegClass).size()),
122  zeroReg(reg_classes.at(IntRegClass).zeroReg()),
123  numResults(numRegs, 0),
127  writingInst(numRegs, 0)
128  { }
129 
130  public:
134  bool findIndex(const RegId& reg, Index &scoreboard_index);
135 
140  void markupInstDests(MinorDynInstPtr inst, Cycles retire_time,
141  ThreadContext *thread_context, bool mark_unpredictable);
142 
145  void clearInstDests(MinorDynInstPtr inst, bool clear_unpredictable);
146 
152  ThreadContext *thread_context);
153 
156  bool canInstIssue(MinorDynInstPtr inst,
157  const std::vector<Cycles> *src_reg_relative_latencies,
158  const std::vector<bool> *cant_forward_from_fu_indices,
159  Cycles now, ThreadContext *thread_context);
160 
162  void minorTrace() const;
163 };
164 
165 } // namespace minor
166 } // namespace gem5
167 
168 #endif /* __CPU_MINOR_SCOREBOARD_HH__ */
dyn_inst.hh
gem5::minor::Scoreboard::vecRegOffset
const unsigned vecRegOffset
Definition: scoreboard.hh:74
gem5::VecElemClass
@ VecElemClass
Vector Register Native Elem lane.
Definition: reg_class.hh:63
gem5::CCRegClass
@ CCRegClass
Condition-code register.
Definition: reg_class.hh:65
gem5::minor::Scoreboard::markupInstDests
void markupInstDests(MinorDynInstPtr inst, Cycles retire_time, ThreadContext *thread_context, bool mark_unpredictable)
Mark up an instruction's effects by incrementing numResults counts.
Definition: scoreboard.cc:102
named.hh
gem5::minor::Scoreboard::numUnpredictableResults
std::vector< Index > numUnpredictableResults
Count of the number of results which can't be predicted.
Definition: scoreboard.hh:95
cpu.hh
gem5::minor::Scoreboard::numRegs
const unsigned numRegs
The number of registers in the Scoreboard.
Definition: scoreboard.hh:83
minor
gem5::minor::Scoreboard::canInstIssue
bool canInstIssue(MinorDynInstPtr inst, const std::vector< Cycles > *src_reg_relative_latencies, const std::vector< bool > *cant_forward_from_fu_indices, Cycles now, ThreadContext *thread_context)
Can this instruction be issued.
Definition: scoreboard.cc:209
gem5::minor::Scoreboard::intRegOffset
const unsigned intRegOffset
Definition: scoreboard.hh:71
std::vector< RegClass >
gem5::minor::Scoreboard::numResults
std::vector< Index > numResults
Count of the number of in-flight instructions that have results for each register.
Definition: scoreboard.hh:92
gem5::minor::Scoreboard::regClasses
const BaseISA::RegClasses regClasses
Definition: scoreboard.hh:69
gem5::minor::Scoreboard::Scoreboard
Scoreboard(const std::string &name, const BaseISA::RegClasses &reg_classes)
Definition: scoreboard.hh:112
gem5::minor::Scoreboard::zeroReg
const RegIndex zeroReg
Definition: scoreboard.hh:85
gem5::VecPredRegClass
@ VecPredRegClass
Definition: reg_class.hh:64
gem5::RefCountingPtr< MinorDynInst >
gem5::ArmISA::at
Bitfield< 35, 32 > at
Definition: misc_types.hh:155
gem5::Cycles
Cycles is a wrapper class for representing cycle counts, i.e.
Definition: types.hh:78
gem5::Named
Interface for things with names.
Definition: named.hh:38
gem5::FloatRegClass
@ FloatRegClass
Floating-point register.
Definition: reg_class.hh:59
gem5::ThreadContext
ThreadContext is the external interface to all thread state for anything outside of the CPU.
Definition: thread_context.hh:94
gem5::Named::name
virtual std::string name() const
Definition: named.hh:47
gem5::minor::Scoreboard::minorTrace
void minorTrace() const
MinorTraceIF interface.
Definition: scoreboard.cc:282
gem5::minor::Scoreboard::fuIndices
std::vector< int > fuIndices
Index of the FU generating this result.
Definition: scoreboard.hh:98
gem5::minor::Scoreboard::clearInstDests
void clearInstDests(MinorDynInstPtr inst, bool clear_unpredictable)
Clear down the dependencies for this instruction.
Definition: scoreboard.cc:174
gem5::minor::Scoreboard::findIndex
bool findIndex(const RegId &reg, Index &scoreboard_index)
Sets scoreboard_index to the index into numResults of the given register index.
Definition: scoreboard.cc:52
gem5::minor::Scoreboard::writingInst
std::vector< InstSeqNum > writingInst
The execute sequence number of the most recent inst to generate this register value.
Definition: scoreboard.hh:109
gem5::GEM5_DEPRECATED_NAMESPACE
GEM5_DEPRECATED_NAMESPACE(GuestABI, guest_abi)
gem5::minor::Scoreboard::Index
unsigned short int Index
Type to use when indexing numResults.
Definition: scoreboard.hh:88
gem5::minor::Scoreboard::ccRegOffset
const unsigned ccRegOffset
Definition: scoreboard.hh:73
gem5::X86ISA::reg
Bitfield< 5, 3 > reg
Definition: types.hh:92
gem5::minor::Scoreboard
A scoreboard of register dependencies including, for each register: The number of in-flight instructi...
Definition: scoreboard.hh:66
gem5::IntRegClass
@ IntRegClass
Integer register.
Definition: reg_class.hh:58
gem5::minor::Scoreboard::returnCycle
std::vector< Cycles > returnCycle
The estimated cycle number that the result will be presented.
Definition: scoreboard.hh:105
types.hh
gem5::minor::Scoreboard::execSeqNumToWaitFor
InstSeqNum execSeqNumToWaitFor(MinorDynInstPtr inst, ThreadContext *thread_context)
Returns the exec sequence number of the most recent inst on which the given inst depends.
Definition: scoreboard.cc:145
gem5::minor::Scoreboard::invalidFUIndex
static constexpr int invalidFUIndex
Definition: scoreboard.hh:99
reg_class.hh
gem5::InstSeqNum
uint64_t InstSeqNum
Definition: inst_seq.hh:40
gem5::RegIndex
uint16_t RegIndex
Definition: types.hh:176
trace.hh
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: tlb.cc:60
gem5::minor::Scoreboard::vecPredRegOffset
const unsigned vecPredRegOffset
Definition: scoreboard.hh:75
gem5::minor::Scoreboard::floatRegOffset
const unsigned floatRegOffset
Definition: scoreboard.hh:72
gem5::RegId
Register ID: describe an architectural register with its class and index.
Definition: reg_class.hh:113

Generated on Tue Dec 21 2021 11:34:26 for gem5 by doxygen 1.8.17