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 81)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/src/Update_Prediction_Table_transition.cpp	(revision 82)
@@ -31,4 +31,5 @@
 	    reg_BOTTOM             [i] = 0;
 	    reg_NB_ELT             [i] = 0;
+	    reg_NB_ELT_UPDATE      [i] = 0;
 	    reg_NB_ELT_NEED_UPDATE [i] = 0;
 	    for (uint32_t j=0; j<_param->_size_queue[i]; j++)
@@ -74,17 +75,19 @@
 	  if (PORT_READ(in_DECOD_VAL[i]) and internal_DECOD_ACK [i])
 	    {
-	      Tcontext_t context = (_param->_have_port_context_id)?PORT_READ(in_DECOD_CONTEXT_ID [i]):0;
-	      Tcontrol_t miss    = PORT_READ(in_DECOD_MISS_PREDICTION [i]);
+	      Tcontext_t context     = (_param->_have_port_context_id)?PORT_READ(in_DECOD_CONTEXT_ID [i]):0;
+	      Tcontrol_t miss_ifetch = PORT_READ(in_DECOD_MISS_IFETCH [i]);
+	      Tcontrol_t miss_decod  = PORT_READ(in_DECOD_MISS_DECOD  [i]);
 
 	      log_printf(TRACE,Update_Prediction_Table,FUNCTION,"DECOD[%d] - Accepted",i);
-	      log_printf(TRACE,Update_Prediction_Table,FUNCTION," * context : %d",context);
-	      log_printf(TRACE,Update_Prediction_Table,FUNCTION," * miss    : %d",miss);
-	      log_printf(TRACE,Update_Prediction_Table,FUNCTION," * nb_elt  : %d",reg_NB_ELT[context]);
+	      log_printf(TRACE,Update_Prediction_Table,FUNCTION," * context     : %d",context);
+	      log_printf(TRACE,Update_Prediction_Table,FUNCTION," * miss_ifetch : %d",miss_ifetch);
+	      log_printf(TRACE,Update_Prediction_Table,FUNCTION," * miss_decod  : %d",miss_decod);
+	      log_printf(TRACE,Update_Prediction_Table,FUNCTION," * nb_elt      : %d",reg_NB_ELT[context]);
 	      
 	      // Test if miss ifetch
 	      //   miss ifetch = decod a branch and the predict unit have not predict this branch ... gloup :P
-	      if (miss)
+	      if (miss_ifetch or miss_decod)
 		{
-		  Tdepth_t depth = (_param->_have_port_depth)?PORT_READ(in_DECOD_UPDATE_PREDICTION_ID [i]):0;
+		  Tdepth_t depth = (_param->_have_port_max_depth)?PORT_READ(in_DECOD_UPDATE_PREDICTION_ID [i]):0;
 		  Tdepth_t top   = reg_TOP [context];
 
@@ -127,4 +130,5 @@
 			}
 		    }
+		  reg_UPDATE_PREDICTION_TABLE [context][depth]._state = UPDATE_PREDICTION_STATE_EVENT; // rewrite
 
 		  reg_TOP                [context] = (depth+1)%_param->_size_queue [context];
@@ -135,5 +139,5 @@
 		{
 		  // Normal case : branch is previous predicated, change state of branch
-		  Tdepth_t depth = (_param->_have_port_depth)?PORT_READ(in_DECOD_UPDATE_PREDICTION_ID [i]):0;
+		  Tdepth_t depth = (_param->_have_port_max_depth)?PORT_READ(in_DECOD_UPDATE_PREDICTION_ID [i]):0;
 
 		  reg_UPDATE_PREDICTION_TABLE [context][depth]._state = UPDATE_PREDICTION_STATE_WAITEND;
@@ -148,5 +152,5 @@
 	    {
 	      Tcontext_t context = (_param->_have_port_context_id)?PORT_READ(in_BRANCH_COMPLETE_CONTEXT_ID [i]):0;
-	      Tdepth_t   depth   = (_param->_have_port_depth     )?PORT_READ(in_BRANCH_COMPLETE_DEPTH      [i]):0;
+	      Tdepth_t   depth   = (_param->_have_port_max_depth     )?PORT_READ(in_BRANCH_COMPLETE_DEPTH      [i]):0;
 
 	      log_printf(TRACE,Update_Prediction_Table,FUNCTION,"BRANCH_COMPLETE[%d] - Accepted",i);
@@ -158,5 +162,5 @@
 		{
 		  // Miss case
-		  reg_UPDATE_PREDICTION_TABLE [context][depth]._state = UPDATE_PREDICTION_STATE_KO;
+		  reg_UPDATE_PREDICTION_TABLE [context][depth]._state = UPDATE_PREDICTION_STATE_EVENT;
 
 		  // Another prediction (prediction with depth higer)
@@ -231,4 +235,15 @@
 
 	// ===================================================================
+	// =====[ BRANCH_EVENT ]==============================================
+	// ===================================================================
+	for (uint32_t i=0; i<_param->_nb_context; i++)
+	  if (internal_BRANCH_EVENT_VAL [i] and PORT_READ(in_BRANCH_EVENT_ACK [i]))
+	  {
+	    Tdepth_t depth = internal_BRANCH_EVENT_DEPTH [i];
+	    
+	    reg_UPDATE_PREDICTION_TABLE [i][depth]._state = UPDATE_PREDICTION_STATE_KO;
+	  }
+
+	// ===================================================================
 	// =====[ GARBAGE COLLECTOR ]=========================================
 	// ===================================================================
@@ -253,10 +268,10 @@
       }
 
-// #if (DEBUG >= DEBUG_TRACE)
+#if (DEBUG >= DEBUG_TRACE)
     log_printf(TRACE,Update_Prediction_Table,FUNCTION,"Dump Update_Prediction_Table");
     log_printf(TRACE,Update_Prediction_Table,FUNCTION,"  * reg_UPDATE_PRIORITY      : %d",reg_UPDATE_PRIORITY);
     for (uint32_t i=0; i<_param->_nb_context; i++)
       {
-	log_printf(TRACE,Update_Prediction_Table,FUNCTION,"  * Update_Prediction_Table [%d]",i);
+	log_printf(TRACE,Update_Prediction_Table,FUNCTION,"  * Update_Prediction_Table   [%d]",i);
 	log_printf(TRACE,Update_Prediction_Table,FUNCTION,"    * reg_TOP                : %d",reg_TOP                [i]);
 	log_printf(TRACE,Update_Prediction_Table,FUNCTION,"    * reg_BOTTOM             : %d",reg_BOTTOM             [i]);
@@ -266,5 +281,5 @@
 	  log_printf(TRACE,Update_Prediction_Table,FUNCTION,"      [%d] %s %x",j,toString(reg_UPDATE_PREDICTION_TABLE [i][j]._state).c_str(),reg_UPDATE_PREDICTION_TABLE [i][j]._address_src);
       }
-// #endif
+#endif
 
 
