Changeset 44 for trunk/IPs/systemC/processor/Morpheo/Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/Meta_Predictor_Glue/SelfTest/src/test.cpp
- Timestamp:
- Jul 17, 2007, 4:47:56 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
r5 r44 10 10 11 11 #include "Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/Meta_Predictor_Glue/SelfTest/include/test.h" 12 #include " Include/Test.h"12 #include "Common/include/Test.h" 13 13 14 14 void test (string name, … … 28 28 *********************************************************************/ 29 29 sc_clock * CLOCK; 30 sc_signal<Tcontrol_t> * NRESET; 30 31 31 32 // Interface Predict … … 65 66 66 67 #if defined(STATISTICS) or defined(VHDL_TESTBENCH) 67 CLOCK = new sc_clock ("clock", 1.0, 0.5); 68 CLOCK = new sc_clock ("clock", 1.0, 0.5); 69 NRESET = new sc_signal<Tcontrol_t> ("nreset"); 68 70 #endif 69 71 … … 170 172 #if defined(STATISTICS) or defined(VHDL_TESTBENCH) 171 173 (*(_Meta_Predictor_Glue->in_CLOCK)) (*(CLOCK)); 174 (*(_Meta_Predictor_Glue->in_NRESET)) (*(NRESET)); 172 175 #endif 173 176 … … 252 255 253 256 sc_start(0); 254 _Meta_Predictor_Glue->vhdl_testbench_label("Initialisation");255 257 cout << "{"+toString(static_cast<uint32_t>(sc_simulation_time()))+"} Initialisation" << endl; 256 258 259 NRESET->write(0); 260 sc_start(5); 261 NRESET->write(1); 257 262 // No need initialisation 258 263 259 _Meta_Predictor_Glue->vhdl_testbench_label("Loop of Test");260 264 cout << "{"+toString(static_cast<uint32_t>(sc_simulation_time()))+"} Loop of Test" << endl; 261 265 … … 282 286 //uint32_t shift_6 = shift_5 + _param._predictor_2_pht_size_counter; 283 287 288 cout << "shift_0 : " << shift_0 << endl; 289 cout << "shift_1 : " << shift_1 << endl; 290 cout << "shift_2 : " << shift_2 << endl; 291 cout << "shift_3 : " << shift_3 << endl; 292 cout << "shift_4 : " << shift_4 << endl; 293 cout << "shift_5 : " << shift_5 << endl; 294 284 295 for (uint32_t iteration=0; iteration<NB_ITERATION; iteration ++) 285 296 { 286 _Meta_Predictor_Glue->vhdl_testbench_label("Iteration "+toString(iteration));287 297 288 298 for (uint32_t i=0; i<_param._nb_prediction; i++) … … 365 375 BRANCH_COMPLETE_PREDICTOR_2_ACK [i] ->write (predictor_2_ack); 366 376 367 branch_complete_predictor_0_bht_history [i] = rand() % ( _param._predictor_0_bht_size_shifter+1);368 branch_complete_predictor_0_pht_history [i] = rand() % ( _param._predictor_0_pht_size_counter+1);369 branch_complete_predictor_1_bht_history [i] = rand() % ( _param._predictor_1_bht_size_shifter+1);370 branch_complete_predictor_1_pht_history [i] = rand() % ( _param._predictor_1_pht_size_counter+1);371 branch_complete_predictor_2_bht_history [i] = rand() % ( _param._predictor_2_bht_size_shifter+1);372 branch_complete_predictor_2_pht_history [i] = rand() % ( _param._predictor_2_pht_size_counter+1);377 branch_complete_predictor_0_bht_history [i] = rand() % (1<<_param._predictor_0_bht_size_shifter); 378 branch_complete_predictor_0_pht_history [i] = rand() % (1<<_param._predictor_0_pht_size_counter); 379 branch_complete_predictor_1_bht_history [i] = rand() % (1<<_param._predictor_1_bht_size_shifter); 380 branch_complete_predictor_1_pht_history [i] = rand() % (1<<_param._predictor_1_pht_size_counter); 381 branch_complete_predictor_2_bht_history [i] = rand() % (1<<_param._predictor_2_bht_size_shifter); 382 branch_complete_predictor_2_pht_history [i] = rand() % (1<<_param._predictor_2_pht_size_counter); 373 383 374 BRANCH_COMPLETE_HISTORY [i]->write((branch_complete_predictor_0_bht_history [i] << shift_0) | 375 (branch_complete_predictor_0_pht_history [i] << shift_1) | 376 (branch_complete_predictor_1_bht_history [i] << shift_2) | 377 (branch_complete_predictor_1_pht_history [i] << shift_3) | 378 (branch_complete_predictor_2_bht_history [i] << shift_4) | 379 (branch_complete_predictor_2_pht_history [i] << shift_5) ); 384 Thistory_t history = ((branch_complete_predictor_0_bht_history [i] << shift_0) | 385 (branch_complete_predictor_0_pht_history [i] << shift_1) | 386 (branch_complete_predictor_1_bht_history [i] << shift_2) | 387 (branch_complete_predictor_1_pht_history [i] << shift_3) | 388 (branch_complete_predictor_2_bht_history [i] << shift_4) | 389 (branch_complete_predictor_2_pht_history [i] << shift_5) ); 390 391 BRANCH_COMPLETE_HISTORY [i]->write (history); 392 393 cout << "<test> [" << i << "] : " << endl 394 << hex 395 << " * " << history << endl 396 << " - " << branch_complete_predictor_0_bht_history [i] << endl 397 << " - " << branch_complete_predictor_0_pht_history [i] << endl 398 << " - " << branch_complete_predictor_1_bht_history [i] << endl 399 << " - " << branch_complete_predictor_1_pht_history [i] << endl 400 << " - " << branch_complete_predictor_2_bht_history [i] << endl 401 << " - " << branch_complete_predictor_2_pht_history [i] << endl 402 << dec; 380 403 381 404 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;
Note: See TracChangeset
for help on using the changeset viewer.