Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Rename_unit/src/Rename_unit_allocation.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Rename_unit/src/Rename_unit_allocation.cpp	(revision 137)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Rename_unit/src/Rename_unit_allocation.cpp	(revision 139)
@@ -74,4 +74,5 @@
       _ALLOC2_SIGNAL_IN ( in_RENAME_IN_LAST_EVENT    ,"last_event"   ,Tcontrol_t        ,1                                   , _param->_nb_front_end, _param->_nb_inst_decod[it1]);
       _ALLOC2_SIGNAL_IN ( in_RENAME_IN_IS_DELAY_SLOT ,"is_delay_slot",Tcontrol_t        ,1                                   , _param->_nb_front_end, _param->_nb_inst_decod[it1]);
+      _ALLOC2_SIGNAL_IN ( in_RENAME_IN_SAVE_RAT      ,"save_rat"     ,Tcontrol_t        ,1                                   , _param->_nb_front_end, _param->_nb_inst_decod[it1]);
 #ifdef DEBUG
       _ALLOC2_SIGNAL_IN ( in_RENAME_IN_ADDRESS       ,"address"      ,Taddress_t        ,_param->_size_instruction_address   , _param->_nb_front_end, _param->_nb_inst_decod[it1]);
@@ -166,10 +167,10 @@
       ALLOC1_SIGNAL_IN ( in_RETIRE_STORE_QUEUE_PTR_WRITE,"store_queue_ptr_write",Tlsq_ptr_t        ,_param->_size_store_queue_ptr       );
       ALLOC1_SIGNAL_IN ( in_RETIRE_LOAD_QUEUE_PTR_WRITE ,"load_queue_ptr_write" ,Tlsq_ptr_t        ,_param->_size_load_queue_ptr        );
-//       ALLOC1_SIGNAL_IN ( in_RETIRE_READ_RA              ,"read_ra"              ,Tcontrol_t        ,1                                   );
-//       ALLOC1_SIGNAL_IN ( in_RETIRE_NUM_REG_RA_PHY       ,"num_reg_ra_phy"       ,Tgeneral_address_t,_param->_size_general_register      );
-//       ALLOC1_SIGNAL_IN ( in_RETIRE_READ_RB              ,"read_rb"              ,Tcontrol_t        ,1                                   );
-//       ALLOC1_SIGNAL_IN ( in_RETIRE_NUM_REG_RB_PHY       ,"num_reg_rb_phy"       ,Tgeneral_address_t,_param->_size_general_register      );
-//       ALLOC1_SIGNAL_IN ( in_RETIRE_READ_RC              ,"read_rc"              ,Tcontrol_t        ,1                                   );
-//       ALLOC1_SIGNAL_IN ( in_RETIRE_NUM_REG_RC_PHY       ,"num_reg_rc_phy"       ,Tspecial_address_t,_param->_size_special_register      );
+//    ALLOC1_SIGNAL_IN ( in_RETIRE_READ_RA              ,"read_ra"              ,Tcontrol_t        ,1                                   );
+//    ALLOC1_SIGNAL_IN ( in_RETIRE_NUM_REG_RA_PHY       ,"num_reg_ra_phy"       ,Tgeneral_address_t,_param->_size_general_register      );
+//    ALLOC1_SIGNAL_IN ( in_RETIRE_READ_RB              ,"read_rb"              ,Tcontrol_t        ,1                                   );
+//    ALLOC1_SIGNAL_IN ( in_RETIRE_NUM_REG_RB_PHY       ,"num_reg_rb_phy"       ,Tgeneral_address_t,_param->_size_general_register      );
+//    ALLOC1_SIGNAL_IN ( in_RETIRE_READ_RC              ,"read_rc"              ,Tcontrol_t        ,1                                   );
+//    ALLOC1_SIGNAL_IN ( in_RETIRE_NUM_REG_RC_PHY       ,"num_reg_rc_phy"       ,Tspecial_address_t,_param->_size_special_register      );
       ALLOC1_SIGNAL_IN ( in_RETIRE_WRITE_RD             ,"write_rd"             ,Tcontrol_t        ,1                                   );
       ALLOC1_SIGNAL_IN ( in_RETIRE_NUM_REG_RD_LOG       ,"num_reg_rd_log"       ,Tgeneral_address_t,_param->_size_general_register_logic);
@@ -180,4 +181,7 @@
       ALLOC1_SIGNAL_IN ( in_RETIRE_NUM_REG_RE_PHY_OLD   ,"num_reg_re_phy_old"   ,Tspecial_address_t,_param->_size_special_register      );
       ALLOC1_SIGNAL_IN ( in_RETIRE_NUM_REG_RE_PHY_NEW   ,"num_reg_re_phy_new"   ,Tspecial_address_t,_param->_size_special_register      );
+      ALLOC1_SIGNAL_IN ( in_RETIRE_RESTORE              ,"restore"              ,Tcontrol_t        ,1                                   );
+      ALLOC1_SIGNAL_IN ( in_RETIRE_RESTORE_RD_PHY_OLD   ,"restore_rd_phy_old"   ,Tcontrol_t        ,1                                   );
+      ALLOC1_SIGNAL_IN ( in_RETIRE_RESTORE_RE_PHY_OLD   ,"restore_re_phy_old"   ,Tcontrol_t        ,1                                   );
 
       ALLOC1_INTERFACE_END(_param->_nb_inst_retire);
@@ -188,9 +192,11 @@
       ALLOC2_INTERFACE_BEGIN("retire_event", IN,NORTH, _("Retire event"), _param->_nb_front_end, _param->_nb_context[it1]);
 
-      _ALLOC2_VALACK_IN ( in_RETIRE_EVENT_VAL           ,VAL,_param->_nb_front_end, _param->_nb_context[it1]);
-      _ALLOC2_VALACK_OUT(out_RETIRE_EVENT_ACK           ,ACK,_param->_nb_front_end, _param->_nb_context[it1]);
-      _ALLOC2_SIGNAL_IN ( in_RETIRE_EVENT_STATE         ,"state"                ,Tevent_state_t    ,_param->_size_event_state, _param->_nb_front_end, _param->_nb_context[it1]);
-//       _ALLOC2_SIGNAL_IN ( in_RETIRE_EVENT_FLUSH         ,"flush"                ,Tcontrol_t        ,1                        , _param->_nb_front_end, _param->_nb_context[it1]);
-      _ALLOC2_SIGNAL_IN ( in_RETIRE_EVENT_STOP          ,"stop"                 ,Tcontrol_t        ,1                        , _param->_nb_front_end, _param->_nb_context[it1]);
+      _ALLOC2_VALACK_IN      ( in_RETIRE_EVENT_VAL           ,VAL,_param->_nb_front_end, _param->_nb_context[it1]);
+      _ALLOC2_VALACK_OUT     (out_RETIRE_EVENT_ACK           ,ACK,_param->_nb_front_end, _param->_nb_context[it1]);
+      _ALLOC2_SIGNAL_IN      ( in_RETIRE_EVENT_STATE         ,"state"                ,Tevent_state_t    ,_param->_size_event_state, _param->_nb_front_end, _param->_nb_context[it1]);
+//    _ALLOC2_SIGNAL_IN      ( in_RETIRE_EVENT_FLUSH         ,"flush"                ,Tcontrol_t        ,1                        , _param->_nb_front_end, _param->_nb_context[it1]);
+      _ALLOC2_SIGNAL_IN      ( in_RETIRE_EVENT_STOP          ,"stop"                 ,Tcontrol_t        ,1                        , _param->_nb_front_end, _param->_nb_context[it1]);
+      _ALLOC2_SIGNAL_IN_COND ( in_RETIRE_EVENT_TYPE          ,"type"                 ,Tevent_type_t     ,_param->_size_event_type , _param->_nb_front_end, _param->_nb_context[it1],_param->_rat_scheme == RAT_DEPTH_SAVE);
+      _ALLOC2_SIGNAL_IN_COND ( in_RETIRE_EVENT_DEPTH         ,"depth"                ,Tdepth_t          ,_param->_size_depth      , _param->_nb_front_end, _param->_nb_context[it1],_param->_rat_scheme == RAT_DEPTH_SAVE);
 
       ALLOC2_INTERFACE_END(_param->_nb_front_end, _param->_nb_context[it1]);
@@ -337,6 +343,8 @@
 		                dest, "in_RENAME_IN_"+toString(i)+"_"+toString(j)+"_CONTEXT_ID"   );
 	    if (_param->_have_port_depth)
+              {
 	    PORT_MAP(_component,src , "in_RENAME_IN_"+toString(i)+"_"+toString(j)+"_DEPTH"        ,
 		                dest, "in_RENAME_IN_"+toString(i)+"_"+toString(j)+"_DEPTH"        );
+              }
 #ifdef STATISTICS
 	    PORT_MAP(_component,src , "in_RENAME_IN_"+toString(i)+"_"+toString(j)+"_INSTRUCTION"  ,
@@ -355,4 +363,6 @@
 	    PORT_MAP(_component,src , "in_RENAME_IN_"+toString(i)+"_"+toString(j)+"_IS_DELAY_SLOT",
 		                dest, "in_RENAME_IN_"+toString(i)+"_"+toString(j)+"_IS_DELAY_SLOT");
+	    PORT_MAP(_component,src , "in_RENAME_IN_"+toString(i)+"_"+toString(j)+"_SAVE_RAT"     ,
+		                dest, "in_RENAME_IN_"+toString(i)+"_"+toString(j)+"_SAVE_RAT"     );
 #ifdef DEBUG
 	    PORT_MAP(_component,src , "in_RENAME_IN_"+toString(i)+"_"+toString(j)+"_ADDRESS"      ,
@@ -400,9 +410,10 @@
 #endif
 
+          if (_param->_have_port_depth and (_param->_rat_scheme != RAT_DEPTH_SAVE))
+	  PORT_MAP(_component,src ,"out_RENAME_OUT_"+toString(i)+"_DEPTH",
+		              dest,"out_INSERT_"    +toString(i)+"_DEPTH");
 	  PORT_MAP(_component,src ,"out_RENAME_OUT_"+toString(i)+"_IS_DELAY_SLOT",
 		              dest,"out_INSERT_"    +toString(i)+"_IS_DELAY_SLOT");
-	  if (_param->_have_port_depth)
-	  PORT_MAP(_component,src ,"out_RENAME_OUT_"+toString(i)+"_DEPTH"       ,
-		              dest,"out_INSERT_"    +toString(i)+"_DEPTH"       );
+
 #ifdef STATISTICS
 	  PORT_MAP(_component,src ,"out_RENAME_OUT_"+toString(i)+"_INSTRUCTION" ,
@@ -429,4 +440,6 @@
 #endif
 
+	  COMPONENT_MAP(_component,src ,"out_RENAME_OUT_"+toString(i)+"_SAVE_RAT"  ,
+		                   dest, "in_RENAME_"    +toString(i)+"_SAVE_RAT"  );
 	  COMPONENT_MAP(_component,src ,"out_RENAME_OUT_"+toString(i)+"_READ_RA"   ,
 		                   dest, "in_RENAME_"    +toString(i)+"_READ_RA"   );
@@ -467,4 +480,7 @@
 	  COMPONENT_MAP(_component,src ,"out_RENAME_OUT_"+toString(i)+              "_CONTEXT_ID"   ,
 			           dest, "in_INSERT_"    +toString(i)+"_RENAME_SELECT_CONTEXT_ID"   );
+          if (_param->_have_port_depth and (_param->_rat_scheme == RAT_DEPTH_SAVE))
+	  COMPONENT_MAP(_component,src ,"out_RENAME_OUT_"+toString(i)+              "_DEPTH"        ,
+		                   dest, "in_INSERT_"    +toString(i)+"_RENAME_SELECT_DEPTH"        );
 	  COMPONENT_MAP(_component,src ,"out_RENAME_OUT_"+toString(i)+              "_TYPE"         ,
 			           dest, "in_INSERT_"    +toString(i)+"_RENAME_SELECT_TYPE"         );
@@ -540,5 +556,9 @@
 	  COMPONENT_MAP(_component,src , "in_RENAME_"+toString(i)+                     "_CONTEXT_ID"  ,
 			           dest,"out_INSERT_"+toString(i)+"_REGISTER_TRANSLATION_CONTEXT_ID"  );
-
+          if (_param->_have_port_depth and (_param->_rat_scheme == RAT_DEPTH_SAVE))
+	  COMPONENT_MAP(_component,src , "in_RENAME_"+toString(i)+                     "_DEPTH"        ,
+			           dest,"out_INSERT_"+toString(i)+"_REGISTER_TRANSLATION_DEPTH"        );
+
+	  //  in_RENAME_SAVE_RAS          - rename_select
 	  //  in_RENAME_READ_RA           - rename_select
 	  //  in_RENAME_NUM_REG_RA_LOG    - rename_select
@@ -662,4 +682,10 @@
 	  PORT_MAP(_component,src , "in_RETIRE_"+toString(i)+"_NUM_REG_RE_PHY_NEW",
 		              dest, "in_RETIRE_"+toString(i)+"_NUM_REG_RE_PHY_NEW");
+          PORT_MAP(_component,src , "in_RETIRE_"+toString(i)+"_RESTORE"           ,
+                              dest, "in_RETIRE_"+toString(i)+"_RESTORE"           );
+          PORT_MAP(_component,src , "in_RETIRE_"+toString(i)+"_RESTORE_RD_PHY_OLD",
+                              dest, "in_RETIRE_"+toString(i)+"_RESTORE_RD_PHY_OLD");
+          PORT_MAP(_component,src , "in_RETIRE_"+toString(i)+"_RESTORE_RE_PHY_OLD",
+                              dest, "in_RETIRE_"+toString(i)+"_RESTORE_RE_PHY_OLD");
 
 	  dest = _name+"_glue";
@@ -696,4 +722,13 @@
 	    PORT_MAP(_component,src , "in_RETIRE_EVENT_"+toString(i)+"_"+toString(j)+"_STATE",
                                 dest, "in_RETIRE_EVENT_"+toString(i)+"_"+toString(j)+"_STATE");
+            if (_param->_rat_scheme == RAT_DEPTH_SAVE)
+              {
+	    PORT_MAP(_component,src , "in_RETIRE_EVENT_"+toString(i)+"_"+toString(j)+"_TYPE" ,
+                                dest, "in_RETIRE_EVENT_"+toString(i)+"_"+toString(j)+"_TYPE" );
+            if (_param->_have_port_depth)
+	    PORT_MAP(_component,src , "in_RETIRE_EVENT_"+toString(i)+"_"+toString(j)+"_DEPTH",
+                                dest, "in_RETIRE_EVENT_"+toString(i)+"_"+toString(j)+"_DEPTH");
+              }
+
           }
 
@@ -871,4 +906,7 @@
 	  PORT_MAP(_component,src ,"out_INSERT_"+toString(i)+"_CONTEXT_ID"   ,
 		              dest,"out_INSERT_"+toString(i)+"_CONTEXT_ID"   );
+          if (_param->_have_port_depth and (_param->_rat_scheme == RAT_DEPTH_SAVE))
+	  PORT_MAP(_component,src ,"out_INSERT_"+toString(i)+"_DEPTH"        ,
+		              dest,"out_INSERT_"+toString(i)+"_DEPTH"        );
 	  PORT_MAP(_component,src ,"out_INSERT_"+toString(i)+"_TYPE"         ,
 		              dest,"out_INSERT_"+toString(i)+"_TYPE"         );
