Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod/src/Decod_genMealy.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod/src/Decod_genMealy.cpp	(revision 123)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod/src/Decod_genMealy.cpp	(revision 124)
@@ -47,4 +47,11 @@
     Tcontrol_t have_decod_branch [_param->_nb_context];
 
+    Tcontext_t      CONTEXT_EVENT_CONTEXT_ID    = 0;
+    Tdepth_t        CONTEXT_EVENT_DEPTH         = 0;
+    Tevent_type_t   CONTEXT_EVENT_TYPE          = 0;
+    Tcontrol_t      CONTEXT_EVENT_IS_DELAY_SLOT = 0;
+    Tgeneral_data_t CONTEXT_EVENT_ADDRESS       = 0;
+    Tgeneral_data_t CONTEXT_EVENT_ADDRESS_EPCR  = 0;
+
     for (uint32_t i=0; i<_param->_nb_context; i++)
       {
@@ -67,6 +74,8 @@
         log_printf(TRACE,Decod,FUNCTION,"  * DECOD [%d]",i);    
 
+        bool ifetch_val = false;
 	while ((it != select->end())    and  // have a no scanned "slot_in" ?
-	       (decod_val [i] == false) and  // have not a previous selected entry?
+// 	       (decod_val [i] == false) and  // have not a previous selected entry?
+               (ifetch_val    == false) and  // not find ifetch instruction valid
 	       (context_event_val == false)) // Have not a context_event (spr_access, exception, ...)
 	  {
@@ -86,4 +95,5 @@
                 log_printf(TRACE,Decod,FUNCTION,"      * decod_ack              : %d",PORT_READ(in_DECOD_ACK [i]));
 
+                ifetch_val        = true;
 		decod_val  [i]    = true;                        // fetch_val and decod_enable 
 		ifetch_ack [x][y] = PORT_READ(in_DECOD_ACK [i]); // fetch_val and decod_enable and decod_ack
@@ -189,16 +199,4 @@
                     ifetch_ack  [x][y] &= not have_decod_branch [x] and PORT_READ(in_PREDICT_ACK [i]);// predict_ack and fetch_val and decod_enable and decod_ack
                 
-		    if (_param->_have_port_context_id)
-		    PORT_WRITE(out_PREDICT_CONTEXT_ID                  [i],x);
-		    PORT_WRITE(out_PREDICT_MATCH_INST_IFETCH_PTR       [i],y == ((_param->_have_port_inst_ifetch_ptr)?PORT_READ(in_IFETCH_INST_IFETCH_PTR [x]):0));
-		    PORT_WRITE(out_PREDICT_BRANCH_STATE                [i],PORT_READ(in_IFETCH_BRANCH_STATE                [x]));
-		    if (_param->_have_port_depth)
-                    PORT_WRITE(out_PREDICT_BRANCH_UPDATE_PREDICTION_ID [i],PORT_READ(in_IFETCH_BRANCH_UPDATE_PREDICTION_ID [x]));
-		    PORT_WRITE(out_PREDICT_BRANCH_CONDITION            [i],_decod_instruction->_branch_condition  );
-// 		    PORT_WRITE(out_PREDICT_BRANCH_STACK_WRITE          [i],_decod_instruction->_branch_stack_write);
-		    PORT_WRITE(out_PREDICT_BRANCH_DIRECTION            [i],_decod_instruction->_branch_direction  );
-		    PORT_WRITE(out_PREDICT_ADDRESS_SRC                 [i],_decod_instruction->_address           );
-		    PORT_WRITE(out_PREDICT_ADDRESS_DEST                [i],_decod_instruction->_address_next      );
-		
                     // can continue is set if direction is "not take" (also, continue is sequential order)
 
@@ -209,4 +207,16 @@
                     log_printf(TRACE,Decod,FUNCTION,"      * predict_can_continue   : %d",PORT_READ(in_PREDICT_CAN_CONTINUE [i]));
                   }
+
+		if (_param->_have_port_context_id)
+		PORT_WRITE(out_PREDICT_CONTEXT_ID                  [i],x);
+		PORT_WRITE(out_PREDICT_MATCH_INST_IFETCH_PTR       [i],y == ((_param->_have_port_inst_ifetch_ptr)?PORT_READ(in_IFETCH_INST_IFETCH_PTR [x]):0));
+		PORT_WRITE(out_PREDICT_BRANCH_STATE                [i],PORT_READ(in_IFETCH_BRANCH_STATE                [x]));
+		if (_param->_have_port_depth)
+                PORT_WRITE(out_PREDICT_BRANCH_UPDATE_PREDICTION_ID [i],PORT_READ(in_IFETCH_BRANCH_UPDATE_PREDICTION_ID [x]));
+		PORT_WRITE(out_PREDICT_BRANCH_CONDITION            [i],_decod_instruction->_branch_condition  );
+// 		PORT_WRITE(out_PREDICT_BRANCH_STACK_WRITE          [i],_decod_instruction->_branch_stack_write);
+		PORT_WRITE(out_PREDICT_BRANCH_DIRECTION            [i],_decod_instruction->_branch_direction  );
+		PORT_WRITE(out_PREDICT_ADDRESS_SRC                 [i],_decod_instruction->_address           );
+		PORT_WRITE(out_PREDICT_ADDRESS_DEST                [i],_decod_instruction->_address_next      );
 
 		Tevent_type_t event_type = _decod_instruction->_event_type;
@@ -223,12 +233,11 @@
 		    ifetch_ack  [x][y] &= PORT_READ(in_CONTEXT_EVENT_ACK);// context_event_ack and fetch_val and decod_enable and decod_ack
 
-		    if (_param->_have_port_context_id)
-		    PORT_WRITE(out_CONTEXT_EVENT_CONTEXT_ID   , x);
-                    if (_param->_have_port_depth)
-		    PORT_WRITE(out_CONTEXT_EVENT_DEPTH        , depth);
-		    PORT_WRITE(out_CONTEXT_EVENT_TYPE         , _decod_instruction->_event_type    );
-		    PORT_WRITE(out_CONTEXT_EVENT_IS_DELAY_SLOT, _decod_instruction->_is_delay_slot );
-		    PORT_WRITE(out_CONTEXT_EVENT_ADDRESS      , _decod_instruction->_address       );
-		    PORT_WRITE(out_CONTEXT_EVENT_ADDRESS_EPCR , _decod_instruction->_address_next  );
+                    CONTEXT_EVENT_CONTEXT_ID    = x;
+                    CONTEXT_EVENT_DEPTH         = depth;
+                    CONTEXT_EVENT_TYPE          = _decod_instruction->_event_type;
+                    CONTEXT_EVENT_IS_DELAY_SLOT = _decod_instruction->_is_delay_slot;
+                    CONTEXT_EVENT_ADDRESS       = _decod_instruction->_address;
+                    CONTEXT_EVENT_ADDRESS_EPCR  = _decod_instruction->_address_next ;
+                
 		  }
 
@@ -263,4 +272,5 @@
 	  }
       }
+
     //-----------------------------------
     // Write output
@@ -272,4 +282,12 @@
 
     PORT_WRITE(out_CONTEXT_EVENT_VAL, context_event_val);
+    if (_param->_have_port_context_id)
+    PORT_WRITE(out_CONTEXT_EVENT_CONTEXT_ID   , CONTEXT_EVENT_CONTEXT_ID   );
+    if (_param->_have_port_depth)
+    PORT_WRITE(out_CONTEXT_EVENT_DEPTH        , CONTEXT_EVENT_DEPTH        );
+    PORT_WRITE(out_CONTEXT_EVENT_TYPE         , CONTEXT_EVENT_TYPE         );
+    PORT_WRITE(out_CONTEXT_EVENT_IS_DELAY_SLOT, CONTEXT_EVENT_IS_DELAY_SLOT);
+    PORT_WRITE(out_CONTEXT_EVENT_ADDRESS      , CONTEXT_EVENT_ADDRESS      );
+    PORT_WRITE(out_CONTEXT_EVENT_ADDRESS_EPCR , CONTEXT_EVENT_ADDRESS_EPCR );
 
     for (uint32_t i=0; i<_param->_nb_inst_decod; i++)
