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 98)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/src/Context_State.cpp	(revision 101)
@@ -82,9 +82,9 @@
 	  }
 
-	for (uint32_t i=0; i<_param->_nb_decod_unit; i++)
-	  {
-	    internal_DECOD_EVENT_ACK [i] = 1;
-	    PORT_WRITE(out_DECOD_EVENT_ACK [i], internal_DECOD_EVENT_ACK [i]);
-	  }
+// 	for (uint32_t i=0; i<_param->_nb_decod_unit; i++)
+// 	  {
+// 	    internal_DECOD_EVENT_ACK [i] = 1;
+// 	    PORT_WRITE(out_DECOD_EVENT_ACK [i], internal_DECOD_EVENT_ACK [i]);
+// 	  }
 
         internal_COMMIT_EVENT_ACK = 1;
@@ -112,4 +112,27 @@
 	dont_initialize ();
 	sensitive << (*(in_CLOCK)).neg(); // use internal register
+	
+# ifdef SYSTEMCASS_SPECIFIC
+	// List dependency information
+# endif    
+
+	log_printf(INFO,Context_State,FUNCTION,_("Method - genMealy_decod_event"));
+
+	SC_METHOD (genMealy_decod_event);
+	dont_initialize ();
+	sensitive << (*(in_CLOCK)).neg(); // use internal register
+        for (uint32_t i=0; i<_param->_nb_decod_unit; ++i)
+          {
+            sensitive << (*(in_DECOD_EVENT_VAL        [i])) // not necessary
+                      << (*(in_DECOD_EVENT_TYPE       [i]));
+            if (_param->_have_port_context_id)				        
+            sensitive << (*(in_DECOD_EVENT_CONTEXT_ID [i]));
+          }
+        for (uint32_t i=0; i<_param->_nb_context; ++i)
+          {
+            sensitive << (*(in_NB_INST_DECOD_ALL      [i]))
+                      << (*(in_NB_INST_COMMIT_ALL     [i]))
+                      << (*(in_NB_INST_COMMIT_MEM     [i]));
+          }
 	
 # ifdef SYSTEMCASS_SPECIFIC
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 98)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/src/Context_State_genMoore.cpp	(revision 101)
@@ -105,7 +105,8 @@
 	context_state_t state = reg_STATE [i];
 
-	PORT_WRITE(out_CONTEXT_DECOD_ENABLE [i], ((state==CONTEXT_STATE_OK            ) or
-						  (state==CONTEXT_STATE_KO_MSYNC_ISSUE) or
-						  (state==CONTEXT_STATE_KO_SPR_ISSUE  )));
+// 	PORT_WRITE(out_CONTEXT_DECOD_ENABLE [i], ((state==CONTEXT_STATE_OK            ) or
+// 						  (state==CONTEXT_STATE_KO_MSYNC_ISSUE) or
+// 						  (state==CONTEXT_STATE_KO_SPR_ISSUE  )));
+	PORT_WRITE(out_CONTEXT_DECOD_ENABLE [i], (state==CONTEXT_STATE_OK));
       }
 
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 98)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/src/Context_State_transition.cpp	(revision 101)
@@ -35,4 +35,145 @@
       {
         // -------------------------------------------------------------------
+        // -----[ next state ]------------------------------------------------
+        // -------------------------------------------------------------------
+        for (uint32_t i=0; i<_param->_nb_context; i++)
+          {
+//             uint32_t x = _param->_link_context_to_decod_unit    [i];
+
+            Tcounter_t inst_all = PORT_READ(in_NB_INST_COMMIT_ALL[i]) + PORT_READ(in_NB_INST_DECOD_ALL [i]);
+//          Tcounter_t inst_mem = PORT_READ(in_NB_INST_COMMIT_MEM[i]) + PORT_READ(in_NB_INST_DECOD_ALL [i]);
+
+            context_state_t state = reg_STATE [i];
+
+            switch (state)
+              {
+              case CONTEXT_STATE_OK              :
+                {
+                  // nothing, wait an event
+                  break;
+                }
+              case CONTEXT_STATE_KO_EXCEP        :
+                {
+                  // Wait end of all instruction
+                  if (inst_all == 0)
+                    state = CONTEXT_STATE_KO_EXCEP_ADDR;
+                  break;
+                }
+              case CONTEXT_STATE_KO_EXCEP_ADDR   :
+                {
+                  // nothing, wait the update of internal register (pc)
+                  break;
+                }
+              case CONTEXT_STATE_KO_MISS_WAITEND :
+                {
+                  // Wait end of all instruction
+                  if (inst_all == 0)
+                    
+//                  state = CONTEXT_STATE_OK; // @@@ TODO : make MISS fast (miss decod)
+                    state = CONTEXT_STATE_KO_MISS_ADDR;
+                  break;
+                }
+              case CONTEXT_STATE_KO_EXCEP_SPR    :
+                {
+                  // nothing, wait the update of internal register (epcr, eear, sr, esr)
+                  break;
+                }
+              case CONTEXT_STATE_KO_MISS_ADDR    :
+                {
+                  // nothing, wait the update of internal register (pc)
+                  break;
+                }
+//               case CONTEXT_STATE_KO_PSYNC        :
+//                 {
+//                   // Wait end of all instruction
+//                   if (inst_all == 0)
+//                     state = CONTEXT_STATE_KO_PSYNC_FLUSH;
+//                   break;
+//                 }
+              case CONTEXT_STATE_KO_PSYNC_FLUSH  :
+                {
+                  // nothing, wait end of flush (ifetch)
+                  if (inst_all == 0)
+//                  state = CONTEXT_STATE_KO_PSYNC_ADDR;
+                    state = CONTEXT_STATE_OK;
+                    
+                  break;
+                }
+              case CONTEXT_STATE_KO_PSYNC_ADDR   :
+                {
+                  // nothing, wait the pc write
+                  break;
+                }
+//               case CONTEXT_STATE_KO_CSYNC        :
+//                 {
+//                   // Wait end of all instruction
+//                   if (inst_all == 0)
+//                     state = CONTEXT_STATE_KO_CSYNC_FLUSH;
+//                   break;
+//                 }
+              case CONTEXT_STATE_KO_CSYNC_FLUSH  :
+                {
+                  // nothing, wait end of flush (all internal structure)
+                  if (inst_all == 0)
+                    state = CONTEXT_STATE_KO_CSYNC_ADDR;
+                  break;
+                }
+              case CONTEXT_STATE_KO_CSYNC_ADDR   :
+                {
+                  // nothing, wait the pc write
+                  break;
+                }
+//               case CONTEXT_STATE_KO_MSYNC        :
+//                 {
+//                   // Wait end of memory instruction
+//                   if (inst_mem == 0)
+//                     state = CONTEXT_STATE_KO_MSYNC_ISSUE;
+//                   break;
+//                 }
+//               case CONTEXT_STATE_KO_MSYNC_ISSUE  :
+//                 {
+//                   // Wait the msync issue
+//                   if (inst_mem != 0)
+//                     state = CONTEXT_STATE_KO_MSYNC_EXEC;
+//                   break;
+//                 }
+              case CONTEXT_STATE_KO_MSYNC_EXEC   :
+                {
+                  // Wait the end of msync
+                  if (inst_all == 0)
+                    state = CONTEXT_STATE_OK;
+                  break;
+                }
+//               case CONTEXT_STATE_KO_SPR          :
+//                 {
+//                   // Wait end of all instruction
+//                   if (inst_all == 0)
+//                     state = CONTEXT_STATE_KO_SPR_ISSUE;
+//                   break;
+//                 }
+//               case CONTEXT_STATE_KO_SPR_ISSUE    :
+//                 {
+//                   // Wait the spr_access issue
+//                   if (inst_all != 0)
+//                     state = CONTEXT_STATE_KO_SPR_EXEC;
+//                   break;
+//                 }
+              case CONTEXT_STATE_KO_SPR_EXEC     :
+                {
+                  // Wait the spr_access execution
+                  if (inst_all == 0)
+                    state = CONTEXT_STATE_OK;
+                  break;
+                }
+
+              default :
+                {
+                  throw ERRORMORPHEO(FUNCTION,toString(_("Context[%d], Unknow state : %s.\n"),i,toString(state).c_str()));
+                }
+              }
+            reg_STATE [i] = state;
+          }
+
+        // -------------------------------------------------------------------
         // -----[ BRANCH_EVENT ]----------------------------------------------
         // -------------------------------------------------------------------
@@ -57,5 +198,5 @@
 
               // priority : miss > excep > spr/sync
-              uint8_t    priority0  = (state == CONTEXT_STATE_KO_MISS)?2:((state == EVENT_TYPE_EXCEPTION)?1:0);
+              uint8_t    priority0  = ((state == CONTEXT_STATE_KO_MISS_ADDR) or (state == CONTEXT_STATE_KO_MISS_WAITEND))?2:((state == EVENT_TYPE_EXCEPTION)?1:0);
               uint8_t    priority1  = 2; // miss
 
@@ -71,5 +212,6 @@
                 {
                   Tcontrol_t dest_val = PORT_READ(in_BRANCH_EVENT_ADDRESS_DEST_VAL[i]);
-                  reg_STATE                  [i] =  CONTEXT_STATE_KO_MISS;
+//                reg_STATE                  [i] =  CONTEXT_STATE_KO_MISS_ADDR;
+                  reg_STATE                  [i] =  CONTEXT_STATE_KO_MISS_WAITEND; //@@@ TODO : make MISS fast (miss decod)
                   reg_EVENT_ADDRESS          [i] =  PORT_READ(in_BRANCH_EVENT_ADDRESS_SRC  [i])+1; // address delay slot
                   reg_EVENT_ADDRESS_EPCR     [i] =  PORT_READ(in_BRANCH_EVENT_ADDRESS_DEST [i]);   // address_next
@@ -107,5 +249,5 @@
               
               // miss > excep > spr/sync
-              uint8_t    priority0  = (state == CONTEXT_STATE_KO_MISS)?2:((state == CONTEXT_STATE_KO_EXCEP)?1:0);
+              uint8_t    priority0  = ((state == CONTEXT_STATE_KO_MISS_ADDR) or (state == CONTEXT_STATE_KO_MISS_WAITEND))?2:((state == CONTEXT_STATE_KO_EXCEP)?1:0);
               uint8_t    priority1  = (state == EVENT_TYPE_EXCEPTION)?1:0;
 
@@ -120,4 +262,6 @@
               if (is_valid)
                 {
+                  log_printf(TRACE,Context_State,FUNCTION,"    * is_valid");
+
                   // decod : 
                   // type : csync, psync, msync, spr_access (l.mac, l.maci, l.macrc, l.msb, l.mfspr, l.mtspr), exception (l.sys)
@@ -130,4 +274,6 @@
                     case EVENT_TYPE_EXCEPTION          : 
                       {
+                        log_printf(TRACE,Context_State,FUNCTION,"    * EVENT_TYPE_EXCEPTION");
+
                         state_next = CONTEXT_STATE_KO_EXCEP; 
 
@@ -136,32 +282,44 @@
                     case EVENT_TYPE_SPR_ACCESS         : 
                       {
-                        state_next = CONTEXT_STATE_KO_SPR  ; 
+                        log_printf(TRACE,Context_State,FUNCTION,"    * EVENT_TYPE_SPR_ACCESS");
+
+//                      state_next = CONTEXT_STATE_KO_SPR  ; 
+                        state_next = CONTEXT_STATE_KO_SPR_EXEC; 
                         address++; // take next address
-                        if (is_delay_slot)
-                          throw ERRORMORPHEO(FUNCTION,"SPR access in delay slot, not supported.\n");
+//                         if (is_delay_slot)
+//                           throw ERRORMORPHEO(FUNCTION,"SPR access in delay slot, not supported.\n");
                         break;
                       }
                     case EVENT_TYPE_MSYNC              : 
                       {
-                        state_next = CONTEXT_STATE_KO_MSYNC;
+                        log_printf(TRACE,Context_State,FUNCTION,"    * EVENT_TYPE_MSYNC");
+
+//                      state_next = CONTEXT_STATE_KO_MSYNC;
+                        state_next = CONTEXT_STATE_KO_MSYNC_EXEC;
                         address++;  // take next address
-                        if (is_delay_slot)
-                          throw ERRORMORPHEO(FUNCTION,"SPR access in delay slot, not supported.\n");
+//                         if (is_delay_slot)
+//                           throw ERRORMORPHEO(FUNCTION,"MSYNC in delay slot, not supported.\n");
                         break;
                       }
                     case EVENT_TYPE_PSYNC              :
                       {
-                        state_next = CONTEXT_STATE_KO_PSYNC;
+                        log_printf(TRACE,Context_State,FUNCTION,"    * EVENT_TYPE_PSYNC");
+
+//                      state_next = CONTEXT_STATE_KO_PSYNC;
+                        state_next = CONTEXT_STATE_KO_PSYNC_FLUSH;
                         address++;  // take next address
                         if (is_delay_slot)
-                          throw ERRORMORPHEO(FUNCTION,"SPR access in delay slot, not supported.\n");
+                          throw ERRORMORPHEO(FUNCTION,"PSYNC in delay slot, not supported.\n");
                         break;
                       }
                     case EVENT_TYPE_CSYNC              :
                       {
-                        state_next = CONTEXT_STATE_KO_CSYNC;
+                        log_printf(TRACE,Context_State,FUNCTION,"    * EVENT_TYPE_CSYNC");
+
+//                      state_next = CONTEXT_STATE_KO_CSYNC;
+                        state_next = CONTEXT_STATE_KO_CSYNC_FLUSH;
                         address++;  // take next address
                         if (is_delay_slot)
-                          throw ERRORMORPHEO(FUNCTION,"SPR access in delay slot, not supported.\n");
+                          throw ERRORMORPHEO(FUNCTION,"CSYNC in delay slot, not supported.\n");
                         break;
                       }               
@@ -210,5 +368,5 @@
             
             // miss > excep > spr/sync
-            uint8_t    priority0  = (state == CONTEXT_STATE_KO_MISS)?2:((state == CONTEXT_STATE_KO_EXCEP)?1:0);
+            uint8_t    priority0  = ((state == CONTEXT_STATE_KO_MISS_ADDR) or (state == CONTEXT_STATE_KO_MISS_WAITEND))?2:((state == CONTEXT_STATE_KO_EXCEP)?1:0);
             uint8_t    priority1  = 1; // exception
 
@@ -277,5 +435,5 @@
                   
 //                   // miss > excep > spr/sync
-//                   uint8_t    priority0  = (state == CONTEXT_STATE_KO_MISS)?2:((state == CONTEXT_STATE_KO_EXCEP)?1:0);
+//                   uint8_t    priority0  = ((state == CONTEXT_STATE_KO_MISS_ADDR) or (state == CONTEXT_STATE_KO_MISS_WAITEND))?2:((state == CONTEXT_STATE_KO_EXCEP)?1:0);
 //                   uint8_t    priority1  = 2; // miss
                   
@@ -323,4 +481,8 @@
                   }
                 case CONTEXT_STATE_KO_MISS_ADDR  :
+//                   {
+//                     reg_STATE [i] = CONTEXT_STATE_KO_MISS_WAITEND; //@@@ TODO : make MISS fast (miss decod)
+//                     break;
+//                   }
                 case CONTEXT_STATE_KO_PSYNC_ADDR :
                 case CONTEXT_STATE_KO_CSYNC_ADDR :
@@ -357,139 +519,4 @@
               reg_STATE [i] = CONTEXT_STATE_OK;
             }
-
-        // -------------------------------------------------------------------
-        // -----[ next state ]------------------------------------------------
-        // -------------------------------------------------------------------
-        for (uint32_t i=0; i<_param->_nb_context; i++)
-          {
-//             uint32_t x = _param->_link_context_to_decod_unit    [i];
-
-            Tcounter_t inst_all = PORT_READ(in_NB_INST_COMMIT_ALL[i]) + PORT_READ(in_NB_INST_DECOD_ALL [i]);
-            Tcounter_t inst_mem = PORT_READ(in_NB_INST_COMMIT_MEM[i]) + PORT_READ(in_NB_INST_DECOD_ALL [i]);
-
-            context_state_t state = reg_STATE [i];
-
-            switch (state)
-              {
-              case CONTEXT_STATE_OK              :
-                {
-                  // nothing, wait an event
-                  break;
-                }
-              case CONTEXT_STATE_KO_EXCEP        :
-                {
-                  // Wait end of all instruction
-                  if (inst_all == 0)
-                    state = CONTEXT_STATE_KO_EXCEP_ADDR;
-                  break;
-                }
-              case CONTEXT_STATE_KO_MISS         :
-                {
-                  // Wait end of all instruction
-                  if (inst_all == 0)
-                    state = CONTEXT_STATE_KO_MISS_ADDR;
-                  break;
-                }
-              case CONTEXT_STATE_KO_EXCEP_ADDR   :
-                {
-                  // nothing, wait the update of internal register (pc)
-                  break;
-                }
-              case CONTEXT_STATE_KO_EXCEP_SPR    :
-                {
-                  // nothing, wait the update of internal register (epcr, eear, sr, esr)
-                  break;
-                }
-              case CONTEXT_STATE_KO_MISS_ADDR    :
-                {
-                  // nothing, wait the update of internal register (pc)
-                  break;
-                }
-              case CONTEXT_STATE_KO_PSYNC        :
-                {
-                  // Wait end of all instruction
-                  if (inst_all == 0)
-//                  state = CONTEXT_STATE_KO_PSYNC_FLUSH;
-                    state = CONTEXT_STATE_KO_PSYNC_ADDR ;
-                  break;
-                }
-//            case CONTEXT_STATE_KO_PSYNC_FLUSH  :
-//              {
-//                // nothing, wait end of flush (ifetch)
-//                break;
-//              }
-              case CONTEXT_STATE_KO_PSYNC_ADDR   :
-                {
-                  // nothing, wait the pc write
-                  break;
-                }
-              case CONTEXT_STATE_KO_CSYNC        :
-                {
-                  // Wait end of all instruction
-                  if (inst_all == 0)
-                    state = CONTEXT_STATE_KO_CSYNC_ADDR ;
-//                  state = CONTEXT_STATE_KO_CSYNC_FLUSH;
-                  break;
-                }
-//            case CONTEXT_STATE_KO_CSYNC_FLUSH  :
-//              {
-//                // nothing, wait end of flush (all internal structure)
-//                break;
-//              }
-              case CONTEXT_STATE_KO_CSYNC_ADDR   :
-                {
-                  // nothing, wait the pc write
-                  break;
-                }
-              case CONTEXT_STATE_KO_MSYNC        :
-                {
-                  // Wait end of memory instruction
-                  if (inst_mem == 0)
-                    state = CONTEXT_STATE_KO_MSYNC_ISSUE;
-                  break;
-                }
-              case CONTEXT_STATE_KO_MSYNC_ISSUE  :
-                {
-                  // Wait the msync issue
-                  if (inst_mem != 0)
-                    state = CONTEXT_STATE_KO_MSYNC_EXEC;
-                  break;
-                }
-              case CONTEXT_STATE_KO_MSYNC_EXEC   :
-                {
-                  // Wait the end of msync
-                  if (inst_mem == 0)
-                    state = CONTEXT_STATE_OK;
-                  break;
-                }
-              case CONTEXT_STATE_KO_SPR          :
-                {
-                  // Wait end of all instruction
-                  if (inst_all == 0)
-                    state = CONTEXT_STATE_KO_SPR_ISSUE;
-                  break;
-                }
-              case CONTEXT_STATE_KO_SPR_ISSUE    :
-                {
-                  // Wait the spr_access issue
-                  if (inst_all != 0)
-                    state = CONTEXT_STATE_KO_SPR_EXEC;
-                  break;
-                }
-              case CONTEXT_STATE_KO_SPR_EXEC     :
-                {
-                  // Wait the spr_access execution
-                  if (inst_all == 0)
-                    state = CONTEXT_STATE_OK;
-                  break;
-                }
-
-              default :
-                {
-                  throw ERRORMORPHEO(FUNCTION,toString(_("Context[%d], Unknow state : %s.\n"),i,toString(state).c_str()));
-                }
-              }
-            reg_STATE [i] = state;
-          }
 
         for (uint32_t i=0; i<_param->_nb_context; ++i)
