Ignore:
Timestamp:
Apr 20, 2009, 11:29:17 PM (15 years ago)
Author:
rosiere
Message:

1) Write queue with mealy
2) Network : fix bug
3) leak memory

Location:
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Branch_Target_Buffer/src/Branch_Target_Buffer_deallocation.cpp

    r112 r115  
    6363    if (_param->_have_component_victim)
    6464      {
    65     delete [] _component_sort;
    66     delete _component_victim;
     65        for (uint32_t i=0; i<_param->_nb_inst_predict; i++)
     66          delete _component_sort [i];
     67        delete [] _component_sort;
     68        delete _component_victim;
    6769      }
    6870    delete _component_branch_target_buffer_glue;
    6971    delete _component_branch_target_buffer_register;
    70 
     72   
    7173    delete _component;
    7274
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/include/Parameters.h

    r112 r115  
    4444                                               
    4545  public : Thistory_t _bht_history_mask        ;
    46   public : Thistory_t _bht_history_rshift      ;
     46  public : Thistory_t _bht_history_shift       ;
    4747  public : Thistory_t _pht_history_mask        ;
    48   public : Thistory_t _pht_history_rshift      ;
     48  public : Thistory_t _pht_history_shift       ;
    4949                                               
    5050  public : uint32_t   _bht_size_address        ;
     
    5555  public : uint32_t   _pht_size_bank           ;
    5656  public : Taddress_t _pht_address_share_mask  ;
    57   public : Taddress_t _pht_address_share_lshift;
     57  public : Taddress_t _pht_address_share_shift ;
    5858  public : Taddress_t _pht_address_bank_mask   ;
    59   public : Taddress_t _pht_address_bank_rshift ;
     59  public : Taddress_t _pht_address_bank_shift ;
    6060
    6161  public : Thistory_t _bht_init_take           ;
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/include/Two_Level_Branch_Predictor.h

    r112 r115  
    8888    // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
    8989  private   : Thistory_t                    * reg_BHT                       ;//[bht_nb_shifter]
    90   private   : Thistory_t                   ** reg_PHT                       ;//[pht_nb_counter][pht_nb_bank]
     90  private   : Thistory_t                   ** reg_PHT                       ;//[pht_nb_bank][pht_size_bank]
    9191
    9292    // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/src/Parameters.cpp

    r112 r115  
    5757    //  MSB : pht_history
    5858    //  LSB : bht_history
     59    log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _have_bht                 : %d",_have_bht        );
     60    log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _bht_size_shifter         : %d",_bht_size_shifter);
     61    log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _bht_nb_shifter           : %d",_bht_nb_shifter  );
     62
     63    log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _have_pht                 : %d",_have_pht        );
     64    log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_size_counter         : %d",_pht_size_counter);
     65    log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_nb_counter           : %d",_pht_nb_counter  );
    5966                       
    6067    _size_history            = _bht_size_shifter + _pht_size_counter;
    6168    _bht_history_mask        = gen_mask<Thistory_t>(_bht_size_shifter);
    62     _bht_history_rshift      = 0;
     69    _bht_history_shift       = 0;
    6370    _pht_history_mask        = gen_mask<Thistory_t>(_pht_size_counter);
    64     _pht_history_rshift      = _bht_size_shifter;
     71    _pht_history_shift       = _bht_size_shifter;
    6572                             
    6673    log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _size_history             : %d",_size_history  );
    6774    log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _bht_history_mask         : 0x%x",_bht_history_mask  );
    68     log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _bht_history_rshift       : %d",_bht_history_rshift);
     75    log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _bht_history_shift        : %d",_bht_history_shift );
    6976    log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_history_mask         : 0x%x",_pht_history_mask  );
    70     log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_history_rshift       : %d",_pht_history_rshift);
     77    log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_history_shift        : %d",_pht_history_shift );
    7178
    72     _bht_init_take           = (Thistory_t)(-1)&_bht_history_mask;
     79    _bht_init_take           = static_cast<Thistory_t>(-1)&_bht_history_mask;
    7380    _bht_init_ntake          = 0;
    7481    _pht_init_take           = (1<<(_pht_size_counter-1)); // size = 4 : 1000/2
     
    9198        _pht_counter_max         = (1<<_pht_size_counter)-1;
    9299       
    93         _pht_nb_bank             = (_pht_nb_counter - (1<<_bht_size_shifter))+1;
    94         _pht_size_bank           = _pht_nb_counter / _pht_nb_bank;
     100        _pht_size_bank           = (_have_bht)?(1<<_bht_size_shifter):1;
     101        _pht_nb_bank             = _pht_nb_counter / _pht_size_bank;
     102
     103        // -------->|
     104        //   +---+  |
     105        //   |   |  |--->
     106        // ---> --->|
     107        //   |   |  |
     108        //   +---+
     109        //
    95110
    96111        _pht_address_share_mask  = gen_mask<Taddress_t>(_pht_size_address_share);
    97         _pht_address_share_lshift= _bht_size_shifter-_pht_size_address_share;
     112        _pht_address_share_shift = _bht_size_shifter-_pht_size_address_share;
    98113        _pht_address_bank_mask   = gen_mask<Taddress_t>(log2(_pht_nb_bank));
    99         _pht_address_bank_rshift = _pht_size_address_share;
     114        _pht_address_bank_shift = _pht_size_address_share;
    100115
    101116        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_nb_bank              : %d"  ,_pht_nb_bank   );
    102117        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_size_bank            : %d"  ,_pht_size_bank );
    103118        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_address_share_mask   : 0x%x",_pht_address_share_mask  );
    104         log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_address_share_lshift : %d"  ,_pht_address_share_lshift);
     119        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_address_share_shift  : %d"  ,_pht_address_share_shift );
    105120        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_address_bank_mask    : 0x%x",_pht_address_bank_mask   );
    106         log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_address_bank_rshift  : %d"  ,_pht_address_bank_rshift );
     121        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_address_bank_shift   : %d"  ,_pht_address_bank_shift );
    107122      }
    108123
  • 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_genMealy_predict.cpp

    r111 r115  
    5252              log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * bht_num_reg      : %d",bht_num_reg);
    5353
    54               history   = (bht_history << _param->_bht_history_rshift)&_param->_bht_history_mask ;
     54              history   = (bht_history << _param->_bht_history_shift )&_param->_bht_history_mask ;
    5555              direction = (bht_history >> (_param->_bht_size_shifter-1))&1;
    5656
     
    6161          if (_param->_have_pht)
    6262            {
    63               Thistory_t pht_num_bank= (address>>_param->_pht_address_bank_rshift)&_param->_pht_address_bank_mask;
    64               Thistory_t pht_num_reg = (pht_bht_history xor ((address&_param->_pht_address_share_mask)<<_param->_pht_address_share_lshift));
     63              Thistory_t pht_num_bank= (address>>_param->_pht_address_bank_shift )&_param->_pht_address_bank_mask;
     64              Thistory_t pht_num_reg = (pht_bht_history xor ((address&_param->_pht_address_share_mask)<<_param->_pht_address_share_shift));
     65
     66              log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * bht_history      : 0x%x",pht_bht_history);
     67              log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * pht_num_reg      : %d",pht_num_reg);
     68              log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * pht_num_bank     : %d",pht_num_bank);
     69
    6570              Thistory_t pht_history = reg_PHT [pht_num_bank][pht_num_reg];
    6671             
    67               log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * bht_history      : 0x%x",pht_bht_history);
    6872              log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * pht_history      : 0x%x",pht_history);
    69               log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * pht_num_reg      : %d",pht_num_reg);
    70               log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * pht_num_bank     : %d",pht_num_bank);
    7173             
    72               history  |= (pht_history << _param->_pht_history_rshift)&_param->_pht_history_mask;
     74              history  |= (pht_history << _param->_pht_history_shift )&_param->_pht_history_mask;
    7375              direction = (pht_history >> (_param->_pht_size_counter-1))&1;
    7476
  • 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

    r112 r115  
    117117                      log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * bht");
    118118
    119                       Thistory_t bht_history = (history>>_param->_bht_history_rshift)&_param->_bht_history_mask;
     119                      Thistory_t bht_history = (history>>_param->_bht_history_shift )&_param->_bht_history_mask;
    120120                      Thistory_t bht_num_reg = address & _param->_bht_address_mask;
    121121                     
     
    125125                      // BHT : shift register
    126126                      if (not history_val)
    127                         bht_history = (direction)?_param->_bht_init_take:_param->_bht_init_ntake;
     127                        {
     128                          bht_history = (direction)?_param->_bht_init_take:_param->_bht_init_ntake;
     129                        }
    128130                      else
    129                         bht_history = ((bht_history<<1) | direction)&_param->_bht_history_mask ;
     131                        {
     132                          bht_history = ((bht_history<<1) | direction)&_param->_bht_history_mask ;
     133                        }
    130134                       
    131135                      pht_bht_history = bht_history;
     
    138142                      log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * pht");
    139143
    140                       Thistory_t pht_history = (history>>_param->_pht_history_rshift)&_param->_pht_history_mask;
    141                       Thistory_t pht_num_reg = pht_bht_history xor ((address&_param->_pht_address_share_mask)<<_param->_pht_address_share_lshift);
    142                       Thistory_t pht_num_bank= (address>>_param->_pht_address_bank_rshift)&_param->_pht_address_bank_mask;
     144                      Thistory_t pht_history = (history>>_param->_pht_history_shift )&_param->_pht_history_mask;
     145                      Thistory_t pht_num_bank= (address>>_param->_pht_address_bank_shift )&_param->_pht_address_bank_mask;
     146                      Thistory_t pht_num_reg = pht_bht_history xor ((address&_param->_pht_address_share_mask)<<_param->_pht_address_share_shift);
    143147                     
    144148                      log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"    * bht_history (old): %x",pht_bht_history);
     
    149153                      // PHT : saturation counter
    150154                      if (not history_val)
    151                         pht_history = (direction)?_param->_pht_init_take:_param->_pht_init_ntake;
     155                        {
     156                          pht_history = (direction)?_param->_pht_init_take:_param->_pht_init_ntake;
     157                        }
    152158                      else
    153                         pht_history = (direction==1)?((pht_history<_param->_pht_counter_max)?(pht_history+1):(pht_history)):((pht_history>0)?(pht_history-1):(pht_history));
     159                        {
     160                          pht_history = (direction==1)?((pht_history<_param->_pht_counter_max)?(pht_history+1):(pht_history)):((pht_history>0)?(pht_history-1):(pht_history));
     161                        }
    154162                     
    155163                      log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"    * pht_history (new): %x",pht_history);
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/include/Update_Prediction_Table.h

    r112 r115  
    5353  public    : Stat                           * _stat;
    5454
    55   private   : counter_t                    *** _stat_nb_branch_hit            ; //[nb_context][MAX_BRANCH_CONDITION]
    56   private   : counter_t                    *** _stat_nb_branch_miss           ; //[nb_context][MAX_BRANCH_CONDITION]
    57   private   : counter_t                     ** _stat_nb_branch_unused         ; //[nb_context]
    58   private   : counter_t                     ** _stat_ufpt_queue_nb_elt        ; //[nb_context]
    59   private   : counter_t                     ** _stat_upt_queue_nb_elt         ; //[nb_context]
    60 
     55  private   : counter_t                    *** _stat_nb_branch_hit              ; //[nb_context][MAX_BRANCH_CONDITION]
     56  private   : counter_t                    *** _stat_nb_branch_miss             ; //[nb_context][MAX_BRANCH_CONDITION]
     57  private   : counter_t                     ** _stat_nb_branch_unused           ; //[nb_context]
     58  private   : counter_t                     ** _stat_ufpt_queue_nb_elt          ; //[nb_context]
     59  private   : counter_t                     ** _stat_upt_queue_nb_elt           ; //[nb_context]
     60
     61  private   : counter_t                     ** _stat_nb_branch_ifetch_prediction; //[nb_context]
     62  private   : counter_t                     ** _stat_nb_branch_accurate         ; //[nb_context]
    6163#endif
    6264
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/src/Update_Prediction_Table_statistics_allocation.cpp

    r97 r115  
    3131
    3232    {
    33       ALLOC2(_stat_nb_branch_hit        ,counter_t *,_param->_nb_context,MAX_BRANCH_CONDITION);
    34       ALLOC2(_stat_nb_branch_miss       ,counter_t *,_param->_nb_context,MAX_BRANCH_CONDITION);
    35       ALLOC1(_stat_nb_branch_unused     ,counter_t *,_param->_nb_context);
     33      ALLOC2(_stat_nb_branch_hit              ,counter_t *,_param->_nb_context,MAX_BRANCH_CONDITION);
     34      ALLOC2(_stat_nb_branch_miss             ,counter_t *,_param->_nb_context,MAX_BRANCH_CONDITION);
     35      ALLOC1(_stat_nb_branch_unused           ,counter_t *,_param->_nb_context);
     36
     37      ALLOC1(_stat_nb_branch_ifetch_prediction,counter_t *,_param->_nb_context);
     38      ALLOC1(_stat_nb_branch_accurate         ,counter_t *,_param->_nb_context);
    3639     
    3740      for (uint32_t i=0; i<_param->_nb_context; ++i)
     
    7477                                     toString(_("Percent miss by branchement (context %d)"),i));
    7578         
    76           _stat_nb_branch_unused [i] = _stat->create_counter("nb_branch_unused_" +toString(i),"",toString(_("Branch unused (previous speculation) (context %d)"),i));
     79          _stat_nb_branch_unused            [i] = _stat->create_counter("nb_branch_unused_" +toString(i),"",toString(_("Branch unused (previous speculation) (context %d)"),i));
     80          _stat_nb_branch_ifetch_prediction [i] = _stat->create_counter("nb_branch_ifetch_prediction_"+toString(i),"",toString(_("Branch used and ifetch prediction (context %d)"),i));
     81          _stat_nb_branch_accurate          [i] = _stat->create_counter("nb_branch_accurate_"         +toString(i),"",toString(_("Branch and is accurate (context %d)"),i));
     82
     83          _stat->create_expr("nb_branch_used_"+toString(i),sum_branchement,TYPE_COUNTER,"",_("Branch used"));
    7784        }
    7885    }
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/src/Update_Prediction_Table_transition.cpp

    r113 r115  
    468468                          reg_UPDATE_PREDICTION_TABLE [context][depth]._retire_ok       = true;
    469469                          reg_UPDATE_PREDICTION_TABLE [context][depth]._miss_prediction = ko;
     470
     471#ifdef STATISTICS
     472                          if (usage_is_set(_usage,USE_STATISTICS))
     473                            {
     474                              if (reg_UPDATE_PREDICTION_TABLE [context][depth]._ifetch_prediction)
     475                                (*_stat_nb_branch_ifetch_prediction [context])++;
     476                              if (reg_UPDATE_PREDICTION_TABLE [context][depth]._is_accurate)
     477                                (*_stat_nb_branch_accurate          [context])++;
     478                            }
     479#endif
    470480                        }
    471481
Note: See TracChangeset for help on using the changeset viewer.