1 | /* |
---|
2 | * $Id$ |
---|
3 | * |
---|
4 | * [ Description ] |
---|
5 | * |
---|
6 | */ |
---|
7 | |
---|
8 | #include "Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/Meta_Predictor_Glue/include/Meta_Predictor_Glue.h" |
---|
9 | |
---|
10 | namespace morpheo { |
---|
11 | namespace behavioural { |
---|
12 | namespace stage_1_ifetch { |
---|
13 | namespace predictor { |
---|
14 | namespace meta_predictor { |
---|
15 | namespace meta_predictor_glue { |
---|
16 | |
---|
17 | |
---|
18 | #ifdef SYSTEMC |
---|
19 | Meta_Predictor_Glue::Meta_Predictor_Glue (sc_module_name name, |
---|
20 | #else |
---|
21 | Meta_Predictor_Glue::Meta_Predictor_Glue (string name, |
---|
22 | #endif |
---|
23 | #ifdef STATISTICS |
---|
24 | morpheo::behavioural::Parameters_Statistics param_statistics, |
---|
25 | #endif |
---|
26 | morpheo::behavioural::stage_1_ifetch::predictor::meta_predictor::meta_predictor_glue::Parameters param ): |
---|
27 | _name (name) |
---|
28 | ,_param (param) |
---|
29 | // #ifdef STATISTICS |
---|
30 | // ,_param_statistics (param_statistics) |
---|
31 | // #endif |
---|
32 | { |
---|
33 | log_printf(FUNC,Meta_Predictor_Glue,"Meta_Predictor_Glue","Begin"); |
---|
34 | |
---|
35 | log_printf(INFO,Meta_Predictor_Glue,"Meta_Predictor_Glue","Allocation"); |
---|
36 | allocation (); |
---|
37 | |
---|
38 | #ifdef STATISTICS |
---|
39 | log_printf(INFO,Meta_Predictor_Glue,"Meta_Predictor_Glue","Allocation of statistics"); |
---|
40 | |
---|
41 | // Allocation of statistics |
---|
42 | _stat = new Statistics (static_cast<string>(_name), |
---|
43 | param_statistics , |
---|
44 | param); |
---|
45 | #endif |
---|
46 | |
---|
47 | #ifdef VHDL |
---|
48 | // generate the vhdl |
---|
49 | log_printf(INFO,Meta_Predictor_Glue,"Meta_Predictor_Glue","VHDL's generation"); |
---|
50 | vhdl(); |
---|
51 | #endif |
---|
52 | |
---|
53 | #ifdef SYSTEMC |
---|
54 | #if defined(STATISTICS) or defined(VHDL_TESTBENCH) |
---|
55 | log_printf(INFO,Meta_Predictor_Glue,"Meta_Predictor_Glue","method - transition"); |
---|
56 | |
---|
57 | SC_METHOD (transition); |
---|
58 | dont_initialize (); |
---|
59 | sensitive_pos << *(in_CLOCK); |
---|
60 | #endif |
---|
61 | |
---|
62 | log_printf(INFO,Meta_Predictor_Glue,"Meta_Predictor_Glue","method - genMealy_predict_ack"); |
---|
63 | SC_METHOD (genMealy_predict_ack); |
---|
64 | dont_initialize (); |
---|
65 | for (uint32_t i=0; i<_param._nb_prediction; i++) |
---|
66 | { |
---|
67 | sensitive << *(in_PREDICT_PREDICTOR_2_ACK [i]); |
---|
68 | |
---|
69 | if (_param._have_meta_predictor) |
---|
70 | { |
---|
71 | sensitive << *(in_PREDICT_PREDICTOR_0_ACK [i]) |
---|
72 | << *(in_PREDICT_PREDICTOR_1_ACK [i]); |
---|
73 | } |
---|
74 | } |
---|
75 | |
---|
76 | #ifdef SYSTEMCASS_SPECIFIC |
---|
77 | // List dependency information |
---|
78 | for (uint32_t i=0; i<_param._nb_prediction; i++) |
---|
79 | { |
---|
80 | (*(out_PREDICT_ACK [i])) (*(in_PREDICT_PREDICTOR_2_ACK [i])); |
---|
81 | |
---|
82 | if (_param._have_meta_predictor) |
---|
83 | { |
---|
84 | (*(out_PREDICT_ACK [i])) (*(in_PREDICT_PREDICTOR_0_ACK [i])); |
---|
85 | (*(out_PREDICT_ACK [i])) (*(in_PREDICT_PREDICTOR_1_ACK [i])); |
---|
86 | } |
---|
87 | } |
---|
88 | #endif |
---|
89 | |
---|
90 | log_printf(INFO,Meta_Predictor_Glue,"Meta_Predictor_Glue","method - genMealy_predict_history"); |
---|
91 | SC_METHOD (genMealy_predict_history); |
---|
92 | dont_initialize (); |
---|
93 | for (uint32_t i=0; i<_param._nb_prediction; i++) |
---|
94 | { |
---|
95 | if (_param._predictor_2_have_bht) |
---|
96 | sensitive << *(in_PREDICT_PREDICTOR_2_BHT_HISTORY [i]); |
---|
97 | if (_param._predictor_2_have_pht) |
---|
98 | sensitive << *(in_PREDICT_PREDICTOR_2_PHT_HISTORY [i]); |
---|
99 | |
---|
100 | if (_param._have_meta_predictor) |
---|
101 | { |
---|
102 | if (_param._predictor_1_have_bht) |
---|
103 | sensitive << *(in_PREDICT_PREDICTOR_1_BHT_HISTORY [i]); |
---|
104 | if (_param._predictor_1_have_pht) |
---|
105 | sensitive << *(in_PREDICT_PREDICTOR_1_PHT_HISTORY [i]); |
---|
106 | |
---|
107 | if (_param._predictor_0_have_bht) |
---|
108 | sensitive << *(in_PREDICT_PREDICTOR_0_BHT_HISTORY [i]); |
---|
109 | if (_param._predictor_0_have_pht) |
---|
110 | sensitive << *(in_PREDICT_PREDICTOR_0_PHT_HISTORY [i]); |
---|
111 | } |
---|
112 | } |
---|
113 | |
---|
114 | #ifdef SYSTEMCASS_SPECIFIC |
---|
115 | // List dependency information |
---|
116 | for (uint32_t i=0; i<_param._nb_prediction; i++) |
---|
117 | { |
---|
118 | if (_param._predictor_2_have_bht) |
---|
119 | (*(out_PREDICT_HISTORY [i])) (*(in_PREDICT_PREDICTOR_2_BHT_HISTORY [i])); |
---|
120 | if (_param._predictor_2_have_pht) |
---|
121 | (*(out_PREDICT_HISTORY [i])) (*(in_PREDICT_PREDICTOR_2_PHT_HISTORY [i])); |
---|
122 | |
---|
123 | if (_param._have_meta_predictor) |
---|
124 | { |
---|
125 | if (_param._predictor_1_have_bht) |
---|
126 | (*(out_PREDICT_HISTORY [i])) (*(in_PREDICT_PREDICTOR_1_BHT_HISTORY [i])); |
---|
127 | if (_param._predictor_1_have_pht) |
---|
128 | (*(out_PREDICT_HISTORY [i])) (*(in_PREDICT_PREDICTOR_1_PHT_HISTORY [i])); |
---|
129 | |
---|
130 | if (_param._predictor_0_have_bht) |
---|
131 | (*(out_PREDICT_HISTORY [i])) (*(in_PREDICT_PREDICTOR_0_BHT_HISTORY [i])); |
---|
132 | if (_param._predictor_0_have_pht) |
---|
133 | (*(out_PREDICT_HISTORY [i])) (*(in_PREDICT_PREDICTOR_0_PHT_HISTORY [i])); |
---|
134 | } |
---|
135 | |
---|
136 | if (_param._predictor_2_have_bht) |
---|
137 | (*(out_PREDICT_DIRECTION [i])) (*(in_PREDICT_PREDICTOR_2_BHT_HISTORY [i])); |
---|
138 | if (_param._predictor_2_have_pht) |
---|
139 | (*(out_PREDICT_DIRECTION [i])) (*(in_PREDICT_PREDICTOR_2_PHT_HISTORY [i])); |
---|
140 | |
---|
141 | if (_param._have_meta_predictor) |
---|
142 | { |
---|
143 | if (_param._predictor_1_have_bht) |
---|
144 | (*(out_PREDICT_DIRECTION [i])) (*(in_PREDICT_PREDICTOR_1_BHT_HISTORY [i])); |
---|
145 | if (_param._predictor_1_have_pht) |
---|
146 | (*(out_PREDICT_DIRECTION [i])) (*(in_PREDICT_PREDICTOR_1_PHT_HISTORY [i])); |
---|
147 | |
---|
148 | if (_param._predictor_0_have_bht) |
---|
149 | (*(out_PREDICT_DIRECTION [i])) (*(in_PREDICT_PREDICTOR_0_BHT_HISTORY [i])); |
---|
150 | if (_param._predictor_0_have_pht) |
---|
151 | (*(out_PREDICT_DIRECTION [i])) (*(in_PREDICT_PREDICTOR_0_PHT_HISTORY [i])); |
---|
152 | } |
---|
153 | } |
---|
154 | #endif |
---|
155 | |
---|
156 | if (_param._have_meta_predictor) |
---|
157 | { |
---|
158 | log_printf(INFO,Meta_Predictor_Glue,"Meta_Predictor_Glue","method - genMealy_branch_complete_val"); |
---|
159 | SC_METHOD (genMealy_branch_complete_val); |
---|
160 | dont_initialize (); |
---|
161 | for (uint32_t i=0; i<_param._nb_branch_complete; i++) |
---|
162 | { |
---|
163 | sensitive << *(in_BRANCH_COMPLETE_VAL [i]) |
---|
164 | << *(in_BRANCH_COMPLETE_HISTORY [i]) |
---|
165 | << *(in_BRANCH_COMPLETE_DIRECTION [i]); |
---|
166 | } |
---|
167 | |
---|
168 | #ifdef SYSTEMCASS_SPECIFIC |
---|
169 | // List dependency information |
---|
170 | for (uint32_t i=0; i<_param._nb_branch_complete; i++) |
---|
171 | { |
---|
172 | (*(out_BRANCH_COMPLETE_PREDICTOR_2_VAL [i])) (*(in_BRANCH_COMPLETE_VAL [i])); |
---|
173 | (*(out_BRANCH_COMPLETE_PREDICTOR_2_VAL [i])) (*(in_BRANCH_COMPLETE_HISTORY [i])); |
---|
174 | (*(out_BRANCH_COMPLETE_PREDICTOR_2_VAL [i])) (*(in_BRANCH_COMPLETE_DIRECTION [i])); |
---|
175 | |
---|
176 | (*(out_BRANCH_COMPLETE_PREDICTOR_2_DIRECTION [i])) (*(in_BRANCH_COMPLETE_VAL [i])); |
---|
177 | (*(out_BRANCH_COMPLETE_PREDICTOR_2_DIRECTION [i])) (*(in_BRANCH_COMPLETE_HISTORY [i])); |
---|
178 | (*(out_BRANCH_COMPLETE_PREDICTOR_2_DIRECTION [i])) (*(in_BRANCH_COMPLETE_DIRECTION [i])); |
---|
179 | } |
---|
180 | #endif |
---|
181 | } |
---|
182 | |
---|
183 | log_printf(INFO,Meta_Predictor_Glue,"Meta_Predictor_Glue","method - genMealy_branch_complete_ack"); |
---|
184 | SC_METHOD (genMealy_branch_complete_ack); |
---|
185 | dont_initialize (); |
---|
186 | for (uint32_t i=0; i<_param._nb_branch_complete; i++) |
---|
187 | { |
---|
188 | sensitive << *(in_BRANCH_COMPLETE_PREDICTOR_2_ACK [i]); |
---|
189 | |
---|
190 | if (_param._have_meta_predictor) |
---|
191 | { |
---|
192 | sensitive << *(in_BRANCH_COMPLETE_PREDICTOR_0_ACK [i]) |
---|
193 | << *(in_BRANCH_COMPLETE_PREDICTOR_1_ACK [i]); |
---|
194 | } |
---|
195 | } |
---|
196 | |
---|
197 | #ifdef SYSTEMCASS_SPECIFIC |
---|
198 | // List dependency information |
---|
199 | for (uint32_t i=0; i<_param._nb_branch_complete; i++) |
---|
200 | { |
---|
201 | (*(out_BRANCH_COMPLETE_ACK [i])) (*(in_BRANCH_COMPLETE_PREDICTOR_2_ACK [i])); |
---|
202 | |
---|
203 | if (_param._have_meta_predictor) |
---|
204 | { |
---|
205 | (*(out_BRANCH_COMPLETE_ACK [i])) (*(in_BRANCH_COMPLETE_PREDICTOR_0_ACK [i])); |
---|
206 | (*(out_BRANCH_COMPLETE_ACK [i])) (*(in_BRANCH_COMPLETE_PREDICTOR_1_ACK [i])); |
---|
207 | } |
---|
208 | } |
---|
209 | #endif |
---|
210 | |
---|
211 | log_printf(INFO,Meta_Predictor_Glue,"Meta_Predictor_Glue","method - genMealy_branch_complete_history"); |
---|
212 | SC_METHOD (genMealy_branch_complete_history); |
---|
213 | dont_initialize (); |
---|
214 | for (uint32_t i=0; i<_param._nb_branch_complete; i++) |
---|
215 | { |
---|
216 | sensitive << *(in_BRANCH_COMPLETE_HISTORY [i]); |
---|
217 | } |
---|
218 | |
---|
219 | #ifdef SYSTEMCASS_SPECIFIC |
---|
220 | // List dependency information |
---|
221 | for (uint32_t i=0; i<_param._nb_branch_complete; i++) |
---|
222 | { |
---|
223 | if (_param._predictor_2_have_bht) |
---|
224 | (*(out_BRANCH_COMPLETE_PREDICTOR_2_BHT_HISTORY [i])) (*( in_BRANCH_COMPLETE_HISTORY [i])); |
---|
225 | if (_param._predictor_2_have_pht) |
---|
226 | (*(out_BRANCH_COMPLETE_PREDICTOR_2_PHT_HISTORY [i])) (*( in_BRANCH_COMPLETE_HISTORY [i])); |
---|
227 | |
---|
228 | if (_param._have_meta_predictor) |
---|
229 | { |
---|
230 | if (_param._predictor_1_have_bht) |
---|
231 | (*(out_BRANCH_COMPLETE_PREDICTOR_1_BHT_HISTORY [i])) (*( in_BRANCH_COMPLETE_HISTORY [i])); |
---|
232 | if (_param._predictor_1_have_pht) |
---|
233 | (*(out_BRANCH_COMPLETE_PREDICTOR_1_PHT_HISTORY [i])) (*( in_BRANCH_COMPLETE_HISTORY [i])); |
---|
234 | |
---|
235 | if (_param._predictor_0_have_bht) |
---|
236 | (*(out_BRANCH_COMPLETE_PREDICTOR_0_BHT_HISTORY [i])) (*( in_BRANCH_COMPLETE_HISTORY [i])); |
---|
237 | if (_param._predictor_0_have_pht) |
---|
238 | (*(out_BRANCH_COMPLETE_PREDICTOR_0_PHT_HISTORY [i])) (*( in_BRANCH_COMPLETE_HISTORY [i])); |
---|
239 | } |
---|
240 | } |
---|
241 | #endif |
---|
242 | |
---|
243 | #endif |
---|
244 | log_printf(FUNC,Meta_Predictor_Glue,"Meta_Predictor_Glue","End"); |
---|
245 | }; |
---|
246 | |
---|
247 | Meta_Predictor_Glue::~Meta_Predictor_Glue (void) |
---|
248 | { |
---|
249 | log_printf(FUNC,Meta_Predictor_Glue,"~Meta_Predictor_Glue","Begin"); |
---|
250 | |
---|
251 | #ifdef STATISTICS |
---|
252 | log_printf(INFO,Meta_Predictor_Glue,"~Meta_Predictor_Glue","Generate Statistics"); |
---|
253 | _stat->generate_file(statistics(0)); |
---|
254 | |
---|
255 | delete _stat; |
---|
256 | #endif |
---|
257 | |
---|
258 | #ifdef SYSTEMC |
---|
259 | log_printf(INFO,Meta_Predictor_Glue,"~Meta_Predictor_Glue","Dealocation"); |
---|
260 | deallocation (); |
---|
261 | #endif |
---|
262 | |
---|
263 | log_printf(FUNC,Meta_Predictor_Glue,"~Meta_Predictor_Glue","End"); |
---|
264 | }; |
---|
265 | |
---|
266 | }; // end namespace meta_predictor_glue |
---|
267 | }; // end namespace meta_predictor |
---|
268 | }; // end namespace predictor |
---|
269 | }; // end namespace stage_1_ifetch |
---|
270 | }; // end namespace behavioural |
---|
271 | }; // end namespace morpheo |
---|