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

#include "Behavioural/Core/Multi_Front_end/Front_end/Ifetch_unit/include/Ifetch_unit.h"

namespace morpheo                    {
namespace behavioural {
namespace core {
namespace multi_front_end {
namespace front_end {
namespace ifetch_unit {


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

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

	delete    out_ICACHE_REQ_VAL                      ;
	delete     in_ICACHE_REQ_ACK                      ;
      //delete    out_ICACHE_REQ_THREAD_ID                ;
	if (_param->_have_port_queue_ptr)
	delete    out_ICACHE_REQ_PACKET_ID                ;
	delete    out_ICACHE_REQ_ADDRESS                  ;
	delete    out_ICACHE_REQ_TYPE                     ;

	delete     in_ICACHE_RSP_VAL                      ;
	delete    out_ICACHE_RSP_ACK                      ;
      //delete     in_ICACHE_RSP_THREAD_ID                ;
	if (_param->_have_port_queue_ptr)
        delete     in_ICACHE_RSP_PACKET_ID                ;
	delete []  in_ICACHE_RSP_INSTRUCTION              ;
	delete     in_ICACHE_RSP_ERROR                    ;

	delete    out_PREDICT_VAL                         ;
	delete     in_PREDICT_ACK                         ;
	delete    out_PREDICT_PC_PREVIOUS                 ;
	delete    out_PREDICT_PC_CURRENT                  ;
	delete    out_PREDICT_PC_CURRENT_IS_DS_TAKE       ;
	delete     in_PREDICT_PC_NEXT                     ;
	delete     in_PREDICT_PC_NEXT_IS_DS_TAKE          ;
	delete []  in_PREDICT_INSTRUCTION_ENABLE          ;
	if (_param->_have_port_instruction_ptr)
	delete     in_PREDICT_INST_IFETCH_PTR             ;
	delete     in_PREDICT_BRANCH_STATE                ;
	if (_param->_have_port_branch_update_prediction_id)
	delete     in_PREDICT_BRANCH_UPDATE_PREDICTION_ID ;

	delete [] out_DECOD_VAL                           ;
	delete []  in_DECOD_ACK                           ;
	delete [] out_DECOD_INSTRUCTION                   ;
      //delete    out_DECOD_CONTEXT_ID                    ;
	delete    out_DECOD_ADDRESS                       ;
	if (_param->_have_port_instruction_ptr)
	delete    out_DECOD_INST_IFETCH_PTR               ;
	delete    out_DECOD_BRANCH_STATE                  ;
	if (_param->_have_port_branch_update_prediction_id)
	delete    out_DECOD_BRANCH_UPDATE_PREDICTION_ID   ;
	delete    out_DECOD_EXCEPTION                     ;

	delete     in_EVENT_VAL                           ;
	delete    out_EVENT_ACK                           ;
	delete     in_EVENT_ADDRESS                       ;
      }
    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    
    delete _component_address_management;
    delete _component_ifetch_queue;
    delete _component_ifetch_unit_glue;
    delete _component;

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

}; // end namespace ifetch_unit
}; // end namespace front_end
}; // end namespace multi_front_end
}; // end namespace core

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