Changeset 5 for trunk/IPs/systemC/processor/Morpheo/Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/Meta_Predictor_Glue/SelfTest
- Timestamp:
- Mar 9, 2007, 7:16:58 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/IPs/systemC/processor/Morpheo/Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/Meta_Predictor_Glue/SelfTest/src/test.cpp
r4 r5 45 45 46 46 // Interface Branch_complete 47 sc_signal<Tcontrol_t> ** BRANCH_COMPLETE_VAL ; 48 sc_signal<Tcontrol_t> ** BRANCH_COMPLETE_PREDICTOR_2_VAL ; 49 47 50 sc_signal<Tcontrol_t> ** BRANCH_COMPLETE_PREDICTOR_0_ACK ; 48 51 sc_signal<Tcontrol_t> ** BRANCH_COMPLETE_PREDICTOR_1_ACK ; … … 57 60 sc_signal<Tpht_history_t> ** BRANCH_COMPLETE_PREDICTOR_2_PHT_HISTORY; 58 61 sc_signal<Thistory_t> ** BRANCH_COMPLETE_HISTORY ; 59 62 sc_signal<Tcontrol_t> ** BRANCH_COMPLETE_DIRECTION ; 63 sc_signal<Tcontrol_t> ** BRANCH_COMPLETE_PREDICTOR_2_DIRECTION ; 60 64 string rename; 61 65 … … 108 112 109 113 // Interface Branch_complete 110 114 BRANCH_COMPLETE_VAL = new sc_signal<Tcontrol_t> * [_param._nb_branch_complete ]; 115 BRANCH_COMPLETE_PREDICTOR_2_VAL = new sc_signal<Tcontrol_t> * [_param._nb_branch_complete ]; 111 116 BRANCH_COMPLETE_PREDICTOR_0_ACK = new sc_signal<Tcontrol_t> * [_param._nb_branch_complete ]; 112 117 BRANCH_COMPLETE_PREDICTOR_1_ACK = new sc_signal<Tcontrol_t> * [_param._nb_branch_complete ]; … … 120 125 BRANCH_COMPLETE_PREDICTOR_2_PHT_HISTORY = new sc_signal<Tpht_history_t> * [_param._nb_branch_complete ]; 121 126 BRANCH_COMPLETE_HISTORY = new sc_signal<Thistory_t> * [_param._nb_branch_complete ]; 127 BRANCH_COMPLETE_DIRECTION = new sc_signal<Tcontrol_t> * [_param._nb_branch_complete ]; 128 BRANCH_COMPLETE_PREDICTOR_2_DIRECTION = new sc_signal<Tcontrol_t> * [_param._nb_branch_complete ]; 122 129 123 130 for (uint32_t i=0; i<_param._nb_branch_complete; i++) 124 131 { 132 rename = "BRANCH_COMPLETE_VAL_" +toString(i); 133 BRANCH_COMPLETE_VAL [i] = new sc_signal<Tcontrol_t> (rename.c_str()); 134 rename = "BRANCH_COMPLETE_PREDICTOR_2_VAL_" +toString(i); 135 BRANCH_COMPLETE_PREDICTOR_2_VAL [i] = new sc_signal<Tcontrol_t> (rename.c_str()); 125 136 rename = "BRANCH_COMPLETE_PREDICTOR_0_ACK_" +toString(i); 126 137 BRANCH_COMPLETE_PREDICTOR_0_ACK [i] = new sc_signal<Tcontrol_t> (rename.c_str()); … … 145 156 rename = "BRANCH_COMPLETE_HISTORY_" +toString(i); 146 157 BRANCH_COMPLETE_HISTORY [i] = new sc_signal<Thistory_t> (rename.c_str()); 158 rename = "BRANCH_COMPLETE_DIRECTION_" +toString(i); 159 BRANCH_COMPLETE_DIRECTION [i] = new sc_signal<Tcontrol_t> (rename.c_str()); 160 rename = "BRANCH_COMPLETE_PREDICTOR_2_DIRECTION_" +toString(i); 161 BRANCH_COMPLETE_PREDICTOR_2_DIRECTION [i] = new sc_signal<Tcontrol_t> (rename.c_str()); 147 162 } 148 163 … … 192 207 if (_param._have_meta_predictor) 193 208 { 209 (*(_Meta_Predictor_Glue-> in_BRANCH_COMPLETE_VAL [i])) (*(BRANCH_COMPLETE_VAL [i])); 210 (*(_Meta_Predictor_Glue->out_BRANCH_COMPLETE_PREDICTOR_2_VAL [i])) (*(BRANCH_COMPLETE_PREDICTOR_2_VAL [i])); 211 194 212 (*(_Meta_Predictor_Glue-> in_BRANCH_COMPLETE_PREDICTOR_0_ACK [i])) (*(BRANCH_COMPLETE_PREDICTOR_0_ACK [i])); 195 213 (*(_Meta_Predictor_Glue-> in_BRANCH_COMPLETE_PREDICTOR_1_ACK [i])) (*(BRANCH_COMPLETE_PREDICTOR_1_ACK [i])); … … 214 232 (*(_Meta_Predictor_Glue->out_BRANCH_COMPLETE_PREDICTOR_2_PHT_HISTORY [i])) (*(BRANCH_COMPLETE_PREDICTOR_2_PHT_HISTORY [i])); 215 233 (*(_Meta_Predictor_Glue-> in_BRANCH_COMPLETE_HISTORY [i])) (*(BRANCH_COMPLETE_HISTORY [i])); 234 if (_param._have_meta_predictor) 235 { 236 (*(_Meta_Predictor_Glue-> in_BRANCH_COMPLETE_DIRECTION [i])) (*(BRANCH_COMPLETE_DIRECTION [i])); 237 (*(_Meta_Predictor_Glue->out_BRANCH_COMPLETE_PREDICTOR_2_DIRECTION [i])) (*(BRANCH_COMPLETE_PREDICTOR_2_DIRECTION [i])); 238 } 216 239 } 217 240 … … 241 264 Tcontrol_t predict_direction [_param._nb_prediction]; 242 265 266 Tcontrol_t branch_complete_predictor_2_val [_param._nb_branch_complete]; 243 267 Tcontrol_t branch_complete_ack [_param._nb_branch_complete]; 244 268 Tbht_history_t branch_complete_predictor_0_bht_history [_param._nb_branch_complete]; … … 248 272 Tbht_history_t branch_complete_predictor_2_bht_history [_param._nb_branch_complete]; 249 273 Tpht_history_t branch_complete_predictor_2_pht_history [_param._nb_branch_complete]; 274 Tcontrol_t branch_complete_predictor_2_direction [_param._nb_branch_complete]; 250 275 251 276 uint32_t shift_0 = 0; … … 255 280 uint32_t shift_4 = shift_3 + _param._predictor_1_pht_size_counter; 256 281 uint32_t shift_5 = shift_4 + _param._predictor_2_bht_size_shifter; 257 //uint32_t shift_ 5= shift_5 + _param._predictor_2_pht_size_counter;282 //uint32_t shift_6 = shift_5 + _param._predictor_2_pht_size_counter; 258 283 259 284 for (uint32_t iteration=0; iteration<NB_ITERATION; iteration ++) … … 353 378 (branch_complete_predictor_2_bht_history [i] << shift_4) | 354 379 (branch_complete_predictor_2_pht_history [i] << shift_5) ); 380 381 Tcontrol_t direction_0 = ((_param._predictor_0_have_pht)?(branch_complete_predictor_0_pht_history [i] >> (_param._predictor_0_pht_size_counter-1)):(branch_complete_predictor_0_bht_history [i] >> (_param._predictor_0_bht_size_shifter-1)))&1; 382 Tcontrol_t direction_1 = ((_param._predictor_1_have_pht)?(branch_complete_predictor_1_pht_history [i] >> (_param._predictor_1_pht_size_counter-1)):(branch_complete_predictor_1_bht_history [i] >> (_param._predictor_1_bht_size_shifter-1)))&1; 383 Tcontrol_t direction_2 = ((_param._predictor_2_have_pht)?(branch_complete_predictor_2_pht_history [i] >> (_param._predictor_2_pht_size_counter-1)):(branch_complete_predictor_2_bht_history [i] >> (_param._predictor_2_bht_size_shifter-1)))&1; 384 385 Tcontrol_t direction = ((rand()%2) != 0); 386 Tcontrol_t val = ((rand()%2) != 0); 387 388 cout << "{"+toString(static_cast<uint32_t>(sc_simulation_time()))+"} " << endl 389 << " * val : " << val << endl 390 << " * direction_good : " << direction << endl 391 << " * direction_0 : " << direction_0 << endl 392 << " * direction_1 : " << direction_1 << endl 393 << " * direction_2 : " << direction_2 << endl; 394 395 BRANCH_COMPLETE_VAL [i] ->write (val); 396 BRANCH_COMPLETE_DIRECTION [i] ->write (direction); 397 398 if (val == 0) 399 { 400 branch_complete_predictor_2_val [i] = val; 401 } 402 else 403 { 404 branch_complete_predictor_2_val [i] = (direction_0 xor direction_1); 405 if (direction_2 == 0) 406 if (direction_0 == direction) 407 branch_complete_predictor_2_direction [i] = 0; 408 else 409 branch_complete_predictor_2_direction [i] = 1; 410 else 411 if (direction_1 == direction) 412 branch_complete_predictor_2_direction [i] = 1; 413 else 414 branch_complete_predictor_2_direction [i] = 0; 415 } 355 416 } 356 417 … … 370 431 if (_param._have_meta_predictor) 371 432 { 433 TEST(Tcontrol_t , BRANCH_COMPLETE_PREDICTOR_2_VAL [i]->read(), branch_complete_predictor_2_val [i]); 434 435 if (branch_complete_predictor_2_val [i]) 436 TEST(Tcontrol_t , BRANCH_COMPLETE_PREDICTOR_2_DIRECTION [i]->read(), branch_complete_predictor_2_direction [i]); 437 372 438 if (_param._predictor_0_have_bht) 373 439 TEST(Tbht_history_t, BRANCH_COMPLETE_PREDICTOR_0_BHT_HISTORY [i]->read(), branch_complete_predictor_0_bht_history [i]);
Note: See TracChangeset
for help on using the changeset viewer.