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 124)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/src/Context_State_transition.cpp	(revision 128)
@@ -50,5 +50,14 @@
             reg_STATE            [i] = CONTEXT_STATE_OK;
             reg_INTERRUPT_ENABLE [i] = 0;
-            reg_EVENT_DEPTH      [i] = 0; // unacessary
+
+            reg_EVENT_ADDRESS          [i] = 0; // not necessary
+            reg_EVENT_ADDRESS_EPCR     [i] = 0; // not necessary 
+            reg_EVENT_ADDRESS_EPCR_VAL [i] = 0; // not necessary
+            reg_EVENT_ADDRESS_EEAR     [i] = 0; // not necessary 
+            reg_EVENT_ADDRESS_EEAR_VAL [i] = 0; // not necessary
+            reg_EVENT_IS_DELAY_SLOT    [i] = 0; // not necessary
+            reg_EVENT_IS_DS_TAKE       [i] = 0; // not necessary
+            reg_EVENT_DEPTH            [i] = 0; // not necessary
+            reg_EVENT_FLUSH_ONLY       [i] = 0; // not necessary
           }
       }
@@ -236,4 +245,233 @@
             reg_STATE [i] = state;
           }
+
+        // -------------------------------------------------------------------
+        // -----[ BRANCH_EVENT ]----------------------------------------------
+        // -------------------------------------------------------------------
+        for (uint32_t i=0; i<_param->_nb_context; ++i)
+          if (PORT_READ(in_BRANCH_EVENT_VAL [i]) and internal_BRANCH_EVENT_ACK [i])
+            {
+              log_printf(TRACE,Context_State,FUNCTION,"  * BRANCH_EVENT [%d]",i);
+
+              context_state_t state = reg_STATE [i];
+
+              Tdepth_t   depth      = (_param->_have_port_depth)?PORT_READ(in_BRANCH_EVENT_DEPTH [i]):0;
+              Tdepth_t   depth_cur  = reg_EVENT_DEPTH [i];
+              Tdepth_t   depth_min  = (_param->_have_port_depth)?PORT_READ(in_DEPTH_MIN [i]):0;
+              Tdepth_t   depth_max  = _param->_nb_inst_branch_speculated [i];
+              
+              Tdepth_t   depth0     = (depth_cur>=depth_min)?(depth_cur-depth_min):((depth_cur+depth_max-depth_min));
+              Tdepth_t   depth1     = (depth    >=depth_min)?(depth    -depth_min):((depth    +depth_max-depth_min));
+//               Tdepth_t   depth0     = (depth_cur>=depth_min)?(depth_cur):((depth_cur+depth_max));
+//               Tdepth_t   depth1     = (depth    >=depth_min)?(depth    ):((depth    +depth_max));
+
+              // priority : miss_load > miss_branch > excep > spr/sync
+              uint8_t    priority0  = get_priority(state);
+              uint8_t    priority1  = PRIORITY_MISS_BRANCH; // miss
+
+              // is_valid = can modify local information
+              //   if context_state_ok : yes
+              //   if context_state_ko : test the depth, and the priority of event
+              bool       is_valid   = ((state == CONTEXT_STATE_OK) or
+                                       (state == CONTEXT_STATE_KO_MISS_BRANCH_WAIT_UPDATE) or
+//                                     (state == CONTEXT_STATE_KO_MISS_LOAD_AND_BRANCH_WAIT_UPDATE) or
+                                       (depth1< depth0) or
+                                       ((depth1==depth0) and (priority1>=priority0))); // >= because another branch can be a miss prediction with same depth
+
+              bool       is_invalid = priority0 == PRIORITY_MISS_LOAD;
+
+#ifdef DEBUG_TEST
+              if ((state == CONTEXT_STATE_KO_MISS_BRANCH_WAIT_UPDATE) and
+                  (depth0 != depth1))
+                throw ERRORMORPHEO(FUNCTION,toString(_("BRANCH_EVENT[%d] : Invalid state : %s.\n"),i,toString(state).c_str()));
+#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 );
+              log_printf(TRACE,Context_State,FUNCTION,"    * depth_min : %d",depth_min );
+              log_printf(TRACE,Context_State,FUNCTION,"    * depth_max : %d",depth_max );
+              log_printf(TRACE,Context_State,FUNCTION,"    * depth0    : %d",depth0    );
+              log_printf(TRACE,Context_State,FUNCTION,"    * depth1    : %d",depth1    );
+              log_printf(TRACE,Context_State,FUNCTION,"    * priority0 : %d",priority0 );
+              log_printf(TRACE,Context_State,FUNCTION,"    * priority1 : %d",priority1 );
+              log_printf(TRACE,Context_State,FUNCTION,"  * is_valid    : %d",is_valid  );
+              log_printf(TRACE,Context_State,FUNCTION,"  * is_invalid  : %d",is_invalid);
+
+              if (is_valid and not is_invalid)
+                {
+//                reg_STATE                  [i] =  CONTEXT_STATE_KO_MISS_BRANCH_ADDR;
+
+                  if (state == CONTEXT_STATE_KO_MISS_LOAD_AND_BRANCH_WAIT_UPDATE)
+                    {
+// #if (MANAGE_EVENT == MANAGE_EVENT_NO_WAIT)
+//                       reg_STATE                  [i] =  CONTEXT_STATE_KO_MISS_LOAD_AND_BRANCH_ADDR;
+// #else
+                      reg_STATE                  [i] =  CONTEXT_STATE_KO_MISS_LOAD_AND_BRANCH_WAITEND;
+// #endif
+                    }
+                  else
+                    {
+                      Tcontrol_t can_continue = PORT_READ(in_BRANCH_EVENT_CAN_CONTINUE    [i]);
+                      Tcontrol_t dest_val     = PORT_READ(in_BRANCH_EVENT_ADDRESS_DEST_VAL[i]);
+
+                      log_printf(TRACE,Context_State,FUNCTION,"  * dest_val    : %d",dest_val    );
+                      log_printf(TRACE,Context_State,FUNCTION,"  * can_continue: %d",can_continue);
+
+                      if (can_continue)
+                        reg_STATE                [i] =  CONTEXT_STATE_KO_MISS_BRANCH_ADDR;
+                      else
+                        {
+// #if (MANAGE_EVENT == MANAGE_EVENT_NO_WAIT)
+//                           reg_STATE                [i] =  CONTEXT_STATE_KO_MISS_BRANCH_ADDR;
+// #else
+                          reg_STATE                [i] =  CONTEXT_STATE_KO_MISS_BRANCH_WAITEND;
+// #endif
+                        }
+
+                      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
+                      reg_EVENT_ADDRESS_EPCR_VAL [i] = dest_val;
+                    //reg_EVENT_ADDRESS_EEAR     [i] = 0; 
+                      reg_EVENT_ADDRESS_EEAR_VAL [i] = 0;
+                      reg_EVENT_IS_DELAY_SLOT    [i] = 1;
+                      reg_EVENT_IS_DS_TAKE       [i] = dest_val;
+                      reg_EVENT_DEPTH            [i] = depth;
+                      reg_EVENT_FLUSH_ONLY       [i] = can_continue;
+                    }
+                }
+            }
+        
+        // -------------------------------------------------------------------
+        // -----[ DECOD_EVENT ]-----------------------------------------------
+        // -------------------------------------------------------------------
+
+        for (uint32_t i=0; i<_param->_nb_decod_unit; i++)
+          if (PORT_READ(in_DECOD_EVENT_VAL [i]) and internal_DECOD_EVENT_ACK [i])
+            {
+              log_printf(TRACE,Context_State,FUNCTION,"  * DECOD_EVENT [%d]",i);
+
+              Tcontext_t context    = (_param->_have_port_context_id )?PORT_READ(in_DECOD_EVENT_CONTEXT_ID [i]):0;
+              Tdepth_t   depth      = (_param->_have_port_depth      )?PORT_READ(in_DECOD_EVENT_DEPTH      [i]):0;
+              Tdepth_t   depth_cur  = reg_EVENT_DEPTH [context];
+              Tdepth_t   depth_min = (_param->_have_port_depth      )?PORT_READ(in_DEPTH_MIN [context]):0;
+              Tdepth_t   depth_max  = _param->_nb_inst_branch_speculated [context];
+              
+              Tdepth_t   depth0     = (depth_cur>=depth_min)?(depth_cur-depth_min):((depth_cur+depth_max-depth_min));
+              Tdepth_t   depth1     = (depth    >=depth_min)?(depth    -depth_min):((depth    +depth_max-depth_min));
+//               Tdepth_t   depth0     = (depth_cur>=depth_min)?(depth_cur):((depth_cur+depth_max));
+//               Tdepth_t   depth1     = (depth    >=depth_min)?(depth    ):((depth    +depth_max));
+
+              context_state_t state = reg_STATE [context];
+              Tevent_type_t   type  = PORT_READ(in_DECOD_EVENT_TYPE [i]);
+              
+              // miss_load > miss_branch > excep > spr/sync
+              uint8_t    priority0  = get_priority(state);
+              uint8_t    priority1  = (state == EVENT_TYPE_EXCEPTION)?PRIORITY_EXCEPTION:PRIORITY_NONE;
+
+              // is_valid = can modify local information
+              //  if context_state_ok : yes
+              //  if context_state_ko : test the depth, and the priority of envent
+
+              bool       is_valid   = ((state == CONTEXT_STATE_OK) or
+                                       (depth1< depth0) or
+                                       ((depth1==depth0) and (priority1>=priority0)));
+
+              log_printf(TRACE,Context_State,FUNCTION,"    * depth     : %d",depth     );
+              log_printf(TRACE,Context_State,FUNCTION,"    * depth_cur : %d",depth_cur );
+              log_printf(TRACE,Context_State,FUNCTION,"    * depth_min : %d",depth_min );
+              log_printf(TRACE,Context_State,FUNCTION,"    * depth_max : %d",depth_max );
+              log_printf(TRACE,Context_State,FUNCTION,"    * depth0    : %d",depth0    );
+              log_printf(TRACE,Context_State,FUNCTION,"    * depth1    : %d",depth1    );
+              log_printf(TRACE,Context_State,FUNCTION,"    * priority0 : %d",priority0 );
+              log_printf(TRACE,Context_State,FUNCTION,"    * priority1 : %d",priority1 );
+              log_printf(TRACE,Context_State,FUNCTION,"  * is_valid    : %d",is_valid  );
+
+              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)
+                  context_state_t state_next    = state;
+                  Taddress_t      address       = PORT_READ(in_DECOD_EVENT_ADDRESS       [i]);
+                  Tcontrol_t      is_delay_slot = PORT_READ(in_DECOD_EVENT_IS_DELAY_SLOT [i]);
+
+                  switch (type)
+                    {
+                    case EVENT_TYPE_EXCEPTION          : 
+                      {
+                        log_printf(TRACE,Context_State,FUNCTION,"    * EVENT_TYPE_EXCEPTION");
+
+                        state_next = CONTEXT_STATE_KO_EXCEP; 
+
+                        break;
+                      }
+                    case EVENT_TYPE_SPR_ACCESS         : 
+                      {
+                        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");
+                        break;
+                      }
+                    case EVENT_TYPE_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,"MSYNC in delay slot, not supported.\n");
+                        break;
+                      }
+                    case EVENT_TYPE_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,"PSYNC in delay slot, not supported.\n");
+                        break;
+                      }
+                    case EVENT_TYPE_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,"CSYNC in delay slot, not supported.\n");
+                        break;
+                      }               
+                    case EVENT_TYPE_NONE               :
+                    case EVENT_TYPE_BRANCH_MISS_SPECULATION   :
+                    case EVENT_TYPE_LOAD_MISS_SPECULATION   :
+//                     case EVENT_TYPE_BRANCH_NO_ACCURATE :
+                    default :
+                      {
+                        throw ERRORMORPHEO(FUNCTION,toString(_("DECOD_EVENT [%d] : invalid event_type : %s.\n"),i,toString(type).c_str()));
+                      }
+                    }
+
+                  reg_STATE                  [context] = state_next;
+                  reg_EVENT_ADDRESS          [context] = address;
+                  reg_EVENT_ADDRESS_EPCR     [context] = PORT_READ(in_DECOD_EVENT_ADDRESS_EPCR  [i]); 
+                  reg_EVENT_ADDRESS_EPCR_VAL [context] = 1;
+                //reg_EVENT_ADDRESS_EEAR     [context]
+                  reg_EVENT_ADDRESS_EEAR_VAL [context] = 0;
+                  reg_EVENT_IS_DELAY_SLOT    [context] = is_delay_slot;
+                //reg_EVENT_IS_DS_TAKE       [context] = 0;
+                  reg_EVENT_DEPTH            [context] = depth;
+                  reg_EVENT_FLUSH_ONLY       [context] = false;
+                }
+            }
 
         // -------------------------------------------------------------------
@@ -283,100 +521,4 @@
 
         // -------------------------------------------------------------------
-        // -----[ BRANCH_EVENT ]----------------------------------------------
-        // -------------------------------------------------------------------
-        for (uint32_t i=0; i<_param->_nb_context; ++i)
-          if (PORT_READ(in_BRANCH_EVENT_VAL [i]) and internal_BRANCH_EVENT_ACK [i])
-            {
-              log_printf(TRACE,Context_State,FUNCTION,"  * BRANCH_EVENT [%d]",i);
-
-              context_state_t state = reg_STATE [i];
-
-              Tdepth_t   depth      = (_param->_have_port_depth)?PORT_READ(in_BRANCH_EVENT_DEPTH [i]):0;
-              Tdepth_t   depth_cur  = reg_EVENT_DEPTH [i];
-              Tdepth_t   depth_min  = (_param->_have_port_depth)?PORT_READ(in_DEPTH_MIN [i]):0;
-              Tdepth_t   depth_max  = _param->_nb_inst_branch_speculated [i];
-              
-              Tdepth_t   depth0     = (depth_cur>=depth_min)?(depth_cur-depth_min):((depth_cur+depth_max-depth_min));
-              Tdepth_t   depth1     = (depth    >=depth_min)?(depth    -depth_min):((depth    +depth_max-depth_min));
-//               Tdepth_t   depth0     = (depth_cur>=depth_min)?(depth_cur):((depth_cur+depth_max));
-//               Tdepth_t   depth1     = (depth    >=depth_min)?(depth    ):((depth    +depth_max));
-
-              // priority : miss_load > miss_branch > excep > spr/sync
-              uint8_t    priority0  = get_priority(state);
-              uint8_t    priority1  = PRIORITY_MISS_BRANCH; // miss
-
-              // is_valid = can modify local information
-              //   if context_state_ok : yes
-              //   if context_state_ko : test the depth, and the priority of event
-              bool       is_valid   = ((state == CONTEXT_STATE_OK) or
-                                       (state == CONTEXT_STATE_KO_MISS_BRANCH_WAIT_UPDATE) or
-//                                     (state == CONTEXT_STATE_KO_MISS_LOAD_AND_BRANCH_WAIT_UPDATE) or
-                                       (depth1< depth0) or
-                                       ((depth1==depth0) and (priority1>=priority0))); // >= because another branch can be a miss prediction with same depth
-
-              bool       is_invalid = priority0 == PRIORITY_MISS_LOAD;
-
-#ifdef DEBUG_TEST
-              if ((state == CONTEXT_STATE_KO_MISS_BRANCH_WAIT_UPDATE) and
-                  (depth0 != depth1))
-                throw ERRORMORPHEO(FUNCTION,toString(_("BRANCH_EVENT[%d] : Invalid state : %s.\n"),i,toString(state).c_str()));
-#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 );
-              log_printf(TRACE,Context_State,FUNCTION,"    * depth_min : %d",depth_min );
-              log_printf(TRACE,Context_State,FUNCTION,"    * depth_max : %d",depth_max );
-              log_printf(TRACE,Context_State,FUNCTION,"    * depth0    : %d",depth0    );
-              log_printf(TRACE,Context_State,FUNCTION,"    * depth1    : %d",depth1    );
-              log_printf(TRACE,Context_State,FUNCTION,"    * priority0 : %d",priority0 );
-              log_printf(TRACE,Context_State,FUNCTION,"    * priority1 : %d",priority1 );
-              log_printf(TRACE,Context_State,FUNCTION,"  * is_valid    : %d",is_valid  );
-
-              if (is_valid and not is_invalid)
-                {
-//                reg_STATE                  [i] =  CONTEXT_STATE_KO_MISS_BRANCH_ADDR;
-
-                  if (state == CONTEXT_STATE_KO_MISS_LOAD_AND_BRANCH_WAIT_UPDATE)
-                    {
-// #if (MANAGE_EVENT == MANAGE_EVENT_NO_WAIT)
-//                       reg_STATE                  [i] =  CONTEXT_STATE_KO_MISS_LOAD_AND_BRANCH_ADDR;
-// #else
-                      reg_STATE                  [i] =  CONTEXT_STATE_KO_MISS_LOAD_AND_BRANCH_WAITEND;
-// #endif
-                    }
-                  else
-                    {
-                      Tcontrol_t can_continue = PORT_READ(in_BRANCH_EVENT_CAN_CONTINUE    [i]);
-                      Tcontrol_t dest_val     = PORT_READ(in_BRANCH_EVENT_ADDRESS_DEST_VAL[i]);
-
-                      log_printf(TRACE,Context_State,FUNCTION,"  * dest_val    : %d",dest_val    );
-                      log_printf(TRACE,Context_State,FUNCTION,"  * can_continue: %d",can_continue);
-
-                      if (can_continue)
-                        reg_STATE                [i] =  CONTEXT_STATE_KO_MISS_BRANCH_ADDR;
-                      else
-                        {
-// #if (MANAGE_EVENT == MANAGE_EVENT_NO_WAIT)
-//                           reg_STATE                [i] =  CONTEXT_STATE_KO_MISS_BRANCH_ADDR;
-// #else
-                          reg_STATE                [i] =  CONTEXT_STATE_KO_MISS_BRANCH_WAITEND;
-// #endif
-                        }
-
-                      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
-                      reg_EVENT_ADDRESS_EPCR_VAL [i] = dest_val;
-                    //reg_EVENT_ADDRESS_EEAR     [i] = 0; 
-                      reg_EVENT_ADDRESS_EEAR_VAL [i] = 0;
-                      reg_EVENT_IS_DELAY_SLOT    [i] = 1;
-                      reg_EVENT_IS_DS_TAKE       [i] = dest_val;
-                      reg_EVENT_DEPTH            [i] = depth;
-                      reg_EVENT_FLUSH_ONLY       [i] = can_continue;
-                    }
-                }
-            }
-
-        // -------------------------------------------------------------------
         // -----[ BRANCH_COMPLETE ]----------------------------------------------
         // -------------------------------------------------------------------
@@ -429,136 +571,4 @@
                   reg_EVENT_DEPTH            [context_id] = depth;
                   reg_EVENT_FLUSH_ONLY       [context_id] = false;
-                }
-            }
-        
-        // -------------------------------------------------------------------
-        // -----[ DECOD_EVENT ]-----------------------------------------------
-        // -------------------------------------------------------------------
-
-        for (uint32_t i=0; i<_param->_nb_decod_unit; i++)
-          if (PORT_READ(in_DECOD_EVENT_VAL [i]) and internal_DECOD_EVENT_ACK [i])
-            {
-              log_printf(TRACE,Context_State,FUNCTION,"  * DECOD_EVENT [%d]",i);
-
-              Tcontext_t context    = (_param->_have_port_context_id )?PORT_READ(in_DECOD_EVENT_CONTEXT_ID [i]):0;
-              Tdepth_t   depth      = (_param->_have_port_depth      )?PORT_READ(in_DECOD_EVENT_DEPTH      [i]):0;
-              Tdepth_t   depth_cur  = reg_EVENT_DEPTH [context];
-              Tdepth_t   depth_min = (_param->_have_port_depth      )?PORT_READ(in_DEPTH_MIN [context]):0;
-              Tdepth_t   depth_max  = _param->_nb_inst_branch_speculated [context];
-              
-              Tdepth_t   depth0     = (depth_cur>=depth_min)?(depth_cur-depth_min):((depth_cur+depth_max-depth_min));
-              Tdepth_t   depth1     = (depth    >=depth_min)?(depth    -depth_min):((depth    +depth_max-depth_min));
-//               Tdepth_t   depth0     = (depth_cur>=depth_min)?(depth_cur):((depth_cur+depth_max));
-//               Tdepth_t   depth1     = (depth    >=depth_min)?(depth    ):((depth    +depth_max));
-
-              context_state_t state = reg_STATE [context];
-              Tevent_type_t   type  = PORT_READ(in_DECOD_EVENT_TYPE [i]);
-              
-              // miss_load > miss_branch > excep > spr/sync
-              uint8_t    priority0  = get_priority(state);
-              uint8_t    priority1  = (state == EVENT_TYPE_EXCEPTION)?PRIORITY_EXCEPTION:PRIORITY_NONE;
-
-              // is_valid = can modify local information
-              //  if context_state_ok : yes
-              //  if context_state_ko : test the depth, and the priority of envent
-
-              bool       is_valid   = ((state == CONTEXT_STATE_OK) or
-                                       (depth1< depth0) or
-                                       ((depth1==depth0) and (priority1>=priority0)));
-
-              log_printf(TRACE,Context_State,FUNCTION,"    * depth     : %d",depth     );
-              log_printf(TRACE,Context_State,FUNCTION,"    * depth_cur : %d",depth_cur );
-              log_printf(TRACE,Context_State,FUNCTION,"    * depth_min : %d",depth_min );
-              log_printf(TRACE,Context_State,FUNCTION,"    * depth_max : %d",depth_max );
-              log_printf(TRACE,Context_State,FUNCTION,"    * depth0    : %d",depth0    );
-              log_printf(TRACE,Context_State,FUNCTION,"    * depth1    : %d",depth1    );
-              log_printf(TRACE,Context_State,FUNCTION,"    * priority0 : %d",priority0 );
-              log_printf(TRACE,Context_State,FUNCTION,"    * priority1 : %d",priority1 );
-              log_printf(TRACE,Context_State,FUNCTION,"  * is_valid    : %d",is_valid  );
-
-              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)
-                  context_state_t state_next    = state;
-                  Taddress_t      address       = PORT_READ(in_DECOD_EVENT_ADDRESS       [i]);
-                  Tcontrol_t      is_delay_slot = PORT_READ(in_DECOD_EVENT_IS_DELAY_SLOT [i]);
-
-                  switch (type)
-                    {
-                    case EVENT_TYPE_EXCEPTION          : 
-                      {
-                        log_printf(TRACE,Context_State,FUNCTION,"    * EVENT_TYPE_EXCEPTION");
-
-                        state_next = CONTEXT_STATE_KO_EXCEP; 
-
-                        break;
-                      }
-                    case EVENT_TYPE_SPR_ACCESS         : 
-                      {
-                        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");
-                        break;
-                      }
-                    case EVENT_TYPE_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,"MSYNC in delay slot, not supported.\n");
-                        break;
-                      }
-                    case EVENT_TYPE_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,"PSYNC in delay slot, not supported.\n");
-                        break;
-                      }
-                    case EVENT_TYPE_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,"CSYNC in delay slot, not supported.\n");
-                        break;
-                      }               
-                    case EVENT_TYPE_NONE               :
-                    case EVENT_TYPE_BRANCH_MISS_SPECULATION   :
-                    case EVENT_TYPE_LOAD_MISS_SPECULATION   :
-//                     case EVENT_TYPE_BRANCH_NO_ACCURATE :
-                    default :
-                      {
-                        throw ERRORMORPHEO(FUNCTION,toString(_("DECOD_EVENT [%d] : invalid event_type : %s.\n"),i,toString(type).c_str()));
-                      }
-                    }
-
-                  reg_STATE                  [context] = state_next;
-                  reg_EVENT_ADDRESS          [context] = address;
-                  reg_EVENT_ADDRESS_EPCR     [context] = PORT_READ(in_DECOD_EVENT_ADDRESS_EPCR  [i]); 
-                  reg_EVENT_ADDRESS_EPCR_VAL [context] = 1;
-                //reg_EVENT_ADDRESS_EEAR     [context]
-                  reg_EVENT_ADDRESS_EEAR_VAL [context] = 0;
-                  reg_EVENT_IS_DELAY_SLOT    [context] = is_delay_slot;
-                //reg_EVENT_IS_DS_TAKE       [context] = 0;
-                  reg_EVENT_DEPTH            [context] = depth;
-                  reg_EVENT_FLUSH_ONLY       [context] = false;
                 }
             }
@@ -706,4 +716,7 @@
             }
 
+        // -------------------------------------------------------------------
+        // -----[ INTERRUPT ]-------------------------------------------------
+        // -------------------------------------------------------------------
         for (uint32_t i=0; i<_param->_nb_context; ++i)
           {
