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

#include "Behavioural/Core/Multi_Execute_loop/Execute_loop/include/Execute_loop.h"
#include "Behavioural/include/Allocation.h"
namespace morpheo                    {
namespace behavioural {
namespace core {
namespace multi_execute_loop {
namespace execute_loop {


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

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

        DELETE1_SIGNAL( in_EXECUTE_LOOP_IN_VAL                  ,_param->_nb_read_unit,1);
        DELETE1_SIGNAL(out_EXECUTE_LOOP_IN_ACK                  ,_param->_nb_read_unit,1);
        DELETE1_SIGNAL( in_EXECUTE_LOOP_IN_CONTEXT_ID           ,_param->_nb_read_unit,_param->_size_context_id);
        DELETE1_SIGNAL( in_EXECUTE_LOOP_IN_FRONT_END_ID         ,_param->_nb_read_unit,_param->_size_front_end_id);
        DELETE1_SIGNAL( in_EXECUTE_LOOP_IN_OOO_ENGINE_ID        ,_param->_nb_read_unit,_param->_size_ooo_engine_id);
        DELETE1_SIGNAL( in_EXECUTE_LOOP_IN_PACKET_ID            ,_param->_nb_read_unit,_param->_size_rob_ptr  );
        DELETE1_SIGNAL( in_EXECUTE_LOOP_IN_OPERATION            ,_param->_nb_read_unit,_param->_size_operation);
        DELETE1_SIGNAL( in_EXECUTE_LOOP_IN_TYPE                 ,_param->_nb_read_unit,_param->_size_type);         
        DELETE1_SIGNAL( in_EXECUTE_LOOP_IN_STORE_QUEUE_PTR_WRITE,_param->_nb_read_unit,_param->_size_store_queue_ptr);
        DELETE1_SIGNAL( in_EXECUTE_LOOP_IN_STORE_QUEUE_PTR_READ ,_param->_nb_read_unit,_param->_size_store_queue_ptr);
        DELETE1_SIGNAL( in_EXECUTE_LOOP_IN_STORE_QUEUE_EMPTY    ,_param->_nb_read_unit,1);
        DELETE1_SIGNAL( in_EXECUTE_LOOP_IN_LOAD_QUEUE_PTR_WRITE ,_param->_nb_read_unit,_param->_size_load_queue_ptr);
        DELETE1_SIGNAL( in_EXECUTE_LOOP_IN_HAS_IMMEDIAT         ,_param->_nb_read_unit,1);
        DELETE1_SIGNAL( in_EXECUTE_LOOP_IN_IMMEDIAT             ,_param->_nb_read_unit,_param->_size_general_data);
        DELETE1_SIGNAL( in_EXECUTE_LOOP_IN_READ_RA              ,_param->_nb_read_unit,1);
        DELETE1_SIGNAL( in_EXECUTE_LOOP_IN_NUM_REG_RA           ,_param->_nb_read_unit,_param->_size_general_register);
        DELETE1_SIGNAL( in_EXECUTE_LOOP_IN_READ_RB              ,_param->_nb_read_unit,1);
        DELETE1_SIGNAL( in_EXECUTE_LOOP_IN_NUM_REG_RB           ,_param->_nb_read_unit,_param->_size_general_register);
        DELETE1_SIGNAL( in_EXECUTE_LOOP_IN_READ_RC              ,_param->_nb_read_unit,1);
        DELETE1_SIGNAL( in_EXECUTE_LOOP_IN_NUM_REG_RC           ,_param->_nb_read_unit,_param->_size_special_register);
        DELETE1_SIGNAL( in_EXECUTE_LOOP_IN_WRITE_RD             ,_param->_nb_read_unit,1);
        DELETE1_SIGNAL( in_EXECUTE_LOOP_IN_NUM_REG_RD           ,_param->_nb_read_unit,_param->_size_general_register);
        DELETE1_SIGNAL( in_EXECUTE_LOOP_IN_WRITE_RE             ,_param->_nb_read_unit,1);
        DELETE1_SIGNAL( in_EXECUTE_LOOP_IN_NUM_REG_RE           ,_param->_nb_read_unit,_param->_size_special_register);
        
        DELETE1_SIGNAL(out_EXECUTE_LOOP_OUT_VAL          ,_param->_nb_write_unit,1);
        DELETE1_SIGNAL( in_EXECUTE_LOOP_OUT_ACK          ,_param->_nb_write_unit,1);
        DELETE1_SIGNAL(out_EXECUTE_LOOP_OUT_CONTEXT_ID   ,_param->_nb_write_unit,_param->_size_context_id);
        DELETE1_SIGNAL(out_EXECUTE_LOOP_OUT_FRONT_END_ID ,_param->_nb_write_unit,_param->_size_front_end_id);
        DELETE1_SIGNAL(out_EXECUTE_LOOP_OUT_OOO_ENGINE_ID,_param->_nb_write_unit,_param->_size_ooo_engine_id);
        DELETE1_SIGNAL(out_EXECUTE_LOOP_OUT_PACKET_ID    ,_param->_nb_write_unit,_param->_size_rob_ptr  );
//      DELETE1_SIGNAL(out_EXECUTE_LOOP_OUT_OPERATION    ,_param->_nb_write_unit,_param->_size_operation);
//      DELETE1_SIGNAL(out_EXECUTE_LOOP_OUT_TYPE         ,_param->_nb_write_unit,_param->_size_type);
        DELETE1_SIGNAL(out_EXECUTE_LOOP_OUT_FLAGS        ,_param->_nb_write_unit,_param->_size_special_data);
        DELETE1_SIGNAL(out_EXECUTE_LOOP_OUT_EXCEPTION    ,_param->_nb_write_unit,_param->_size_exception);
        DELETE1_SIGNAL(out_EXECUTE_LOOP_OUT_NO_SEQUENCE  ,_param->_nb_write_unit,1);
        DELETE1_SIGNAL(out_EXECUTE_LOOP_OUT_ADDRESS      ,_param->_nb_write_unit,_param->_size_general_data);
        DELETE1_SIGNAL(out_EXECUTE_LOOP_OUT_DATA         ,_param->_nb_write_unit,_param->_size_general_data);
        
        DELETE2_SIGNAL(out_DCACHE_REQ_VAL       , _param->_nb_load_store_unit, _param->_nb_cache_port[it1],1                                  );
        DELETE2_SIGNAL( in_DCACHE_REQ_ACK       , _param->_nb_load_store_unit, _param->_nb_cache_port[it1],1                                  );
        DELETE2_SIGNAL(out_DCACHE_REQ_CONTEXT_ID, _param->_nb_load_store_unit, _param->_nb_cache_port[it1],_param->_max_size_dcache_context_id);
        DELETE2_SIGNAL(out_DCACHE_REQ_PACKET_ID , _param->_nb_load_store_unit, _param->_nb_cache_port[it1],_param->_max_size_dcache_packet_id );
        DELETE2_SIGNAL(out_DCACHE_REQ_ADDRESS   , _param->_nb_load_store_unit, _param->_nb_cache_port[it1],_param->_size_general_data         );
        DELETE2_SIGNAL(out_DCACHE_REQ_TYPE      , _param->_nb_load_store_unit, _param->_nb_cache_port[it1],_param->_size_dcache_type          );
        DELETE2_SIGNAL(out_DCACHE_REQ_WDATA     , _param->_nb_load_store_unit, _param->_nb_cache_port[it1],_param->_size_general_data         );
        													                                     
        DELETE2_SIGNAL( in_DCACHE_RSP_VAL       , _param->_nb_load_store_unit, _param->_nb_cache_port[it1],1                                  );
        DELETE2_SIGNAL(out_DCACHE_RSP_ACK       , _param->_nb_load_store_unit, _param->_nb_cache_port[it1],1                                  );
        DELETE2_SIGNAL( in_DCACHE_RSP_CONTEXT_ID, _param->_nb_load_store_unit, _param->_nb_cache_port[it1],_param->_max_size_dcache_context_id);
        DELETE2_SIGNAL( in_DCACHE_RSP_PACKET_ID , _param->_nb_load_store_unit, _param->_nb_cache_port[it1],_param->_max_size_dcache_packet_id );
        DELETE2_SIGNAL( in_DCACHE_RSP_RDATA     , _param->_nb_load_store_unit, _param->_nb_cache_port[it1],_param->_size_general_data         );
        DELETE2_SIGNAL( in_DCACHE_RSP_ERROR     , _param->_nb_load_store_unit, _param->_nb_cache_port[it1],_param->_size_dcache_error         );
        
        DELETE2_SIGNAL( in_INSERT_ROB_VAL       ,_param->_nb_ooo_engine,_param->_nb_inst_insert_rob[it1],1                             );
        DELETE2_SIGNAL(out_INSERT_ROB_ACK       ,_param->_nb_ooo_engine,_param->_nb_inst_insert_rob[it1],1                             );
        DELETE2_SIGNAL( in_INSERT_ROB_RD_USE    ,_param->_nb_ooo_engine,_param->_nb_inst_insert_rob[it1],1                             );
        DELETE2_SIGNAL( in_INSERT_ROB_RD_NUM_REG,_param->_nb_ooo_engine,_param->_nb_inst_insert_rob[it1],_param->_size_general_register);
        DELETE2_SIGNAL( in_INSERT_ROB_RE_USE    ,_param->_nb_ooo_engine,_param->_nb_inst_insert_rob[it1],1                             );
        DELETE2_SIGNAL( in_INSERT_ROB_RE_NUM_REG,_param->_nb_ooo_engine,_param->_nb_inst_insert_rob[it1],_param->_size_special_register);
        
//         DELETE2_SIGNAL( in_RETIRE_ROB_VAL           ,_param->_nb_ooo_engine,_param->_nb_inst_retire_rob[it1],1                             );
//         DELETE2_SIGNAL(out_RETIRE_ROB_ACK           ,_param->_nb_ooo_engine,_param->_nb_inst_retire_rob[it1],1                             );
//         DELETE2_SIGNAL( in_RETIRE_ROB_RD_OLD_USE    ,_param->_nb_ooo_engine,_param->_nb_inst_retire_rob[it1],1                             );
//         DELETE2_SIGNAL( in_RETIRE_ROB_RD_OLD_NUM_REG,_param->_nb_ooo_engine,_param->_nb_inst_retire_rob[it1],_param->_size_general_register);
//         DELETE2_SIGNAL( in_RETIRE_ROB_RD_NEW_USE    ,_param->_nb_ooo_engine,_param->_nb_inst_retire_rob[it1],1                             );
//         DELETE2_SIGNAL( in_RETIRE_ROB_RD_NEW_NUM_REG,_param->_nb_ooo_engine,_param->_nb_inst_retire_rob[it1],_param->_size_general_register);
//         DELETE2_SIGNAL( in_RETIRE_ROB_RE_OLD_USE    ,_param->_nb_ooo_engine,_param->_nb_inst_retire_rob[it1],1                             );
//         DELETE2_SIGNAL( in_RETIRE_ROB_RE_OLD_NUM_REG,_param->_nb_ooo_engine,_param->_nb_inst_retire_rob[it1],_param->_size_special_register);
//         DELETE2_SIGNAL( in_RETIRE_ROB_RE_NEW_USE    ,_param->_nb_ooo_engine,_param->_nb_inst_retire_rob[it1],1                             );
//         DELETE2_SIGNAL( in_RETIRE_ROB_RE_NEW_NUM_REG,_param->_nb_ooo_engine,_param->_nb_inst_retire_rob[it1],_param->_size_special_register);
      }

    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    
    delete    _component_glue                        ;
    for (uint32_t i=0; i<_param->_nb_read_unit; i++)
    delete    _component_read_unit [i]               ;
    delete [] _component_read_unit                   ;
    for (uint32_t i=0; i<_param->_nb_functionnal_unit; i++)
    delete    _component_functionnal_unit [i]        ;
    delete [] _component_functionnal_unit            ;
    for (uint32_t i=0; i<_param->_nb_load_store_unit; i++)
    delete    _component_load_store_unit [i]         ;
    delete [] _component_load_store_unit             ;
    for (uint32_t i=0; i<_param->_nb_write_unit; i++)
    delete    _component_write_unit [i]              ;
    delete [] _component_write_unit                  ;
    delete    _component_read_unit_to_execution_unit ;
    delete    _component_execution_unit_to_write_unit;
    delete    _component_register_unit               ;

    delete    _component;
    
    log_printf(FUNC,Execute_loop,FUNCTION,"End");
  };

}; // end namespace execute_loop
}; // end namespace multi_execute_loop
}; // end namespace core
}; // end namespace behavioural
}; // end namespace morpheo              
