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 94)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/src/Update_Prediction_Table_genMoore.cpp	(revision 95)
@@ -57,7 +57,7 @@
         event_state_t event_state = reg_EVENT_STATE [i];
 
-        retire_ras_from_ufpt [i] = ((event_state == EVENT_STATE_FLUSH_UFPT        ) or
+        retire_ras_from_ufpt [i] = ((event_state == EVENT_STATE_FLUSH_UFPT            ) or
                                     (event_state == EVENT_STATE_FLUSH_UFPT_AND_UPT));
-        retire_ras_from_upt  [i] = (event_state == EVENT_STATE_FLUSH_UPT_RAS);
+        retire_ras_from_upt  [i] = (event_state == EVENT_STATE_FLUSH_UPT);
 
         ufpt_update          [i] = true;
@@ -154,7 +154,8 @@
                 log_printf(TRACE,Update_Prediction_Table,FUNCTION,"    * condition       : %s",toString(condition).c_str());
               
-                Tcontrol_t          state_is_ok_ko           = ((state == UPDATE_PREDICTION_STATE_OK) or
-                                                                (state == UPDATE_PREDICTION_STATE_KO));
-                Tcontrol_t          state_is_event           = (state == UPDATE_PREDICTION_STATE_EVENT);
+                Tcontrol_t          state_is_ok_ko           = ((state == UPDATE_PREDICTION_STATE_OK   ) or
+                                                                (state == UPDATE_PREDICTION_STATE_KO   ));
+                Tcontrol_t          state_is_event           = ((state == UPDATE_PREDICTION_STATE_KO   ) or
+                                                                (state == UPDATE_PREDICTION_STATE_EVENT));
                 Tcontrol_t          state_is_event_update    = state_is_event and     need_update(condition);
                 Tcontrol_t          state_is_event_no_update = state_is_event and not need_update(condition);
@@ -167,5 +168,5 @@
                 else
                   {
-                val                   = state_is_ok_ko;
+                val                   = (state == UPDATE_PREDICTION_STATE_OK);
                 val_without_ack       = false;
                   }                  
@@ -173,9 +174,9 @@
                 miss_prediction       = (state != UPDATE_PREDICTION_STATE_OK);
                 direction_good        = reg_UPDATE_PREDICTION_TABLE [context][depth]._good_take   ;
-                btb_val               = update_btb(condition);
+                btb_val               = state_is_ok_ko and update_btb(condition);
                 btb_address_src       = reg_UPDATE_PREDICTION_TABLE [context][depth]._address_src ;
                 btb_address_dest      = reg_UPDATE_PREDICTION_TABLE [context][depth]._address_dest;
                 btb_condition         = condition;
-                dir_val               = update_dir(condition) and ifetch; // if not ifetch, then static prediction
+                dir_val               = state_is_ok_ko and update_dir(condition) and ifetch; // if not ifetch, then static prediction
                 dir_history           = reg_UPDATE_PREDICTION_TABLE [context][depth]._history     ;
                 ras_val               = update_ras(condition); // repop/ repush data -> don't corrupt ras
@@ -208,7 +209,9 @@
               }
           }
-
+        
         log_printf(TRACE,Update_Prediction_Table,FUNCTION,"    * val             : %d",val    );
         log_printf(TRACE,Update_Prediction_Table,FUNCTION,"    * val_without_ack : %d",val_without_ack);
+        log_printf(TRACE,Update_Prediction_Table,FUNCTION,"    * miss_prediction : %d",miss_prediction);
+        log_printf(TRACE,Update_Prediction_Table,FUNCTION,"    * direction_good  : %d",direction_good );
         log_printf(TRACE,Update_Prediction_Table,FUNCTION,"    * btb_val         : %d",btb_val);
         log_printf(TRACE,Update_Prediction_Table,FUNCTION,"    * dir_val         : %d",dir_val);
