/*
 * $Id: Stat_List_unit_deallocation.cpp 123 2009-06-08 20:43:30Z rosiere $
 *
 * [ Description ]
 * 
 */

#include "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Rename_unit/Register_translation_unit/Stat_List_unit/include/Stat_List_unit.h"
#include "Behavioural/include/Allocation.h"

namespace morpheo                    {
namespace behavioural {
namespace core {
namespace multi_ooo_engine {
namespace ooo_engine {
namespace rename_unit {
namespace register_translation_unit {
namespace stat_list_unit {


#undef  FUNCTION
#define FUNCTION "Stat_List_unit::deallocation"
  void Stat_List_unit::deallocation (void)
  {
    log_printf(FUNC,Stat_List_unit,FUNCTION,"Begin");

    if (usage_is_set(_usage,USE_SYSTEMC))
      {
	delete     in_CLOCK ;
	delete     in_NRESET;

        DELETE1_SIGNAL( in_INSERT_VAL               ,_param->_nb_inst_insert,1);
        DELETE1_SIGNAL(out_INSERT_ACK               ,_param->_nb_inst_insert,1);
        DELETE1_SIGNAL( in_INSERT_READ_RA           ,_param->_nb_inst_insert,1                             );
        DELETE1_SIGNAL( in_INSERT_NUM_REG_RA_PHY    ,_param->_nb_inst_insert,_param->_size_general_register);
        DELETE1_SIGNAL( in_INSERT_READ_RB           ,_param->_nb_inst_insert,1                             );
        DELETE1_SIGNAL( in_INSERT_NUM_REG_RB_PHY    ,_param->_nb_inst_insert,_param->_size_general_register);
        DELETE1_SIGNAL( in_INSERT_READ_RC           ,_param->_nb_inst_insert,1                             );
        DELETE1_SIGNAL( in_INSERT_NUM_REG_RC_PHY    ,_param->_nb_inst_insert,_param->_size_special_register);
        DELETE1_SIGNAL( in_INSERT_WRITE_RD          ,_param->_nb_inst_insert,1                             );
        DELETE1_SIGNAL( in_INSERT_NUM_REG_RD_PHY_OLD,_param->_nb_inst_insert,_param->_size_general_register);
        DELETE1_SIGNAL( in_INSERT_NUM_REG_RD_PHY_NEW,_param->_nb_inst_insert,_param->_size_general_register);
        DELETE1_SIGNAL( in_INSERT_WRITE_RE          ,_param->_nb_inst_insert,1                             );
        DELETE1_SIGNAL( in_INSERT_NUM_REG_RE_PHY_OLD,_param->_nb_inst_insert,_param->_size_special_register);
        DELETE1_SIGNAL( in_INSERT_NUM_REG_RE_PHY_NEW,_param->_nb_inst_insert,_param->_size_special_register);
  
        DELETE1_SIGNAL( in_RETIRE_VAL               ,_param->_nb_inst_retire,1);
        DELETE1_SIGNAL(out_RETIRE_ACK               ,_param->_nb_inst_retire,1);
        DELETE1_SIGNAL( in_RETIRE_RESTORE           ,_param->_nb_inst_retire,1                             );
//         DELETE1_SIGNAL( in_RETIRE_READ_RA           ,_param->_nb_inst_retire,1                             );
//         DELETE1_SIGNAL( in_RETIRE_NUM_REG_RA_PHY    ,_param->_nb_inst_retire,_param->_size_general_register);
//         DELETE1_SIGNAL( in_RETIRE_READ_RB           ,_param->_nb_inst_retire,1                             );
//         DELETE1_SIGNAL( in_RETIRE_NUM_REG_RB_PHY    ,_param->_nb_inst_retire,_param->_size_general_register);
//         DELETE1_SIGNAL( in_RETIRE_READ_RC           ,_param->_nb_inst_retire,1                             );
//         DELETE1_SIGNAL( in_RETIRE_NUM_REG_RC_PHY    ,_param->_nb_inst_retire,_param->_size_special_register);
        DELETE1_SIGNAL( in_RETIRE_WRITE_RD          ,_param->_nb_inst_retire,1                             );
        DELETE1_SIGNAL( in_RETIRE_RESTORE_RD_PHY_OLD,_param->_nb_inst_retire,1                             );
        DELETE1_SIGNAL( in_RETIRE_NUM_REG_RD_PHY_OLD,_param->_nb_inst_retire,_param->_size_general_register);
        DELETE1_SIGNAL( in_RETIRE_NUM_REG_RD_PHY_NEW,_param->_nb_inst_retire,_param->_size_general_register);
        DELETE1_SIGNAL( in_RETIRE_WRITE_RE          ,_param->_nb_inst_retire,1                             );
        DELETE1_SIGNAL( in_RETIRE_RESTORE_RE_PHY_OLD,_param->_nb_inst_retire,1                             );
        DELETE1_SIGNAL( in_RETIRE_NUM_REG_RE_PHY_OLD,_param->_nb_inst_retire,_param->_size_special_register);
        DELETE1_SIGNAL( in_RETIRE_NUM_REG_RE_PHY_NEW,_param->_nb_inst_retire,_param->_size_special_register);

        DELETE1_SIGNAL(out_PUSH_GPR_VAL    ,_param->_nb_reg_free,1);
        DELETE1_SIGNAL( in_PUSH_GPR_ACK    ,_param->_nb_reg_free,1);
        DELETE1_SIGNAL(out_PUSH_GPR_NUM_REG,_param->_nb_reg_free,_param->_size_general_register);

        DELETE1_SIGNAL(out_PUSH_SPR_VAL    ,_param->_nb_reg_free,1);
        DELETE1_SIGNAL( in_PUSH_SPR_ACK    ,_param->_nb_reg_free,1);
        DELETE1_SIGNAL(out_PUSH_SPR_NUM_REG,_param->_nb_reg_free,_param->_size_special_register);

#ifdef DEBUG_TEST
        DELETE0_SIGNAL( in_INFO_ROB_EMPTY  ,1);
        DELETE0_SIGNAL( in_INFO_NB_GPR_FREE,_param->_size_general_register+1);
        DELETE0_SIGNAL( in_INFO_NB_SPR_FREE,_param->_size_special_register+1);
#endif

        DELETE2(gpr_stat_list             ,_param->_nb_bank,_param->_nb_general_register_by_bank);
        DELETE2(spr_stat_list             ,_param->_nb_bank,_param->_nb_special_register_by_bank);
        DELETE1(internal_INSERT_ACK       ,_param->_nb_inst_insert);
        DELETE1(internal_RETIRE_ACK       ,_param->_nb_inst_retire);
        DELETE1(internal_PUSH_GPR_VAL     ,_param->_nb_reg_free);
        DELETE1(internal_PUSH_GPR_NUM_BANK,_param->_nb_reg_free);
        DELETE1(internal_PUSH_GPR_NUM_REG ,_param->_nb_reg_free);
        DELETE1(internal_PUSH_SPR_VAL     ,_param->_nb_reg_free);
        DELETE1(internal_PUSH_SPR_NUM_BANK,_param->_nb_reg_free);
        DELETE1(internal_PUSH_SPR_NUM_REG ,_param->_nb_reg_free);
      }

    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    

    delete _component;

    log_printf(FUNC,Stat_List_unit,FUNCTION,"End");
  };

}; // end namespace stat_list_unit
}; // end namespace register_translation_unit
}; // end namespace rename_unit
}; // end namespace ooo_engine
}; // end namespace multi_ooo_engine
}; // end namespace core

}; // end namespace behavioural
}; // end namespace morpheo              
