Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/SelfTest/src/test.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/SelfTest/src/test.cpp	(revision 106)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/SelfTest/src/test.cpp	(revision 107)
@@ -1005,5 +1005,6 @@
               request.address_dest     = 0x21071981+i;                                   
               request.address_good     = request.address_dest;
-              request.condition        = (rand()%2)?BRANCH_CONDITION_NONE_WITH_WRITE_STACK:BRANCH_CONDITION_FLAG_SET;
+              request.condition        = // (rand()%2)?BRANCH_CONDITION_NONE_WITH_WRITE_STACK:
+                BRANCH_CONDITION_FLAG_SET;
 
               have_ras |= (update_ras(request.condition));
@@ -1451,5 +1452,6 @@
                 request.address_dest     = rand();                                   
                 
-                request.condition        = (rand()%2)?BRANCH_CONDITION_READ_STACK:BRANCH_CONDITION_FLAG_SET;
+                request.condition        = // (rand()%2)?BRANCH_CONDITION_NONE_WITHOUT_WRITE_STACK:
+                  BRANCH_CONDITION_FLAG_SET;
 
                 request.take             = 1;                                              
@@ -1597,5 +1599,6 @@
                 request.address_dest     = rand();                                   
                 request.address_good     = request.address_dest;
-                request.condition        = (rand()%2)?BRANCH_CONDITION_NONE_WITH_WRITE_STACK:BRANCH_CONDITION_FLAG_SET;
+                request.condition        = // (rand()%2)?BRANCH_CONDITION_NONE_WITH_WRITE_STACK:
+                  BRANCH_CONDITION_FLAG_SET;
                 
                 have_ufpt_ras |= (update_ras(request.condition));
@@ -2157,5 +2160,6 @@
                 request.address_dest     = rand();                                   
                 
-                request.condition        = (rand()%2)?BRANCH_CONDITION_READ_STACK:BRANCH_CONDITION_FLAG_SET;
+                request.condition        = // (rand()%2)?BRANCH_CONDITION_NONE_WITHOUT_WRITE_STACK:
+                  BRANCH_CONDITION_FLAG_SET;
 
                 request.take             = 1;                                              
@@ -2303,5 +2307,6 @@
                 request.address_dest     = rand();                                   
                 request.address_good     = request.address_dest;
-                request.condition        = (rand()%2)?BRANCH_CONDITION_NONE_WITH_WRITE_STACK:BRANCH_CONDITION_FLAG_SET;
+                request.condition        = // (rand()%2)?BRANCH_CONDITION_NONE_WITH_WRITE_STACK:
+                  BRANCH_CONDITION_FLAG_SET;
                 
                 have_ufpt_ras |= (update_ras(request.condition));
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 106)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/src/Update_Prediction_Table_genMoore.cpp	(revision 107)
@@ -175,16 +175,19 @@
                 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)//  or
+//                 Tcontrol_t          state_is_event           = ((state == UPDATE_PREDICTION_STATE_KO   ) or
+//                                                                 (state == UPDATE_PREDICTION_STATE_EVENT)//  or
 //                                                                 ((have_event[context])?(state == UPDATE_PREDICTION_STATE_OK):false)
-                                                                );
-                
-                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);
+//                                                                 );
+                
+//                 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);
 
                 if (retire_ras_from_upt [context])
                   {
-                val                   = state_is_event_update;
-                val_without_ack       = state_is_event_no_update;
+//                 val                   = state_is_event_update;
+//                 val_without_ack       = state_is_event_no_update;
+                val                   = ((state == UPDATE_PREDICTION_STATE_KO   ) or 
+                                         ((state == UPDATE_PREDICTION_STATE_EVENT) and need_update(condition)));
+                val_without_ack       = ((state == UPDATE_PREDICTION_STATE_EVENT) and not need_update(condition));
                   }
                 else
@@ -205,5 +208,7 @@
                 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;
+                // If corrupt, RAS must be flushed.
+                // Also, if instruction l.jal, l.jalr, push addr+2 (delay slot), else (no flush) restore RAS
+                ras_address           = (ras_flush)?(reg_UPDATE_PREDICTION_TABLE [context][depth]._address_src+2):reg_UPDATE_PREDICTION_TABLE [context][depth]._address_ras;
                 ras_index             = reg_UPDATE_PREDICTION_TABLE [context][depth]._index_ras;
                 ras_prediction_ifetch = ifetch;
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 106)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/src/Update_Prediction_Table_transition.cpp	(revision 107)
@@ -422,5 +422,13 @@
 
 	      // In all case : update good_take
-	      reg_UPDATE_PREDICTION_TABLE [context][depth]._good_take = good_take;
+	      reg_UPDATE_PREDICTION_TABLE [context][depth]._good_take    = good_take;
+
+              // Write address_dest if need read register
+              Tbranch_condition_t condition = reg_UPDATE_PREDICTION_TABLE [context][depth]._condition;
+              
+              if ((condition == BRANCH_CONDITION_READ_REGISTER_WITHOUT_WRITE_STACK) or
+                  (condition == BRANCH_CONDITION_READ_REGISTER_WITH_WRITE_STACK   ) or
+                  (condition == BRANCH_CONDITION_READ_STACK                       ) )
+                reg_UPDATE_PREDICTION_TABLE [context][depth]._address_dest = good_addr;
             }
 
@@ -599,13 +607,12 @@
 	      log_printf(TRACE,Update_Prediction_Table,FUNCTION,"  * BRANCH_EVENT [%d] - Accepted",i);
 
-#ifdef DEBUG_TEST
-              if (reg_EVENT_STATE [i] != EVENT_STATE_UPDATE_CONTEXT)
-                throw ERRORMORPHEO(FUNCTION,_("Decod : invalid event state."));
-#endif
-              
-              // Change state
-              log_printf(TRACE,Update_Prediction_Table,FUNCTION,"    * EVENT [%d] <- EVENT_STATE_WAIT_END_EVENT (branch_event)",i);
-              
-              reg_EVENT_STATE [i] = EVENT_STATE_WAIT_END_EVENT;
+              // if different : an other branch is occured
+              if (reg_EVENT_STATE [i] == EVENT_STATE_UPDATE_CONTEXT)
+                {
+                  // Change state
+                  log_printf(TRACE,Update_Prediction_Table,FUNCTION,"    * EVENT [%d] <- EVENT_STATE_WAIT_END_EVENT (branch_event)",i);
+                  
+                  reg_EVENT_STATE [i] = EVENT_STATE_WAIT_END_EVENT;
+                }
             }
 
@@ -866,13 +873,16 @@
 	log_printf(TRACE,Update_Prediction_Table,FUNCTION,"      * reg_UFPT_NB_UPDATE      : %d",reg_UFPT_NB_UPDATE      [i]);
 	for (uint32_t j=0; j<_param->_size_ufpt_queue[i]; j++)
-	  log_printf(TRACE,Update_Prediction_Table,FUNCTION,"        [%d] %.4d, %.8x %.8x, %.1d   %.1d, %.8d %.8x %.4d - %s",
+	  log_printf(TRACE,Update_Prediction_Table,FUNCTION,"        [%d] %.4d, %.8x (%.8x) %.8x (%.8x), %.1d   %.1d, %.8d %.8x (%.8x) %.4d - %s",
                      j,
                      reg_UPDATE_FETCH_PREDICTION_TABLE [i][j]._condition,
                      reg_UPDATE_FETCH_PREDICTION_TABLE [i][j]._address_src,
+                     reg_UPDATE_FETCH_PREDICTION_TABLE [i][j]._address_src<<2,
                      reg_UPDATE_FETCH_PREDICTION_TABLE [i][j]._address_dest,
+                     reg_UPDATE_FETCH_PREDICTION_TABLE [i][j]._address_dest<<2,
                      reg_UPDATE_FETCH_PREDICTION_TABLE [i][j]._last_take,
                      reg_UPDATE_FETCH_PREDICTION_TABLE [i][j]._is_accurate,
                      reg_UPDATE_FETCH_PREDICTION_TABLE [i][j]._history,
                      reg_UPDATE_FETCH_PREDICTION_TABLE [i][j]._address_ras,
+                     reg_UPDATE_FETCH_PREDICTION_TABLE [i][j]._address_ras<<2,
                      reg_UPDATE_FETCH_PREDICTION_TABLE [i][j]._index_ras,
                      toString(reg_UPDATE_FETCH_PREDICTION_TABLE [i][j]._state).c_str()
@@ -886,9 +896,11 @@
 	log_printf(TRACE,Update_Prediction_Table,FUNCTION,"      * reg_UPT_EMPTY           : %d",reg_UPT_EMPTY          [i]);
 	for (uint32_t j=0; j<_param->_size_upt_queue[i]; j++)
-	  log_printf(TRACE,Update_Prediction_Table,FUNCTION,"        [%d] %.4d, %.8x %.8x, %.1d %.1d %.1d, %.8d %.8x %.4d - %s",
+	  log_printf(TRACE,Update_Prediction_Table,FUNCTION,"        [%d] %.4d, %.8x (%.8x) %.8x (%.8x), %.1d %.1d %.1d, %.8d %.8x (%.8x) %.4d - %s",
                      j,
                      reg_UPDATE_PREDICTION_TABLE [i][j]._condition,
                      reg_UPDATE_PREDICTION_TABLE [i][j]._address_src,
+                     reg_UPDATE_PREDICTION_TABLE [i][j]._address_src<<2,
                      reg_UPDATE_PREDICTION_TABLE [i][j]._address_dest,
+                     reg_UPDATE_PREDICTION_TABLE [i][j]._address_dest<<2,
                      reg_UPDATE_PREDICTION_TABLE [i][j]._last_take,
                      reg_UPDATE_PREDICTION_TABLE [i][j]._good_take,
@@ -896,4 +908,5 @@
                      reg_UPDATE_PREDICTION_TABLE [i][j]._history,
                      reg_UPDATE_PREDICTION_TABLE [i][j]._address_ras,
+                     reg_UPDATE_PREDICTION_TABLE [i][j]._address_ras<<2,
                      reg_UPDATE_PREDICTION_TABLE [i][j]._index_ras,
                      toString(reg_UPDATE_PREDICTION_TABLE [i][j]._state).c_str()
