Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/src/Update_Prediction_Table_genMoore.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/src/Update_Prediction_Table_genMoore.cpp	(revision 88)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/src/Update_Prediction_Table_genMoore.cpp	(revision 94)
@@ -24,5 +24,4 @@
     log_begin(Update_Prediction_Table,FUNCTION);
     log_function(Update_Prediction_Table,FUNCTION,_name.c_str());
-    log_printf(NONE,Update_Prediction_Table,FUNCTION,FUNCTION);
 
     if (PORT_READ(in_NRESET) == 1)
@@ -87,4 +86,5 @@
         Thistory_t          dir_history          ;
         Tcontrol_t          ras_val              ;
+        Tcontrol_t          ras_flush            ;
         Tcontrol_t          ras_push             ;
         Taddress_t          ras_address          ;
@@ -110,4 +110,6 @@
                 
                 val                   = (state == UPDATE_FETCH_PREDICTION_STATE_EVENT);
+//              val_without_ack       = not update_ras(condition);
+
                 miss_prediction       = 1;
 //              direction_good        = ;
@@ -119,4 +121,5 @@
 //              dir_history           = ;
                 ras_val               = update_ras(condition); // repop/ repush data -> don't corrupt ras
+                ras_flush             = 0;
                 ras_push              = push_ras(condition);
                 ras_address           = reg_UPDATE_FETCH_PREDICTION_TABLE [context][depth]._address_ras;
@@ -132,5 +135,5 @@
                   ufpt_update [context] = false;
                 
-                tab_ufpt_depth[context] = (depth==0)?(_param->_size_ufpt_queue[context]-1):(depth-1);
+                tab_ufpt_depth[context] = ((depth==0)?_param->_size_ufpt_queue[context]:depth)-1;
               }
           }
@@ -177,4 +180,5 @@
                 dir_history           = reg_UPDATE_PREDICTION_TABLE [context][depth]._history     ;
                 ras_val               = update_ras(condition); // repop/ repush data -> don't corrupt ras
+                ras_flush             = (state == UPDATE_PREDICTION_STATE_KO); // miss prediction, RAS is corrupted
                 ras_push              = push_ras(condition);
                 ras_address           = reg_UPDATE_PREDICTION_TABLE [context][depth]._address_ras;
@@ -224,7 +228,4 @@
         PORT_WRITE(out_UPDATE_BTB_VAL               [i],btb_val              );
         PORT_WRITE(out_UPDATE_BTB_ADDRESS_SRC       [i],btb_address_src      );
-
-        log_printf(TRACE,Update_Prediction_Table,FUNCTION,"    * address_src     : %.8x",btb_address_src);
-
         PORT_WRITE(out_UPDATE_BTB_ADDRESS_DEST      [i],btb_address_dest     );
         PORT_WRITE(out_UPDATE_BTB_CONDITION         [i],btb_condition        );
@@ -233,4 +234,5 @@
         PORT_WRITE(out_UPDATE_DIR_HISTORY           [i],dir_history          );
         PORT_WRITE(out_UPDATE_RAS_VAL               [i],ras_val              );
+        PORT_WRITE(out_UPDATE_RAS_FLUSH             [i],ras_flush            );
         PORT_WRITE(out_UPDATE_RAS_PUSH              [i],ras_push             );
         PORT_WRITE(out_UPDATE_RAS_ADDRESS           [i],ras_address          );
@@ -239,29 +241,21 @@
           }
       }
-
-//     // ===================================================================
-//     // =====[ BRANCH_EVENT ]==============================================
-//     // ===================================================================
-//     for (uint32_t i=0; i<_param->_nb_context; i++)
-//       {
-// 	Tdepth_t   depth   = (reg_BOTTOM [i] + reg_NB_ELT_UPDATE [i])%_param->_size_queue [i];
-// 	state_t    state   = reg_UPDATE_PREDICTION_TABLE [i][depth]._state;
-	
-// 	Tcontrol_t val     = ((state == UPDATE_PREDICTION_STATE_EVENT) or
-//                               (state == UPDATE_PREDICTION_STATE_WAITEND_AND_EVENT));
-
-// 	if (val)
-// 	  {
-// //          breakpoint ("UPT : have an branch_event (depth %d)",depth);
-// 	    PORT_WRITE(out_BRANCH_EVENT_ADDRESS_SRC  [i], reg_UPDATE_PREDICTION_TABLE [i][depth]._address_src );
-// 	    PORT_WRITE(out_BRANCH_EVENT_ADDRESS_DEST [i], reg_UPDATE_PREDICTION_TABLE [i][depth]._address_dest);
-// 	    internal_BRANCH_EVENT_DEPTH [i] = depth;
-// 	  }
-
-// 	internal_BRANCH_EVENT_VAL   [i] = val;
-// 	PORT_WRITE(out_BRANCH_EVENT_VAL [i], internal_BRANCH_EVENT_VAL [i]);
-//       }
-
-      }
+    
+    // ===================================================================
+    // =====[ BRANCH_EVENT ]==============================================
+    // ===================================================================
+    for (uint32_t i=0; i<_param->_nb_context; i++)
+      {
+	Tcontrol_t val = (reg_EVENT_STATE [i] == EVENT_STATE_UPDATE_CONTEXT);
+
+        PORT_WRITE(out_BRANCH_EVENT_VAL              [i],val);
+        PORT_WRITE(out_BRANCH_EVENT_ADDRESS_SRC      [i],reg_EVENT_ADDRESS_SRC      [i]);
+        PORT_WRITE(out_BRANCH_EVENT_ADDRESS_DEST_VAL [i],reg_EVENT_ADDRESS_DEST_VAL [i]);
+        PORT_WRITE(out_BRANCH_EVENT_ADDRESS_DEST     [i],reg_EVENT_ADDRESS_DEST     [i]);
+
+	internal_BRANCH_EVENT_VAL [i] = val;
+      }
+      }
+
     log_end(Update_Prediction_Table,FUNCTION);
   };
