/*
 * $Id: Core_deallocation.cpp 88 2008-12-10 18:31:39Z rosiere $
 *
 * [ Description ]
 * 
 */

#include "Behavioural/Core/include/Core.h"
#include "Behavioural/include/Allocation.h"

namespace morpheo                    {
namespace behavioural {
namespace core {


#undef  FUNCTION
#define FUNCTION "Core::deallocation"
  void Core::deallocation (void)
  {
    log_begin(Core,FUNCTION);

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

        DELETE1_SIGNAL(out_ICACHE_REQ_VAL         ,_param->_nb_icache_port,1);
        DELETE1_SIGNAL( in_ICACHE_REQ_ACK         ,_param->_nb_icache_port,1);
        DELETE1_SIGNAL(out_ICACHE_REQ_THREAD_ID   ,_param->_nb_icache_port,_param->_size_icache_thread_id);
        DELETE1_SIGNAL(out_ICACHE_REQ_PACKET_ID   ,_param->_nb_icache_port,_param->_size_icache_packet_id);
        DELETE1_SIGNAL(out_ICACHE_REQ_ADDRESS     ,_param->_nb_icache_port,_param->_size_icache_address);
        DELETE1_SIGNAL(out_ICACHE_REQ_TYPE        ,_param->_nb_icache_port,_param->_size_icache_type);
  
        DELETE1_SIGNAL( in_ICACHE_RSP_VAL         ,_param->_nb_icache_port,1);
        DELETE1_SIGNAL(out_ICACHE_RSP_ACK         ,_param->_nb_icache_port,1);
        DELETE1_SIGNAL( in_ICACHE_RSP_THREAD_ID   ,_param->_nb_icache_port,_param->_size_icache_thread_id);
        DELETE1_SIGNAL( in_ICACHE_RSP_PACKET_ID   ,_param->_nb_icache_port,_param->_size_icache_packet_id);
        DELETE1_SIGNAL( in_ICACHE_RSP_ERROR       ,_param->_nb_icache_port,_param->_size_icache_error);
        DELETE2_SIGNAL( in_ICACHE_RSP_INSTRUCTION ,_param->_nb_icache_port,_param->_icache_nb_instruction[it1],_param->_size_instruction);
  
        DELETE1_SIGNAL(out_DCACHE_REQ_VAL         ,_param->_nb_dcache_port,1);
        DELETE1_SIGNAL( in_DCACHE_REQ_ACK         ,_param->_nb_dcache_port,1);
        DELETE1_SIGNAL(out_DCACHE_REQ_THREAD_ID   ,_param->_nb_dcache_port,_param->_size_dcache_thread_id);
        DELETE1_SIGNAL(out_DCACHE_REQ_PACKET_ID   ,_param->_nb_dcache_port,_param->_size_dcache_packet_id);
        DELETE1_SIGNAL(out_DCACHE_REQ_ADDRESS     ,_param->_nb_dcache_port,_param->_size_dcache_address);
        DELETE1_SIGNAL(out_DCACHE_REQ_WDATA       ,_param->_nb_dcache_port,_param->_size_dcache_data);
        DELETE1_SIGNAL(out_DCACHE_REQ_TYPE        ,_param->_nb_dcache_port,_param->_size_dcache_type);
  
        DELETE1_SIGNAL( in_DCACHE_RSP_VAL         ,_param->_nb_dcache_port,1);
        DELETE1_SIGNAL(out_DCACHE_RSP_ACK         ,_param->_nb_dcache_port,1);
        DELETE1_SIGNAL( in_DCACHE_RSP_THREAD_ID   ,_param->_nb_dcache_port,_param->_size_dcache_thread_id);
        DELETE1_SIGNAL( in_DCACHE_RSP_PACKET_ID   ,_param->_nb_dcache_port,_param->_size_dcache_packet_id);
        DELETE1_SIGNAL( in_DCACHE_RSP_RDATA       ,_param->_nb_dcache_port,_param->_size_dcache_data);
        DELETE1_SIGNAL( in_DCACHE_RSP_ERROR       ,_param->_nb_dcache_port,_param->_size_dcache_error);
  
        DELETE1_SIGNAL( in_INTERRUPT_ENABLE       ,_param->_nb_thread,1);
      }

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

    delete _component;

    log_end(Core,FUNCTION);
  };

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