Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Commit_unit/src/Commit_unit_transition.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Commit_unit/src/Commit_unit_transition.cpp	(revision 123)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Commit_unit/src/Commit_unit_transition.cpp	(revision 124)
@@ -54,4 +54,5 @@
 //            reg_EVENT_FLUSH           [i][j] = false;
 //            reg_EVENT_STOP            [i][j] = false;
+              reg_EVENT_NB_INST         [i][j] = 0;
               reg_EVENT_LAST            [i][j] = false;
 
@@ -126,4 +127,37 @@
 //                     break;
 //                   }
+
+//                 case COMMIT_EVENT_STATE_WAIT_END : 
+//                   {
+//                     // Wait the flush of Re Order Buffer.
+//                     // Test if the last element is retire
+//                     if (reg_EVENT_LAST [i][j])
+//                       reg_EVENT_STATE [i][j] = COMMIT_EVENT_STATE_END ; 
+                    
+//                     break;
+//                   }
+//                 case COMMIT_EVENT_STATE_END      :
+//                   {
+//                     // Just one cycle
+                    
+//                     // flush of re order buffer is finish
+//                     reg_EVENT_LAST  [i][j] = false;
+
+//                     if (not reg_EVENT_NEXT_STOP [i][j])
+//                       reg_EVENT_STATE [i][j] = COMMIT_EVENT_STATE_NO_EVENT;
+//                     else
+//                       {
+//                         reg_EVENT_NEXT_STOP [i][j] = false;
+//                         reg_EVENT_PACKET [i][j] = reg_EVENT_NEXT_PACKET [i][j];
+//                         reg_EVENT_STATE         [i][j] = COMMIT_EVENT_STATE_NOT_YET_EVENT;
+// //                      reg_EVENT_STOP          [i][j] = true;
+//                         reg_EVENT_LAST_NUM_BANK [i][j] = ((reg_NUM_BANK_TAIL==0)?_param->_nb_bank:reg_NUM_BANK_TAIL)-1;
+//                         reg_EVENT_LAST_NUM_PTR  [i][j] = reg_NUM_PTR_TAIL;
+//                       }
+
+//                     break;
+//                   }
+
+
                 case COMMIT_EVENT_STATE_WAIT_END : 
                   {
@@ -131,29 +165,25 @@
                     // Test if the last element is retire
                     if (reg_EVENT_LAST [i][j])
-                      reg_EVENT_STATE [i][j] = COMMIT_EVENT_STATE_END ; 
-                    
+                      {
+                        // flush of re order buffer is finish
+                        reg_EVENT_LAST  [i][j] = false;
+                        
+                        if (not reg_EVENT_NEXT_STOP [i][j])
+                          reg_EVENT_STATE [i][j] = COMMIT_EVENT_STATE_NO_EVENT;
+                        else
+                          {
+                            reg_EVENT_STATE         [i][j] = COMMIT_EVENT_STATE_NOT_YET_EVENT;
+
+                            reg_EVENT_NEXT_STOP     [i][j] = false;
+                            reg_EVENT_PACKET        [i][j] = reg_EVENT_NEXT_PACKET [i][j];
+                            reg_EVENT_NB_INST       [i][j] = reg_NB_INST_COMMIT_ALL [i][j];
+                          //reg_EVENT_STOP          [i][j] = true;
+                            reg_EVENT_LAST_NUM_BANK [i][j] = ((reg_NUM_BANK_TAIL==0)?_param->_nb_bank:reg_NUM_BANK_TAIL)-1;
+                            reg_EVENT_LAST_NUM_PTR  [i][j] = reg_NUM_PTR_TAIL;
+                          }
+                      }
                     break;
                   }
-                case COMMIT_EVENT_STATE_END      :
-                  {
-                    // Just one cycle
-                    
-                    // flush of re order buffer is finish
-                    reg_EVENT_LAST  [i][j] = false;
-
-                    if (not reg_EVENT_NEXT_STOP [i][j])
-                      reg_EVENT_STATE [i][j] = COMMIT_EVENT_STATE_NO_EVENT;
-                    else
-                      {
-                        reg_EVENT_NEXT_STOP [i][j] = false;
-                        reg_EVENT_PACKET [i][j] = reg_EVENT_NEXT_PACKET [i][j];
-                        reg_EVENT_STATE         [i][j] = COMMIT_EVENT_STATE_NOT_YET_EVENT;
-//                      reg_EVENT_STOP          [i][j] = true;
-                        reg_EVENT_LAST_NUM_BANK [i][j] = ((reg_NUM_BANK_TAIL==0)?_param->_nb_bank:reg_NUM_BANK_TAIL)-1;
-                        reg_EVENT_LAST_NUM_PTR  [i][j] = reg_NUM_PTR_TAIL;
-                      }
-
-                    break;
-                  }
+
                   //case COMMIT_EVENT_STATE_NO_EVENT : 
                   //case COMMIT_EVENT_STATE_NOT_YET_EVENT : 
@@ -166,7 +196,11 @@
 	// ===================================================================
         {
+//           for (uint32_t i=0; i<_param->_nb_rename_unit; i++)
+//             for (uint32_t j=0; j<_param->_nb_inst_insert[i]; j++)
+//               log_printf(TRACE,Commit_unit,FUNCTION,"  * INSERT_VAL        [%d][%d] : %d",i,j,PORT_READ(in_INSERT_VAL [i][j]));
+              
           // variable to count instruction insert
           uint32_t nb_insert = 0;
-
+          
           for (uint32_t i=0; i<_param->_nb_bank; i++)
             {
@@ -241,5 +275,5 @@
 	              entry->num_reg_re_phy_new      = PORT_READ(in_INSERT_NUM_REG_RE_PHY_NEW    [x][y]);
                       entry->no_sequence             = type == TYPE_BRANCH;
-                      entry->speculative             = true;
+//                    entry->speculative             = true;
 #ifdef DEBUG        
 	              entry->address                 = PORT_READ(in_INSERT_ADDRESS               [x][y]);
@@ -371,10 +405,10 @@
 #endif
 
-		    log_printf(TRACE,Commit_unit,FUNCTION,"    * num_bank   : %d",i);
+		    log_printf(TRACE,Commit_unit,FUNCTION,"    * num_bank              : %d",i);
 
 		    // find the good entry !!!
 		    entry_t *       entry        = internal_BANK_COMMIT_ENTRY [i][j];
 
-		    log_printf(TRACE,Commit_unit,FUNCTION,"    * ptr        : %d",entry->ptr);
+		    log_printf(TRACE,Commit_unit,FUNCTION,"    * ptr                   : %d",entry->ptr);
                                                  
 		  //Toperation_t    operation    = PORT_READ(in_COMMIT_OPERATION   [x]);
@@ -437,4 +471,8 @@
                           }
                       }
+
+		    log_printf(TRACE,Commit_unit,FUNCTION,"    * have_exception        : %d",have_exception       ); 
+		    log_printf(TRACE,Commit_unit,FUNCTION,"    * have_miss_speculation : %d",have_miss_speculation);
+
                    
                     // Next state depends of previous state
@@ -509,10 +547,13 @@
                         bool flush = ((reg_EVENT_STATE [front_end_id][context_id] == COMMIT_EVENT_STATE_EVENT) or
 //                                    (reg_EVENT_STATE [front_end_id][context_id] == COMMIT_EVENT_STATE_WAIT_DECOD) or
-                                      (reg_EVENT_STATE [front_end_id][context_id] == COMMIT_EVENT_STATE_WAIT_END) or
-                                      (reg_EVENT_STATE [front_end_id][context_id] == COMMIT_EVENT_STATE_END)
+                                      (reg_EVENT_STATE [front_end_id][context_id] == COMMIT_EVENT_STATE_WAIT_END)//  or
+//                                       (reg_EVENT_STATE [front_end_id][context_id] == COMMIT_EVENT_STATE_END)
                                       );
                         
                         uint32_t packet = ((entry->ptr << _param->_shift_num_slot) | i);
                         uint32_t _top   = ((_rob[ reg_NUM_BANK_HEAD].front()->ptr << _param->_shift_num_slot) | reg_NUM_BANK_HEAD);
+
+                        log_printf(TRACE,Commit_unit,FUNCTION,"    * flush                 : %d",flush); 
+                        log_printf(TRACE,Commit_unit,FUNCTION,"    * packet                : %d",packet);
                             
                         if (not flush)
@@ -539,5 +580,8 @@
                                 // have an error, stop issue instruction
                                 reg_EVENT_STATE         [front_end_id][context_id] = COMMIT_EVENT_STATE_NOT_YET_EVENT;
-                                //                      reg_EVENT_STOP          [front_end_id][context_id] = true;
+
+                                reg_EVENT_NB_INST       [front_end_id][context_id] = reg_NB_INST_COMMIT_ALL [front_end_id][context_id];
+
+                              //reg_EVENT_STOP          [front_end_id][context_id] = true;
                                 
                                 reg_EVENT_LAST_NUM_BANK [front_end_id][context_id] = ((reg_NUM_BANK_TAIL==0)?_param->_nb_bank:reg_NUM_BANK_TAIL)-1;
@@ -549,4 +593,7 @@
                             bool find = true;
 
+                            log_printf(TRACE,Commit_unit,FUNCTION,"    * reg_EVENT_NEXT_STOP   : %d",reg_EVENT_NEXT_STOP  [front_end_id][context_id]); 
+                            log_printf(TRACE,Commit_unit,FUNCTION,"    * reg_EVENT_NEXT_PACKET : %d",reg_EVENT_NEXT_PACKET[front_end_id][context_id]); 
+
                             // already manage an event.
                             if (reg_EVENT_NEXT_STOP [front_end_id][context_id])
@@ -555,8 +602,16 @@
                                 uint32_t _old = reg_EVENT_NEXT_PACKET [front_end_id][context_id];
                                 uint32_t _new = packet;
+
+                                log_printf(TRACE,Commit_unit,FUNCTION,"    * _top                  : %d",_top ); 
+                                log_printf(TRACE,Commit_unit,FUNCTION,"    * _old (before)         : %d",_old ); 
+                                log_printf(TRACE,Commit_unit,FUNCTION,"    * _new (before)         : %d",_new ); 
+
                                 if (_old < _top) _old = _old+_param->_size_queue;
                                 if (_new < _top) _new = _new+_param->_size_queue;
                                 if (_new > _old) reg_EVENT_NEXT_PACKET [front_end_id][context_id] = packet;
-                                find = false;
+                                else find = false;
+
+                                log_printf(TRACE,Commit_unit,FUNCTION,"    * _old (after)          : %d",_old ); 
+                                log_printf(TRACE,Commit_unit,FUNCTION,"    * _new (after)          : %d",_new ); 
                               }
                             else
@@ -565,9 +620,19 @@
                                 uint32_t _old = ((reg_EVENT_LAST_NUM_PTR [front_end_id][context_id] << _param->_shift_num_slot) | reg_EVENT_LAST_NUM_BANK [front_end_id][context_id]);
                                 uint32_t _new = packet;
+
+                                log_printf(TRACE,Commit_unit,FUNCTION,"    * _top                  : %d",_top ); 
+                                log_printf(TRACE,Commit_unit,FUNCTION,"    * _old (before)         : %d",_old ); 
+                                log_printf(TRACE,Commit_unit,FUNCTION,"    * _new (before)         : %d",_new ); 
+
                                 if (_old < _top) _old = _old+_param->_size_queue;
                                 if (_new < _top) _new = _new+_param->_size_queue;
                                 if (_new > _old) reg_EVENT_NEXT_PACKET [front_end_id][context_id] = packet;
-                                find = false;
+                                else find = false;
+
+                                log_printf(TRACE,Commit_unit,FUNCTION,"    * _old (after)          : %d",_old ); 
+                                log_printf(TRACE,Commit_unit,FUNCTION,"    * _new (after)          : %d",_new ); 
                               }
+
+                            log_printf(TRACE,Commit_unit,FUNCTION,"    * find                  : %d",find); 
 
                             if (find)
@@ -710,10 +775,20 @@
                     //   * need event
                     //   * packet id = last packet id
-                    if (((reg_EVENT_STATE         [front_end_id][context_id] != COMMIT_EVENT_STATE_NO_EVENT     ) and
-                         (reg_EVENT_STATE         [front_end_id][context_id] != COMMIT_EVENT_STATE_NOT_YET_EVENT)) and
-                        (reg_EVENT_LAST_NUM_BANK [front_end_id][context_id] == num_bank            ) and
-                        (reg_EVENT_LAST_NUM_PTR  [front_end_id][context_id] == entry->ptr          ))
-                      reg_EVENT_LAST [front_end_id][context_id] = true;
-	            
+//                     for (uint32_t x=0; x<_param->_nb_front_end; x++)
+//                       for (uint32_t y=0; y<_param->_nb_context [x]; y++)
+//                         if (((reg_EVENT_STATE         [x][y] != COMMIT_EVENT_STATE_NO_EVENT     ) and
+//                              (reg_EVENT_STATE         [x][y] != COMMIT_EVENT_STATE_NOT_YET_EVENT)) and
+//                             (reg_EVENT_LAST_NUM_BANK [x][y] == num_bank            ) and
+//                             (reg_EVENT_LAST_NUM_PTR  [x][y] == entry->ptr          ))
+//                           reg_EVENT_LAST [x][y] = true;
+
+
+                    if (reg_EVENT_NB_INST [front_end_id][context_id] > 0)
+                      {
+                        reg_EVENT_NB_INST [front_end_id][context_id] --;
+                        if (reg_EVENT_NB_INST [front_end_id][context_id] == 0)
+                          reg_EVENT_LAST [front_end_id][context_id] = true;
+                      }
+
                     // Update nb_inst
                     reg_NB_INST_COMMIT_ALL [front_end_id][context_id] --;
@@ -853,4 +928,6 @@
                       // In all case, stop instruction flow
                       reg_EVENT_STATE         [entry->front_end_id][entry->context_id] = COMMIT_EVENT_STATE_NOT_YET_EVENT;
+                      reg_EVENT_NB_INST       [entry->front_end_id][entry->context_id] = reg_NB_INST_COMMIT_ALL [entry->front_end_id][entry->context_id];
+                                
 //                    reg_EVENT_STOP          [entry->front_end_id][entry->context_id] = true;
 
@@ -918,8 +995,16 @@
 
         {
-          bool EVENT_LAST [_param->_nb_front_end][_param->_max_nb_context];
+          bool     can_continue   [_param->_nb_front_end][_param->_max_nb_context];
+          uint32_t event_nb_inst  [_param->_nb_front_end][_param->_max_nb_context];
+          bool     is_speculative [_param->_nb_front_end][_param->_max_nb_context];
           for (uint32_t i=0; i<_param->_nb_front_end; i++)
             for (uint32_t j=0; j<_param->_nb_context [i]; j++)
-              EVENT_LAST [i][j] = reg_EVENT_LAST [i][j];
+              {
+                event_nb_inst [i][j] = 0;
+                is_speculative[i][j] = false;
+                can_continue  [i][j] = (((reg_EVENT_NB_INST [i][j] == 0) or
+                                         (    event_nb_inst [i][j] < reg_EVENT_NB_INST [i][j])) and
+                                        not reg_EVENT_LAST [i][j]);
+              }
 
           // Read all instruction of all top bank
@@ -933,10 +1018,18 @@
                   // Scan all instruction in windows and test if instruction is speculative
                   entry_t    * entry        = _rob [num_bank].front();
-                  
+
+                  uint32_t     num_packet   = ((entry->ptr << _param->_shift_num_slot) | num_bank);
                   Tcontext_t   front_end_id = entry->front_end_id;
                   Tcontext_t   context_id   = entry->context_id  ;
+
+                  log_printf(TRACE,Commit_unit,FUNCTION,"  * HEAD              [%d] - %d",num_bank,num_packet);
+                  log_printf(TRACE,Commit_unit,FUNCTION,"    * front_end_id    : %d",front_end_id);
+                  log_printf(TRACE,Commit_unit,FUNCTION,"    * context_id      : %d",context_id);
+                  log_printf(TRACE,Commit_unit,FUNCTION,"    * EVENT_LAST      : %d",reg_EVENT_LAST    [front_end_id][context_id]);
+                  log_printf(TRACE,Commit_unit,FUNCTION,"    * EVENT_NB_INST   : %d",reg_EVENT_NB_INST [front_end_id][context_id]);
+                  log_printf(TRACE,Commit_unit,FUNCTION,"    * event_nb_inst   : %d",    event_nb_inst [front_end_id][context_id]);
                   
                   // scan while last event instruction is not retire
-                  if (EVENT_LAST [front_end_id][context_id] == false)
+                  if (can_continue  [front_end_id][context_id])
                     {
                       // Read information
@@ -965,15 +1058,19 @@
 //                                                  (reg_EVENT_STATE [front_end_id][context_id] == COMMIT_EVENT_STATE_WAIT_DECOD) or
                                                     (reg_EVENT_STATE [front_end_id][context_id] == COMMIT_EVENT_STATE_WAIT_END));
-                      bool         speculative   = entry->speculative and not (depth == depth_min);
-                      Tcontrol_t   is_valid      = ((not speculative or 
-                                                     (speculative and (depth_full or // all is valid
-                                                                       ((depth_min <= depth_max)? // test if depth is overflow
-                                                                        ((depth >= depth_min) and (depth <=depth_max)):
-                                                                        ((depth >= depth_min) or  (depth <=depth_max))))))
-                                                    and not flush); // no event
-                      
+                      bool         speculative   = is_speculative [front_end_id][context_id];
+
+//                       bool         speculative   = entry->speculative and not (depth == depth_min);
+//                       Tcontrol_t   is_valid      = ((not speculative or 
+//                                                      (speculative and (depth_full or // all is valid
+//                                                                        ((depth_min <= depth_max)? // test if depth is overflow
+//                                                                         ((depth >= depth_min) and (depth <=depth_max)):
+//                                                                         ((depth >= depth_min) or  (depth <=depth_max))))))
+//                                                     and not flush); // no event
+
+                      Tcontrol_t   is_valid      = not flush;
+
+
                       //Tcontrol_t   is_valid      = ((depth == depth_min) and not flush);
                       
-                      log_printf(TRACE,Commit_unit,FUNCTION,"  * HEAD              [%d] - %d",num_bank,((entry->ptr << _param->_shift_num_slot) | num_bank));
                       
                       log_printf(TRACE,Commit_unit,FUNCTION,"    * is_valid        : %d ((depth == depth_min) and not flush)",is_valid);
@@ -984,4 +1081,28 @@
                       log_printf(TRACE,Commit_unit,FUNCTION,"    * speculative     : %d",speculative);
                       log_printf(TRACE,Commit_unit,FUNCTION,"    * flush           : %d",flush);
+                      log_printf(TRACE,Commit_unit,FUNCTION,"    * state (before)  : %s",toString(state).c_str());
+
+//                       //------------------------------------------------------
+//                       // Event ?
+//                       //------------------------------------------------------
+
+//                       if ((reg_EVENT_STATE  [front_end_id][context_id] == COMMIT_EVENT_STATE_NOT_YET_EVENT) and
+//                           (reg_EVENT_PACKET [front_end_id][context_id] == num_packet))
+//                         {
+//                           switch (state)
+//                             {
+//                             case ROB_END_BRANCH_MISS_SPECULATIVE : {state = ROB_END_BRANCH_MISS        ; break;}
+//                             case ROB_END_LOAD_MISS_SPECULATIVE   : {state = ROB_END_LOAD_MISS_UPDATE   ; break;}
+//                             case ROB_END_BRANCH_MISS             :
+//                             case ROB_END_LOAD_MISS               : 
+//                             case ROB_END                         :
+//                               {break;}
+//                             default : 
+//                               {
+//                                 throw ERRORMORPHEO(FUNCTION,toString(_("Head [%d] : invalid state (%s)"),num_packet,toString(state).c_str()));
+//                                 break;
+//                               }
+//                             }
+//                         }
                     
                       //------------------------------------------------------
@@ -997,6 +1118,6 @@
                             case ROB_END_BRANCH_MISS             :
                             case ROB_END_BRANCH_MISS_SPECULATIVE : {state = ROB_END_MISS      ; break;}
+                            case ROB_END_LOAD_MISS               :
                             case ROB_END_LOAD_MISS_UPDATE        :
-                            case ROB_END_LOAD_MISS               :
                             case ROB_END_LOAD_MISS_SPECULATIVE   : {state = ROB_END_MISS      ; break;}
                             case ROB_STORE_OK                    : {state = ROB_STORE_KO      ; break;}
@@ -1029,9 +1150,23 @@
                             }
                         }
+
+                      //------------------------------------------------------
+                      // test if instruction is branch not finish
+                      //------------------------------------------------------
+                      switch (state)
+                        {
+                        case ROB_BRANCH_WAIT_END :
+                        case ROB_BRANCH_COMPLETE :
+                          {
+                            is_speculative [front_end_id][context_id] = true;
+                            break;
+                          }
+                        default : break;
+                        }
                       
                       //------------------------------------------------------
                       // test if instruction is not speculative
                       //------------------------------------------------------
-                      entry->speculative = speculative;
+//                       entry->speculative = speculative;
 //                    if (entry->depth == depth_min)
                       // test if instruction is speculative (depth != depth_min)
@@ -1064,15 +1199,19 @@
                       // Write new state
                       entry->state = state;
-                      
-                      // Test if this instruction is the last of event
-                      if (((reg_EVENT_STATE         [front_end_id][context_id] != COMMIT_EVENT_STATE_NO_EVENT) and
-                           (reg_EVENT_STATE         [front_end_id][context_id] != COMMIT_EVENT_STATE_NOT_YET_EVENT)) and
-                          (reg_EVENT_LAST_NUM_BANK [front_end_id][context_id] == num_bank            ) and
-                          (reg_EVENT_LAST_NUM_PTR  [front_end_id][context_id] == entry->ptr          ))
-                        {
-                          log_printf(TRACE,Commit_unit,FUNCTION,"  * Stop Scan !!!");
+
+                      log_printf(TRACE,Commit_unit,FUNCTION,"    * state (after )  : %s",toString(state).c_str());
+                      
+//                    log_printf(TRACE,Commit_unit,FUNCTION,"  * Stop Scan !!!");
                           
-                          EVENT_LAST [front_end_id][context_id] = true;
-                        }
+                      event_nb_inst [front_end_id][context_id] ++;
+
+                      // stop if : 
+                      //  * begin event
+                      //  * end event
+                      if (((reg_EVENT_STATE [front_end_id][context_id] == COMMIT_EVENT_STATE_NOT_YET_EVENT) and
+                           (reg_EVENT_PACKET[front_end_id][context_id] == num_packet)) or
+                          ((reg_EVENT_NB_INST [front_end_id][context_id] > 0) and
+                           (    event_nb_inst [front_end_id][context_id] >= reg_EVENT_NB_INST [front_end_id][context_id])))
+                        can_continue [front_end_id][context_id] = false;
                     }
                 }
@@ -1083,7 +1222,23 @@
 
 #ifdef STATISTICS
-    for (uint32_t i=0; i<_param->_nb_bank; i++)
-      if (usage_is_set(_usage,USE_STATISTICS))
-        *(_stat_bank_nb_inst [i]) += _rob[i].size();
+    if (usage_is_set(_usage,USE_STATISTICS))
+      {
+        for (uint32_t i=0; i<_param->_nb_bank; i++)
+          *(_stat_bank_nb_inst [i]) += _rob[i].size();
+
+	for (uint32_t i=0; i<_param->_nb_front_end; i++)
+	  for (uint32_t j=0; j<_param->_nb_context [i]; j++)
+            {
+              uint32_t num_thread = _param->_translate_num_context_to_num_thread [i][j];
+              
+              switch (reg_EVENT_STATE [i][j])
+                {
+                case COMMIT_EVENT_STATE_NO_EVENT      : (*_stat_nb_cycle_state_no_event      [num_thread])++; break;
+                case COMMIT_EVENT_STATE_NOT_YET_EVENT : (*_stat_nb_cycle_state_not_yet_event [num_thread])++; break;
+                case COMMIT_EVENT_STATE_EVENT         : (*_stat_nb_cycle_state_event         [num_thread])++; break;
+                case COMMIT_EVENT_STATE_WAIT_END      : (*_stat_nb_cycle_state_wait_end      [num_thread])++; break;
+                }
+            }
+      }
 #endif
       }
@@ -1109,13 +1264,8 @@
 //          log_printf(TRACE,Commit_unit,FUNCTION,"      * EVENT             : %d (bank %d, ptr %d)",((reg_EVENT_NUM_PTR [i][j] << _param->_shift_num_slot) | reg_EVENT_NUM_BANK [i][j]), reg_EVENT_NUM_BANK [i][j],reg_EVENT_NUM_PTR [i][j]);
 //          log_printf(TRACE,Commit_unit,FUNCTION,"      * EVENT_CAN_RESTART : %d",reg_EVENT_CAN_RESTART [i][j]);
-            log_printf(TRACE,Commit_unit,FUNCTION,"      * EVENT_PACKET      : %d",reg_EVENT_PACKET[i][j]);
-            log_printf(TRACE,Commit_unit,FUNCTION,"      * EVENT_LAST        : %d",reg_EVENT_LAST [i][j]);
-            log_printf(TRACE,Commit_unit,FUNCTION,"      * EVENT_LAST        : %d (bank %d, ptr %d)",((reg_EVENT_LAST_NUM_PTR [i][j] << _param->_shift_num_slot) | reg_EVENT_LAST_NUM_BANK [i][j]), reg_EVENT_LAST_NUM_BANK [i][j],reg_EVENT_LAST_NUM_PTR [i][j]);
-            log_printf(TRACE,Commit_unit,FUNCTION,"      * EVENT_NEXT_STOP   : %d",reg_EVENT_NEXT_STOP  [i][j]);
-            log_printf(TRACE,Commit_unit,FUNCTION,"      * EVENT_NEXT_PACKET : %d",reg_EVENT_NEXT_PACKET[i][j]);
-            log_printf(TRACE,Commit_unit,FUNCTION,"      * NB_INST_ALL       : %d",reg_NB_INST_COMMIT_ALL[i][j]);
-            log_printf(TRACE,Commit_unit,FUNCTION,"      * NB_INST_MEM       : %d",reg_NB_INST_COMMIT_MEM[i][j]);
-            log_printf(TRACE,Commit_unit,FUNCTION,"      * PC_CURRENT        : %.8x (%.8x) - %d %d",reg_PC_CURRENT [i][j],reg_PC_CURRENT [i][j]<<2, reg_PC_CURRENT_IS_DS [i][j], reg_PC_CURRENT_IS_DS_TAKE [i][j]);
-            log_printf(TRACE,Commit_unit,FUNCTION,"      * PC_NEXT           : %.8x (%.8x)",reg_PC_NEXT [i][j],reg_PC_NEXT [i][j]<<2);
+            log_printf(TRACE,Commit_unit,FUNCTION,"      * EVENT_LAST        : %d - packet %d - ptr %d (bank %d, ptr %d)",reg_EVENT_LAST [i][j],reg_EVENT_PACKET[i][j],((reg_EVENT_LAST_NUM_PTR [i][j] << _param->_shift_num_slot) | reg_EVENT_LAST_NUM_BANK [i][j]), reg_EVENT_LAST_NUM_BANK [i][j],reg_EVENT_LAST_NUM_PTR [i][j]);
+            log_printf(TRACE,Commit_unit,FUNCTION,"      * EVENT_NEXT        : stop : %d - packet : %d",reg_EVENT_NEXT_STOP  [i][j],reg_EVENT_NEXT_PACKET[i][j]);
+            log_printf(TRACE,Commit_unit,FUNCTION,"      * NB_INST_ALL       : all : %d - mem : %d - event : %d",reg_NB_INST_COMMIT_ALL[i][j], reg_NB_INST_COMMIT_MEM[i][j],reg_EVENT_NB_INST[i][j]);
+            log_printf(TRACE,Commit_unit,FUNCTION,"      * PC                : %.8x (%.8x) - %d %d - %.8x (%.8x)",reg_PC_CURRENT [i][j],reg_PC_CURRENT [i][j]<<2, reg_PC_CURRENT_IS_DS [i][j], reg_PC_CURRENT_IS_DS_TAKE [i][j],reg_PC_NEXT [i][j],reg_PC_NEXT [i][j]<<2);
           }
 
@@ -1149,8 +1299,7 @@
                   nb_write_re += ((*it)->write_re)?1:0;
 
-                  log_printf(TRACE,Commit_unit,FUNCTION,"        [%.4d][%.4d] (%.4d) %.4d %.4d %.4d %.4d, %.3d %.3d, %.1d, %.1d %.4d, %.1d %.4d, %s",
+                  log_printf(TRACE,Commit_unit,FUNCTION,"        [%.4d][%.4d] %.4d %.4d %.4d %.4d, %.3d %.3d, %.1d, %.1d %.4d, %.1d %.4d, %s",
                              num_bank                       ,
                              (*it)->ptr                     ,
-                             (((*it)->ptr << _param->_shift_num_slot) | num_bank),
                              (*it)->front_end_id            ,
                              (*it)->context_id              ,
@@ -1165,5 +1314,6 @@
                              (*it)->load_queue_ptr_write    ,
                              toString((*it)->state).c_str() );
-                  log_printf(TRACE,Commit_unit,FUNCTION,"                     %.1d %.2d %.6d, %.1d %.2d %.6d, %.1d %.1d %.6d, %.1d %.2d %.6d %.6d, %.1d %.1d %.6d %.6d ",
+                  log_printf(TRACE,Commit_unit,FUNCTION,"              (%.4d) %.1d %.2d %.6d, %.1d %.2d %.6d, %.1d %.1d %.6d, %.1d %.2d %.6d %.6d, %.1d %.1d %.6d %.6d ",
+                             (((*it)->ptr << _param->_shift_num_slot) | num_bank),
                              (*it)->read_ra                 ,
                              (*it)->num_reg_ra_log          ,
@@ -1184,10 +1334,10 @@
                              (*it)->num_reg_re_phy_new      );
                   
-                  log_printf(TRACE,Commit_unit,FUNCTION,"                     %.2d %.2d %.1d %.1d %.1d - %.8x (%.8x) %.8x (%.8x)",
+                  log_printf(TRACE,Commit_unit,FUNCTION,"                     %.2d %.2d %.1d %.1d - %.8x (%.8x) %.8x (%.8x)",
                              (*it)->exception_use ,
                              (*it)->exception     ,
                              (*it)->flags         ,
                              (*it)->no_sequence   ,
-                             (*it)->speculative   ,
+//                              (*it)->speculative   ,
                              (*it)->address       ,
                              (*it)->address<<2    ,
@@ -1245,4 +1395,21 @@
         }
     }
+    {
+      uint32_t NB_INST [_param->_nb_front_end][_param->_max_nb_context];
+      for (uint32_t i=0; i<_param->_nb_front_end; i++)
+        for (uint32_t j=0; j<_param->_nb_context [i]; j++)
+          NB_INST [i][j] = 0; //reg_EVENT_NB_INST [i][j];
+
+      for (uint32_t i=0; i<_param->_nb_bank; ++i)
+        for (std::list<entry_t*>::iterator it=_rob[i].begin();
+             it!=_rob [i].end();
+             ++it)
+          NB_INST [(*it)->front_end_id][(*it)->context_id] ++;
+
+      for (uint32_t i=0; i<_param->_nb_front_end; i++)
+        for (uint32_t j=0; j<_param->_nb_context [i]; j++)
+          if (NB_INST [i][j] != reg_NB_INST_COMMIT_ALL [i][j])
+            throw ERRORMORPHEO(FUNCTION,toString(_("Context [%d][%d] have not the good nb_inst (%d in rob, %d in register).\n"),i,j,NB_INST[i][j], reg_NB_INST_COMMIT_ALL [i][j]));
+    }
 #endif
 
