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

#include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Write_unit/Write_unit/Execute_queue/include/Execute_queue.h"

namespace morpheo                    {
namespace behavioural {
namespace core {
namespace multi_execute_loop {
namespace execute_loop {
namespace multi_write_unit {
namespace write_unit {
namespace execute_queue {


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

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

	// -----[ Interface "execute_queue_in" ]--------------------------------    
	delete      in_EXECUTE_QUEUE_IN_VAL          ;
	delete     out_EXECUTE_QUEUE_IN_ACK          ;
	if (_param->_have_port_context_id)
	delete      in_EXECUTE_QUEUE_IN_CONTEXT_ID   ;
	if (_param->_have_port_front_end_id)
	delete      in_EXECUTE_QUEUE_IN_FRONT_END_ID ;
	if (_param->_have_port_ooo_engine_id)
	delete      in_EXECUTE_QUEUE_IN_OOO_ENGINE_ID;
        if (_param->_have_port_rob_ptr)
	delete      in_EXECUTE_QUEUE_IN_PACKET_ID    ;
//      delete      in_EXECUTE_QUEUE_IN_OPERATION    ;
//      delete      in_EXECUTE_QUEUE_IN_TYPE         ;
        delete      in_EXECUTE_QUEUE_IN_FLAGS        ;
        delete      in_EXECUTE_QUEUE_IN_EXCEPTION    ;
        delete      in_EXECUTE_QUEUE_IN_NO_SEQUENCE  ;
        delete      in_EXECUTE_QUEUE_IN_ADDRESS      ;
        delete      in_EXECUTE_QUEUE_IN_DATA         ;

	// -----[ Interface "execute_queue_out" ]-------------------------------    
        delete     out_EXECUTE_QUEUE_OUT_VAL          ;
        delete      in_EXECUTE_QUEUE_OUT_ACK          ;
        if (_param->_have_port_context_id)
	delete     out_EXECUTE_QUEUE_OUT_CONTEXT_ID   ;
        if (_param->_have_port_front_end_id)
	delete     out_EXECUTE_QUEUE_OUT_FRONT_END_ID ;
        if (_param->_have_port_ooo_engine_id)
	delete     out_EXECUTE_QUEUE_OUT_OOO_ENGINE_ID;
        if (_param->_have_port_rob_ptr)
	delete     out_EXECUTE_QUEUE_OUT_PACKET_ID    ;
//      delete     out_EXECUTE_QUEUE_OUT_OPERATION    ;
//      delete     out_EXECUTE_QUEUE_OUT_TYPE         ;
        delete     out_EXECUTE_QUEUE_OUT_FLAGS        ;
        delete     out_EXECUTE_QUEUE_OUT_EXCEPTION    ;
        delete     out_EXECUTE_QUEUE_OUT_NO_SEQUENCE  ;
        delete     out_EXECUTE_QUEUE_OUT_ADDRESS      ;
        delete     out_EXECUTE_QUEUE_OUT_DATA         ;
      }

    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    
    while (not _queue->empty())
      {
	delete _queue->front();
	_queue->pop();
      }
    delete _queue;

    delete _component;

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

}; // end namespace execute_queue
}; // end namespace write_unit
}; // end namespace multi_write_unit
}; // end namespace execute_loop
}; // end namespace multi_execute_loop
}; // end namespace core

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