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