Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Return_Address_Stack/src/Return_Address_Stack_transition.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Return_Address_Stack/src/Return_Address_Stack_transition.cpp	(revision 107)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Return_Address_Stack/src/Return_Address_Stack_transition.cpp	(revision 111)
@@ -76,5 +76,8 @@
 		  if (push)
 		    {
+                      Taddress_t address = PORT_READ(in_PREDICT_ADDRESS_PUSH [i]);
+
                       log_printf(TRACE,Return_Address_Stack,FUNCTION,"    * push (call procedure)");
+                      log_printf(TRACE,Return_Address_Stack,FUNCTION,"      * address_push        : 0x%.8x",address);
 
 		      // push : increase the top (circular)
@@ -82,5 +85,5 @@
 
                       // Write new value in Queue
-		      reg_stack [context][top_new]._address = PORT_READ(in_PREDICT_ADDRESS_PUSH [i]);
+		      reg_stack [context][top_new]._address = address;
 
 		      // Test if full
@@ -150,5 +153,8 @@
               if (push)
                 {
+                  Taddress_t address = PORT_READ(in_DECOD_ADDRESS_PUSH [i]);
+                  
                   log_printf(TRACE,Return_Address_Stack,FUNCTION,"    * push (call procedure)");
+                  log_printf(TRACE,Return_Address_Stack,FUNCTION,"      * address_push        : 0x%.8x",address);
                   
                   // push : increase the top (circular)
@@ -156,5 +162,5 @@
                   
                   // Write new value in Queue
-                  reg_stack [context][top_new]._address = PORT_READ(in_DECOD_ADDRESS_PUSH [i]);
+                  reg_stack [context][top_new]._address = address;
                   
                   // Test if full
@@ -201,21 +207,15 @@
               //   if decod miss : ifetch can have predict call and return branchement. Also, the head of decod can be false
 
-// 	      Tcontrol_t miss       = PORT_READ(in_DECOD_MISS_PREDICTION [i]);
-
-// 	      if (miss)
-// 		{
+	      Tcontrol_t miss       = PORT_READ(in_DECOD_MISS_PREDICTION [i]);
+
+              log_printf(TRACE,Return_Address_Stack,FUNCTION,"      * miss                : %d",miss);
+
+	      if (miss)
+		{
+
 // 		  reg_PREDICT_BOTTOM [context] = reg_BOTTOM [context];
-// 		  reg_PREDICT_TOP    [context] = reg_TOP    [context];
-// 		  reg_PREDICT_NB_ELT [context] = reg_NB_ELT [context];
-		  
-// 		  // Scan full assoc !!!
-// 		  for (uint32_t j=0; j<_param->_size_queue [context]; j++)
-// 		    // Test if this slot is tagged with "predict" : if true, tagged as miss
-// 		    if (reg_stack [context][j]._predict)
-// 		      {
-// 			reg_stack [context][j]._predict = false;
-// 			reg_stack [context][j]._miss    = true;
-// 		      }
-// 		}
+		  reg_PREDICT_TOP    [context] = reg_TOP    [context];
+		  reg_PREDICT_NB_ELT [context] = reg_NB_ELT [context];
+		}
 	    }
 
@@ -252,5 +252,10 @@
                     {
                       // reinsert push value
-                      reg_stack [context_id][0]._address = PORT_READ(in_UPDATE_ADDRESS [i]);
+                      Taddress_t address = PORT_READ(in_UPDATE_ADDRESS [i]);
+                  
+                      log_printf(TRACE,Return_Address_Stack,FUNCTION,"    * flush and push");
+                      log_printf(TRACE,Return_Address_Stack,FUNCTION,"      * address_push        : 0x%.8x",address);
+
+                      reg_stack [context_id][value]._address = address;
                     }
                 }
@@ -292,5 +297,4 @@
 #endif
 
-
                       Tptr_t     top_old    = (prediction_ifetch)?reg_PREDICT_TOP    [context_id]:reg_TOP    [context_id];
                       Tptr_t     top_new    = top_old;
@@ -320,4 +324,6 @@
                       if (push)
                         {
+                          log_printf(TRACE,Return_Address_Stack,FUNCTION,"    * previous is push, now pop");
+
                           // previous is push, now must be pop
 
@@ -331,6 +337,10 @@
                       else
                         {
+                          log_printf(TRACE,Return_Address_Stack,FUNCTION,"    * previous is pop, now push");
+
                           // previous is pop, now must be push
                           Taddress_t address           = PORT_READ(in_UPDATE_ADDRESS           [i]);
+
+                          log_printf(TRACE,Return_Address_Stack,FUNCTION,"    * address       : 0x%.8x",address);
 
                           // push : increase the top (circular)
@@ -345,5 +355,5 @@
                           top_new = index;
                           
-                          reg_stack [context_id][index]._address = address;
+                          reg_stack [context_id][top_new]._address = address;
                         }
 
@@ -352,21 +362,33 @@
                       if (prediction_ifetch)
                         {
-                          log_printf(TRACE,Return_Address_Stack,FUNCTION,"      * reg_predict_top     : %d",top_new);
-//                        log_printf(TRACE,Return_Address_Stack,FUNCTION,"      * reg_predict_bottom  : %d",bottom_new);
-                          log_printf(TRACE,Return_Address_Stack,FUNCTION,"      * reg_predict_nb_elt  : %d",nb_elt_new);
-
+                          log_printf(TRACE,Return_Address_Stack,FUNCTION,"      * reg_predict_top     : %d",reg_TOP    [context_id]);
+//                        log_printf(TRACE,Return_Address_Stack,FUNCTION,"      * reg_predict_bottom  : %d",reg_BOTTOM [context_id]);
+                          log_printf(TRACE,Return_Address_Stack,FUNCTION,"      * reg_predict_nb_elt  : %d",reg_NB_ELT [context_id]);
+
+                          reg_PREDICT_TOP    [context_id] = reg_TOP    [context_id];
+//                        reg_PREDICT_BOTTOM [context_id] = reg_BOTTOM [context_id];
+                          reg_PREDICT_NB_ELT [context_id] = reg_NB_ELT [context_id];
+
+//                           log_printf(TRACE,Return_Address_Stack,FUNCTION,"      * reg_predict_top     : %d",top_new   );
+// //                        log_printf(TRACE,Return_Address_Stack,FUNCTION,"      * reg_predict_bottom  : %d",bottom_new);
+//                           log_printf(TRACE,Return_Address_Stack,FUNCTION,"      * reg_predict_nb_elt  : %d",nb_elt_new);
+
+//                           reg_PREDICT_TOP    [context_id] = top_new   ;
+// //                        reg_PREDICT_BOTTOM [context_id] = bottom_new;
+//                           reg_PREDICT_NB_ELT [context_id] = nb_elt_new;
+
+                        }
+                      else
+                        {
+                          log_printf(TRACE,Return_Address_Stack,FUNCTION,"      * reg_top     : %d",top_new);
+//                        log_printf(TRACE,Return_Address_Stack,FUNCTION,"      * reg_bottom  : %d",bottom_new);
+                          log_printf(TRACE,Return_Address_Stack,FUNCTION,"      * reg_nb_elt  : %d",nb_elt_new);
+
+                          reg_TOP            [context_id] = top_new   ;
+//                        reg_BOTTOM         [context_id] = bottom_new;
+                          reg_NB_ELT         [context_id] = nb_elt_new;
                           reg_PREDICT_TOP    [context_id] = top_new   ;
 //                        reg_PREDICT_BOTTOM [context_id] = bottom_new;
                           reg_PREDICT_NB_ELT [context_id] = nb_elt_new;
-                        }
-                      else
-                        {
-                          log_printf(TRACE,Return_Address_Stack,FUNCTION,"      * reg_top     : %d",top_new);
-//                        log_printf(TRACE,Return_Address_Stack,FUNCTION,"      * reg_bottom  : %d",bottom_new);
-                          log_printf(TRACE,Return_Address_Stack,FUNCTION,"      * reg_nb_elt  : %d",nb_elt_new);
-
-                          reg_TOP            [context_id] = top_new   ;
-//                        reg_BOTTOM         [context_id] = bottom_new;
-                          reg_NB_ELT         [context_id] = nb_elt_new;
                         }
                     }
