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 137)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Commit_unit/src/Commit_unit_transition.cpp	(revision 139)
@@ -54,8 +54,9 @@
 //            reg_EVENT_FLUSH           [i][j] = false;
 //            reg_EVENT_STOP            [i][j] = false;
-              reg_EVENT_NUM_BANK        [i][j] = 0; // not necessary
-              reg_EVENT_NUM_PTR         [i][j] = 0; // not necessary
-            //reg_EVENT_CAN_RESTART     [i][j] = 0; // not necessary
+//            reg_EVENT_NUM_BANK        [i][j] = 0; // not necessary
+//            reg_EVENT_NUM_PTR         [i][j] = 0; // not necessary
+//            reg_EVENT_CAN_RESTART     [i][j] = 0; // not necessary
               reg_EVENT_PACKET          [i][j] = 0; // not necessary
+              reg_EVENT_DEPTH           [i][j] = 0; // not necessary
               reg_EVENT_NB_INST         [i][j] = 0;
               reg_EVENT_LAST            [i][j] = false;
@@ -72,4 +73,14 @@
               reg_PC_NEXT               [i][j] = (0x100+4)>>2;
 	    }
+
+        // Resert RAT_UPDATE_TABLE
+	for (uint32_t i=0; i<_param->_nb_front_end; i++)
+	  for (uint32_t j=0; j<_param->_nb_context[i]; j++)
+	    {
+	      for (uint32_t k=0; k<_param->_nb_general_register_logic; k++)
+                rat_gpr_update_table       [i][j][k] = false; // not necessary
+	      for (uint32_t k=0; k<_param->_nb_special_register_logic; k++)
+                rat_spr_update_table       [i][j][k] = false; // not necessary
+            }
 
         // Reset priority algorithm
@@ -114,4 +125,10 @@
 //                         else
                           reg_EVENT_STATE [i][j] = COMMIT_EVENT_STATE_WAIT_END; 
+                          
+                          // Reset update_table
+                          for (uint32_t k=0; k<_param->_nb_general_register_logic; k++)
+                            rat_gpr_update_table      [i][j][k] = false;
+                          for (uint32_t k=0; k<_param->_nb_special_register_logic; k++)
+                            rat_spr_update_table      [i][j][k] = false;
                       }
                     
@@ -180,8 +197,11 @@
                         else
                           {
+                            uint32_t next_packet = reg_EVENT_NEXT_PACKET [i][j];
+
                             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_PACKET        [i][j] = next_packet;
+//                          reg_EVENT_DEPTH         [i][j] = _rob[next_packet].depth;
                             reg_EVENT_NB_INST       [i][j] = reg_NB_INST_COMMIT_ALL [i][j];
                           //reg_EVENT_STOP          [i][j] = true;
@@ -596,4 +616,5 @@
                                 reg_EVENT_STATE         [front_end_id][context_id] = COMMIT_EVENT_STATE_NOT_YET_EVENT;
 
+//                              reg_EVENT_DEPTH         [front_end_id][context_id] = _rob[packet].depth;
                                 reg_EVENT_NB_INST       [front_end_id][context_id] = reg_NB_INST_COMMIT_ALL [front_end_id][context_id];
 
@@ -697,9 +718,7 @@
 #endif
 
-
 #ifdef STATISTICS
-	    if (usage_is_set(_usage,USE_STATISTICS))
-	      (*_stat_nb_inst_retire [x]) ++;
-                
+                if (usage_is_set(_usage,USE_STATISTICS))
+                  (*_stat_nb_inst_retire [x]) ++;
 #endif
                 
@@ -709,4 +728,14 @@
                 entry->state_old = entry->state;
                 entry->state     = ROB_END;
+
+
+                // Update RAT_UPDATE_TABLE
+                Tcontext_t front_end_id = entry->front_end_id;
+                Tcontext_t context_id   = entry->context_id  ;
+
+                if (entry->write_rd and internal_BANK_RETIRE_RESTORE_RD_PHY_OLD [num_bank])
+                  rat_gpr_update_table [front_end_id][context_id][entry->num_reg_rd_log] = true;
+                if (entry->write_re and internal_BANK_RETIRE_RESTORE_RE_PHY_OLD [num_bank])
+                  rat_spr_update_table [front_end_id][context_id][entry->num_reg_re_log] = true;
               }
           }
@@ -771,9 +800,11 @@
 	              {
                           reg_EVENT_STATE         [front_end_id][context_id] = COMMIT_EVENT_STATE_EVENT;
+                          reg_EVENT_TYPE          [front_end_id][context_id] = rob_state_to_event_type(state);
 //                        reg_EVENT_STOP          [front_end_id][context_id] = false; // instruction flow can continue
                           reg_EVENT_LAST          [front_end_id][context_id] = false;
                           // it the head !
                           reg_EVENT_PACKET        [front_end_id][context_id] = packet_id;
-	            
+                          reg_EVENT_DEPTH         [front_end_id][context_id] = entry->depth;
+
 //                           // If event is an load_miss, many instruction can be inserted. 
 //                           // -> new last instruction
@@ -947,6 +978,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_DEPTH         [entry->front_end_id][entry->context_id] = _rob[packet]._depth;
                       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;
 
@@ -1283,4 +1314,5 @@
 //          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_DEPTH       : %d - type %s",reg_EVENT_DEPTH [i][j],toString(reg_EVENT_TYPE [i][j]).c_str());
             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]);
@@ -1370,4 +1402,25 @@
         }
 
+      log_printf(TRACE,Commit_unit,FUNCTION,"  * Dump RAT Update Table");
+      for (uint32_t i=0; i<_param->_nb_front_end; ++i)
+        for (uint32_t j=0; j<_param->_nb_context[i]; ++j)
+          {
+            {
+              std::string str = "";
+              for (uint32_t k=0; k<_param->_nb_general_register_logic; k++)
+                str+=toString("%.1d ",rat_gpr_update_table[i][j][k]);
+              
+              log_printf(TRACE,Commit_unit,FUNCTION,"    * GPR [%d][%d] %s",i,j,str.c_str());
+            }
+
+            {
+              std::string str = "";
+              for (uint32_t k=0; k<_param->_nb_special_register_logic; k++)
+                str+=toString("%.1d ",rat_spr_update_table[i][j][k]);
+              
+              log_printf(TRACE,Commit_unit,FUNCTION,"    * GPR [%d][%d] %s",i,j,str.c_str());
+            }
+          }
+
       log_printf(TRACE,Commit_unit,FUNCTION,"    * nb_write_rd   : %d",nb_write_rd);
       log_printf(TRACE,Commit_unit,FUNCTION,"    * nb_write_re   : %d",nb_write_re);
