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

Location:
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/src
Files:
1 added
6 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/src/Parameters.cpp

    r110 r111  
    77
    88#include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/include/Parameters.h"
     9#include "Common/include/BitManipulation.h"
    910
    1011namespace morpheo {
     
    2122#undef  FUNCTION
    2223#define FUNCTION "Two_Level_Branch_Predictor::Parameters"
    23   Parameters::Parameters (bool is_toplevel)
     24  Parameters::Parameters (uint32_t nb_inst_predict       ,
     25                          uint32_t nb_inst_update        ,
     26                          uint32_t size_address          ,
     27                          bool     have_bht              ,
     28                          uint32_t bht_size_shifter      ,
     29                          uint32_t bht_nb_shifter        ,
     30                          bool     have_pht              ,
     31                          uint32_t pht_size_counter      ,
     32                          uint32_t pht_nb_counter        ,
     33                          uint32_t pht_size_address_share,
     34                          bool     update_on_prediction  ,
     35                          bool is_toplevel)
    2436  {
    2537    log_begin(Two_Level_Branch_Predictor,FUNCTION);
    2638
    27     test();
     39    _nb_inst_predict         = nb_inst_predict       ;
     40    _nb_inst_update          = nb_inst_update        ;
     41    _size_address            = size_address          ;
     42    _have_bht                = have_bht              ;
     43    _bht_size_shifter        = (have_bht)?(bht_size_shifter):0;
     44    _bht_nb_shifter          = (have_bht)?(bht_nb_shifter  ):0;
     45    _have_pht                = have_pht              ;
     46    _pht_size_counter        = (have_pht)?(pht_size_counter      ):0;
     47    _pht_nb_counter          = (have_pht)?(pht_nb_counter        ):0;
     48    _pht_size_address_share  = (have_bht and have_pht)?(pht_size_address_share):0;
     49    _update_on_prediction    = update_on_prediction  ;
     50                             
     51    _bht_size_address        = (_have_bht)?log2(_bht_nb_shifter):0;
     52    _pht_size_address        = (_have_pht)?log2(_pht_nb_counter):0;
     53                             
     54    test();                 
     55
     56    _size_history            = _bht_size_shifter + _pht_size_counter;
     57                             
     58    _bht_history_mask        = gen_mask<Thistory_t>(_bht_size_shifter);
     59    _bht_history_rshift      = 0;
     60    _pht_history_mask        = gen_mask<Thistory_t>(_pht_size_counter);
     61    _pht_history_rshift      = _bht_size_shifter;
     62                             
     63    log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _size_history             : %d",_size_history  );
     64    log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _bht_history_mask         : 0x%x",_bht_history_mask  );
     65    log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _bht_history_rshift       : %d",_bht_history_rshift);
     66    log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_history_mask         : 0x%x",_pht_history_mask  );
     67    log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_history_rshift       : %d",_pht_history_rshift);
     68
     69    if (_have_bht)
     70      {
     71        _bht_address_mask        = gen_mask<Taddress_t>(_bht_size_address);
     72
     73        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _bht_address_mask         : 0x%x",_bht_address_mask  );
     74      }
     75
     76    if (_have_pht)
     77      {
     78        _pht_counter_max         = (1<<_pht_size_counter)-1;
     79       
     80        _pht_nb_bank             = (_pht_nb_counter - (1<<_bht_size_shifter))+1;
     81        _pht_size_bank           = _pht_nb_counter / _pht_nb_bank;
     82
     83        _pht_address_share_mask  = gen_mask<Taddress_t>(_pht_size_address_share);
     84        _pht_address_share_lshift= _bht_size_shifter-_pht_size_address_share;
     85        _pht_address_bank_mask   = gen_mask<Taddress_t>(log2(_pht_nb_bank));
     86        _pht_address_bank_rshift = _pht_size_address_share;
     87
     88        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_nb_bank              : %d"  ,_pht_nb_bank   );
     89        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_size_bank            : %d"  ,_pht_size_bank );
     90        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_address_share_mask   : 0x%x",_pht_address_share_mask  );
     91        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_address_share_lshift : %d"  ,_pht_address_share_lshift);
     92        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_address_bank_mask    : 0x%x",_pht_address_bank_mask   );
     93        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_address_bank_rshift  : %d"  ,_pht_address_bank_rshift );
     94      }
    2895
    2996    if (is_toplevel)
    30       {
    31         copy();
    32       }
     97      copy();
    3398
    3499    log_end(Two_Level_Branch_Predictor,FUNCTION);
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/src/Parameters_msg_error.cpp

    r110 r111  
    2929    Parameters_test test ("Two_Level_Branch_Predictor");
    3030
     31    if ((_have_bht or _have_pht) == false)
     32      test.error(_("They have no Branch History Table and no Pattern History Table. You need a less of a BHT or a PHT\n"));
     33
     34    if ( _have_bht and (_size_address < _bht_size_address))
     35      test.error(_("The address's size must to large to the number of shifter in the Branch History Table.\n"));
     36
     37    if (_have_pht and (_size_address < _pht_size_address))
     38      test.error(_("The address's size must to large to the number of counter in the Pattern History Table.\n"));
     39
     40    if (_have_pht and _have_bht and (_bht_size_address > _pht_nb_counter))
     41      test.error (_("The size of shifter don't must too large that the number of counter in the Pattern History Table.\n"));
     42
     43    if (_have_pht and _have_bht and (_pht_size_address_share > _bht_size_shifter))
     44      test.error (_("The size of address share don't must too large that the size of shifter in the Branch History Table.\n"));
     45
    3146    log_end(Two_Level_Branch_Predictor,FUNCTION);
    3247
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/src/Two_Level_Branch_Predictor.cpp

    r110 r111  
    7272    if (usage_is_set(_usage,USE_SYSTEMC))
    7373      {
     74        // Constants :
     75        for (uint32_t i=0; i<_param->_nb_inst_predict; ++i)
     76          {
     77            internal_PREDICT_ACK [i] = 1;
     78            PORT_WRITE(out_PREDICT_ACK [i], internal_PREDICT_ACK [i]);
     79          }
     80        for (uint32_t i=0; i<_param->_nb_inst_update; ++i)
     81          {
     82            internal_UPDATE_ACK [i] = 1;
     83            PORT_WRITE(out_UPDATE_ACK [i], internal_UPDATE_ACK [i]);
     84          }
     85       
     86
    7487        log_printf(INFO,Two_Level_Branch_Predictor,FUNCTION,_("<%s> : Method - transition"),_name.c_str());
    7588
     
    8295# endif   
    8396
    84 //      log_printf(INFO,Two_Level_Branch_Predictor,FUNCTION,_("<%s> : Method - genMoore"),_name.c_str());
     97        log_printf(INFO,Two_Level_Branch_Predictor,FUNCTION,_("<%s> : Method - genMealy_predict"),_name.c_str());
    8598
    86 //      SC_METHOD (genMoore);
    87 //      dont_initialize ();
    88 //      sensitive << (*(in_CLOCK)).neg(); // need internal register
    89        
    90 // # ifdef SYSTEMCASS_SPECIFIC
    91 //      // List dependency information
    92 // # endif   
     99        SC_METHOD (genMealy_predict);
     100        dont_initialize ();
     101        sensitive << (*(in_CLOCK)).neg(); // need internal register
     102
     103        for (uint32_t i=0; i<_param->_nb_inst_predict; ++i)
     104          sensitive
     105//             << (*(in_PREDICT_VAL     [i]))
     106            << (*(in_PREDICT_ADDRESS [i]));
     107               
     108# ifdef SYSTEMCASS_SPECIFIC
     109        // List dependency information
     110# endif   
    93111       
    94112#endif
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/src/Two_Level_Branch_Predictor_allocation.cpp

    r110 r111  
    1919namespace meta_predictor {
    2020namespace two_level_branch_predictor {
    21 
    22 
    2321
    2422#undef  FUNCTION
     
    5856      in_NRESET       = interface->set_signal_in  <Tcontrol_t> ("nreset",1, RESET_VHDL_YES);
    5957    }
     58
     59    // ~~~~~[ Interface : "predict" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     60    {
     61      ALLOC1_INTERFACE("predict",IN,WEST,_("Predict direction interface"),_param->_nb_inst_predict);
     62
     63      ALLOC1_VALACK_IN ( in_PREDICT_VAL          ,VAL);
     64      ALLOC1_VALACK_OUT(out_PREDICT_ACK          ,ACK);
     65      ALLOC1_SIGNAL_IN ( in_PREDICT_ADDRESS      ,"ADDRESS"      ,Taddress_t,_param->_size_address);
     66      ALLOC1_SIGNAL_OUT(out_PREDICT_DIRECTION    ,"DIRECTION"    ,Tcontrol_t,1                    );
     67      ALLOC1_SIGNAL_OUT(out_PREDICT_HISTORY      ,"HISTORY"      ,Thistory_t,_param->_size_history);
     68      if (_param->_update_on_prediction)
     69        {
     70      ALLOC1_SIGNAL_IN ( in_PREDICT_DIRECTION_VAL,"DIRECTION_VAL",Tcontrol_t,1                    );
     71      ALLOC1_SIGNAL_IN ( in_PREDICT_DIRECTION    ,"DIRECTION"    ,Tcontrol_t,1                    );
     72        }
     73    }
     74
     75    // ~~~~~[ Interface : "update" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     76    {
     77      ALLOC1_INTERFACE("update",IN,WEST,_("Update direction interface"),_param->_nb_inst_update);
     78
     79      ALLOC1_VALACK_IN ( in_UPDATE_VAL           ,VAL);
     80      ALLOC1_VALACK_OUT(out_UPDATE_ACK           ,ACK);
     81      ALLOC1_SIGNAL_IN ( in_UPDATE_ADDRESS       ,"ADDRESS"      ,Taddress_t,_param->_size_address);
     82      ALLOC1_SIGNAL_IN ( in_UPDATE_HISTORY       ,"HISTORY"      ,Thistory_t,_param->_size_history);
     83      ALLOC1_SIGNAL_IN ( in_UPDATE_DIRECTION     ,"DIRECTION"    ,Tcontrol_t,1                    );
     84      if (_param->_update_on_prediction)
     85      ALLOC1_SIGNAL_IN ( in_UPDATE_MISS          ,"MISS"         ,Tcontrol_t,1                    );
     86    }
     87
     88    if (usage_is_set(_usage,USE_SYSTEMC))
     89      {
     90        if (_param->_have_bht)
     91          {
     92        ALLOC1(reg_BHT                       ,Thistory_t,_param->_bht_nb_shifter);
     93
     94        for (uint32_t i=0; i<_param->_bht_nb_shifter; ++i)
     95          reg_BHT [i] = 0;
     96          }
     97
     98        if (_param->_have_pht)
     99          {
     100        ALLOC2(reg_PHT                       ,Thistory_t,_param->_pht_nb_bank,_param->_pht_size_bank);
     101
     102        for (uint32_t i=0; i<_param->_pht_nb_bank; ++i)
     103          for (uint32_t j=0; j<_param->_pht_size_bank; ++j)
     104            reg_PHT [i][j] = 0;
     105          }
     106
     107
     108        ALLOC1(internal_PREDICT_ACK          ,Tcontrol_t,_param->_nb_inst_predict);
     109        if (_param->_update_on_prediction)
     110          {
     111        if (_param->_have_bht)
     112        ALLOC1(internal_PREDICT_BHT_NUM_REG  ,Thistory_t,_param->_nb_inst_predict);
     113        if (_param->_have_pht)
     114          {
     115        ALLOC1(internal_PREDICT_PHT_NUM_BANK ,Thistory_t,_param->_nb_inst_predict);
     116        ALLOC1(internal_PREDICT_PHT_NUM_REG  ,Thistory_t,_param->_nb_inst_predict);
     117          }
     118          }
     119        ALLOC1(internal_UPDATE_ACK           ,Tcontrol_t,_param->_nb_inst_update );
     120      }
     121
    60122    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
    61 
    62123#ifdef POSITION
    63124    if (usage_is_set(_usage,USE_POSITION))
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/src/Two_Level_Branch_Predictor_deallocation.cpp

    r110 r111  
    3030        delete    in_CLOCK ;
    3131        delete    in_NRESET;
     32
     33        DELETE1_SIGNAL( in_PREDICT_VAL          ,_param->_nb_inst_predict,1                    );
     34        DELETE1_SIGNAL(out_PREDICT_ACK          ,_param->_nb_inst_predict,1                    );
     35        DELETE1_SIGNAL( in_PREDICT_ADDRESS      ,_param->_nb_inst_predict,_param->_size_address);
     36        DELETE1_SIGNAL(out_PREDICT_DIRECTION    ,_param->_nb_inst_predict,1                    );
     37        DELETE1_SIGNAL(out_PREDICT_HISTORY      ,_param->_nb_inst_predict,_param->_size_history);
     38        if (_param->_update_on_prediction)                               
     39          {                                                             
     40        DELETE1_SIGNAL( in_PREDICT_DIRECTION_VAL,_param->_nb_inst_predict,1                    );
     41        DELETE1_SIGNAL( in_PREDICT_DIRECTION    ,_param->_nb_inst_predict,1                    );
     42          }
     43       
     44        DELETE1_SIGNAL( in_UPDATE_VAL           ,_param->_nb_inst_update,1                    );
     45        DELETE1_SIGNAL(out_UPDATE_ACK           ,_param->_nb_inst_update,1                    );
     46        DELETE1_SIGNAL( in_UPDATE_ADDRESS       ,_param->_nb_inst_update,_param->_size_address);
     47        DELETE1_SIGNAL( in_UPDATE_HISTORY       ,_param->_nb_inst_update,_param->_size_history);
     48        DELETE1_SIGNAL( in_UPDATE_DIRECTION     ,_param->_nb_inst_update,1                    );
     49        if (_param->_update_on_prediction)                             
     50        DELETE1_SIGNAL( in_UPDATE_MISS          ,_param->_nb_inst_update,1                    );
     51       
     52        if (_param->_have_bht)
     53        DELETE1(reg_BHT                         ,_param->_bht_nb_shifter);
     54        if (_param->_have_pht)
     55        DELETE2(reg_PHT                         ,_param->_pht_nb_bank,_param->_pht_size_bank);
     56       
     57        DELETE1(internal_PREDICT_ACK            ,_param->_nb_inst_predict);
     58        if (_param->_update_on_prediction)     
     59          {                                     
     60        if (_param->_have_bht)
     61        DELETE1(internal_PREDICT_BHT_NUM_REG    ,_param->_nb_inst_predict);
     62        if (_param->_have_pht)
     63          {
     64        DELETE1(internal_PREDICT_PHT_NUM_BANK   ,_param->_nb_inst_predict);
     65        DELETE1(internal_PREDICT_PHT_NUM_REG    ,_param->_nb_inst_predict);
     66          }
     67          }                                     
     68        DELETE1(internal_UPDATE_ACK             ,_param->_nb_inst_update );
    3269      }
    3370    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/src/Two_Level_Branch_Predictor_transition.cpp

    r110 r111  
    2525  {
    2626    log_begin(Two_Level_Branch_Predictor,FUNCTION);
     27    log_function(Two_Level_Branch_Predictor,FUNCTION,_name.c_str());
     28
     29    if (PORT_READ(in_NRESET) == 0)
     30      {
     31      }
     32    else
     33      {
     34        // ===================================================================
     35        // =====[ PREDICT ]===================================================
     36        // ===================================================================
     37
     38        for (uint32_t i=0; i<_param->_nb_inst_predict; ++i)
     39          if (PORT_READ(in_PREDICT_VAL[i]) and internal_PREDICT_ACK[i])
     40            {
     41              log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * PREDICT [%d]",i);
     42
     43              // Predict if
     44              //  * update_on_prediction and direction is valid
     45              if (_param->_update_on_prediction)
     46                if (PORT_READ(in_PREDICT_DIRECTION_VAL [i]))
     47                  {
     48                    Tcontrol_t direction = PORT_READ(in_PREDICT_DIRECTION [i]);
     49                   
     50                    if (_param->_have_bht)
     51                      {
     52                        Thistory_t bht_num_reg = internal_PREDICT_BHT_NUM_REG [i];
     53                        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * bht_num_reg      : %d",bht_num_reg);
     54
     55                        Thistory_t bht_history = reg_BHT[bht_num_reg];
     56                        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * bht_history (old): %x",bht_history);
     57
     58                       
     59                        bht_history = ((bht_history<<1) | direction)&_param->_bht_history_mask ;
     60                        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * bht_history (new): %x",bht_history);
     61                        reg_BHT [bht_num_reg] = bht_history;
     62                      }
     63
     64                    if (_param->_have_pht)
     65                      {
     66                        Thistory_t pht_num_reg = internal_PREDICT_PHT_NUM_REG  [i];
     67                        Thistory_t pht_num_bank= internal_PREDICT_PHT_NUM_BANK [i];
     68                        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * pht_num_reg      : %d",pht_num_reg);
     69                        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * pht_num_bank     : %d",pht_num_bank);
     70
     71                        Thistory_t pht_history = reg_PHT [pht_num_bank][pht_num_reg];
     72                        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * pht_history (old): %x",pht_history);
     73                       
     74                        // PHT : saturation counter
     75                        pht_history = (direction==1)?((pht_history<_param->_pht_counter_max)?(pht_history+1):(pht_history)):((pht_history>0)?(pht_history-1):(pht_history));
     76                       
     77                        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * pht_history (new): %x",pht_history);
     78                       
     79                        reg_PHT [pht_num_bank][pht_num_reg] = pht_history;
     80                      }
     81                  }
     82            }       
     83
     84        // ===================================================================
     85        // =====[ UPDATE ]====================================================
     86        // ===================================================================
     87       
     88        for (uint32_t i=0; i<_param->_nb_inst_update; ++i)
     89          if (PORT_READ(in_UPDATE_VAL[i]) and internal_UPDATE_ACK[i])
     90            {
     91              log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * UPDATE [%d]",i);
     92             
     93              // Update if
     94              //  * update_on_prediction and miss
     95              //  * not update_on_prediction
     96              if (not _param->_update_on_prediction or (_param->_update_on_prediction and PORT_READ(in_UPDATE_MISS [i])))
     97                {
     98                  Taddress_t address     = PORT_READ(in_UPDATE_ADDRESS   [i]);
     99                  Thistory_t history     = PORT_READ(in_UPDATE_HISTORY   [i]);
     100                  Tcontrol_t direction   = PORT_READ(in_UPDATE_DIRECTION [i])&1;
     101
     102                  log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * address          : %.8x",address);
     103                  log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * direction        : %d",direction);
     104
     105                  Thistory_t pht_bht_history = 0;
     106
     107                  if (_param->_have_bht)
     108                    {
     109                      Thistory_t bht_history = (history>>_param->_bht_history_rshift)&_param->_bht_history_mask;
     110                      Thistory_t bht_num_reg = address & _param->_bht_address_mask;
     111                     
     112                      pht_bht_history = bht_history;
     113                     
     114                      log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * bht_history (old): %x",bht_history);
     115                      log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * bht_num_reg      : %x",bht_num_reg);
     116                     
     117                      // BHT : shift register
     118                     
     119                      bht_history = ((bht_history<<1) | direction)&_param->_bht_history_mask ;
     120                      log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * bht_history (new): %x",bht_history);
     121                      reg_BHT [bht_num_reg]               = bht_history;
     122                    }
     123
     124                  if (_param->_have_pht)
     125                    {
     126                      Thistory_t pht_history = (history>>_param->_pht_history_rshift)&_param->_pht_history_mask;
     127                      Thistory_t pht_num_reg = pht_bht_history xor ((address&_param->_pht_address_share_mask)<<_param->_pht_address_share_lshift);
     128                      Thistory_t pht_num_bank= (address>>_param->_pht_address_bank_rshift)&_param->_pht_address_bank_mask;
     129                     
     130                      log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * bht_history (old): %x",pht_bht_history);
     131                      log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * pht_history (old): %x",pht_history);
     132                      log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * pht_num_reg      : %x",pht_num_reg);
     133                      log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * pht_num_bank     : %x",pht_num_bank);
     134                     
     135                      // PHT : saturation counter
     136                      pht_history = (direction==1)?((pht_history<_param->_pht_counter_max)?(pht_history+1):(pht_history)):((pht_history>0)?(pht_history-1):(pht_history));
     137                     
     138                      log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * pht_history (new): %x",pht_history);
     139                     
     140                      reg_PHT [pht_num_bank][pht_num_reg] = pht_history;
     141                    }
     142                }
     143            }
     144      }
     145
     146#if defined(DEBUG) and DEBUG_Two_Level_Branch_Predictor and (DEBUG >= DEBUG_TRACE)
     147    if (0)
     148    {
     149      log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * Dump Two_Level_Branch_Predictor");
     150
     151      if (_param->_have_bht)
     152        {
     153          log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * Dump BHT");
     154
     155          uint32_t limit = 4;
     156
     157          for (uint32_t i=0; i<_param->_bht_nb_shifter; i+=limit)
     158            {
     159              std::string str = "";
     160
     161              for (uint32_t j=0; j<limit; j++)
     162                {
     163                  uint32_t index = i+j;
     164                  if (index >= _param->_bht_nb_shifter)
     165                    break;
     166                  else
     167                    str+=toString("[%.4d] %.4x ",index,reg_BHT[index]);
     168                }
     169             
     170              log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"    %s",str.c_str());
     171            }
     172        }
     173
     174      if (_param->_have_pht)
     175        {
     176          log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * Dump PHT");
     177
     178          uint32_t limit = 4;
     179
     180          for (uint32_t num_bank=0; num_bank <_param->_pht_nb_bank; ++num_bank)
     181            {
     182              log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  [%.4d]",num_bank);
     183
     184              for (uint32_t i=0; i<_param->_pht_size_bank; i+=limit)
     185                {
     186                  std::string str = "";
     187                 
     188                  for (uint32_t j=0; j<limit; j++)
     189                    {
     190                      uint32_t index = i+j;
     191                      if (index >= _param->_pht_nb_counter)
     192                        break;
     193                      else
     194                        str+=toString("[%.4d] %.4x ",index,reg_PHT[num_bank][index]);
     195                    }
     196                 
     197                  log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"    %s",str.c_str());
     198                }
     199            }
     200        }
     201    }
     202#endif
    27203
    28204#if defined(STATISTICS) or defined(VHDL_TESTBENCH)
Note: See TracChangeset for help on using the changeset viewer.