Ignore:
Timestamp:
Feb 27, 2009, 7:37:40 PM (15 years ago)
Author:
rosiere
Message:

1) Decod_queue : multi implementation (one_fifo, multi_fifo)
2) Issue_queue : multi implementation (in_order, out_of_order)
3) Direction : Add Meta predictor
4) Context_State : re add Branch_complete, More priority to Load miss (is not speculative)
5) Return_Address_Stack : update reg_PREDICT pointer on decod miss prediction
6) UPT : Fix bug in multi event
7) Prediction_glue : in read_stack case, insert in UPT pc_next
8) Rename select : when rob have an event (need flush), read_r{a,b,c} and write_r{d,e} is set at 0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/SelfTest/src/test.cpp

    r110 r111  
    5050  sc_clock              *  in_CLOCK  = new sc_clock ("clock", 1.0, 0.5);         
    5151  sc_signal<Tcontrol_t> *  in_NRESET = new sc_signal<Tcontrol_t> ("NRESET");
     52
     53  ALLOC1_SC_SIGNAL( in_PREDICT_VAL          ," in_PREDICT_VAL          ",Tcontrol_t,_param->_nb_inst_predict);
     54  ALLOC1_SC_SIGNAL(out_PREDICT_ACK          ,"out_PREDICT_ACK          ",Tcontrol_t,_param->_nb_inst_predict);
     55  ALLOC1_SC_SIGNAL( in_PREDICT_ADDRESS      ," in_PREDICT_ADDRESS      ",Taddress_t,_param->_nb_inst_predict);
     56  ALLOC1_SC_SIGNAL(out_PREDICT_DIRECTION    ,"out_PREDICT_DIRECTION    ",Tcontrol_t,_param->_nb_inst_predict);
     57  ALLOC1_SC_SIGNAL(out_PREDICT_HISTORY      ,"out_PREDICT_HISTORY      ",Thistory_t,_param->_nb_inst_predict);
     58  ALLOC1_SC_SIGNAL( in_PREDICT_DIRECTION_VAL," in_PREDICT_DIRECTION_VAL",Tcontrol_t,_param->_nb_inst_predict);
     59  ALLOC1_SC_SIGNAL( in_PREDICT_DIRECTION    ," in_PREDICT_DIRECTION    ",Tcontrol_t,_param->_nb_inst_predict);
     60 
     61  ALLOC1_SC_SIGNAL( in_UPDATE_VAL           ," in_UPDATE_VAL           ",Tcontrol_t,_param->_nb_inst_update);
     62  ALLOC1_SC_SIGNAL(out_UPDATE_ACK           ,"out_UPDATE_ACK           ",Tcontrol_t,_param->_nb_inst_update);
     63  ALLOC1_SC_SIGNAL( in_UPDATE_ADDRESS       ," in_UPDATE_ADDRESS       ",Taddress_t,_param->_nb_inst_update);
     64  ALLOC1_SC_SIGNAL( in_UPDATE_HISTORY       ," in_UPDATE_HISTORY       ",Thistory_t,_param->_nb_inst_update);
     65  ALLOC1_SC_SIGNAL( in_UPDATE_DIRECTION     ," in_UPDATE_DIRECTION     ",Tcontrol_t,_param->_nb_inst_update);
     66  ALLOC1_SC_SIGNAL( in_UPDATE_MISS          ," in_UPDATE_MISS          ",Tcontrol_t,_param->_nb_inst_update);
    5267 
    5368  /********************************************************
     
    6075  (*(_Two_Level_Branch_Predictor->in_NRESET))       (*(in_NRESET));
    6176
     77  INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor, in_PREDICT_VAL          ,_param->_nb_inst_predict);
     78  INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor,out_PREDICT_ACK          ,_param->_nb_inst_predict);
     79  INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor, in_PREDICT_ADDRESS      ,_param->_nb_inst_predict);
     80  INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor,out_PREDICT_DIRECTION    ,_param->_nb_inst_predict);
     81  INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor,out_PREDICT_HISTORY      ,_param->_nb_inst_predict);
     82  if (_param->_update_on_prediction)
     83    {
     84  INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor, in_PREDICT_DIRECTION_VAL,_param->_nb_inst_predict);
     85  INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor, in_PREDICT_DIRECTION    ,_param->_nb_inst_predict);
     86    }
     87
     88  INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor, in_UPDATE_VAL           ,_param->_nb_inst_update);
     89  INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor,out_UPDATE_ACK           ,_param->_nb_inst_update);
     90  INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor, in_UPDATE_ADDRESS       ,_param->_nb_inst_update);
     91  INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor, in_UPDATE_HISTORY       ,_param->_nb_inst_update);
     92  INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor, in_UPDATE_DIRECTION     ,_param->_nb_inst_update);
     93  if (_param->_update_on_prediction)
     94  INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor, in_UPDATE_MISS          ,_param->_nb_inst_update);
    6295
    6396  msg(_("<%s> : Start Simulation ............\n"),name.c_str());
     
    76109  srand(seed);
    77110
     111  const  int32_t percent_transaction_predict = 75;
     112  const  int32_t percent_transaction_update  = 75;
     113
    78114  SC_START(0);
    79115  LABEL("Initialisation");
     116
     117  for (uint32_t i=0; i<_param->_nb_inst_predict; ++i)
     118    in_PREDICT_VAL [i]->write(0);
     119  for (uint32_t i=0; i<_param->_nb_inst_update; ++i)
     120    in_UPDATE_VAL [i]->write(0);
    80121
    81122  LABEL("Reset");
     
    85126
    86127  LABEL("Loop of Test");
    87 
     128 
     129  Thistory_t bht;
     130  Thistory_t pht [_param->_pht_size_bank];
     131 
    88132  for (uint32_t iteration=0; iteration<NB_ITERATION; iteration ++)
    89133    {
    90134      LABEL("Iteration %d",iteration);
    91135
     136      uint32_t bht_num_reg  = (_param->_have_bht)?(rand()%_param->_bht_nb_shifter):0;
     137      uint32_t pht_num_bank = (_param->_have_pht)?(rand()%_param->_pht_nb_bank   ):0;
     138
     139      LABEL("  * bht_num_reg  : %d",bht_num_reg );
     140      LABEL("  * pht_num_bank : %d",pht_num_bank);
     141
     142      {
     143        LABEL("Init BHT and PHT");
     144
     145        bht = 0;
     146        for (uint32_t i=0; i<_param->_pht_size_bank; ++i)
     147          pht [i] = 0;
     148       
     149        uint32_t port = rand()%_param->_nb_inst_update;
     150
     151        if (_param->_have_bht)
     152          {       
     153            bool find = false;
     154            while (not find)
     155              {
     156                bool val = ((rand()%2)<percent_transaction_update);
     157                in_UPDATE_VAL       [port]->write(val);
     158                in_UPDATE_DIRECTION [port]->write(0);
     159               
     160                if (_param->_update_on_prediction)
     161                  in_UPDATE_MISS      [port]->write(1); // miss
     162                in_UPDATE_HISTORY   [port]->write(0);
     163                in_UPDATE_ADDRESS   [port]->write(bht_num_reg);
     164               
     165                SC_START(0);
     166               
     167                if (val and out_UPDATE_ACK [port]->read())
     168                  {
     169                    LABEL("UPDATE[%d] - Transaction accepted",port);
     170                    find = true;
     171                  }
     172               
     173                SC_START(1);
     174              }
     175            in_UPDATE_VAL [port]->write(0);
     176          }
     177
     178        if (_param->_have_pht)
     179          {       
     180            for (uint32_t i=0; i<_param->_pht_size_bank; ++i)
     181              {
     182                bool find = false;
     183               
     184                while (not find)
     185                  {
     186                    bool val = ((rand()%2)<percent_transaction_update);
     187                    in_UPDATE_VAL       [port]->write(val);
     188                    in_UPDATE_DIRECTION [port]->write(0);
     189                   
     190                    if (_param->_update_on_prediction)
     191                      in_UPDATE_MISS      [port]->write(1); // miss
     192                    in_UPDATE_HISTORY   [port]->write(i<<_param->_bht_history_rshift);
     193                    in_UPDATE_ADDRESS   [port]->write(pht_num_bank<<_param->_pht_address_bank_rshift);
     194                   
     195                    SC_START(0);
     196                   
     197                    if (val and out_UPDATE_ACK [port]->read())
     198                      {
     199                        LABEL("UPDATE[%d] - Transaction accepted",port);
     200                        find = true;
     201                      }
     202                   
     203                    SC_START(1);
     204                  }
     205                in_UPDATE_VAL [port]->write(0);
     206              }
     207          }
     208      }
     209
     210//       if (1)
     211//         {
     212//           LABEL("Saturation all PHT");
     213         
     214//         }
     215
    92216      SC_START(1);
    93217    }
     
    104228  delete in_CLOCK;
    105229  delete in_NRESET;
     230
     231  DELETE1_SC_SIGNAL( in_PREDICT_VAL          ,_param->_nb_inst_predict);
     232  DELETE1_SC_SIGNAL(out_PREDICT_ACK          ,_param->_nb_inst_predict);
     233  DELETE1_SC_SIGNAL( in_PREDICT_ADDRESS      ,_param->_nb_inst_predict);
     234  DELETE1_SC_SIGNAL(out_PREDICT_DIRECTION    ,_param->_nb_inst_predict);
     235  DELETE1_SC_SIGNAL(out_PREDICT_HISTORY      ,_param->_nb_inst_predict);
     236  DELETE1_SC_SIGNAL( in_PREDICT_DIRECTION_VAL,_param->_nb_inst_predict);
     237  DELETE1_SC_SIGNAL( in_PREDICT_DIRECTION    ,_param->_nb_inst_predict);
     238
     239  DELETE1_SC_SIGNAL( in_UPDATE_VAL           ,_param->_nb_inst_update);
     240  DELETE1_SC_SIGNAL(out_UPDATE_ACK           ,_param->_nb_inst_update);
     241  DELETE1_SC_SIGNAL( in_UPDATE_ADDRESS       ,_param->_nb_inst_update);
     242  DELETE1_SC_SIGNAL( in_UPDATE_HISTORY       ,_param->_nb_inst_update);
     243  DELETE1_SC_SIGNAL( in_UPDATE_DIRECTION     ,_param->_nb_inst_update);
     244  DELETE1_SC_SIGNAL( in_UPDATE_MISS          ,_param->_nb_inst_update);
    106245    }
    107246#endif
Note: See TracChangeset for help on using the changeset viewer.