Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod_queue/include/Decod_queue.h
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod_queue/include/Decod_queue.h	(revision 118)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod_queue/include/Decod_queue.h	(revision 123)
@@ -106,4 +106,6 @@
   public    : SC_OUT(Toperation_t       )  ** out_DECOD_OUT_OPERATION     ;//[nb_inst_decod]
   public    : SC_OUT(Tcontrol_t         )  ** out_DECOD_OUT_NO_EXECUTE    ;//[nb_inst_decod]
+//public    : SC_OUT(Tcontrol_t         )  ** out_DECOD_OUT_HAVE_EVENT    ;//[nb_inst_decod]
+  public    : SC_OUT(Tcontrol_t         )  ** out_DECOD_OUT_LAST_EVENT    ;//[nb_inst_decod]
   public    : SC_OUT(Tcontrol_t         )  ** out_DECOD_OUT_IS_DELAY_SLOT ;//[nb_inst_decod]
 #ifdef DEBUG
@@ -134,4 +136,7 @@
   public    : SC_OUT(Tcounter_t         )  ** out_NB_INST_ALL             ;//[nb_context]
 
+    // ~~~~~[ Interface : "context" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  public    : SC_IN (Tcontrol_t         )  **  in_CONTEXT_EVENT           ;//[nb_context]
+
     // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    
 
@@ -141,4 +146,6 @@
   private   : std::list<decod_queue_entry_t*> * reg_QUEUE                  ;
   private   : uint32_t                        * reg_NB_INST                ;//[nb_context]
+  private   : uint32_t                        * reg_NB_INST_EVENT          ;//[nb_context]
+
     // implementation : one_fifo only
   private   : uint32_t                          reg_LAST_SLOT              ;
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod_queue/src/Decod_queue.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod_queue/src/Decod_queue.cpp	(revision 118)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod_queue/src/Decod_queue.cpp	(revision 123)
@@ -40,9 +40,9 @@
     usage_environment(_usage);
 
-#if DEBUG_Decod_queue == true
-    log_printf(INFO,Decod_queue,FUNCTION,_("<%s> Parameters"),_name.c_str());
+// #if DEBUG_Decod_queue == true
+//     log_printf(INFO,Decod_queue,FUNCTION,_("<%s> Parameters"),_name.c_str());
 
-    std::cout << *param << std::endl;
-#endif    
+//     std::cout << *param << std::endl;
+// #endif    
 
     log_printf(INFO,Decod_queue,FUNCTION,_("Allocation"));
@@ -129,28 +129,28 @@
 	for (uint32_t i=0; i<_param->_nb_inst_decod; i++)
 	  sensitive << (*(in_DECOD_OUT_ACK [i]));
-	  for (uint32_t i=0; i<_param->_nb_context; i++)
-            {
-              if (_param->_have_port_depth)
-                {
-              sensitive << (*(in_DEPTH_MIN [i]));
-              sensitive << (*(in_DEPTH_MAX [i]));
-                }
-              sensitive << (*(in_DEPTH_FULL[i]));
-            }
+//         for (uint32_t i=0; i<_param->_nb_context; i++)
+//           {
+//             if (_param->_have_port_depth)
+//               {
+//                 sensitive << (*(in_DEPTH_MIN [i]));
+//                 sensitive << (*(in_DEPTH_MAX [i]));
+//               }
+//             sensitive << (*(in_DEPTH_FULL[i]));
+//           }
 
 # ifdef SYSTEMCASS_SPECIFIC
-	// List dependency information
-	for (uint32_t i=0; i<_param->_nb_inst_decod; i++)
-	  {
-	    (*(out_DECOD_OUT_VAL [i])) (*(in_DECOD_OUT_ACK [i]));
-            for (uint32_t j=0; j<_param->_nb_context; j++)
-              {
-                if (_param->_have_port_depth)
-                  {
-                (*(out_DECOD_OUT_VAL [i])) (*(in_DEPTH_MIN [j]));
-                (*(out_DECOD_OUT_VAL [i])) (*(in_DEPTH_MAX [j]));
-                  }
-              }
-	  }
+// 	// List dependency information
+// 	for (uint32_t i=0; i<_param->_nb_inst_decod; i++)
+// 	  {
+// 	    (*(out_DECOD_OUT_VAL [i])) (*(in_DECOD_OUT_ACK [i]));
+//             for (uint32_t j=0; j<_param->_nb_context; j++)
+//               {
+//                 if (_param->_have_port_depth)
+//                   {
+//                 (*(out_DECOD_OUT_VAL [i])) (*(in_DEPTH_MIN [j]));
+//                 (*(out_DECOD_OUT_VAL [i])) (*(in_DEPTH_MAX [j]));
+//                   }
+//               }
+// 	  }
 # endif    
 	
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod_queue/src/Decod_queue_allocation.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod_queue/src/Decod_queue_allocation.cpp	(revision 118)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod_queue/src/Decod_queue_allocation.cpp	(revision 123)
@@ -100,4 +100,6 @@
       ALLOC1_SIGNAL_OUT(out_DECOD_OUT_OPERATION      ,"operation"    ,Toperation_t       ,_param->_size_operation             );
       ALLOC1_SIGNAL_OUT(out_DECOD_OUT_NO_EXECUTE     ,"no_execute"   ,Tcontrol_t         ,1                                   );
+//    ALLOC1_SIGNAL_OUT(out_DECOD_OUT_HAVE_EVENT     ,"have_event"   ,Tcontrol_t         ,1                                   );
+      ALLOC1_SIGNAL_OUT(out_DECOD_OUT_LAST_EVENT     ,"last_event"   ,Tcontrol_t         ,1                                   );
       ALLOC1_SIGNAL_OUT(out_DECOD_OUT_IS_DELAY_SLOT  ,"is_delay_slot",Tcontrol_t         ,1                                   );
 #ifdef DEBUG
@@ -143,4 +145,13 @@
     }
 
+    // ~~~~~[ Interface : "context" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~            
+    {
+      ALLOC1_INTERFACE_BEGIN("context",IN ,NORTH,_("Context"), _param->_nb_context);
+
+      ALLOC1_SIGNAL_IN ( in_CONTEXT_EVENT  ,"event"    ,Tcontrol_t         ,1);
+
+      ALLOC1_INTERFACE_END(_param->_nb_context);
+    }
+
     if (usage_is_set(_usage,USE_SYSTEMC))
       {
@@ -152,5 +163,6 @@
       }
 
-    ALLOC1(reg_NB_INST,uint32_t,_param->_nb_context);
+    ALLOC1(reg_NB_INST           ,uint32_t,_param->_nb_context);
+    ALLOC1(reg_NB_INST_EVENT     ,uint32_t,_param->_nb_context);
 
     // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod_queue/src/Decod_queue_deallocation.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod_queue/src/Decod_queue_deallocation.cpp	(revision 118)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod_queue/src/Decod_queue_deallocation.cpp	(revision 123)
@@ -62,5 +62,7 @@
 	DELETE1_SIGNAL(out_DECOD_OUT_TYPE          ,_param->_nb_inst_decod,_param->_size_type                  );
 	DELETE1_SIGNAL(out_DECOD_OUT_OPERATION     ,_param->_nb_inst_decod,_param->_size_operation             );
-	DELETE1_SIGNAL(out_DECOD_OUT_NO_EXECUTE    ,_param->_nb_inst_decod,1                                   );
+ 	DELETE1_SIGNAL(out_DECOD_OUT_NO_EXECUTE    ,_param->_nb_inst_decod,1                                   );
+// 	DELETE1_SIGNAL(out_DECOD_OUT_HAVE_EVENT    ,_param->_nb_inst_decod,1                                   );
+	DELETE1_SIGNAL(out_DECOD_OUT_LAST_EVENT    ,_param->_nb_inst_decod,1                                   );
 	DELETE1_SIGNAL(out_DECOD_OUT_IS_DELAY_SLOT ,_param->_nb_inst_decod,1                                   );
 #ifdef DEBUG
@@ -88,4 +90,6 @@
 
 	DELETE1_SIGNAL(out_NB_INST_ALL             ,_param->_nb_context,_param->_size_nb_inst_decod);
+
+        DELETE1_SIGNAL( in_CONTEXT_EVENT           ,_param->_nb_context,1);
 
         // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    
@@ -117,5 +121,6 @@
           }
 
-        DELETE1(reg_NB_INST ,_param->_nb_context);
+        DELETE1(reg_NB_INST           ,_param->_nb_context);
+        DELETE1(reg_NB_INST_EVENT     ,_param->_nb_context);
         
         // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod_queue/src/Decod_queue_function_multi_fifo_genMealy_decod_out.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod_queue/src/Decod_queue_function_multi_fifo_genMealy_decod_out.cpp	(revision 118)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod_queue/src/Decod_queue_function_multi_fifo_genMealy_decod_out.cpp	(revision 123)
@@ -24,6 +24,16 @@
     log_begin(Decod_queue,FUNCTION);
     log_function(Decod_queue,FUNCTION,_name.c_str());
-    
-    Tcontrol_t val [_param->_nb_inst_decod];
+
+    if (PORT_READ(in_NRESET))
+      {
+    bool       context_val   [_param->_nb_context];
+    uint32_t   nb_inst_event [_param->_nb_context];
+    for (uint32_t i=0; i<_param->_nb_context; i++)
+      {
+        context_val   [i] = true;
+        nb_inst_event [i] = reg_NB_INST_EVENT [i];
+      }
+
+    Tcontrol_t val         [_param->_nb_inst_decod];
     for (uint32_t i=0; i<_param->_nb_inst_decod; i++)
       {
@@ -44,57 +54,74 @@
             
             Tcontext_t context         = reg_QUEUE[num_bank].front()->_context_id    [0];
-            Tdepth_t   depth           = reg_QUEUE[num_bank].front()->_depth         [0];
-            Tdepth_t   depth_min       = (_param->_have_port_depth)?PORT_READ(in_DEPTH_MIN [context]):0;
-            Tdepth_t   depth_max       = (_param->_have_port_depth)?PORT_READ(in_DEPTH_MAX [context]):0;
-            Tcontrol_t depth_full      = PORT_READ(in_DEPTH_FULL[context]);
 
-            // is a valid instruction ?
-            // If DEPTH_CURRENT :
-            // equal at     DEPTH_MIN            -> not speculative
-            // not include ]DEPTH_MIN:DEPTH_MAX] -> previous branch miss
-            //     include ]DEPTH_MIN:DEPTH_MAX] -> speculative
-            
-            // All case
-            // ....... min ...X... max ....... OK
-            // ....... min ....... max ...X... KO
-            // ...X... min ....... max ....... KO
-            // ....... max ....... min ...X... OK
-            // ...X... max ....... min ....... OK
-            // ....... max ...X... min ....... KO
-            
-	    Tcontrol_t is_valid = true;
+            log_printf(TRACE,Decod_queue,FUNCTION,"      * context      : %d",context);
 
-//             Tcontrol_t   is_valid      = ((depth == depth_min) or
-//                                           depth_full or
-//                                           ((depth_min <= depth_max)?
-//                                            ((depth >= depth_min) and (depth <=depth_max)):
-//                                            ((depth >= depth_min) or  (depth <=depth_max))));
-            //Tcontrol_t is_valid        = ((depth == depth_min) or 
-            //                              ((depth_min < depth_max)?
-            //                               (depth<=depth_max):
-            //                               ((depth > depth_min) or (depth <= depth_max))));
-            //Tcontrol_t is_valid        = depth <= depth_max;
-            
-            log_printf(TRACE,Decod_queue,FUNCTION,"    * is_valid : %d",is_valid);
-            log_printf(TRACE,Decod_queue,FUNCTION,"      * context      : %d",context);
-            log_printf(TRACE,Decod_queue,FUNCTION,"      * depth        : %d",depth);
-            log_printf(TRACE,Decod_queue,FUNCTION,"      * depth_min    : %d",depth_min);
-            log_printf(TRACE,Decod_queue,FUNCTION,"      * depth_max    : %d",depth_max);
-            log_printf(TRACE,Decod_queue,FUNCTION,"      * depth_full   : %d",depth_full);
-#ifdef DEBUG
-            log_printf(TRACE,Decod_queue,FUNCTION,"      * address      : 0x%x (0x%x)",reg_QUEUE[num_bank].front()->_address     [0],reg_QUEUE[num_bank].front()->_address     [0]<<2);
-#endif
-            log_printf(TRACE,Decod_queue,FUNCTION,"      * address_next : 0x%x (0x%x)",reg_QUEUE[num_bank].front()->_address_next[0],reg_QUEUE[num_bank].front()->_address_next[0]<<2);
+            if (context_val [context])
+              {
 
-            internal_DECOD_OUT_VAL [i] = 1; // in all case, val is set (entry is not empty, and instruction is valid)
-            if (is_valid)
-              {
-                val                    [i] = 1;
-                internal_DECOD_OUT_ACK [i] = PORT_READ(in_DECOD_OUT_ACK [i]);
-              }
-            else
-              {
-                // Consume the instruction (to erase)
-                internal_DECOD_OUT_ACK [i] = 1;
+//                 Tdepth_t   depth           = reg_QUEUE[num_bank].front()->_depth         [0];
+//                 Tdepth_t   depth_min       = (_param->_have_port_depth)?PORT_READ(in_DEPTH_MIN [context]):0;
+//                 Tdepth_t   depth_max       = (_param->_have_port_depth)?PORT_READ(in_DEPTH_MAX [context]):0;
+//                 Tcontrol_t depth_full      = PORT_READ(in_DEPTH_FULL[context]);
+                
+                    // is a valid instruction ?
+                // If DEPTH_CURRENT :
+                // equal at     DEPTH_MIN            -> not speculative
+                // not include ]DEPTH_MIN:DEPTH_MAX] -> previous branch miss
+                //     include ]DEPTH_MIN:DEPTH_MAX] -> speculative
+                
+                // All case
+                // ....... min ...X... max ....... OK
+                // ....... min ....... max ...X... KO
+                // ...X... min ....... max ....... KO
+                // ....... max ....... min ...X... OK
+                // ...X... max ....... min ....... OK
+                // ....... max ...X... min ....... KO
+                
+                Tcontrol_t is_valid = (nb_inst_event [context] == 0);
+                
+//                 Tcontrol_t   is_valid      = ((depth == depth_min) or
+//                                               depth_full or
+//                                               ((depth_min <= depth_max)?
+//                                                ((depth >= depth_min) and (depth <=depth_max)):
+//                                                ((depth >= depth_min) or  (depth <=depth_max))));
+                
+                log_printf(TRACE,Decod_queue,FUNCTION,"    * is_valid : %d",is_valid);
+                log_printf(TRACE,Decod_queue,FUNCTION,"      * context_val  : %d",context_val   [context]);
+                log_printf(TRACE,Decod_queue,FUNCTION,"      * nb_inst_event: %d",nb_inst_event [context]);
+//              log_printf(TRACE,Decod_queue,FUNCTION,"      * depth        : %d",depth);
+//              log_printf(TRACE,Decod_queue,FUNCTION,"      * depth_min    : %d",depth_min);
+//              log_printf(TRACE,Decod_queue,FUNCTION,"      * depth_max    : %d",depth_max);
+//              log_printf(TRACE,Decod_queue,FUNCTION,"      * depth_full   : %d",depth_full);
+#ifdef DEBUG    
+                log_printf(TRACE,Decod_queue,FUNCTION,"      * address      : 0x%x (0x%x)",reg_QUEUE[num_bank].front()->_address     [0],reg_QUEUE[num_bank].front()->_address     [0]<<2);
+#endif          
+                log_printf(TRACE,Decod_queue,FUNCTION,"      * address_next : 0x%x (0x%x)",reg_QUEUE[num_bank].front()->_address_next[0],reg_QUEUE[num_bank].front()->_address_next[0]<<2);
+                
+                internal_DECOD_OUT_VAL [i] = 1; // in all case, val is set (entry is not empty, and instruction is valid)
+                
+                if (is_valid)
+                  {
+                    val                    [i] = 1;
+                    internal_DECOD_OUT_ACK [i] = PORT_READ(in_DECOD_OUT_ACK [i]);
+                
+                  }
+                else
+                  {
+                    // Consume the instruction (to erase)
+                    internal_DECOD_OUT_ACK [i] = 1;
+
+                    // Have event ?
+                    if (nb_inst_event [context] > 0)
+                      {
+                        nb_inst_event [context] --;
+                        
+                        // Last event ?
+                        if (nb_inst_event [context] == 0)
+                          {
+                            context_val [context] = false;
+                          }
+                      }
+                  }
               }
           }
@@ -107,4 +134,15 @@
         
         PORT_WRITE(out_DECOD_OUT_VAL [i],val [i]);
+      }
+      }
+    else
+      {
+        // Reset
+        for (uint32_t i=0; i<_param->_nb_inst_decod; i++)
+          {
+            internal_DECOD_OUT_VAL [i] = 0;
+            internal_DECOD_OUT_ACK [i] = 0;
+            PORT_WRITE(out_DECOD_OUT_VAL [i],0);
+          }
       }
 
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod_queue/src/Decod_queue_function_multi_fifo_genMoore.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod_queue/src/Decod_queue_function_multi_fifo_genMoore.cpp	(revision 118)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod_queue/src/Decod_queue_function_multi_fifo_genMoore.cpp	(revision 123)
@@ -25,4 +25,6 @@
     log_function(Decod_queue,FUNCTION,_name.c_str());
 
+    if (PORT_READ(in_NRESET))
+      {
     //--------------------------------------------------------------------
     //-----[ DECOD_IN ]---------------------------------------------------
@@ -34,5 +36,4 @@
         {
 	  internal_DECOD_IN_ACK [i] = (reg_QUEUE[num_bank].size() < _param->_size_queue);
-	  PORT_WRITE(out_DECOD_IN_ACK [i],internal_DECOD_IN_ACK [i]);
 
           num_bank = (num_bank+1)%_param->_nb_bank;
@@ -57,4 +58,6 @@
 	        PORT_WRITE(out_DECOD_OUT_OPERATION     [i],reg_QUEUE[num_bank].front()->_operation     [0]);
 	        PORT_WRITE(out_DECOD_OUT_NO_EXECUTE    [i],reg_QUEUE[num_bank].front()->_no_execute    [0]);
+// 	        PORT_WRITE(out_DECOD_OUT_HAVE_EVENT    [i],0);
+	        PORT_WRITE(out_DECOD_OUT_LAST_EVENT    [i],0);
 	        PORT_WRITE(out_DECOD_OUT_IS_DELAY_SLOT [i],reg_QUEUE[num_bank].front()->_is_delay_slot [0]);
 #ifdef DEBUG
@@ -86,4 +89,22 @@
     for (uint32_t i=0; i<_param->_nb_context; i++)
       PORT_WRITE(out_NB_INST_ALL [i], reg_NB_INST [i]);
+      }
+    else
+      {
+        for (uint32_t i=0; i<_param->_nb_inst_decod; i++)
+          {
+            internal_DECOD_IN_ACK [i] = 0;
+          }
+        for (uint32_t i=0; i<_param->_nb_context; i++)
+          PORT_WRITE(out_NB_INST_ALL [i], 0);
+      }
+
+
+    // Write output
+    for (uint32_t i=0; i<_param->_nb_inst_decod; i++)
+      {
+        PORT_WRITE(out_DECOD_IN_ACK [i],internal_DECOD_IN_ACK [i]);
+      }
+
 
     log_end(Decod_queue,FUNCTION);
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod_queue/src/Decod_queue_function_multi_fifo_transition.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod_queue/src/Decod_queue_function_multi_fifo_transition.cpp	(revision 118)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod_queue/src/Decod_queue_function_multi_fifo_transition.cpp	(revision 123)
@@ -35,5 +35,8 @@
 
 	for (uint32_t i=0; i<_param->_nb_context; i++)
-	  reg_NB_INST [i]=0;
+          {
+            reg_NB_INST       [i]=0;
+            reg_NB_INST_EVENT [i]=0;
+          }
 
         reg_NUM_BANK_HEAD = 0;
@@ -131,9 +134,19 @@
                 // Update pointer
                 reg_NUM_BANK_HEAD = (reg_NUM_BANK_HEAD+1)%_param->_nb_bank;
-		reg_NB_INST [context] --;
+                
+		reg_NB_INST       [context] --;
+                if (reg_NB_INST_EVENT [context] > 0)
+                reg_NB_INST_EVENT [context] --;
 	      }
         }
 
 	//--------------------------------------------------------------------
+	//-----[ CONTEXT_EVENT ]----------------------------------------------
+	//--------------------------------------------------------------------
+        for (uint32_t i=0; i<_param->_nb_context; i++)
+          if (PORT_READ(in_CONTEXT_EVENT [i]))
+            reg_NB_INST_EVENT [i] = reg_NB_INST [i];
+
+	//--------------------------------------------------------------------
 	//-----[ OTHERS ]-----------------------------------------------------
 	//--------------------------------------------------------------------
@@ -141,9 +154,11 @@
 #if defined(DEBUG) and defined(DEBUG_Decod_queue) and (DEBUG >= DEBUG_TRACE)
     log_printf(TRACE,Decod_queue,FUNCTION,"  * Dump decod_queue");
-    log_printf(TRACE,Decod_queue,FUNCTION,"    * reg_NUM_BANK_HEAD : %d",reg_NUM_BANK_HEAD);
-    log_printf(TRACE,Decod_queue,FUNCTION,"    * reg_NUM_BANK_TAIL : %d",reg_NUM_BANK_TAIL);
+    log_printf(TRACE,Decod_queue,FUNCTION,"    * reg_NUM_BANK_HEAD     : %d",reg_NUM_BANK_HEAD);
+    log_printf(TRACE,Decod_queue,FUNCTION,"    * reg_NUM_BANK_TAIL     : %d",reg_NUM_BANK_TAIL);
     for (uint32_t i=0; i<_param->_nb_context; i++)
-      log_printf(TRACE,Decod_queue,FUNCTION,"    * reg_NB_INST [%d] : %d",i,reg_NB_INST [i]);
-
+      {
+    log_printf(TRACE,Decod_queue,FUNCTION,"    * reg_NB_INST       [%d] : %d",i,reg_NB_INST [i]);
+    log_printf(TRACE,Decod_queue,FUNCTION,"    * reg_NB_INST_EVENT [%d] : %d",i,reg_NB_INST_EVENT [i]);
+      }
     for (uint32_t i=0; i<_param->_nb_bank; ++i)
       {
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod_queue/src/Decod_queue_function_one_fifo_genMealy_decod_out.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod_queue/src/Decod_queue_function_one_fifo_genMealy_decod_out.cpp	(revision 118)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod_queue/src/Decod_queue_function_one_fifo_genMealy_decod_out.cpp	(revision 123)
@@ -25,4 +25,14 @@
     log_function(Decod_queue,FUNCTION,_name.c_str());
 
+    if (PORT_READ(in_NRESET))
+      {
+    bool       context_val   [_param->_nb_context];
+    uint32_t   nb_inst_event [_param->_nb_context];
+    for (uint32_t i=0; i<_param->_nb_context; i++)
+      {
+        context_val   [i] = true;
+        nb_inst_event [i] = reg_NB_INST_EVENT [i];
+      }
+
     Tcontrol_t val [_param->_nb_inst_decod];
     for (uint32_t i=0; i<_param->_nb_inst_decod; i++)
@@ -47,55 +57,72 @@
               
               Tcontext_t context         = reg_QUEUE->front()->_context_id    [index];
-              Tdepth_t   depth           = reg_QUEUE->front()->_depth         [index];
-              Tdepth_t   depth_min       = (_param->_have_port_depth)?PORT_READ(in_DEPTH_MIN [context]):0;
-              Tdepth_t   depth_max       = (_param->_have_port_depth)?PORT_READ(in_DEPTH_MAX [context]):0;
-              Tcontrol_t depth_full      = PORT_READ(in_DEPTH_FULL[context]);
 
-              // is a valid instruction ?
-              // If DEPTH_CURRENT :
-              // equal at     DEPTH_MIN            -> not speculative
-              // not include ]DEPTH_MIN:DEPTH_MAX] -> previous branch miss
-              //     include ]DEPTH_MIN:DEPTH_MAX] -> speculative
-              
-              // All case
-              // ....... min ...X... max ....... OK
-              // ....... min ....... max ...X... KO
-              // ...X... min ....... max ....... KO
-              // ....... max ....... min ...X... OK
-              // ...X... max ....... min ....... OK
-              // ....... max ...X... min ....... KO
-              
-	      Tcontrol_t is_valid = true;
-//               Tcontrol_t   is_valid      = ((depth == depth_min) or
-//                                             depth_full or
-//                                             ((depth_min <= depth_max)?
-//                                              ((depth >= depth_min) and (depth <=depth_max)):
-//                                              ((depth >= depth_min) or  (depth <=depth_max))));
-              //Tcontrol_t is_valid        = ((depth == depth_min) or 
-              //                              ((depth_min < depth_max)?
-              //                               (depth<=depth_max):
-              //                               ((depth > depth_min) or (depth <= depth_max))));
-              //Tcontrol_t is_valid        = depth <= depth_max;
+              log_printf(TRACE,Decod_queue,FUNCTION,"      * context      : %d",context);
 
-              log_printf(TRACE,Decod_queue,FUNCTION,"    * is_valid : %d",is_valid);
-              log_printf(TRACE,Decod_queue,FUNCTION,"      * context      : %d",context);
-              log_printf(TRACE,Decod_queue,FUNCTION,"      * depth        : %d",depth);
-              log_printf(TRACE,Decod_queue,FUNCTION,"      * depth_min    : %d",depth_min);
-              log_printf(TRACE,Decod_queue,FUNCTION,"      * depth_max    : %d",depth_max);
-              log_printf(TRACE,Decod_queue,FUNCTION,"      * depth_full   : %d",depth_full);
-#ifdef DEBUG
-              log_printf(TRACE,Decod_queue,FUNCTION,"      * address      : 0x%x (0x%x)",reg_QUEUE->front()->_address     [index],reg_QUEUE->front()->_address     [index]<<2);
-#endif
-              log_printf(TRACE,Decod_queue,FUNCTION,"      * address_next : 0x%x (0x%x)",reg_QUEUE->front()->_address_next[index],reg_QUEUE->front()->_address_next[index]<<2);
-              internal_DECOD_OUT_VAL [index] = 1; // in all case, val is set (entry is not empty, and instruction is valid)
-              if (is_valid)
+              if (context_val [context])
                 {
-                  val                    [i]     = 1;
-                  internal_DECOD_OUT_ACK [index] = PORT_READ(in_DECOD_OUT_ACK [i]);
-                }
-              else
-                {
-                  // Consume the instruction (to erase)
-                  internal_DECOD_OUT_ACK [index] = 1;
+
+//               Tdepth_t   depth           = reg_QUEUE->front()->_depth         [index];
+//               Tdepth_t   depth_min       = (_param->_have_port_depth)?PORT_READ(in_DEPTH_MIN [context]):0;
+//               Tdepth_t   depth_max       = (_param->_have_port_depth)?PORT_READ(in_DEPTH_MAX [context]):0;
+//               Tcontrol_t depth_full      = PORT_READ(in_DEPTH_FULL[context]);
+
+                  // is a valid instruction ?
+                  // If DEPTH_CURRENT :
+                  // equal at     DEPTH_MIN            -> not speculative
+                  // not include ]DEPTH_MIN:DEPTH_MAX] -> previous branch miss
+                  //     include ]DEPTH_MIN:DEPTH_MAX] -> speculative
+                  
+                  // All case
+                  // ....... min ...X... max ....... OK
+                  // ....... min ....... max ...X... KO
+                  // ...X... min ....... max ....... KO
+                  // ....... max ....... min ...X... OK
+                  // ...X... max ....... min ....... OK
+                  // ....... max ...X... min ....... KO
+                  
+                  Tcontrol_t is_valid = (nb_inst_event [context] == 0);
+
+//                   Tcontrol_t   is_valid      = ((depth == depth_min) or
+//                                                 depth_full or
+//                                                 ((depth_min <= depth_max)?
+//                                                  ((depth >= depth_min) and (depth <=depth_max)):
+//                                                  ((depth >= depth_min) or  (depth <=depth_max))));
+                  
+                  log_printf(TRACE,Decod_queue,FUNCTION,"    * is_valid : %d",is_valid);
+                  log_printf(TRACE,Decod_queue,FUNCTION,"      * context_val  : %d",context_val   [context]);
+                  log_printf(TRACE,Decod_queue,FUNCTION,"      * nb_inst_event: %d",nb_inst_event [context]);
+//                   log_printf(TRACE,Decod_queue,FUNCTION,"      * depth        : %d",depth);
+//                   log_printf(TRACE,Decod_queue,FUNCTION,"      * depth_min    : %d",depth_min);
+//                   log_printf(TRACE,Decod_queue,FUNCTION,"      * depth_max    : %d",depth_max);
+//                   log_printf(TRACE,Decod_queue,FUNCTION,"      * depth_full   : %d",depth_full);
+#ifdef DEBUG      
+                  log_printf(TRACE,Decod_queue,FUNCTION,"      * address      : 0x%x (0x%x)",reg_QUEUE->front()->_address     [index],reg_QUEUE->front()->_address     [index]<<2);
+#endif            
+                  log_printf(TRACE,Decod_queue,FUNCTION,"      * address_next : 0x%x (0x%x)",reg_QUEUE->front()->_address_next[index],reg_QUEUE->front()->_address_next[index]<<2);
+                  internal_DECOD_OUT_VAL [index] = 1; // in all case, val is set (entry is not empty, and instruction is valid)
+                  
+                  if (is_valid)
+                    {
+                      val                    [i]     = 1;
+                      internal_DECOD_OUT_ACK [index] = PORT_READ(in_DECOD_OUT_ACK [i]);
+                    }
+                  else
+                    {
+                      // Consume the instruction (to erase)
+                      internal_DECOD_OUT_ACK [index] = 1;
+
+                      // Have event ?
+                      if (nb_inst_event [context] > 0)
+                        {
+                          nb_inst_event [context] --;
+                          
+                          // Last event ?
+                          if (nb_inst_event [context] == 0)
+                            {
+                              context_val [context] = false;
+                            }
+                        }
+                    }
                 }
             }
@@ -107,4 +134,15 @@
         
         PORT_WRITE(out_DECOD_OUT_VAL [i],val [i]);
+      }
+      }
+    else
+      {
+        // Reset 
+        for (uint32_t i=0; i<_param->_nb_inst_decod; i++)
+          {
+            internal_DECOD_OUT_VAL [i] = 0;
+            internal_DECOD_OUT_ACK [i] = 0;
+            PORT_WRITE(out_DECOD_OUT_VAL [i],0);
+          }
       }
 
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod_queue/src/Decod_queue_function_one_fifo_genMoore.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod_queue/src/Decod_queue_function_one_fifo_genMoore.cpp	(revision 118)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod_queue/src/Decod_queue_function_one_fifo_genMoore.cpp	(revision 123)
@@ -25,4 +25,6 @@
     log_function(Decod_queue,FUNCTION,_name.c_str());
 
+    if (PORT_READ(in_NRESET))
+      {
     //--------------------------------------------------------------------
     //-----[ DECOD_IN ]---------------------------------------------------
@@ -34,5 +36,4 @@
 	{
 	  internal_DECOD_IN_ACK [i] = ack;
-	  PORT_WRITE(out_DECOD_IN_ACK [i],ack);
 	}
     }
@@ -57,4 +58,6 @@
 	  PORT_WRITE(out_DECOD_OUT_OPERATION     [i],reg_QUEUE->front()->_operation     [index]);
 	  PORT_WRITE(out_DECOD_OUT_NO_EXECUTE    [i],reg_QUEUE->front()->_no_execute    [index]);
+// 	  PORT_WRITE(out_DECOD_OUT_HAVE_EVENT    [i],0);
+	  PORT_WRITE(out_DECOD_OUT_LAST_EVENT    [i],0);
 	  PORT_WRITE(out_DECOD_OUT_IS_DELAY_SLOT [i],reg_QUEUE->front()->_is_delay_slot [index]);
 #ifdef DEBUG
@@ -83,4 +86,21 @@
     for (uint32_t i=0; i<_param->_nb_context; i++)
       PORT_WRITE(out_NB_INST_ALL [i], reg_NB_INST [i]);
+      }
+    else
+      {
+        for (uint32_t i=0; i<_param->_nb_inst_decod; i++)
+          {
+            internal_DECOD_IN_ACK [i] = 0;
+          }
+        for (uint32_t i=0; i<_param->_nb_context; i++)
+          PORT_WRITE(out_NB_INST_ALL [i], 0);
+      }
+      
+    // Write output
+    for (uint32_t i=0; i<_param->_nb_inst_decod; i++)
+      {
+        PORT_WRITE(out_DECOD_IN_ACK [i],internal_DECOD_IN_ACK [i]);
+      }
+
 
     log_end(Decod_queue,FUNCTION);
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod_queue/src/Decod_queue_function_one_fifo_transition.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod_queue/src/Decod_queue_function_one_fifo_transition.cpp	(revision 118)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod_queue/src/Decod_queue_function_one_fifo_transition.cpp	(revision 123)
@@ -34,5 +34,8 @@
 
 	for (uint32_t i=0; i<_param->_nb_context; i++)
-	  reg_NB_INST [i]=0;
+          {
+            reg_NB_INST       [i]=0;
+            reg_NB_INST_EVENT [i]=0;
+          }
 
         reg_LAST_SLOT = 0;
@@ -130,5 +133,8 @@
 		    log_printf(TRACE,Decod_queue,FUNCTION,_("    * context : %d"),context);
 		    
-		    reg_NB_INST [context] --;
+                    reg_NB_INST       [context] --;
+                    if (reg_NB_INST_EVENT [context] > 0)
+                    reg_NB_INST_EVENT [context] --;
+
 		    log_printf(TRACE,Decod_queue,FUNCTION,_("    * nb_inst : %d"),reg_NB_INST [context]);
 		  }
@@ -149,4 +155,11 @@
 	      }
 	  }
+
+	//--------------------------------------------------------------------
+	//-----[ CONTEXT_EVENT ]----------------------------------------------
+	//--------------------------------------------------------------------
+        for (uint32_t i=0; i<_param->_nb_context; i++)
+          if (PORT_READ(in_CONTEXT_EVENT [i]))
+            reg_NB_INST_EVENT [i] = reg_NB_INST [i];
       }
 
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod_queue/src/Decod_queue_genMealy_decod_out.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod_queue/src/Decod_queue_genMealy_decod_out.cpp	(revision 118)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod_queue/src/Decod_queue_genMealy_decod_out.cpp	(revision 123)
@@ -25,4 +25,5 @@
     log_function(Decod_queue,FUNCTION,_name.c_str());
 
+//     if (PORT_READ(in_NRESET))
     (this->*function_genMealy_decod_out) ();
 
