@@ -30,74 +30,73 @@ 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;
71+ public:
72+ Addr btb_pc;
73+ TageTableInfo mainInfo;
74+ TageTableInfo altInfo;
7875
79- bool useAlt;
80- // bitset usefulMask;
81- // bool taken;
82- Addr target;
76+ bool useAlt;
77+ // bitset usefulMask;
78+ // bool taken;
79+ Addr target;
8380
84- TagePrediction () : btb_pc(0 ), useAlt(false ), target(0 ) {}
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) {}
8587
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- }
9088 };
9189
9290 public:
93- BTBITTAGE (const Params & p);
91+ BTBITTAGE (const Params& p);
9492
9593 void tickStart () override ;
9694
9795 void tick () override ;
9896 void dryRunCycle (Addr startAddr) override ;
9997 // make predictions, record in stage preds
100- void putPCHistory (Addr startAddr, const boost::dynamic_bitset<> &history,
98+ void putPCHistory (Addr startAddr,
99+ const boost::dynamic_bitset<> &history,
101100 std::vector<FullBTBPrediction> &stagePreds) override ;
102101 void putPCHistoryForBlock1 (Addr startAddr, const boost::dynamic_bitset<> &history,
103102 const boost::dynamic_bitset<> &phistory, const boost::dynamic_bitset<> &bwhistory,
@@ -124,8 +123,8 @@ class BTBITTAGE : public TimedBaseBTBPredictor
124123
125124 // Recover 3 folded history after a misprediction, then update 3 folded history according to history and pred.taken
126125 // 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 ;
126+ void recoverPHist (const boost::dynamic_bitset<> &history,
127+ const FetchTarget &entry, int shamt, bool cond_taken) override ;
129128
130129 void update (const FetchTarget &entry) override ;
131130
@@ -135,8 +134,9 @@ class BTBITTAGE : public TimedBaseBTBPredictor
135134 void checkFoldedHist (const bitset &history, const char *when);
136135
137136 private:
137+
138138 // return provided
139- void lookupHelper (Addr stream_start, const std::vector<BTBEntry> &btbEntries, IndirectTargets & results);
139+ void lookupHelper (Addr stream_start, const std::vector<BTBEntry> &btbEntries, IndirectTargets& results);
140140
141141 // use blockPC
142142 Addr getTageIndex (Addr pc, int table);
@@ -150,7 +150,9 @@ class BTBITTAGE : public TimedBaseBTBPredictor
150150 // use blockPC (uint64_t version for performance)
151151 Addr getTageTag (Addr pc, int table, uint64_t foldedHist, uint64_t altFoldedHist);
152152
153- Addr getOffset (Addr pc) { return (pc & (blockSize - 1 )) >> 1 ; }
153+ Addr getOffset (Addr pc) {
154+ return (pc & (blockSize - 1 )) >> 1 ;
155+ }
154156
155157 // Update branch history
156158 void doUpdateHist (const bitset &history, bool taken, Addr pc, Addr target);
@@ -188,7 +190,7 @@ class BTBITTAGE : public TimedBaseBTBPredictor
188190
189191 unsigned numBr;
190192
191- unsigned instShiftAmt{1 };
193+ unsigned instShiftAmt {1 };
192194
193195 void updateCounter (bool taken, unsigned width, short &counter);
194196
@@ -229,7 +231,7 @@ class BTBITTAGE : public TimedBaseBTBPredictor
229231 statistics::Distribution updateTableHits;
230232
231233 int numPredictors;
232- IttageStats (statistics::Group * parent, int numPredictors);
234+ IttageStats (statistics::Group* parent, int numPredictors);
233235#endif
234236 Scalar commitHits;
235237 Scalar callHits;
@@ -277,12 +279,13 @@ class BTBITTAGE : public TimedBaseBTBPredictor
277279
278280 std::shared_ptr<TageMeta> meta;
279281
280- public:
282+ public:
283+
281284 Addr debugPC = 0 ;
282285 Addr debugPC2 = 0 ;
283286 bool debugFlag = false ;
284287
285- void recoverFoldedHist (const bitset & history);
288+ void recoverFoldedHist (const bitset& history);
286289 bool tageHit ();
287290
288291 // void checkFoldedHist(const bitset& history);
0 commit comments