/*
 * $Id: Execute_queue_deallocation.cpp 113 2009-04-14 18:39:12Z rosiere $
 *
 * [ Description ]
 * 
 */

#include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Write_unit/Write_unit/Execute_queue/include/Execute_queue.h"
#include "Behavioural/include/Allocation.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_INTERFACE))
      {
	delete    in_CLOCK ;
	delete    in_NRESET;

        DELETE0_SIGNAL( in_EXECUTE_QUEUE_IN_VAL           ,1);
        DELETE0_SIGNAL(out_EXECUTE_QUEUE_IN_ACK           ,1);
        DELETE0_SIGNAL( in_EXECUTE_QUEUE_IN_CONTEXT_ID    ,_param->_size_context_id       );
        DELETE0_SIGNAL( in_EXECUTE_QUEUE_IN_FRONT_END_ID  ,_param->_size_front_end_id     );
        DELETE0_SIGNAL( in_EXECUTE_QUEUE_IN_OOO_ENGINE_ID ,_param->_size_ooo_engine_id    );
        DELETE0_SIGNAL( in_EXECUTE_QUEUE_IN_PACKET_ID     ,_param->_size_rob_ptr          );
//      DELETE0_SIGNAL( in_EXECUTE_QUEUE_IN_OPERATION     ,_param->_size_operation        );
//      DELETE0_SIGNAL( in_EXECUTE_QUEUE_IN_TYPE          ,_param->_size_type             );
        DELETE0_SIGNAL( in_EXECUTE_QUEUE_IN_FLAGS         ,_param->_size_special_data     );
        DELETE0_SIGNAL( in_EXECUTE_QUEUE_IN_EXCEPTION     ,_param->_size_exception        );
        DELETE0_SIGNAL( in_EXECUTE_QUEUE_IN_NO_SEQUENCE   ,1                              );
        DELETE0_SIGNAL( in_EXECUTE_QUEUE_IN_ADDRESS       ,_param->_size_instruction_address);
        DELETE0_SIGNAL( in_EXECUTE_QUEUE_IN_DATA          ,_param->_size_general_data     );
        
        DELETE0_SIGNAL(out_EXECUTE_QUEUE_OUT_VAL          ,1);
        DELETE0_SIGNAL( in_EXECUTE_QUEUE_OUT_ACK          ,1);
        DELETE0_SIGNAL(out_EXECUTE_QUEUE_OUT_CONTEXT_ID   ,_param->_size_context_id   );
        DELETE0_SIGNAL(out_EXECUTE_QUEUE_OUT_FRONT_END_ID ,_param->_size_front_end_id );
        DELETE0_SIGNAL(out_EXECUTE_QUEUE_OUT_OOO_ENGINE_ID,_param->_size_ooo_engine_id);
        DELETE0_SIGNAL(out_EXECUTE_QUEUE_OUT_PACKET_ID    ,_param->_size_rob_ptr    );
//      DELETE0_SIGNAL(out_EXECUTE_QUEUE_OUT_OPERATION    ,_param->_size_operation    );
//      DELETE0_SIGNAL(out_EXECUTE_QUEUE_OUT_TYPE         ,_param->_size_type         );
        DELETE0_SIGNAL(out_EXECUTE_QUEUE_OUT_FLAGS        ,_param->_size_special_data );
        DELETE0_SIGNAL(out_EXECUTE_QUEUE_OUT_EXCEPTION    ,_param->_size_exception    );
        DELETE0_SIGNAL(out_EXECUTE_QUEUE_OUT_NO_SEQUENCE  ,1                          );
        DELETE0_SIGNAL(out_EXECUTE_QUEUE_OUT_ADDRESS      ,_param->_size_instruction_address);
        DELETE0_SIGNAL(out_EXECUTE_QUEUE_OUT_DATA         ,_param->_size_general_data );
      }

    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    
    if (usage_is_set(_usage,USE_SYSTEMC_BODY))
      {
        while (not _queue->empty())
          {
            delete _queue->front();
            _queue->pop_front();
          }
        delete _queue;
      }

    delete _component;

#ifdef VHDL
    if (usage_is_set(_usage,USE_VHDL))
      {
        delete _component_queue;
        delete _param_queue;
      }
#endif

#ifdef MODELSIM_COSIMULATION
    if (usage_is_set(_usage,USE_COSIMULATION))
      {
        delete _wrapper;
      }
#endif

    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              
