1
+ #include " TAGE_SC_L.hpp"
2
+
3
+ namespace olympia
4
+ {
5
+ namespace BranchPredictor
6
+ {
7
+
8
+ // Tage Tagged Component Entry
9
+ TageTaggedComponentEntry::TageTaggedComponentEntry (uint8_t tage_ctr_bits,
10
+ uint8_t tage_useful_bits) :
11
+ tage_ctr_bits_ (tage_ctr_bits),
12
+ tage_useful_bits_ (tage_useful_bits)
13
+ {
14
+ }
15
+
16
+ void TageTaggedComponentEntry::incrementCtr () {}
17
+
18
+ void TageTaggedComponentEntry::decrementCtr () {}
19
+
20
+ void TageTaggedComponentEntry::incrementUseful () {}
21
+
22
+ void TageTaggedComponentEntry::decrementUseful () {}
23
+
24
+ // Tagged component
25
+ TageTaggedComponent::TageTaggedComponent (uint8_t tage_ctr_bits, uint8_t tage_useful_bits,
26
+ uint16_t num_tagged_entry) :
27
+ tage_ctr_bits_ (tage_ctr_bits),
28
+ tage_useful_bits_ (tage_useful_bits),
29
+ num_tagged_entry_ (num_tagged_entry),
30
+ tage_tagged_component_ (num_tagged_entry_, {tage_ctr_bits_, tage_useful_bits_})
31
+ {
32
+ }
33
+
34
+ // Tage Bimodal
35
+ TageBIM::TageBIM (uint32_t tage_bim_table_size, uint8_t tage_base_ctr_bits) :
36
+ tage_bim_table_size_ (tage_bim_table_size),
37
+ tage_base_ctr_bits_ (tage_base_ctr_bits)
38
+ {
39
+ // recheck value
40
+ tage_base_max_ctr_ = 2 << tage_base_ctr_bits_;
41
+
42
+ // initialize counter at all index to be 0
43
+ for (auto & val : Tage_Bimodal_)
44
+ {
45
+ val = 0 ;
46
+ }
47
+ }
48
+
49
+ void TageBIM::incrementCtr (uint32_t ip)
50
+ {
51
+ if (Tage_Bimodal_[ip] < tage_base_max_ctr_)
52
+ {
53
+ Tage_Bimodal_[ip]++;
54
+ }
55
+ }
56
+
57
+ void TageBIM::decrementCtr (uint32_t ip)
58
+ {
59
+ if (Tage_Bimodal_[ip] > 0 )
60
+ {
61
+ Tage_Bimodal_[ip]--;
62
+ }
63
+ }
64
+
65
+ uint8_t TageBIM::getPrediction (uint32_t ip) { return Tage_Bimodal_[ip]; }
66
+
67
+ // TAGE
68
+ Tage::Tage (uint32_t tage_bim_table_size, uint8_t tage_bim_ctr_bits,
69
+ uint8_t tage_tagged_ctr_bits, uint8_t tage_tagged_useful_bits,
70
+ uint8_t num_tage_component) :
71
+ tage_bim_table_size_ (tage_bim_table_size),
72
+ tage_bim_ctr_bits_ (tage_bim_ctr_bits),
73
+ tage_tagged_ctr_bits_ (tage_tagged_ctr_bits),
74
+ tage_tagged_useful_bits_ (tage_tagged_useful_bits),
75
+ num_tage_component_ (num_tage_component),
76
+ tage_bim_ (tage_bim_table_size_, tage_bim_table_size_),
77
+ // for now number of tagged component entry in each component is set as 10
78
+ tage_tagged_components_ (num_tage_component_,
79
+ {tage_tagged_ctr_bits_, tage_tagged_useful_bits_, 10 })
80
+ {
81
+ }
82
+ } // namespace BranchPredictor
83
+ } // namespace olympia
0 commit comments