/*
 * $Id$
 *
 * [ Description ]
 * 
 */

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

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


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

    if (_usage & USE_SYSTEMC)
      {
	delete    in_CLOCK ;
	delete    in_NRESET;

	// -----[ Interface "write_unit_in" ]--------------------------------    
	delete      in_WRITE_UNIT_IN_VAL          ;
	delete     out_WRITE_UNIT_IN_ACK          ;
	if (_param->_have_port_context_id)
	delete      in_WRITE_UNIT_IN_CONTEXT_ID   ;
	if (_param->_have_port_front_end_id)
	delete      in_WRITE_UNIT_IN_FRONT_END_ID ;
	if (_param->_have_port_ooo_engine_id)
	delete      in_WRITE_UNIT_IN_OOO_ENGINE_ID;
        if (_param->_have_port_packet_id)
	delete      in_WRITE_UNIT_IN_PACKET_ID    ;
//      delete      in_WRITE_UNIT_IN_OPERATION    ;
	delete      in_WRITE_UNIT_IN_TYPE         ;
        delete      in_WRITE_UNIT_IN_WRITE_RD     ;
        delete      in_WRITE_UNIT_IN_NUM_REG_RD   ;
        delete      in_WRITE_UNIT_IN_DATA_RD      ;
        delete      in_WRITE_UNIT_IN_WRITE_RE     ;
        delete      in_WRITE_UNIT_IN_NUM_REG_RE   ;
        delete      in_WRITE_UNIT_IN_DATA_RE      ;
        delete      in_WRITE_UNIT_IN_EXCEPTION    ;
        delete      in_WRITE_UNIT_IN_NO_SEQUENCE  ;
        delete      in_WRITE_UNIT_IN_ADDRESS      ;

	// -----[ Interface "write_unit_out" ]-------------------------------    
        delete     out_WRITE_UNIT_OUT_VAL          ;
        delete      in_WRITE_UNIT_OUT_ACK          ;
        if (_param->_have_port_context_id)
	delete     out_WRITE_UNIT_OUT_CONTEXT_ID   ;
        if (_param->_have_port_front_end_id)
	delete     out_WRITE_UNIT_OUT_FRONT_END_ID ;
        if (_param->_have_port_ooo_engine_id)
	delete     out_WRITE_UNIT_OUT_OOO_ENGINE_ID;
        if (_param->_have_port_packet_id)
	delete     out_WRITE_UNIT_OUT_PACKET_ID    ;
//      delete     out_WRITE_UNIT_OUT_OPERATION    ;
//      delete     out_WRITE_UNIT_OUT_TYPE         ;
        delete     out_WRITE_UNIT_OUT_FLAGS        ;
        delete     out_WRITE_UNIT_OUT_EXCEPTION    ;
        delete     out_WRITE_UNIT_OUT_NO_SEQUENCE  ;
        delete     out_WRITE_UNIT_OUT_ADDRESS      ;

	// -----[ Interface "gpr_write" ]-------------------------------------
        delete []  out_GPR_WRITE_VAL               ;
        delete []   in_GPR_WRITE_ACK               ;
        if (_param->_have_port_ooo_engine_id)
	delete []  out_GPR_WRITE_OOO_ENGINE_ID     ;
        delete []  out_GPR_WRITE_NUM_REG           ;
        delete []  out_GPR_WRITE_DATA              ;
	
	// -----[ Interface "spr_write" ]-------------------------------------
        delete []  out_SPR_WRITE_VAL               ;
        delete []   in_SPR_WRITE_ACK               ;
        if (_param->_have_port_ooo_engine_id)
	delete []  out_SPR_WRITE_OOO_ENGINE_ID     ;
        delete []  out_SPR_WRITE_NUM_REG           ;
        delete []  out_SPR_WRITE_DATA              ;

	// -----[ Interface "bypass_write" ]----------------------------------
        if (_param->_have_port_ooo_engine_id)
	delete []  out_BYPASS_WRITE_OOO_ENGINE_ID ;
        delete []  out_BYPASS_WRITE_GPR_VAL       ;
        delete []  out_BYPASS_WRITE_GPR_NUM_REG   ;
        delete []  out_BYPASS_WRITE_GPR_DATA      ;
        delete []  out_BYPASS_WRITE_SPR_VAL       ;
        delete []  out_BYPASS_WRITE_SPR_NUM_REG   ;
        delete []  out_BYPASS_WRITE_SPR_DATA      ;

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

    delete component_write_queue;
    if (_param->_have_component_execute_queue)
      delete component_execute_queue;

    delete _component;

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

}; // 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              
