Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Branch_Target_Buffer/src/Branch_Target_Buffer_deallocation.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Branch_Target_Buffer/src/Branch_Target_Buffer_deallocation.cpp	(revision 113)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Branch_Target_Buffer/src/Branch_Target_Buffer_deallocation.cpp	(revision 115)
@@ -63,10 +63,12 @@
     if (_param->_have_component_victim)
       {
-    delete [] _component_sort;
-    delete _component_victim;
+	for (uint32_t i=0; i<_param->_nb_inst_predict; i++)
+	  delete _component_sort [i];
+	delete [] _component_sort;
+	delete _component_victim;
       }
     delete _component_branch_target_buffer_glue;
     delete _component_branch_target_buffer_register;
-
+    
     delete _component;
 
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/include/Parameters.h
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/include/Parameters.h	(revision 113)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/include/Parameters.h	(revision 115)
@@ -44,7 +44,7 @@
                                                
   public : Thistory_t _bht_history_mask        ;
-  public : Thistory_t _bht_history_rshift      ;
+  public : Thistory_t _bht_history_shift       ;
   public : Thistory_t _pht_history_mask        ;
-  public : Thistory_t _pht_history_rshift      ;
+  public : Thistory_t _pht_history_shift       ;
                                                
   public : uint32_t   _bht_size_address        ;
@@ -55,7 +55,7 @@
   public : uint32_t   _pht_size_bank           ;
   public : Taddress_t _pht_address_share_mask  ;
-  public : Taddress_t _pht_address_share_lshift;
+  public : Taddress_t _pht_address_share_shift ;
   public : Taddress_t _pht_address_bank_mask   ;
-  public : Taddress_t _pht_address_bank_rshift ;
+  public : Taddress_t _pht_address_bank_shift  ;
 
   public : Thistory_t _bht_init_take           ;
Index: 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
===================================================================
--- 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	(revision 113)
+++ 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	(revision 115)
@@ -88,5 +88,5 @@
     // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    
   private   : Thistory_t                    * reg_BHT                       ;//[bht_nb_shifter]
-  private   : Thistory_t                   ** reg_PHT                       ;//[pht_nb_counter][pht_nb_bank]
+  private   : Thistory_t                   ** reg_PHT                       ;//[pht_nb_bank][pht_size_bank]
 
     // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/src/Parameters.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/src/Parameters.cpp	(revision 113)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/src/Parameters.cpp	(revision 115)
@@ -57,18 +57,25 @@
     //  MSB : pht_history
     //  LSB : bht_history
+    log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _have_bht                 : %d",_have_bht        );
+    log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _bht_size_shifter         : %d",_bht_size_shifter);
+    log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _bht_nb_shifter           : %d",_bht_nb_shifter  );
+
+    log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _have_pht                 : %d",_have_pht        );
+    log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_size_counter         : %d",_pht_size_counter);
+    log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_nb_counter           : %d",_pht_nb_counter  );
                        
     _size_history            = _bht_size_shifter + _pht_size_counter;
     _bht_history_mask        = gen_mask<Thistory_t>(_bht_size_shifter);
-    _bht_history_rshift      = 0;
+    _bht_history_shift       = 0;
     _pht_history_mask        = gen_mask<Thistory_t>(_pht_size_counter);
-    _pht_history_rshift      = _bht_size_shifter;
+    _pht_history_shift       = _bht_size_shifter;
                              
     log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _size_history             : %d",_size_history  );
     log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _bht_history_mask         : 0x%x",_bht_history_mask  );
-    log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _bht_history_rshift       : %d",_bht_history_rshift);
+    log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _bht_history_shift        : %d",_bht_history_shift );
     log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_history_mask         : 0x%x",_pht_history_mask  );
-    log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_history_rshift       : %d",_pht_history_rshift);
+    log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_history_shift        : %d",_pht_history_shift );
 
-    _bht_init_take           = (Thistory_t)(-1)&_bht_history_mask;
+    _bht_init_take           = static_cast<Thistory_t>(-1)&_bht_history_mask;
     _bht_init_ntake          = 0;
     _pht_init_take           = (1<<(_pht_size_counter-1)); // size = 4 : 1000/2
@@ -91,18 +98,26 @@
         _pht_counter_max         = (1<<_pht_size_counter)-1;
         
-        _pht_nb_bank             = (_pht_nb_counter - (1<<_bht_size_shifter))+1;
-        _pht_size_bank           = _pht_nb_counter / _pht_nb_bank;
+        _pht_size_bank           = (_have_bht)?(1<<_bht_size_shifter):1;
+        _pht_nb_bank             = _pht_nb_counter / _pht_size_bank;
+
+	// -------->|
+	//   +---+  |
+	//   |   |  |--->
+	// ---> --->|
+	//   |   |  |
+	//   +---+
+	//
 
         _pht_address_share_mask  = gen_mask<Taddress_t>(_pht_size_address_share);
-        _pht_address_share_lshift= _bht_size_shifter-_pht_size_address_share;
+        _pht_address_share_shift = _bht_size_shifter-_pht_size_address_share;
         _pht_address_bank_mask   = gen_mask<Taddress_t>(log2(_pht_nb_bank));
-        _pht_address_bank_rshift = _pht_size_address_share;
+        _pht_address_bank_shift  = _pht_size_address_share;
 
         log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_nb_bank              : %d"  ,_pht_nb_bank   );
         log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_size_bank            : %d"  ,_pht_size_bank );
         log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_address_share_mask   : 0x%x",_pht_address_share_mask  );
-        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_address_share_lshift : %d"  ,_pht_address_share_lshift);
+        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_address_share_shift  : %d"  ,_pht_address_share_shift );
         log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_address_bank_mask    : 0x%x",_pht_address_bank_mask   );
-        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_address_bank_rshift  : %d"  ,_pht_address_bank_rshift );
+        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_address_bank_shift   : %d"  ,_pht_address_bank_shift  );
       }
 
Index: 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
===================================================================
--- 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	(revision 113)
+++ 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	(revision 115)
@@ -52,5 +52,5 @@
               log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * bht_num_reg      : %d",bht_num_reg);
 
-              history   = (bht_history << _param->_bht_history_rshift)&_param->_bht_history_mask ;
+              history   = (bht_history << _param->_bht_history_shift )&_param->_bht_history_mask ;
               direction = (bht_history >> (_param->_bht_size_shifter-1))&1;
 
@@ -61,14 +61,16 @@
           if (_param->_have_pht)
             {
-              Thistory_t pht_num_bank= (address>>_param->_pht_address_bank_rshift)&_param->_pht_address_bank_mask;
-              Thistory_t pht_num_reg = (pht_bht_history xor ((address&_param->_pht_address_share_mask)<<_param->_pht_address_share_lshift));
+              Thistory_t pht_num_bank= (address>>_param->_pht_address_bank_shift )&_param->_pht_address_bank_mask;
+              Thistory_t pht_num_reg = (pht_bht_history xor ((address&_param->_pht_address_share_mask)<<_param->_pht_address_share_shift));
+
+              log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * bht_history      : 0x%x",pht_bht_history);
+              log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * pht_num_reg      : %d",pht_num_reg);
+              log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * pht_num_bank     : %d",pht_num_bank);
+
               Thistory_t pht_history = reg_PHT [pht_num_bank][pht_num_reg];
               
-              log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * bht_history      : 0x%x",pht_bht_history);
               log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * pht_history      : 0x%x",pht_history);
-              log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * pht_num_reg      : %d",pht_num_reg);
-              log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * pht_num_bank     : %d",pht_num_bank);
               
-              history  |= (pht_history << _param->_pht_history_rshift)&_param->_pht_history_mask;
+              history  |= (pht_history << _param->_pht_history_shift )&_param->_pht_history_mask;
               direction = (pht_history >> (_param->_pht_size_counter-1))&1;
 
Index: 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
===================================================================
--- 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	(revision 113)
+++ 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	(revision 115)
@@ -117,5 +117,5 @@
                       log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * bht");
 
-                      Thistory_t bht_history = (history>>_param->_bht_history_rshift)&_param->_bht_history_mask;
+                      Thistory_t bht_history = (history>>_param->_bht_history_shift )&_param->_bht_history_mask;
                       Thistory_t bht_num_reg = address & _param->_bht_address_mask;
                       
@@ -125,7 +125,11 @@
                       // BHT : shift register
                       if (not history_val)
-                        bht_history = (direction)?_param->_bht_init_take:_param->_bht_init_ntake;
+			{
+			  bht_history = (direction)?_param->_bht_init_take:_param->_bht_init_ntake;
+			}
                       else
-                        bht_history = ((bht_history<<1) | direction)&_param->_bht_history_mask ;
+			{
+			  bht_history = ((bht_history<<1) | direction)&_param->_bht_history_mask ;
+			}
                         
                       pht_bht_history = bht_history;
@@ -138,7 +142,7 @@
                       log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * pht");
 
-                      Thistory_t pht_history = (history>>_param->_pht_history_rshift)&_param->_pht_history_mask;
-                      Thistory_t pht_num_reg = pht_bht_history xor ((address&_param->_pht_address_share_mask)<<_param->_pht_address_share_lshift);
-                      Thistory_t pht_num_bank= (address>>_param->_pht_address_bank_rshift)&_param->_pht_address_bank_mask;
+                      Thistory_t pht_history = (history>>_param->_pht_history_shift )&_param->_pht_history_mask;
+                      Thistory_t pht_num_bank= (address>>_param->_pht_address_bank_shift )&_param->_pht_address_bank_mask;
+                      Thistory_t pht_num_reg = pht_bht_history xor ((address&_param->_pht_address_share_mask)<<_param->_pht_address_share_shift);
                       
                       log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"    * bht_history (old): %x",pht_bht_history);
@@ -149,7 +153,11 @@
                       // PHT : saturation counter
                       if (not history_val)
-                        pht_history = (direction)?_param->_pht_init_take:_param->_pht_init_ntake;
+			{
+			  pht_history = (direction)?_param->_pht_init_take:_param->_pht_init_ntake;
+			}
                       else
-                        pht_history = (direction==1)?((pht_history<_param->_pht_counter_max)?(pht_history+1):(pht_history)):((pht_history>0)?(pht_history-1):(pht_history));
+			{
+			  pht_history = (direction==1)?((pht_history<_param->_pht_counter_max)?(pht_history+1):(pht_history)):((pht_history>0)?(pht_history-1):(pht_history));
+			}
                       
                       log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"    * pht_history (new): %x",pht_history);
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/include/Update_Prediction_Table.h
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/include/Update_Prediction_Table.h	(revision 113)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/include/Update_Prediction_Table.h	(revision 115)
@@ -53,10 +53,12 @@
   public    : Stat                           * _stat;
 
-  private   : counter_t                    *** _stat_nb_branch_hit            ; //[nb_context][MAX_BRANCH_CONDITION]
-  private   : counter_t                    *** _stat_nb_branch_miss           ; //[nb_context][MAX_BRANCH_CONDITION]
-  private   : counter_t                     ** _stat_nb_branch_unused         ; //[nb_context]
-  private   : counter_t                     ** _stat_ufpt_queue_nb_elt        ; //[nb_context]
-  private   : counter_t                     ** _stat_upt_queue_nb_elt         ; //[nb_context]
-
+  private   : counter_t                    *** _stat_nb_branch_hit              ; //[nb_context][MAX_BRANCH_CONDITION]
+  private   : counter_t                    *** _stat_nb_branch_miss             ; //[nb_context][MAX_BRANCH_CONDITION]
+  private   : counter_t                     ** _stat_nb_branch_unused           ; //[nb_context]
+  private   : counter_t                     ** _stat_ufpt_queue_nb_elt          ; //[nb_context]
+  private   : counter_t                     ** _stat_upt_queue_nb_elt           ; //[nb_context]
+
+  private   : counter_t                     ** _stat_nb_branch_ifetch_prediction; //[nb_context]
+  private   : counter_t                     ** _stat_nb_branch_accurate         ; //[nb_context]
 #endif
 
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/src/Update_Prediction_Table_statistics_allocation.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/src/Update_Prediction_Table_statistics_allocation.cpp	(revision 113)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/src/Update_Prediction_Table_statistics_allocation.cpp	(revision 115)
@@ -31,7 +31,10 @@
 
     {
-      ALLOC2(_stat_nb_branch_hit        ,counter_t *,_param->_nb_context,MAX_BRANCH_CONDITION);
-      ALLOC2(_stat_nb_branch_miss       ,counter_t *,_param->_nb_context,MAX_BRANCH_CONDITION);
-      ALLOC1(_stat_nb_branch_unused     ,counter_t *,_param->_nb_context);
+      ALLOC2(_stat_nb_branch_hit              ,counter_t *,_param->_nb_context,MAX_BRANCH_CONDITION);
+      ALLOC2(_stat_nb_branch_miss             ,counter_t *,_param->_nb_context,MAX_BRANCH_CONDITION);
+      ALLOC1(_stat_nb_branch_unused           ,counter_t *,_param->_nb_context);
+
+      ALLOC1(_stat_nb_branch_ifetch_prediction,counter_t *,_param->_nb_context);
+      ALLOC1(_stat_nb_branch_accurate         ,counter_t *,_param->_nb_context);
       
       for (uint32_t i=0; i<_param->_nb_context; ++i)
@@ -74,5 +77,9 @@
                                      toString(_("Percent miss by branchement (context %d)"),i));
           
-          _stat_nb_branch_unused [i] = _stat->create_counter("nb_branch_unused_" +toString(i),"",toString(_("Branch unused (previous speculation) (context %d)"),i));
+          _stat_nb_branch_unused            [i] = _stat->create_counter("nb_branch_unused_" +toString(i),"",toString(_("Branch unused (previous speculation) (context %d)"),i));
+	  _stat_nb_branch_ifetch_prediction [i] = _stat->create_counter("nb_branch_ifetch_prediction_"+toString(i),"",toString(_("Branch used and ifetch prediction (context %d)"),i));
+	  _stat_nb_branch_accurate          [i] = _stat->create_counter("nb_branch_accurate_"         +toString(i),"",toString(_("Branch and is accurate (context %d)"),i));
+
+	  _stat->create_expr("nb_branch_used_"+toString(i),sum_branchement,TYPE_COUNTER,"",_("Branch used"));
         }
     }
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/src/Update_Prediction_Table_transition.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/src/Update_Prediction_Table_transition.cpp	(revision 113)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/src/Update_Prediction_Table_transition.cpp	(revision 115)
@@ -468,4 +468,14 @@
                           reg_UPDATE_PREDICTION_TABLE [context][depth]._retire_ok       = true;
                           reg_UPDATE_PREDICTION_TABLE [context][depth]._miss_prediction = ko;
+
+#ifdef STATISTICS
+                          if (usage_is_set(_usage,USE_STATISTICS))
+			    {
+			      if (reg_UPDATE_PREDICTION_TABLE [context][depth]._ifetch_prediction)
+				(*_stat_nb_branch_ifetch_prediction [context])++;
+			      if (reg_UPDATE_PREDICTION_TABLE [context][depth]._is_accurate)
+				(*_stat_nb_branch_accurate          [context])++;
+			    }
+#endif
                         }
 
