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 111)
+++ 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 112)
@@ -44,6 +44,6 @@
     _bht_nb_shifter          = (have_bht)?(bht_nb_shifter  ):0;
     _have_pht                = have_pht              ;
-    _pht_size_counter        = (have_pht)?(pht_size_counter      ):0;
-    _pht_nb_counter          = (have_pht)?(pht_nb_counter        ):0;
+    _pht_size_counter        = (have_pht)?(pht_size_counter):0;
+    _pht_nb_counter          = (have_pht)?(pht_nb_counter  ):0;
     _pht_size_address_share  = (have_bht and have_pht)?(pht_size_address_share):0;
     _update_on_prediction    = update_on_prediction  ;
@@ -54,6 +54,9 @@
     test();                  
 
+    // history to update_prediction_table :
+    //  MSB : pht_history
+    //  LSB : bht_history
+                       
     _size_history            = _bht_size_shifter + _pht_size_counter;
-                             
     _bht_history_mask        = gen_mask<Thistory_t>(_bht_size_shifter);
     _bht_history_rshift      = 0;
@@ -67,4 +70,14 @@
     log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_history_rshift       : %d",_pht_history_rshift);
 
+    _bht_init_take           = (Thistory_t)(-1)&_bht_history_mask;
+    _bht_init_ntake          = 0;
+    _pht_init_take           = (1<<(_pht_size_counter-1)); // size = 4 : 1000/2
+    _pht_init_ntake          = _pht_init_take-1;           // size = 4 : 0111/2
+
+    log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _bht_init_take            : 0x%x",_bht_init_take );
+    log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _bht_init_ntake           : 0x%x",_bht_init_ntake);
+    log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_init_take            : 0x%x",_pht_init_take );
+    log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_init_ntake           : 0x%x",_pht_init_ntake);
+    
     if (_have_bht)
       {
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_allocation.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_allocation.cpp	(revision 111)
+++ 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	(revision 112)
@@ -59,5 +59,5 @@
     // ~~~~~[ Interface : "predict" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     {
-      ALLOC1_INTERFACE("predict",IN,WEST,_("Predict direction interface"),_param->_nb_inst_predict);
+      ALLOC1_INTERFACE_BEGIN("predict",IN,WEST,_("Predict direction interface"),_param->_nb_inst_predict);
 
       ALLOC1_VALACK_IN ( in_PREDICT_VAL          ,VAL);
@@ -71,9 +71,11 @@
       ALLOC1_SIGNAL_IN ( in_PREDICT_DIRECTION    ,"DIRECTION"    ,Tcontrol_t,1                    );
         }
+
+      ALLOC1_INTERFACE_END(_param->_nb_inst_predict);
     }
 
     // ~~~~~[ Interface : "update" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     {
-      ALLOC1_INTERFACE("update",IN,WEST,_("Update direction interface"),_param->_nb_inst_update);
+      ALLOC1_INTERFACE_BEGIN("update",IN,WEST,_("Update direction interface"),_param->_nb_inst_update);
 
       ALLOC1_VALACK_IN ( in_UPDATE_VAL           ,VAL);
@@ -81,8 +83,13 @@
       ALLOC1_SIGNAL_IN ( in_UPDATE_ADDRESS       ,"ADDRESS"      ,Taddress_t,_param->_size_address);
       ALLOC1_SIGNAL_IN ( in_UPDATE_HISTORY       ,"HISTORY"      ,Thistory_t,_param->_size_history);
+      ALLOC1_SIGNAL_IN ( in_UPDATE_HISTORY_VAL   ,"HISTORY_VAL"  ,Tcontrol_t,1                    );
       ALLOC1_SIGNAL_IN ( in_UPDATE_DIRECTION     ,"DIRECTION"    ,Tcontrol_t,1                    );
       if (_param->_update_on_prediction)
       ALLOC1_SIGNAL_IN ( in_UPDATE_MISS          ,"MISS"         ,Tcontrol_t,1                    );
+
+      ALLOC1_INTERFACE_END(_param->_nb_inst_update);
     }
+
+    // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
     if (usage_is_set(_usage,USE_SYSTEMC))
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_deallocation.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_deallocation.cpp	(revision 111)
+++ 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	(revision 112)
@@ -46,4 +46,5 @@
         DELETE1_SIGNAL( in_UPDATE_ADDRESS       ,_param->_nb_inst_update,_param->_size_address);
         DELETE1_SIGNAL( in_UPDATE_HISTORY       ,_param->_nb_inst_update,_param->_size_history);
+        DELETE1_SIGNAL( in_UPDATE_HISTORY_VAL   ,_param->_nb_inst_update,1                    );
         DELETE1_SIGNAL( in_UPDATE_DIRECTION     ,_param->_nb_inst_update,1                    );
         if (_param->_update_on_prediction)                              
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 111)
+++ 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 112)
@@ -90,16 +90,24 @@
             {
               log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * UPDATE [%d]",i);
+              log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * miss             : %d",PORT_READ(in_UPDATE_MISS [i]));
+              log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * update_on_predict: %d",_param->_update_on_prediction);
               
               // Update if 
               //  * update_on_prediction and miss
               //  * not update_on_prediction
-              if (not _param->_update_on_prediction or (_param->_update_on_prediction and PORT_READ(in_UPDATE_MISS [i])))
-                {
-                  Taddress_t address     = PORT_READ(in_UPDATE_ADDRESS   [i]);
-                  Thistory_t history     = PORT_READ(in_UPDATE_HISTORY   [i]);
-                  Tcontrol_t direction   = PORT_READ(in_UPDATE_DIRECTION [i])&1;
+              Tcontrol_t history_val = PORT_READ(in_UPDATE_HISTORY_VAL [i]);
+
+              if (not _param->_update_on_prediction or 
+                  (_param->_update_on_prediction and PORT_READ(in_UPDATE_MISS [i])) or
+                  not history_val // static_prediction
+                  )
+                {
+                  Taddress_t address     = PORT_READ(in_UPDATE_ADDRESS     [i]);
+                  Thistory_t history     = PORT_READ(in_UPDATE_HISTORY     [i]);
+                  Tcontrol_t direction   = PORT_READ(in_UPDATE_DIRECTION   [i])&1;
 
                   log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * address          : %.8x",address);
                   log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * direction        : %d",direction);
+                  log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * history_val      : %d",direction);
 
                   Thistory_t pht_bht_history = 0;
@@ -107,16 +115,20 @@
                   if (_param->_have_bht)
                     {
+                      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_num_reg = address & _param->_bht_address_mask;
                       
+                      log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"    * bht_history (old): %x",bht_history);
+                      log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"    * bht_num_reg      : %x",bht_num_reg);
+                      
+                      // BHT : shift register
+                      if (not history_val)
+                        bht_history = (direction)?_param->_bht_init_take:_param->_bht_init_ntake;
+                      else
+                        bht_history = ((bht_history<<1) | direction)&_param->_bht_history_mask ;
+                        
                       pht_bht_history = bht_history;
-                      
-                      log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * bht_history (old): %x",bht_history);
-                      log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * bht_num_reg      : %x",bht_num_reg);
-                      
-                      // BHT : shift register
-                      
-                      bht_history = ((bht_history<<1) | direction)&_param->_bht_history_mask ;
-                      log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * bht_history (new): %x",bht_history);
+                      log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"    * bht_history (new): %x",bht_history);
                       reg_BHT [bht_num_reg]               = bht_history;
                     }
@@ -124,17 +136,22 @@
                   if (_param->_have_pht)
                     {
+                      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;
                       
-                      log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * bht_history (old): %x",pht_bht_history);
-                      log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * pht_history (old): %x",pht_history);
-                      log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * pht_num_reg      : %x",pht_num_reg);
-                      log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * pht_num_bank     : %x",pht_num_bank);
+                      log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"    * bht_history (old): %x",pht_bht_history);
+                      log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"    * pht_history (old): %x",pht_history);
+                      log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"    * pht_num_reg      : %x",pht_num_reg);
+                      log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"    * pht_num_bank     : %x",pht_num_bank);
                       
                       // PHT : saturation counter
-                      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);
+                      if (not history_val)
+                        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));
+                      
+                      log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"    * pht_history (new): %x",pht_history);
                       
                       reg_PHT [pht_num_bank][pht_num_reg] = pht_history;
@@ -145,5 +162,5 @@
 
 #if defined(DEBUG) and DEBUG_Two_Level_Branch_Predictor and (DEBUG >= DEBUG_TRACE)
-    if (0)
+    if (1)
     {
       log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * Dump Two_Level_Branch_Predictor");
@@ -180,20 +197,27 @@
           for (uint32_t num_bank=0; num_bank <_param->_pht_nb_bank; ++num_bank)
             {
-              log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  [%.4d]",num_bank);
-
-              for (uint32_t i=0; i<_param->_pht_size_bank; i+=limit)
-                {
-                  std::string str = "";
+              if (_param->_pht_size_bank == 1)
+                {
+                  log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  [%.4d][0000] %4x",num_bank,reg_PHT[num_bank][0]);
+                }
+              else
+                {
+                  log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  [%.4d]",num_bank);
                   
-                  for (uint32_t j=0; j<limit; j++)
+                  for (uint32_t i=0; i<_param->_pht_size_bank; i+=limit)
                     {
-                      uint32_t index = i+j;
-                      if (index >= _param->_pht_nb_counter)
-                        break;
-                      else
-                        str+=toString("[%.4d] %.4x ",index,reg_PHT[num_bank][index]);
+                      std::string str = "";
+                      
+                      for (uint32_t j=0; j<limit; j++)
+                        {
+                          uint32_t index = i+j;
+                          if (index >= _param->_pht_size_bank)
+                            break;
+                          else
+                            str+=toString("[%.4d] %.4x ",index,reg_PHT[num_bank][index]);
+                        }
+                      
+                      log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"    %s",str.c_str());
                     }
-                  
-                  log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"    %s",str.c_str());
                 }
             }
