Deleted Added
sdiff udiff text old ( 13493:91ae6168ef27 ) new ( 13626:d6a6358aa6db )
full compact
1/*
2 * Copyright (c) 2014 The University of Wisconsin
3 *
4 * Copyright (c) 2006 INRIA (Institut National de Recherche en
5 * Informatique et en Automatique / French National Research Institute
6 * for Computer Science and Applied Mathematics)
7 *
8 * All rights reserved.

--- 52 unchanged lines hidden (view full) ---

61
62class LTAGE: public TAGE
63{
64 public:
65 LTAGE(const LTAGEParams *params);
66
67 // Base class methods.
68 void squash(ThreadID tid, void *bp_history) override;
69
70 void regStats() override;
71
72 private:
73 // Prediction Structures
74 // Loop Predictor Entry
75 struct LoopEntry
76 {

--- 6 unchanged lines hidden (view full) ---

83 bool dir; // only for useDirectionBit
84
85 LoopEntry() : numIter(0), currentIter(0), currentIterSpec(0),
86 confidence(0), tag(0), age(0), dir(0) { }
87 };
88
89 // more provider types
90 enum {
91 LOOP = LAST_TAGE_PROVIDER_TYPE + 1
92 };
93
94 // Primary branch history entry
95 struct LTageBranchInfo : public TageBranchInfo
96 {
97 uint16_t loopTag;
98 uint16_t currentIter;
99
100 bool loopPred;
101 bool loopPredValid;
102 int loopIndex;
103 int loopLowPcBits; // only for useHashing
104 int loopHit;
105
106 LTageBranchInfo(int sz)
107 : TageBranchInfo(sz),
108 loopTag(0), currentIter(0),
109 loopPred(false),
110 loopPredValid(false), loopIndex(0), loopLowPcBits(0), loopHit(0)
111 {}
112 };
113
114 /**
115 * Computes the index used to access the
116 * loop predictor.
117 * @param pc_in The unshifted branch PC.
118 */
119 int lindex(Addr pc_in) const;

--- 32 unchanged lines hidden (view full) ---

152 * iteration count (only for useSpeculation).
153 * @param taken The predicted branch outcome.
154 * @param bi Pointer to information on the prediction
155 * recorded at prediction time.
156 */
157 void specLoopUpdate(bool taken, LTageBranchInfo* bi);
158
159 /**
160 * Update LTAGE for conditional branches.
161 * @param branch_pc The unshifted branch PC.
162 * @param taken Actual branch outcome.
163 * @param bi Pointer to information on the prediction
164 * recorded at prediction time.
165 * @nrand Random int number from 0 to 3
166 */
167 void condBranchUpdate(
168 Addr branch_pc, bool taken, TageBranchInfo* bi, int nrand) override;
169
170 /**
171 * Get a branch prediction from LTAGE. *NOT* an override of
172 * BpredUnit::predict().
173 * @param tid The thread ID to select the global
174 * histories to use.
175 * @param branch_pc The unshifted branch PC.
176 * @param cond_branch True if the branch is conditional.
177 * @param b Reference to wrapping pointer to allow storing
178 * derived class prediction information in the base class.
179 */
180 bool predict(
181 ThreadID tid, Addr branch_pc, bool cond_branch, void* &b) override;
182
183 /**
184 * Restores speculatively updated path and direction histories.
185 * Also recomputes compressed (folded) histories based on the
186 * correct branch outcome.
187 * This version of squash() is called once on a branch misprediction.
188 * @param tid The Thread ID to select the histories to rollback.
189 * @param taken The correct branch outcome.
190 * @param bp_history Wrapping pointer to TageBranchInfo (to allow
191 * storing derived class prediction information in the
192 * base class).
193 * @post bp_history points to valid memory.
194 */
195 void squash(
196 ThreadID tid, bool taken, void *bp_history) override;
197
198 /**
199 * Update the stats
200 * @param taken Actual branch outcome
201 * @param bi Pointer to information on the prediction
202 * recorded at prediction time.
203 */
204 void updateStats(bool taken, TageBranchInfo* bi) override;
205
206 const unsigned logSizeLoopPred;
207 const unsigned loopTableAgeBits;
208 const unsigned loopTableConfidenceBits;
209 const unsigned loopTableTagBits;
210 const unsigned loopTableIterBits;
211 const unsigned logLoopTableAssoc;
212 const uint8_t confidenceThreshold;
213 const uint16_t loopTagMask;

--- 18 unchanged lines hidden ---