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 139)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Rename_unit/src/Rename_unit_allocation.cpp	(revision 145)
@@ -15,6 +15,4 @@
 namespace ooo_engine {
 namespace rename_unit {
-
-
 
 #undef  FUNCTION
@@ -101,52 +99,53 @@
       ALLOC1_INTERFACE_BEGIN("insert",OUT,WEST , _("Instruction with physical register"), _param->_nb_inst_insert);
       
-      ALLOC1_VALACK_OUT(out_INSERT_VAL                  ,VAL);
-      ALLOC1_VALACK_IN ( in_INSERT_ACK                  ,ACK);
-      ALLOC1_SIGNAL_OUT(out_INSERT_FRONT_END_ID         ,"front_end_id"         ,Tcontext_t        ,_param->_size_front_end_id          );
-      ALLOC1_SIGNAL_OUT(out_INSERT_CONTEXT_ID           ,"context_id"           ,Tcontext_t        ,_param->_size_context_id            );
-      ALLOC1_SIGNAL_OUT(out_INSERT_DEPTH                ,"depth"                ,Tdepth_t          ,_param->_size_depth                 );
-#ifdef STATISTICS
-      ALLOC1_SIGNAL_OUT(out_INSERT_INSTRUCTION          ,"instruction"          ,uint32_t          ,32);
-#endif
-      ALLOC1_SIGNAL_OUT(out_INSERT_TYPE                 ,"type"                 ,Ttype_t           ,_param->_size_type                  );
-      ALLOC1_SIGNAL_OUT(out_INSERT_OPERATION            ,"operation"            ,Toperation_t      ,_param->_size_operation             );
-      ALLOC1_SIGNAL_OUT(out_INSERT_NO_EXECUTE           ,"no_execute"           ,Tcontrol_t        ,1                                   );
-      ALLOC1_SIGNAL_OUT(out_INSERT_LAST_EVENT           ,"last_event"           ,Tcontrol_t        ,1                                   );
-      ALLOC1_SIGNAL_OUT(out_INSERT_IS_DELAY_SLOT        ,"is_delay_slot"        ,Tcontrol_t        ,1                                   );
+      ALLOC1_VALACK_OUT     (out_INSERT_VAL                  ,VAL);
+      ALLOC1_VALACK_IN      ( in_INSERT_ACK                  ,ACK);
+      ALLOC1_SIGNAL_OUT     (out_INSERT_FRONT_END_ID         ,"front_end_id"         ,Tcontext_t        ,_param->_size_front_end_id          );
+      ALLOC1_SIGNAL_OUT     (out_INSERT_CONTEXT_ID           ,"context_id"           ,Tcontext_t        ,_param->_size_context_id            );
+      ALLOC1_SIGNAL_OUT     (out_INSERT_DEPTH                ,"depth"                ,Tdepth_t          ,_param->_size_depth                 );
+#ifdef STATISTICS           
+      ALLOC1_SIGNAL_OUT     (out_INSERT_INSTRUCTION          ,"instruction"          ,uint32_t          ,32);
+#endif                      
+      ALLOC1_SIGNAL_OUT     (out_INSERT_TYPE                 ,"type"                 ,Ttype_t           ,_param->_size_type                  );
+      ALLOC1_SIGNAL_OUT     (out_INSERT_OPERATION            ,"operation"            ,Toperation_t      ,_param->_size_operation             );
+      ALLOC1_SIGNAL_OUT     (out_INSERT_NO_EXECUTE           ,"no_execute"           ,Tcontrol_t        ,1                                   );
+      ALLOC1_SIGNAL_OUT     (out_INSERT_LAST_EVENT           ,"last_event"           ,Tcontrol_t        ,1                                   );
+      ALLOC1_SIGNAL_OUT     (out_INSERT_IS_DELAY_SLOT        ,"is_delay_slot"        ,Tcontrol_t        ,1                                   );
+      ALLOC1_SIGNAL_OUT_COND(out_INSERT_SAVE_RAT             ,"save_rat"             ,Tcontrol_t        ,1                                   ,_param->_rat_scheme == RAT_DEPTH_SAVE);
 #ifdef DEBUG
-      ALLOC1_SIGNAL_OUT(out_INSERT_ADDRESS              ,"address"              ,Taddress_t        ,_param->_size_instruction_address   );
-#endif
-      ALLOC1_SIGNAL_OUT(out_INSERT_ADDRESS_NEXT         ,"address_next"         ,Taddress_t        ,_param->_size_instruction_address   );
-      ALLOC1_SIGNAL_OUT(out_INSERT_HAS_IMMEDIAT         ,"has_immediat"         ,Tcontrol_t        ,1                                   );
-      ALLOC1_SIGNAL_OUT(out_INSERT_IMMEDIAT             ,"immediat"             ,Tgeneral_data_t   ,_param->_size_general_data          );
-      ALLOC1_SIGNAL_OUT(out_INSERT_STORE_QUEUE_PTR_WRITE,"store_queue_ptr_write",Tlsq_ptr_t        ,_param->_size_store_queue_ptr       );
-      ALLOC1_SIGNAL_OUT(out_INSERT_STORE_QUEUE_PTR_READ ,"store_queue_ptr_read" ,Tlsq_ptr_t        ,_param->_size_store_queue_ptr       );
-      ALLOC1_SIGNAL_OUT(out_INSERT_STORE_QUEUE_EMPTY    ,"store_queue_empty"    ,Tcontrol_t        ,1                                   );
-      ALLOC1_SIGNAL_OUT(out_INSERT_LOAD_QUEUE_PTR_WRITE ,"load_queue_ptr_write" ,Tlsq_ptr_t        ,_param->_size_load_queue_ptr        );
-      ALLOC1_SIGNAL_OUT(out_INSERT_EXCEPTION_USE        ,"exception_use"        ,Texception_t      ,_param->_size_exception_use         );
-      ALLOC1_SIGNAL_OUT(out_INSERT_EXCEPTION            ,"exception"            ,Texception_t      ,_param->_size_exception             );
-      ALLOC1_SIGNAL_OUT(out_INSERT_READ_RA              ,"read_ra"              ,Tcontrol_t        ,1                                   );
-#ifdef DEBUG
-      ALLOC1_SIGNAL_OUT(out_INSERT_NUM_REG_RA_LOG       ,"num_reg_ra_log"       ,Tgeneral_address_t,_param->_size_general_register_logic);
-#endif
-      ALLOC1_SIGNAL_OUT(out_INSERT_NUM_REG_RA_PHY       ,"num_reg_ra_phy"       ,Tgeneral_address_t,_param->_size_general_register      );
-      ALLOC1_SIGNAL_OUT(out_INSERT_READ_RB              ,"read_rb"              ,Tcontrol_t        ,1                                   );
-#ifdef DEBUG
-      ALLOC1_SIGNAL_OUT(out_INSERT_NUM_REG_RB_LOG       ,"num_reg_rb_log"       ,Tgeneral_address_t,_param->_size_general_register_logic);
-#endif
-      ALLOC1_SIGNAL_OUT(out_INSERT_NUM_REG_RB_PHY       ,"num_reg_rb_phy"       ,Tgeneral_address_t,_param->_size_general_register      );
-      ALLOC1_SIGNAL_OUT(out_INSERT_READ_RC              ,"read_rc"              ,Tcontrol_t        ,1                                   );
-#ifdef DEBUG
-      ALLOC1_SIGNAL_OUT(out_INSERT_NUM_REG_RC_LOG       ,"num_reg_rc_log"       ,Tspecial_address_t,_param->_size_special_register_logic);
-#endif
-      ALLOC1_SIGNAL_OUT(out_INSERT_NUM_REG_RC_PHY       ,"num_reg_rc_phy"       ,Tspecial_address_t,_param->_size_special_register      );
-      ALLOC1_SIGNAL_OUT(out_INSERT_WRITE_RD             ,"write_rd"             ,Tcontrol_t        ,1                                   );
-      ALLOC1_SIGNAL_OUT(out_INSERT_NUM_REG_RD_LOG       ,"num_reg_rd_log"       ,Tgeneral_address_t,_param->_size_general_register_logic);
-      ALLOC1_SIGNAL_OUT(out_INSERT_NUM_REG_RD_PHY_OLD   ,"num_reg_rd_phy_old"   ,Tgeneral_address_t,_param->_size_general_register      );
-      ALLOC1_SIGNAL_OUT(out_INSERT_NUM_REG_RD_PHY_NEW   ,"num_reg_rd_phy_new"   ,Tgeneral_address_t,_param->_size_general_register      );
-      ALLOC1_SIGNAL_OUT(out_INSERT_WRITE_RE             ,"write_re"             ,Tcontrol_t        ,1                                   );
-      ALLOC1_SIGNAL_OUT(out_INSERT_NUM_REG_RE_LOG       ,"num_reg_re_log"       ,Tspecial_address_t,_param->_size_special_register_logic);
-      ALLOC1_SIGNAL_OUT(out_INSERT_NUM_REG_RE_PHY_OLD   ,"num_reg_re_phy_old"   ,Tspecial_address_t,_param->_size_special_register      );
-      ALLOC1_SIGNAL_OUT(out_INSERT_NUM_REG_RE_PHY_NEW   ,"num_reg_re_phy_new"   ,Tspecial_address_t,_param->_size_special_register      );
+      ALLOC1_SIGNAL_OUT     (out_INSERT_ADDRESS              ,"address"              ,Taddress_t        ,_param->_size_instruction_address   );
+#endif                      
+      ALLOC1_SIGNAL_OUT     (out_INSERT_ADDRESS_NEXT         ,"address_next"         ,Taddress_t        ,_param->_size_instruction_address   );
+      ALLOC1_SIGNAL_OUT     (out_INSERT_HAS_IMMEDIAT         ,"has_immediat"         ,Tcontrol_t        ,1                                   );
+      ALLOC1_SIGNAL_OUT     (out_INSERT_IMMEDIAT             ,"immediat"             ,Tgeneral_data_t   ,_param->_size_general_data          );
+      ALLOC1_SIGNAL_OUT     (out_INSERT_STORE_QUEUE_PTR_WRITE,"store_queue_ptr_write",Tlsq_ptr_t        ,_param->_size_store_queue_ptr       );
+      ALLOC1_SIGNAL_OUT     (out_INSERT_STORE_QUEUE_PTR_READ ,"store_queue_ptr_read" ,Tlsq_ptr_t        ,_param->_size_store_queue_ptr       );
+      ALLOC1_SIGNAL_OUT     (out_INSERT_STORE_QUEUE_EMPTY    ,"store_queue_empty"    ,Tcontrol_t        ,1                                   );
+      ALLOC1_SIGNAL_OUT     (out_INSERT_LOAD_QUEUE_PTR_WRITE ,"load_queue_ptr_write" ,Tlsq_ptr_t        ,_param->_size_load_queue_ptr        );
+      ALLOC1_SIGNAL_OUT     (out_INSERT_EXCEPTION_USE        ,"exception_use"        ,Texception_t      ,_param->_size_exception_use         );
+      ALLOC1_SIGNAL_OUT     (out_INSERT_EXCEPTION            ,"exception"            ,Texception_t      ,_param->_size_exception             );
+      ALLOC1_SIGNAL_OUT     (out_INSERT_READ_RA              ,"read_ra"              ,Tcontrol_t        ,1                                   );
+#ifdef DEBUG                
+      ALLOC1_SIGNAL_OUT     (out_INSERT_NUM_REG_RA_LOG       ,"num_reg_ra_log"       ,Tgeneral_address_t,_param->_size_general_register_logic);
+#endif                      
+      ALLOC1_SIGNAL_OUT     (out_INSERT_NUM_REG_RA_PHY       ,"num_reg_ra_phy"       ,Tgeneral_address_t,_param->_size_general_register      );
+      ALLOC1_SIGNAL_OUT     (out_INSERT_READ_RB              ,"read_rb"              ,Tcontrol_t        ,1                                   );
+#ifdef DEBUG                
+      ALLOC1_SIGNAL_OUT     (out_INSERT_NUM_REG_RB_LOG       ,"num_reg_rb_log"       ,Tgeneral_address_t,_param->_size_general_register_logic);
+#endif                      
+      ALLOC1_SIGNAL_OUT     (out_INSERT_NUM_REG_RB_PHY       ,"num_reg_rb_phy"       ,Tgeneral_address_t,_param->_size_general_register      );
+      ALLOC1_SIGNAL_OUT     (out_INSERT_READ_RC              ,"read_rc"              ,Tcontrol_t        ,1                                   );
+#ifdef DEBUG                
+      ALLOC1_SIGNAL_OUT     (out_INSERT_NUM_REG_RC_LOG       ,"num_reg_rc_log"       ,Tspecial_address_t,_param->_size_special_register_logic);
+#endif                      
+      ALLOC1_SIGNAL_OUT     (out_INSERT_NUM_REG_RC_PHY       ,"num_reg_rc_phy"       ,Tspecial_address_t,_param->_size_special_register      );
+      ALLOC1_SIGNAL_OUT     (out_INSERT_WRITE_RD             ,"write_rd"             ,Tcontrol_t        ,1                                   );
+      ALLOC1_SIGNAL_OUT     (out_INSERT_NUM_REG_RD_LOG       ,"num_reg_rd_log"       ,Tgeneral_address_t,_param->_size_general_register_logic);
+      ALLOC1_SIGNAL_OUT     (out_INSERT_NUM_REG_RD_PHY_OLD   ,"num_reg_rd_phy_old"   ,Tgeneral_address_t,_param->_size_general_register      );
+      ALLOC1_SIGNAL_OUT     (out_INSERT_NUM_REG_RD_PHY_NEW   ,"num_reg_rd_phy_new"   ,Tgeneral_address_t,_param->_size_general_register      );
+      ALLOC1_SIGNAL_OUT     (out_INSERT_WRITE_RE             ,"write_re"             ,Tcontrol_t        ,1                                   );
+      ALLOC1_SIGNAL_OUT     (out_INSERT_NUM_REG_RE_LOG       ,"num_reg_re_log"       ,Tspecial_address_t,_param->_size_special_register_logic);
+      ALLOC1_SIGNAL_OUT     (out_INSERT_NUM_REG_RE_PHY_OLD   ,"num_reg_re_phy_old"   ,Tspecial_address_t,_param->_size_special_register      );
+      ALLOC1_SIGNAL_OUT     (out_INSERT_NUM_REG_RE_PHY_NEW   ,"num_reg_re_phy_new"   ,Tspecial_address_t,_param->_size_special_register      );
 
       ALLOC1_INTERFACE_END(_param->_nb_inst_insert);
@@ -210,4 +209,15 @@
 
       ALLOC2_INTERFACE_END(_param->_nb_front_end, _param->_nb_context[it1]);
+    }
+
+    // ~~~~~[ Interface : "depth" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+    {
+      ALLOC2_INTERFACE_BEGIN("depth",IN,WEST,_("Interface with Prediction unit."),_param->_nb_front_end, _param->_nb_context[it1]);
+
+      _ALLOC2_SIGNAL_IN ( in_DEPTH_MIN                        ,"MIN"                        ,Tdepth_t         ,_param->_size_depth                  ,_param->_nb_front_end, _param->_nb_context[it1]);
+      _ALLOC2_SIGNAL_IN ( in_DEPTH_MAX                        ,"MAX"                        ,Tdepth_t         ,_param->_size_depth                  ,_param->_nb_front_end, _param->_nb_context[it1]); 
+      _ALLOC2_SIGNAL_IN ( in_DEPTH_FULL                       ,"FULL"                       ,Tcontrol_t       ,1                                    ,_param->_nb_front_end, _param->_nb_context[it1]); 
+
+      ALLOC2_INTERFACE_END(_param->_nb_front_end,_param->_nb_context[it1]);
     }
 
@@ -440,4 +450,5 @@
 #endif
 
+          if (_param->_rat_scheme != RAT_DEPTH_SAVE)
 	  COMPONENT_MAP(_component,src ,"out_RENAME_OUT_"+toString(i)+"_SAVE_RAT"  ,
 		                   dest, "in_RENAME_"    +toString(i)+"_SAVE_RAT"  );
@@ -483,4 +494,7 @@
 	  COMPONENT_MAP(_component,src ,"out_RENAME_OUT_"+toString(i)+              "_DEPTH"        ,
 		                   dest, "in_INSERT_"    +toString(i)+"_RENAME_SELECT_DEPTH"        );
+          if (_param->_rat_scheme == RAT_DEPTH_SAVE)
+	  COMPONENT_MAP(_component,src ,"out_RENAME_OUT_"+toString(i)+              "_SAVE_RAT"     ,
+		                   dest, "in_INSERT_"    +toString(i)+"_RENAME_SELECT_SAVE_RAT"     );
 	  COMPONENT_MAP(_component,src ,"out_RENAME_OUT_"+toString(i)+              "_TYPE"         ,
 			           dest, "in_INSERT_"    +toString(i)+"_RENAME_SELECT_TYPE"         );
@@ -559,4 +573,7 @@
 	  COMPONENT_MAP(_component,src , "in_RENAME_"+toString(i)+                     "_DEPTH"        ,
 			           dest,"out_INSERT_"+toString(i)+"_REGISTER_TRANSLATION_DEPTH"        );
+          if (_param->_rat_scheme == RAT_DEPTH_SAVE)
+	  COMPONENT_MAP(_component,src , "in_RENAME_"+toString(i)+                     "_SAVE_RAT"     ,
+			           dest,"out_INSERT_"+toString(i)+"_REGISTER_TRANSLATION_SAVE_RAT"     );
 
 	  //  in_RENAME_SAVE_RAS          - rename_select
@@ -733,4 +750,23 @@
           }
 
+      for (uint32_t i=0; i<_param->_nb_front_end; i++)
+        for (uint32_t j=0; j<_param->_nb_context[i]; j++)
+          {
+            dest = _name;
+            
+#ifdef POSITION
+            _component->interface_map (src ,"depth_"+toString(i)+"_"+toString(j),
+                                       dest,"depth_"+toString(i)+"_"+toString(j));
+#endif     
+            if (_param->_have_port_depth)
+              {
+	    PORT_MAP(_component,src , "in_DEPTH_"+toString(i)+"_"+toString(j)+"_MIN" ,
+                                dest, "in_DEPTH_"+toString(i)+"_"+toString(j)+"_MIN" );
+	    PORT_MAP(_component,src , "in_DEPTH_"+toString(i)+"_"+toString(j)+"_MAX" ,
+                                dest, "in_DEPTH_"+toString(i)+"_"+toString(j)+"_MAX" );
+              }
+	    PORT_MAP(_component,src , "in_DEPTH_"+toString(i)+"_"+toString(j)+"_FULL",
+                                dest, "in_DEPTH_"+toString(i)+"_"+toString(j)+"_FULL");
+          }
 
 #ifdef DEBUG_TEST
@@ -909,4 +945,7 @@
 	  PORT_MAP(_component,src ,"out_INSERT_"+toString(i)+"_DEPTH"        ,
 		              dest,"out_INSERT_"+toString(i)+"_DEPTH"        );
+          if (_param->_rat_scheme == RAT_DEPTH_SAVE)
+	  PORT_MAP(_component,src ,"out_INSERT_"+toString(i)+"_SAVE_RAT"     ,
+		              dest,"out_INSERT_"+toString(i)+"_SAVE_RAT"     );
 	  PORT_MAP(_component,src ,"out_INSERT_"+toString(i)+"_TYPE"         ,
 		              dest,"out_INSERT_"+toString(i)+"_TYPE"         );
