Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/src/Context_State.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/src/Context_State.cpp	(revision 122)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/src/Context_State.cpp	(revision 123)
@@ -39,9 +39,9 @@
     usage_environment(_usage);
 
-#if DEBUG_Context_State == true
-    log_printf(INFO,Context_State,FUNCTION,_("<%s> Parameters"),_name.c_str());
+// #if DEBUG_Context_State == true
+//     log_printf(INFO,Context_State,FUNCTION,_("<%s> Parameters"),_name.c_str());
 
-    std::cout << *param << std::endl;
-#endif    
+//     std::cout << *param << std::endl;
+// #endif    
 
     log_printf(INFO,Context_State,FUNCTION,_("Allocation"));
@@ -139,4 +139,24 @@
 	// List dependency information
 # endif    
+
+	log_printf(INFO,Context_State,FUNCTION,_("Method - genMealy_context_event"));
+
+	SC_METHOD (genMealy_context_event);
+	dont_initialize ();
+// 	sensitive << (*(in_CLOCK)).neg(); // use internal register
+        sensitive << (*(in_COMMIT_EVENT_VAL             ));
+        if (_param->_have_port_context_id)				        
+        sensitive << (*(in_COMMIT_EVENT_CONTEXT_ID      ));
+        for (uint32_t i=0; i<_param->_nb_inst_branch_complete; ++i)
+          {
+            sensitive << (*(in_BRANCH_COMPLETE_VAL             [i]))
+                      << (*(in_BRANCH_COMPLETE_MISS_PREDICTION [i]));
+            if (_param->_have_port_context_id)				        
+            sensitive << (*(in_BRANCH_COMPLETE_CONTEXT_ID      [i]));
+          }
+	
+# ifdef SYSTEMCASS_SPECIFIC
+	// List dependency information
+# endif    
 	
 #endif
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/src/Context_State_allocation.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/src/Context_State_allocation.cpp	(revision 122)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/src/Context_State_allocation.cpp	(revision 123)
@@ -172,4 +172,5 @@
       
       ALLOC1_SIGNAL_OUT(out_CONTEXT_DECOD_ENABLE               ,"decod_enable",Tcontrol_t,1);
+      ALLOC1_SIGNAL_OUT(out_CONTEXT_EVENT                      ,"event"       ,Tcontrol_t,1);
 
       ALLOC1_INTERFACE_END(_param->_nb_context);
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/src/Context_State_deallocation.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/src/Context_State_deallocation.cpp	(revision 122)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/src/Context_State_deallocation.cpp	(revision 123)
@@ -91,4 +91,5 @@
         
 	DELETE1_SIGNAL(out_CONTEXT_DECOD_ENABLE               ,_param->_nb_context,1);
+	DELETE1_SIGNAL(out_CONTEXT_EVENT                      ,_param->_nb_context,1);
 
 	DELETE1_SIGNAL( in_DEPTH_MIN                          ,_param->_nb_context,_param->_size_depth);
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/src/Context_State_genMealy_context_event.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/src/Context_State_genMealy_context_event.cpp	(revision 123)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/src/Context_State_genMealy_context_event.cpp	(revision 123)
@@ -0,0 +1,72 @@
+#ifdef SYSTEMC
+/*
+ * $Id$
+ *
+ * [ Description ]
+ * 
+ */
+
+#include "Behavioural/Core/Multi_Front_end/Front_end/Context_State/include/Context_State.h"
+
+namespace morpheo                    {
+namespace behavioural {
+namespace core {
+namespace multi_front_end {
+namespace front_end {
+namespace context_state {
+
+
+#undef  FUNCTION
+#define FUNCTION "Context_State::genMealy_context_event"
+  void Context_State::genMealy_context_event (void)
+  {
+    log_begin(Context_State,FUNCTION);
+    log_function(Context_State,FUNCTION,_name.c_str());
+
+    bool context_event [_param->_nb_context];
+
+    // init
+    for (uint32_t i=0; i<_param->_nb_context; ++i)
+      context_event [i] = false;
+
+    if (PORT_READ(in_NRESET))
+      {
+    // Commit Event ?
+    if (PORT_READ(in_COMMIT_EVENT_VAL))
+      {
+        Tcontext_t context = (_param->_have_port_context_id)?PORT_READ(in_COMMIT_EVENT_CONTEXT_ID):0;
+      
+        context_event [context] = true;
+      }
+
+    // Miss ?
+    for (uint32_t i=0; i<_param->_nb_inst_branch_complete; ++i)
+    if (PORT_READ(in_BRANCH_COMPLETE_VAL             [i]) and
+        PORT_READ(in_BRANCH_COMPLETE_MISS_PREDICTION [i]))
+      {
+        Tcontext_t context = (_param->_have_port_context_id)?PORT_READ(in_BRANCH_COMPLETE_CONTEXT_ID [i]):0;
+      
+        context_event [context] = true;
+      }
+
+    for (uint32_t i=0; i<_param->_nb_context; ++i)
+      PORT_WRITE(out_CONTEXT_EVENT [i], context_event [i]);
+      }
+//     else
+//       {
+//       }
+
+    for (uint32_t i=0; i<_param->_nb_context; ++i)
+      PORT_WRITE(out_CONTEXT_EVENT [i], context_event [i]);
+
+    log_end(Context_State,FUNCTION);
+  };
+
+}; // end namespace context_state
+}; // end namespace front_end
+}; // end namespace multi_front_end
+}; // end namespace core
+
+}; // end namespace behavioural
+}; // end namespace morpheo              
+#endif
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/src/Context_State_genMealy_decod_event.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/src/Context_State_genMealy_decod_event.cpp	(revision 122)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/src/Context_State_genMealy_decod_event.cpp	(revision 123)
@@ -24,4 +24,6 @@
     log_function(Context_State,FUNCTION,_name.c_str());
 
+    if (PORT_READ(in_NRESET))
+      {
     for (uint32_t i=0; i<_param->_nb_decod_unit; i++)
       {
@@ -49,6 +51,14 @@
 
         internal_DECOD_EVENT_ACK [i] = ack;
-        PORT_WRITE(out_DECOD_EVENT_ACK [i], internal_DECOD_EVENT_ACK [i]);
       }
+      }
+    else
+      {
+        for (uint32_t i=0; i<_param->_nb_decod_unit; i++)
+          internal_DECOD_EVENT_ACK [i] = 0;
+      }
+
+    for (uint32_t i=0; i<_param->_nb_decod_unit; i++)
+      PORT_WRITE(out_DECOD_EVENT_ACK [i], internal_DECOD_EVENT_ACK [i]);
 
     log_end(Context_State,FUNCTION);
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/src/Context_State_genMoore.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/src/Context_State_genMoore.cpp	(revision 122)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/src/Context_State_genMoore.cpp	(revision 123)
@@ -24,4 +24,6 @@
     log_function(Context_State,FUNCTION,_name.c_str());
 
+    if (PORT_READ(in_NRESET))
+      {
     // -------------------------------------------------------------------
     // -----[ EVENT ]-----------------------------------------------------
@@ -67,5 +69,4 @@
 
         internal_EVENT_VAL [i] = val;
-	PORT_WRITE(out_EVENT_VAL              [i], val);
 	PORT_WRITE(out_EVENT_ADDRESS          [i], address);
 	PORT_WRITE(out_EVENT_ADDRESS_NEXT     [i], address_next); 
@@ -97,5 +98,4 @@
 	internal_SPR_EVENT_VAL [i] = (state == CONTEXT_STATE_KO_EXCEP_SPR  );
 
-	PORT_WRITE(out_SPR_EVENT_VAL       [i], internal_SPR_EVENT_VAL     [i]);
 	PORT_WRITE(out_SPR_EVENT_EPCR      [i], reg_EVENT_ADDRESS_EPCR     [i]);
 	PORT_WRITE(out_SPR_EVENT_EEAR      [i], reg_EVENT_ADDRESS_EEAR     [i]);
@@ -117,4 +117,22 @@
 	PORT_WRITE(out_CONTEXT_DECOD_ENABLE [i], (state==CONTEXT_STATE_OK));
       }
+      }
+    else
+      {
+        for (uint32_t i=0; i<_param->_nb_context; i++)
+          {
+            internal_EVENT_VAL     [i] = 0;
+            internal_SPR_EVENT_VAL [i] = 0;
+
+            PORT_WRITE(out_CONTEXT_DECOD_ENABLE [i], 0);
+          }
+      }
+
+    // Write output
+    for (uint32_t i=0; i<_param->_nb_context; i++)
+      {
+        PORT_WRITE(out_EVENT_VAL     [i], internal_EVENT_VAL     [i]);
+        PORT_WRITE(out_SPR_EVENT_VAL [i], internal_SPR_EVENT_VAL [i]);
+      }
 
     log_end(Context_State,FUNCTION);
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/src/Context_State_transition.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/src/Context_State_transition.cpp	(revision 122)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/src/Context_State_transition.cpp	(revision 123)
@@ -16,10 +16,12 @@
 namespace context_state {
 
-#define MISS_FAST
+// #define MANAGE_EVENT MANAGE_EVENT_WAIT_ALL
+// #define MANAGE_EVENT MANAGE_EVENT_WAIT_DECODE
+#define MANAGE_EVENT MANAGE_EVENT_NO_WAIT
 
 #define get_priority(x) \
   (((state == CONTEXT_STATE_KO_MISS_LOAD_ADDR                  ) or  \
+    (state == CONTEXT_STATE_KO_MISS_LOAD_WAITEND               ) or  \
     (state == CONTEXT_STATE_KO_MISS_LOAD_AND_BRANCH_ADDR       ) or  \
-    (state == CONTEXT_STATE_KO_MISS_LOAD_WAITEND               ) or  \
     (state == CONTEXT_STATE_KO_MISS_LOAD_AND_BRANCH_WAITEND    ) or  \
     (state == CONTEXT_STATE_KO_MISS_LOAD_AND_BRANCH_WAIT_UPDATE))?3: \
@@ -43,4 +45,5 @@
             reg_STATE            [i] = CONTEXT_STATE_OK;
             reg_INTERRUPT_ENABLE [i] = 0;
+            reg_EVENT_DEPTH      [i] = 0; // unacessary
           }
       }
@@ -59,4 +62,7 @@
             Tcounter_t inst_all        = inst_commit_all + inst_decod_all;
 //          Tcounter_t inst_mem        = inst_commit_mem + inst_decod_all;
+            bool       condition       = ( (MANAGE_EVENT == MANAGE_EVENT_WAIT_ALL   )?(inst_all       == 0):
+                                          ((MANAGE_EVENT == MANAGE_EVENT_WAIT_DECODE)?(inst_decod_all == 0):
+                                            true));
 
             context_state_t state = reg_STATE [i];
@@ -89,14 +95,5 @@
               case CONTEXT_STATE_KO_MISS_BRANCH_WAITEND :
                 {
-                  // Wait end of all instruction
-//                if (inst_all == 0)
-                  if (
-#ifdef  MISS_FAST
-                      inst_decod_all ==
-#else
-                      inst_all ==
-#endif
-                      0)
-                    
+                  if (condition)
 //                  state = CONTEXT_STATE_OK;
                     state = CONTEXT_STATE_KO_MISS_BRANCH_ADDR;
@@ -106,12 +103,5 @@
                 {
                   // Wait end of all instruction
-//                if (inst_all == 0)
-                  if (
-#ifdef  MISS_FAST
-                      inst_decod_all ==
-#else
-                      inst_all ==
-#endif
-                      0)
+                  if (condition)
                     state = CONTEXT_STATE_KO_MISS_LOAD_ADDR;
 
@@ -146,12 +136,5 @@
                 {
                   // Wait end of all instruction
-//                if (inst_all == 0)
-                  if (
-#ifdef  MISS_FAST
-                      inst_decod_all ==
-#else
-                      inst_all ==
-#endif
-                      0)
+                  if (condition)
 //                  state = CONTEXT_STATE_OK; // @@@ TODO : make MISS fast (miss decod)
                     state = CONTEXT_STATE_KO_MISS_LOAD_AND_BRANCH_ADDR;
@@ -333,4 +316,5 @@
 #endif
 
+              log_printf(TRACE,Context_State,FUNCTION,"    * state     : %s",toString(state).c_str());
               log_printf(TRACE,Context_State,FUNCTION,"    * depth     : %d",depth     );
               log_printf(TRACE,Context_State,FUNCTION,"    * depth_cur : %d",depth_cur );
@@ -648,4 +632,7 @@
                           }
                         }
+
+                      depth = (depth+1)%_param->_nb_inst_branch_speculated[context];
+
                       break;
                     }
