/*
 * $Id: Load_Store_pointer_unit_deallocation.cpp 122 2009-06-03 08:15:51Z rosiere $
 *
 * [ Description ]
 * 
 */

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

namespace morpheo                    {
namespace behavioural {
namespace core {
namespace multi_ooo_engine {
namespace ooo_engine {
namespace rename_unit {
namespace load_store_pointer_unit {


#undef  FUNCTION
#define FUNCTION "Load_Store_pointer_unit::deallocation"
  void Load_Store_pointer_unit::deallocation (void)
  {
    log_printf(FUNC,Load_Store_pointer_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_FRONT_END_ID         ,_param->_nb_inst_insert,_param->_size_front_end_id   );
        DELETE1_SIGNAL( in_INSERT_CONTEXT_ID           ,_param->_nb_inst_insert,_param->_size_context_id     );
        DELETE1_SIGNAL( in_INSERT_TYPE                 ,_param->_nb_inst_insert,_param->_size_type           );
        DELETE1_SIGNAL( in_INSERT_OPERATION            ,_param->_nb_inst_insert,_param->_size_operation      );
        DELETE1_SIGNAL(out_INSERT_STORE_QUEUE_PTR_WRITE,_param->_nb_inst_insert,_param->_size_store_queue_ptr);
        DELETE1_SIGNAL(out_INSERT_STORE_QUEUE_PTR_READ ,_param->_nb_inst_insert,_param->_size_store_queue_ptr);
        DELETE1_SIGNAL(out_INSERT_STORE_QUEUE_EMPTY    ,_param->_nb_inst_insert,1);
        DELETE1_SIGNAL(out_INSERT_LOAD_QUEUE_PTR_WRITE ,_param->_nb_inst_insert,_param->_size_load_queue_ptr );

        DELETE1_SIGNAL( in_RETIRE_VAL                  ,_param->_nb_inst_retire,1);
        DELETE1_SIGNAL(out_RETIRE_ACK                  ,_param->_nb_inst_retire,1);
        DELETE1_SIGNAL( in_RETIRE_FRONT_END_ID         ,_param->_nb_inst_retire,_param->_size_front_end_id   );
        DELETE1_SIGNAL( in_RETIRE_CONTEXT_ID           ,_param->_nb_inst_retire,_param->_size_context_id     );
//      DELETE1_SIGNAL( in_RETIRE_TYPE                 ,_param->_nb_inst_retire,_param->_size_type           );
//      DELETE1_SIGNAL( in_RETIRE_OPERATION            ,_param->_nb_inst_retire,_param->_size_operation      );
        DELETE1_SIGNAL( in_RETIRE_USE_STORE_QUEUE      ,_param->_nb_inst_retire,1);
        DELETE1_SIGNAL( in_RETIRE_USE_LOAD_QUEUE       ,_param->_nb_inst_retire,1);
        DELETE1_SIGNAL( in_RETIRE_STORE_QUEUE_PTR_WRITE,_param->_nb_inst_retire,_param->_size_store_queue_ptr);
        DELETE1_SIGNAL( in_RETIRE_LOAD_QUEUE_PTR_WRITE ,_param->_nb_inst_retire,_param->_size_load_queue_ptr );

        DELETE2_SIGNAL( in_RETIRE_EVENT_VAL            ,_param->_nb_front_end, _param->_nb_context[it1],1);
        DELETE2_SIGNAL(out_RETIRE_EVENT_ACK            ,_param->_nb_front_end, _param->_nb_context[it1],1);
        DELETE2_SIGNAL( in_RETIRE_EVENT_STATE          ,_param->_nb_front_end, _param->_nb_context[it1],_param->_size_event_state);

        DELETE1(reg_STORE_QUEUE_PTR_WRITE     ,_param->_nb_load_store_queue);
        DELETE2(reg_STORE_QUEUE_PTR_READ      ,_param->_nb_front_end, _param->_nb_context[it1]);
        DELETE2(reg_STORE_QUEUE_EMPTY         ,_param->_nb_front_end, _param->_nb_context[it1]);
        DELETE2(reg_STORE_QUEUE_USE           ,_param->_nb_load_store_queue,_param->_size_store_queue [it1]);
        DELETE1(reg_STORE_QUEUE_NB_USE        ,_param->_nb_load_store_queue);
        DELETE1(reg_LOAD_QUEUE_PTR_WRITE      ,_param->_nb_load_store_queue);
        DELETE2(reg_LOAD_QUEUE_USE            ,_param->_nb_load_store_queue,_param->_size_load_queue  [it1]);
        
        DELETE1(internal_INSERT_ACK           ,_param->_nb_inst_insert);
        DELETE1(internal_INSERT_OPERATION_USE ,_param->_nb_inst_insert);
        DELETE1(internal_INSERT_LSQ           ,_param->_nb_inst_insert);
        DELETE1(internal_INSERT_PTR           ,_param->_nb_inst_insert);
        
        DELETE1(internal_RETIRE_ACK           ,_param->_nb_inst_retire);
        DELETE1(internal_RETIRE_OPERATION_USE ,_param->_nb_inst_retire);
        DELETE1(internal_RETIRE_LSQ           ,_param->_nb_inst_retire);
        DELETE1(internal_RETIRE_PTR           ,_param->_nb_inst_retire);

        DELETE2(internal_RETIRE_EVENT_ACK     ,_param->_nb_front_end,_param->_nb_context[it1]);
      }

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

    delete _component;

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

}; // end namespace load_store_pointer_unit
}; // end namespace rename_unit
}; // end namespace ooo_engine
}; // end namespace multi_ooo_engine
}; // end namespace core

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