1 | #ifndef morpheo_behavioural_core_multi_front_end_front_end_prediction_unit_direction_meta_predictor_two_level_branch_predictor_Two_Level_Branch_Predictor_h |
---|
2 | #define morpheo_behavioural_core_multi_front_end_front_end_prediction_unit_direction_meta_predictor_two_level_branch_predictor_Two_Level_Branch_Predictor_h |
---|
3 | |
---|
4 | /* |
---|
5 | * $Id: Two_Level_Branch_Predictor.h 131 2009-07-08 18:40:08Z rosiere $ |
---|
6 | * |
---|
7 | * [ Description ] |
---|
8 | * |
---|
9 | */ |
---|
10 | |
---|
11 | #ifdef SYSTEMC |
---|
12 | #include "systemc.h" |
---|
13 | #endif |
---|
14 | |
---|
15 | |
---|
16 | #include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/include/Parameters.h" |
---|
17 | #include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/include/Types.h" |
---|
18 | #ifdef STATISTICS |
---|
19 | #include "Behavioural/include/Stat.h" |
---|
20 | #endif |
---|
21 | #include "Behavioural/include/Component.h" |
---|
22 | #ifdef VHDL |
---|
23 | #include "Behavioural/include/Vhdl.h" |
---|
24 | #endif |
---|
25 | #include "Behavioural/include/Usage.h" |
---|
26 | |
---|
27 | #include "Common/include/ToString.h" |
---|
28 | #include "Common/include/Debug.h" |
---|
29 | |
---|
30 | #include <iostream> |
---|
31 | |
---|
32 | namespace morpheo { |
---|
33 | namespace behavioural { |
---|
34 | |
---|
35 | namespace core { |
---|
36 | namespace multi_front_end { |
---|
37 | namespace front_end { |
---|
38 | namespace prediction_unit { |
---|
39 | namespace direction { |
---|
40 | namespace meta_predictor { |
---|
41 | namespace two_level_branch_predictor { |
---|
42 | |
---|
43 | |
---|
44 | class Two_Level_Branch_Predictor |
---|
45 | #if SYSTEMC |
---|
46 | : public sc_module |
---|
47 | #endif |
---|
48 | { |
---|
49 | // -----[ fields ]---------------------------------------------------- |
---|
50 | // Parameters |
---|
51 | protected : const std::string _name; |
---|
52 | protected : const Parameters * _param; |
---|
53 | private : const Tusage_t _usage; |
---|
54 | |
---|
55 | #ifdef STATISTICS |
---|
56 | public : Stat * _stat; |
---|
57 | #endif |
---|
58 | |
---|
59 | public : Component * _component; |
---|
60 | private : Interfaces * _interfaces; |
---|
61 | |
---|
62 | #ifdef SYSTEMC |
---|
63 | // ~~~~~[ Interface ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
64 | // ~~~~~[ Interface : "" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
65 | public : SC_CLOCK * in_CLOCK ; |
---|
66 | public : SC_IN (Tcontrol_t) * in_NRESET ; |
---|
67 | |
---|
68 | // ~~~~~[ Interface : "predict" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
69 | public : SC_IN (Tcontrol_t) ** in_PREDICT_VAL ;//[nb_inst_predict] |
---|
70 | public : SC_OUT(Tcontrol_t) ** out_PREDICT_ACK ;//[nb_inst_predict] |
---|
71 | public : SC_IN (Taddress_t) ** in_PREDICT_ADDRESS ;//[nb_inst_predict] |
---|
72 | public : SC_OUT(Tcontrol_t) ** out_PREDICT_DIRECTION ;//[nb_inst_predict] // = MSB[history] |
---|
73 | public : SC_OUT(Thistory_t) ** out_PREDICT_HISTORY ;//[nb_inst_predict] |
---|
74 | public : SC_IN (Tcontrol_t) ** in_PREDICT_DIRECTION_VAL;//[nb_inst_predict] // if update_on_prediction |
---|
75 | public : SC_IN (Tcontrol_t) ** in_PREDICT_DIRECTION ;//[nb_inst_predict] // if update_on_prediction |
---|
76 | |
---|
77 | // ~~~~~[ Interface : "update" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
78 | public : SC_IN (Tcontrol_t) ** in_UPDATE_VAL ;//[nb_inst_update] |
---|
79 | public : SC_OUT(Tcontrol_t) ** out_UPDATE_ACK ;//[nb_inst_update] |
---|
80 | public : SC_IN (Taddress_t) ** in_UPDATE_ADDRESS ;//[nb_inst_update] |
---|
81 | public : SC_IN (Thistory_t) ** in_UPDATE_HISTORY ;//[nb_inst_update] |
---|
82 | public : SC_IN (Tcontrol_t) ** in_UPDATE_HISTORY_VAL ;//[nb_inst_update] |
---|
83 | public : SC_IN (Tcontrol_t) ** in_UPDATE_DIRECTION ;//[nb_inst_update] |
---|
84 | public : SC_IN (Tcontrol_t) ** in_UPDATE_MISS ;//[nb_inst_update] // if update_on_prediction |
---|
85 | |
---|
86 | // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
87 | |
---|
88 | // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
89 | private : Thistory_t * reg_BHT ;//[bht_nb_shifter] |
---|
90 | private : Thistory_t ** reg_PHT ;//[pht_nb_bank][pht_size_bank] |
---|
91 | |
---|
92 | // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
93 | private : Tcontrol_t * internal_PREDICT_ACK ;//[nb_inst_predict] |
---|
94 | private : Thistory_t * internal_PREDICT_BHT_NUM_REG ;//[nb_inst_predict] // if update_on_prediction |
---|
95 | private : Thistory_t * internal_PREDICT_PHT_NUM_BANK ;//[nb_inst_predict] // if update_on_prediction |
---|
96 | private : Thistory_t * internal_PREDICT_PHT_NUM_REG ;//[nb_inst_predict] // if update_on_prediction |
---|
97 | |
---|
98 | private : Tcontrol_t * internal_UPDATE_ACK ;//[nb_inst_update] |
---|
99 | #endif |
---|
100 | |
---|
101 | // -----[ Methods ]--------------------------------------------------- |
---|
102 | |
---|
103 | #ifdef SYSTEMC |
---|
104 | SC_HAS_PROCESS (Two_Level_Branch_Predictor); |
---|
105 | #endif |
---|
106 | public : Two_Level_Branch_Predictor |
---|
107 | ( |
---|
108 | #ifdef SYSTEMC |
---|
109 | sc_module_name name, |
---|
110 | #else |
---|
111 | std::string name, |
---|
112 | #endif |
---|
113 | #ifdef STATISTICS |
---|
114 | morpheo::behavioural::Parameters_Statistics * param_statistics, |
---|
115 | #endif |
---|
116 | Parameters * param, |
---|
117 | morpheo::behavioural::Tusage_t usage |
---|
118 | ); |
---|
119 | public : ~Two_Level_Branch_Predictor (void); |
---|
120 | |
---|
121 | private : void allocation ( |
---|
122 | #ifdef STATISTICS |
---|
123 | morpheo::behavioural::Parameters_Statistics * param_statistics |
---|
124 | #else |
---|
125 | void |
---|
126 | #endif |
---|
127 | ); |
---|
128 | private : void deallocation (void); |
---|
129 | |
---|
130 | #ifdef SYSTEMC |
---|
131 | public : void constant (void); |
---|
132 | public : void transition (void); |
---|
133 | public : void genMealy_predict (void); |
---|
134 | #endif |
---|
135 | |
---|
136 | #if VHDL |
---|
137 | public : void vhdl (void); |
---|
138 | private : void vhdl_declaration (Vhdl * & vhdl); |
---|
139 | private : void vhdl_body (Vhdl * & vhdl); |
---|
140 | #endif |
---|
141 | |
---|
142 | #ifdef STATISTICS |
---|
143 | public : void statistics_allocation (morpheo::behavioural::Parameters_Statistics * param_statistics); |
---|
144 | public : void statistics_deallocation (void); |
---|
145 | #endif |
---|
146 | #if defined(STATISTICS) or defined(VHDL_TESTBENCH) |
---|
147 | private : void end_cycle (void); |
---|
148 | #endif |
---|
149 | }; |
---|
150 | |
---|
151 | }; // end namespace two_level_branch_predictor |
---|
152 | }; // end namespace meta_predictor |
---|
153 | }; // end namespace direction |
---|
154 | }; // end namespace prediction_unit |
---|
155 | }; // end namespace front_end |
---|
156 | }; // end namespace multi_front_end |
---|
157 | }; // end namespace core |
---|
158 | |
---|
159 | }; // end namespace behavioural |
---|
160 | }; // end namespace morpheo |
---|
161 | |
---|
162 | #endif |
---|