@@ -30,67 +30,64 @@ class BTBITTAGE : public TimedBaseBTBPredictor
3030{
3131 using defer = std::shared_ptr<void >;
3232 using bitset = boost::dynamic_bitset<>;
33-
3433 public:
3534 typedef BTBITTAGEParams Params;
3635
3736 struct TageEntry
3837 {
39- public:
40- bool valid;
41- Addr tag;
42- Addr target;
43- short counter;
44- bool useful;
45- Addr pc; // TODO: should use lowest bits only
46-
47- TageEntry () : valid(false ), tag(0 ), target(0 ), counter(0 ), useful(false ), pc(0 ) {}
48-
49- TageEntry (Addr tag, Addr target, short counter, Addr pc)
50- : valid(true ), tag(tag), target(target), counter(counter), useful(false ), pc(pc)
51- {
52- }
53- bool taken () { return counter >= 2 ; }
38+ public:
39+ bool valid;
40+ Addr tag;
41+ Addr target;
42+ short counter;
43+ bool useful;
44+ Addr pc; // TODO: should use lowest bits only
45+
46+ TageEntry () : valid(false ), tag(0 ), target(0 ), counter(0 ), useful(false ), pc(0 ) {}
47+
48+ TageEntry (Addr tag, Addr target, short counter, Addr pc) :
49+ valid (true ), tag(tag), target(target), counter(counter), useful(false ), pc(pc) {}
50+ bool taken () {
51+ return counter >= 2 ;
52+ }
5453 };
5554
5655 struct TageTableInfo
5756 {
58- public:
59- bool found;
60- TageEntry entry;
61- unsigned table;
62- Addr index;
63- Addr tag;
64- TageTableInfo () : found(false ), table(0 ), index(0 ), tag(0 ) {}
65- TageTableInfo (bool found, TageEntry entry, unsigned table, Addr index, Addr tag)
66- : found(found), entry(entry), table(table), index(index), tag(tag)
67- {
68- }
69- bool taken () { return entry.taken (); }
57+ public:
58+ bool found;
59+ TageEntry entry;
60+ unsigned table;
61+ Addr index;
62+ Addr tag;
63+ TageTableInfo () : found(false ), table(0 ), index(0 ), tag(0 ) {}
64+ TageTableInfo (bool found, TageEntry entry, unsigned table, Addr index, Addr tag) :
65+ found (found), entry(entry), table(table), index(index), tag(tag) {}
66+ bool taken () { return entry.taken (); }
7067 };
7168
7269 struct TagePrediction
7370 {
74- public:
75- Addr btb_pc;
76- TageTableInfo mainInfo;
77- TageTableInfo altInfo;
78-
79- bool useAlt;
80- // bitset usefulMask;
81- // bool taken;
82- Addr target;
83-
84- TagePrediction () : btb_pc(0 ), useAlt(false ), target(0 ) {}
85-
86- TagePrediction (Addr btb_pc, TageTableInfo mainInfo, TageTableInfo altInfo, bool useAlt, Addr target)
87- : btb_pc(btb_pc), mainInfo(mainInfo), altInfo(altInfo), useAlt(useAlt), target(target)
88- {
89- }
71+ public:
72+ Addr btb_pc;
73+ TageTableInfo mainInfo;
74+ TageTableInfo altInfo;
75+
76+ bool useAlt;
77+ // bitset usefulMask;
78+ // bool taken;
79+ Addr target;
80+
81+ TagePrediction () : btb_pc(0 ), useAlt(false ), target(0 ) {}
82+
83+ TagePrediction (Addr btb_pc, TageTableInfo mainInfo, TageTableInfo altInfo,
84+ bool useAlt, Addr target) :
85+ btb_pc (btb_pc), mainInfo(mainInfo), altInfo(altInfo),
86+ useAlt (useAlt), target(target) { }
9087 };
9188
9289 public:
93- BTBITTAGE (const Params & p);
90+ BTBITTAGE (const Params& p);
9491
9592 void tickStart () override ;
9693
@@ -124,8 +121,8 @@ class BTBITTAGE : public TimedBaseBTBPredictor
124121
125122 // Recover 3 folded history after a misprediction, then update 3 folded history according to history and pred.taken
126123 // the other recoverHist methods are left blank
127- void recoverPHist (const boost::dynamic_bitset<> &history, const FetchTarget &entry, int shamt,
128- bool cond_taken) override ;
124+ void recoverPHist (const boost::dynamic_bitset<> &history,
125+ const FetchTarget &entry, int shamt, bool cond_taken) override ;
129126
130127 void update (const FetchTarget &entry) override ;
131128
@@ -150,7 +147,9 @@ class BTBITTAGE : public TimedBaseBTBPredictor
150147 // use blockPC (uint64_t version for performance)
151148 Addr getTageTag (Addr pc, int table, uint64_t foldedHist, uint64_t altFoldedHist);
152149
153- Addr getOffset (Addr pc) { return (pc & (blockSize - 1 )) >> 1 ; }
150+ Addr getOffset (Addr pc) {
151+ return (pc & (blockSize - 1 )) >> 1 ;
152+ }
154153
155154 // Update branch history
156155 void doUpdateHist (const bitset &history, bool taken, Addr pc, Addr target);
@@ -188,7 +187,7 @@ class BTBITTAGE : public TimedBaseBTBPredictor
188187
189188 unsigned numBr;
190189
191- unsigned instShiftAmt{1 };
190+ unsigned instShiftAmt {1 };
192191
193192 void updateCounter (bool taken, unsigned width, short &counter);
194193
@@ -229,7 +228,7 @@ class BTBITTAGE : public TimedBaseBTBPredictor
229228 statistics::Distribution updateTableHits;
230229
231230 int numPredictors;
232- IttageStats (statistics::Group * parent, int numPredictors);
231+ IttageStats (statistics::Group* parent, int numPredictors);
233232#endif
234233 Scalar commitHits;
235234 Scalar callHits;
@@ -277,12 +276,12 @@ class BTBITTAGE : public TimedBaseBTBPredictor
277276
278277 std::shared_ptr<TageMeta> meta;
279278
280- public:
279+ public:
281280 Addr debugPC = 0 ;
282281 Addr debugPC2 = 0 ;
283282 bool debugFlag = false ;
284283
285- void recoverFoldedHist (const bitset & history);
284+ void recoverFoldedHist (const bitset& history);
286285 bool tageHit ();
287286
288287 // void checkFoldedHist(const bitset& history);
0 commit comments