Ignore:
Timestamp:
Jul 17, 2007, 4:47:56 PM (17 years ago)
Author:
rosiere
Message:

Modification des classes d'encapsulation des interfaces.
Stable sur tous les composants actuels

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  
    1010
    1111#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"
    1313
    1414void test (string name,
     
    2828   *********************************************************************/
    2929  sc_clock                         * CLOCK;
     30  sc_signal<Tcontrol_t>            * NRESET;
    3031
    3132    // Interface Predict
     
    6566
    6667#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");
    6870#endif 
    6971
     
    170172#if defined(STATISTICS) or defined(VHDL_TESTBENCH)
    171173  (*(_Meta_Predictor_Glue->in_CLOCK))        (*(CLOCK));
     174  (*(_Meta_Predictor_Glue->in_NRESET))        (*(NRESET));
    172175#endif
    173176
     
    252255
    253256  sc_start(0);
    254   _Meta_Predictor_Glue->vhdl_testbench_label("Initialisation");
    255257  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);
    257262  // No need initialisation
    258263
    259   _Meta_Predictor_Glue->vhdl_testbench_label("Loop of Test");
    260264  cout << "{"+toString(static_cast<uint32_t>(sc_simulation_time()))+"} Loop of Test" << endl;
    261265 
     
    282286//uint32_t shift_6 = shift_5 + _param._predictor_2_pht_size_counter;
    283287
     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
    284295  for (uint32_t iteration=0; iteration<NB_ITERATION; iteration ++)
    285296    {
    286       _Meta_Predictor_Glue->vhdl_testbench_label("Iteration "+toString(iteration));
    287297
    288298      for (uint32_t i=0; i<_param._nb_prediction; i++)
     
    365375          BRANCH_COMPLETE_PREDICTOR_2_ACK         [i] ->write (predictor_2_ack);
    366376
    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);
    373383               
    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;
    380403
    381404          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.