/*
 * $Id: Functionnal_unit_deallocation.cpp 112 2009-03-18 22:36:26Z rosiere $
 *
 * [ Description ]
 * 
 */

#include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Execute_unit/Execute_unit/Functionnal_unit/include/Functionnal_unit.h"
#include "Behavioural/include/Allocation.h"

namespace morpheo                    {
namespace behavioural {
namespace core {
namespace multi_execute_loop {
namespace execute_loop {
namespace multi_execute_unit {
namespace execute_unit {
namespace functionnal_unit {


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

    if (usage_is_set(_usage,USE_SYSTEMC))
      {
	delete    in_CLOCK ;
	delete    in_NRESET;
	
        DELETE0_SIGNAL( in_EXECUTE_IN_VAL                   ,1);
        DELETE0_SIGNAL(out_EXECUTE_IN_ACK                   ,1);
        DELETE0_SIGNAL( in_EXECUTE_IN_CONTEXT_ID            , _param->_size_context_id   );
        DELETE0_SIGNAL( in_EXECUTE_IN_FRONT_END_ID          , _param->_size_front_end_id );
        DELETE0_SIGNAL( in_EXECUTE_IN_OOO_ENGINE_ID         , _param->_size_ooo_engine_id);
        DELETE0_SIGNAL( in_EXECUTE_IN_PACKET_ID             , _param->_size_rob_ptr    );
        DELETE0_SIGNAL( in_EXECUTE_IN_OPERATION             , _param->_size_operation    );
        DELETE0_SIGNAL( in_EXECUTE_IN_TYPE                  , _param->_size_type         );
        DELETE0_SIGNAL( in_EXECUTE_IN_STORE_QUEUE_PTR_WRITE ,_param->_size_store_queue_ptr);
        DELETE0_SIGNAL( in_EXECUTE_IN_LOAD_QUEUE_PTR_WRITE  ,_param->_size_load_queue_ptr);
        DELETE0_SIGNAL( in_EXECUTE_IN_HAS_IMMEDIAT          , 1);
        DELETE0_SIGNAL( in_EXECUTE_IN_IMMEDIAT              , _param->_size_general_data);
        DELETE0_SIGNAL( in_EXECUTE_IN_DATA_RA               , _param->_size_general_data);
        DELETE0_SIGNAL( in_EXECUTE_IN_DATA_RB               , _param->_size_general_data);
        DELETE0_SIGNAL( in_EXECUTE_IN_DATA_RC               , _param->_size_special_data);
        DELETE0_SIGNAL( in_EXECUTE_IN_WRITE_RD              , 1);
        DELETE0_SIGNAL( in_EXECUTE_IN_NUM_REG_RD            , _param->_size_general_register);
        DELETE0_SIGNAL( in_EXECUTE_IN_WRITE_RE              , 1);
        DELETE0_SIGNAL( in_EXECUTE_IN_NUM_REG_RE            , _param->_size_special_register);

        DELETE0_SIGNAL(out_EXECUTE_OUT_VAL            ,1);
        DELETE0_SIGNAL( in_EXECUTE_OUT_ACK            ,1);
        DELETE0_SIGNAL(out_EXECUTE_OUT_CONTEXT_ID     ,_param->_size_context_id   );
        DELETE0_SIGNAL(out_EXECUTE_OUT_FRONT_END_ID   ,_param->_size_front_end_id );
        DELETE0_SIGNAL(out_EXECUTE_OUT_OOO_ENGINE_ID  ,_param->_size_ooo_engine_id);
        DELETE0_SIGNAL(out_EXECUTE_OUT_PACKET_ID      ,_param->_size_rob_ptr    );
      //DELETE0_SIGNAL(out_EXECUTE_OUT_OPERATION      ,_param->_size_operation    );
      //DELETE0_SIGNAL(out_EXECUTE_OUT_TYPE           ,_param->_size_type         );
        DELETE0_SIGNAL(out_EXECUTE_OUT_WRITE_RD       ,1);
        DELETE0_SIGNAL(out_EXECUTE_OUT_NUM_REG_RD     ,_param->_size_general_register);
        DELETE0_SIGNAL(out_EXECUTE_OUT_DATA_RD        ,_param->_size_general_data);
        DELETE0_SIGNAL(out_EXECUTE_OUT_WRITE_RE       ,1);
        DELETE0_SIGNAL(out_EXECUTE_OUT_NUM_REG_RE     ,_param->_size_special_register);
        DELETE0_SIGNAL(out_EXECUTE_OUT_DATA_RE        ,_param->_size_special_data);
        DELETE0_SIGNAL(out_EXECUTE_OUT_EXCEPTION      ,_param->_size_exception);
        DELETE0_SIGNAL(out_EXECUTE_OUT_NO_SEQUENCE    ,1);
        DELETE0_SIGNAL(out_EXECUTE_OUT_ADDRESS        ,_param->_size_instruction_address);

        // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    
        
        delete [] _execute_register;
        delete    _execute_param;
        delete    _execute_operation_in;
        delete    _execute_operation_out;
        delete [] _function_execute;
      }

    delete    _component;

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

}; // end namespace functionnal_unit
}; // end namespace execute_unit
}; // end namespace multi_execute_unit
}; // end namespace execute_loop
}; // end namespace multi_execute_loop
}; // end namespace core

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