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 109)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Commit_unit/src/Commit_unit_transition.cpp	(revision 110)
@@ -8,4 +8,5 @@
 
 #include "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Commit_unit/include/Commit_unit.h"
+#include "Behavioural/include/Simulation.h"
 
 namespace morpheo                    {
@@ -114,9 +115,4 @@
 		{
 		  log_printf(TRACE,Commit_unit,FUNCTION,"  * INSERT            [%d][%d]",x,y);
-
-#ifdef STATISTICS
-                  if (usage_is_set(_usage,USE_STATISTICS))
-                    (*_stat_nb_inst_insert [x]) ++;
-#endif
 
                   // get information
@@ -219,4 +215,9 @@
                         }
                     }
+
+#ifdef STATISTICS
+                  if (usage_is_set(_usage,USE_STATISTICS))
+                    (*_stat_nb_inst_insert [x]) ++;
+#endif
 
                   // Push in rob
@@ -346,71 +347,96 @@
 	// ===================================================================
 	for (uint32_t i=0; i<_param->_nb_bank; i++)
-	  if (internal_BANK_RETIRE_VAL [i])
-	    {
-	      uint32_t x = internal_BANK_RETIRE_NUM_RENAME_UNIT [i];
-	      uint32_t y = internal_BANK_RETIRE_NUM_INST        [i];
-
-	      log_printf(TRACE,Commit_unit,FUNCTION,"  * RETIRE            [%d][%d]",x,y);
-
+          {
+            uint32_t num_bank = (internal_BANK_RETIRE_HEAD+i)%_param->_nb_bank;
+            
+            if (internal_BANK_RETIRE_VAL [num_bank])
+              {
+                uint32_t x = internal_BANK_RETIRE_NUM_RENAME_UNIT [num_bank];
+                uint32_t y = internal_BANK_RETIRE_NUM_INST        [num_bank];
+                
+                log_printf(TRACE,Commit_unit,FUNCTION,"  * RETIRE            [%d][%d]",x,y);
+                
 #ifdef DEBUG_TEST
-	      if (not PORT_READ(in_RETIRE_ACK [x][y]))
-		throw ERRORMORPHEO(FUNCTION,_("Retire : retire_ack must be set.\n"));
-#endif
-
-	      entry_t *  entry        =  _rob [i].front();
-              rob_state_t state = entry->state;
-              
-#ifdef STATISTICS
-              if (usage_is_set(_usage,USE_STATISTICS))
-                {
-                  if (state == ROB_END_OK)
-                    (*_stat_nb_inst_retire_ok [x]) ++;
-                  else
-                    (*_stat_nb_inst_retire_ko [x]) ++;
-                }
-#endif
-
-	      Tcontext_t front_end_id = entry->front_end_id;
-	      Tcontext_t context_id   = entry->context_id  ;
-	      Ttype_t    type         = entry->type        ;
-
-              if ((state == ROB_END_OK         ) or
-// 		  (state == ROB_END_KO         ) or 
-		  (state == ROB_END_BRANCH_MISS) or 
- 		  (state == ROB_END_LOAD_MISS  )//  or 
-// 		  (state == ROB_END_MISS       ) or 
-// 		  (state == ROB_END_EXCEPTION  )
-		  )
-                {
-//                reg_PC_PREVIOUS           [front_end_id][context_id] = reg_PC_CURRENT [front_end_id][context_id];
-                  reg_PC_CURRENT            [front_end_id][context_id] = reg_PC_NEXT    [front_end_id][context_id];
-                  reg_PC_CURRENT_IS_DS      [front_end_id][context_id] = entry->type == TYPE_BRANCH;
-                  reg_PC_CURRENT_IS_DS_TAKE [front_end_id][context_id] = entry->no_sequence;
-                  reg_PC_NEXT               [front_end_id][context_id] = (entry->no_sequence)?(entry->address_next):(reg_PC_CURRENT [front_end_id][context_id]+1);
+                if (not PORT_READ(in_RETIRE_ACK [x][y]))
+                  throw ERRORMORPHEO(FUNCTION,_("Retire : retire_ack must be set.\n"));
+#endif
+                
+                entry_t *  entry        =  _rob [num_bank].front();
+                rob_state_t state = entry->state;
+                
+                Tcontext_t front_end_id = entry->front_end_id;
+                Tcontext_t context_id   = entry->context_id  ;
+                uint32_t   num_thread   = _param->_translate_num_context_to_num_thread [front_end_id][context_id];
+                Ttype_t    type         = entry->type        ;
+                bool       retire_ok    = false;
+
+                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,"    * num_thread   : %d",num_thread   );
+                log_printf(TRACE,Commit_unit,FUNCTION,"    * type         : %s",toString(type).c_str());
+                log_printf(TRACE,Commit_unit,FUNCTION,"    * state        : %s",toString(state).c_str());
+
+                if ((state == ROB_END_OK         ) or
+// 		    (state == ROB_END_KO         ) or 
+                    (state == ROB_END_BRANCH_MISS) or 
+                    (state == ROB_END_LOAD_MISS  )//  or 
+// 		    (state == ROB_END_MISS       ) or 
+// 		    (state == ROB_END_EXCEPTION  )
+                    )
+                  {
+                    log_printf(TRACE,Commit_unit,FUNCTION,"    * retire_ok");
+
+                    retire_ok = true;
+
+//                  reg_PC_PREVIOUS           [front_end_id][context_id] = reg_PC_CURRENT [front_end_id][context_id];
+                    reg_PC_CURRENT            [front_end_id][context_id] = reg_PC_NEXT    [front_end_id][context_id];
+                    reg_PC_CURRENT_IS_DS      [front_end_id][context_id] = entry->type == TYPE_BRANCH;
+                    reg_PC_CURRENT_IS_DS_TAKE [front_end_id][context_id] = entry->no_sequence;
+                    reg_PC_NEXT               [front_end_id][context_id] = (entry->no_sequence)?(entry->address_next):(reg_PC_CURRENT [front_end_id][context_id]+1);
 
 //                   if (entry->address_next != reg_PC_NEXT [front_end_id][context_id])
 //                     throw ERRORMORPHEO(FUNCTION,toString(_("Retire : Instruction's address_next (%.8x) is different of commit_unit's address_next (%.8x)"),entry->address_next,reg_PC_NEXT [front_end_id][context_id]));
-                }
-
-              if ((state == ROB_END_BRANCH_MISS) or
-                  (state == ROB_END_LOAD_MISS))
-                {
-                  reg_EVENT_STATE [front_end_id][context_id] = EVENT_STATE_EVENT;
-                  reg_EVENT_FLUSH [front_end_id][context_id] = true;
-                }
-	      
-	      // Update nb_inst
-	      reg_NB_INST_COMMIT_ALL [front_end_id][context_id] --;
-	      if (type == TYPE_MEMORY)
-		reg_NB_INST_COMMIT_MEM [front_end_id][context_id] --;
-
-	      reg_NUM_BANK_HEAD = (reg_NUM_BANK_HEAD+1)%_param->_nb_bank;
-	      
-	      _rob [i].pop_front();
-	      delete entry;
-
-              // Transaction on retire interface : reset watch dog timer.
-              _nb_cycle_idle [front_end_id][context_id] = 0;
-	    }
+                  }
+                
+                if ((state == ROB_END_BRANCH_MISS) or
+                    (state == ROB_END_LOAD_MISS))
+                  {
+                    reg_EVENT_STATE [front_end_id][context_id] = EVENT_STATE_EVENT;
+                    reg_EVENT_FLUSH [front_end_id][context_id] = true;
+                  }
+                
+                // Update nb_inst
+                reg_NB_INST_COMMIT_ALL [front_end_id][context_id] --;
+                if (type == TYPE_MEMORY)
+                  reg_NB_INST_COMMIT_MEM [front_end_id][context_id] --;
+                
+                reg_NUM_BANK_HEAD = (reg_NUM_BANK_HEAD+1)%_param->_nb_bank;
+                
+                _rob [num_bank].pop_front();
+                delete entry;
+                
+                // Transaction on retire interface : reset watch dog timer.
+                _nb_cycle_idle [front_end_id][context_id] = 0;
+
+                // Increase stop condition
+                if (retire_ok)
+                  _simulation_nb_instruction_commited [num_thread] ++;
+
+#ifdef STATISTICS
+                if (usage_is_set(_usage,USE_STATISTICS))
+                  {
+                    (*_stat_nb_inst_retire [x]) ++;
+                    
+                    if (retire_ok)
+                      {
+                        (*_stat_nb_inst_retire_ok [num_thread]) ++;
+                        (*_stat_nb_inst_type      [type]      ) ++;
+                      }
+                    else
+                      (*_stat_nb_inst_retire_ko [num_thread]) ++;
+                  }
+#endif
+              }
+          }
 
 	// ===================================================================
@@ -652,5 +678,5 @@
         for (uint32_t j=0; j<_param->_nb_context [i]; j++)
           {
-            log_printf(TRACE,Commit_unit,FUNCTION,"    * [%d][%d]",i,j);
+            log_printf(TRACE,Commit_unit,FUNCTION,"    * [%d][%d] - %d",i,j,_param->_translate_num_context_to_num_thread [i][j]);
             log_printf(TRACE,Commit_unit,FUNCTION,"      * EVENT_STATE  : %s",toString(reg_EVENT_STATE [i][j]).c_str());
             log_printf(TRACE,Commit_unit,FUNCTION,"      * EVENT_FLUSH  : %d",reg_EVENT_FLUSH [i][j]);
@@ -667,11 +693,12 @@
           log_printf(TRACE,Commit_unit,FUNCTION,"      * Bank [%d] size : %d, ptr : %d",num_bank,(int)_rob[num_bank].size(), reg_BANK_PTR [i]);
           
-          uint32_t x=0;
           for (std::list<entry_t*>::iterator it=_rob[num_bank].begin();
                it!=_rob[num_bank].end();
                it++)
             {
-              log_printf(TRACE,Commit_unit,FUNCTION,"        [%.4d] %.4d %.4d %.4d %.4d, %.3d %.3d, %.1d, %.1d %.4d, %.1d %.4d, %s - %d",
-                         x,
+              log_printf(TRACE,Commit_unit,FUNCTION,"        [%.4d][%.4d] (%.4d) %.4d %.4d %.4d %.4d, %.3d %.3d, %.1d, %.1d %.4d, %.1d %.4d, %s",
+                         num_bank                       ,
+                         (*it)->ptr                     ,
+                         ((num_bank << _param->_shift_num_bank) | (*it)->ptr),
                          (*it)->front_end_id            ,
                          (*it)->context_id              ,
@@ -685,7 +712,6 @@
                          (*it)->use_load_queue          ,
                          (*it)->load_queue_ptr_write    ,
-                         toString((*it)->state).c_str() ,
-                         (*it)->ptr                     );
-              log_printf(TRACE,Commit_unit,FUNCTION,"               %.1d %.2d %.6d, %.1d %.2d %.6d, %.1d %.1d %.6d, %.1d %.2d %.6d %.6d, %.1d %.1d %.6d %.6d ",
+                         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 ",
                          (*it)->read_ra                 ,
                          (*it)->num_reg_ra_log          ,
@@ -706,5 +732,5 @@
                          (*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 %.1d - %.8x (%.8x) %.8x (%.8x)",
                          (*it)->exception_use ,
                          (*it)->exception     ,
@@ -717,6 +743,4 @@
                          (*it)->address_next<<2
                          );
-              
-              x++;
             }
         }
@@ -772,6 +796,6 @@
     for (uint32_t i=0; i<_param->_nb_front_end; i++)
       for (uint32_t j=0; j<_param->_nb_context [i]; j++)
-        if (_nb_cycle_idle [i][j] >= debug_cycle_idle)
-          throw ERRORMORPHEO(FUNCTION,toString(_("Context [%d][%d] is idle since %.0f cycles.\n"),i,j,_nb_cycle_idle [i][j]));
+        if (_nb_cycle_idle [i][j] >= debug_idle_cycle)
+          throw ERRORMORPHEO(FUNCTION,toString(_("Thread [%d] is idle since %.0f cycles.\n"),_param->_translate_num_context_to_num_thread[i][j],_nb_cycle_idle [i][j]));
 
     log_end(Commit_unit,FUNCTION);
