/*
 * $Id: Ifetch_unit_deallocation.cpp 88 2008-12-10 18:31:39Z rosiere $
 *
 * [ 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_is_set(_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_ifetch_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_ifetch_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_inst_ifetch_ptr)
	delete     in_PREDICT_INST_IFETCH_PTR             ;
	delete     in_PREDICT_BRANCH_STATE                ;
	if (_param->_have_port_depth)
	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_inst_ifetch_ptr)
	delete    out_DECOD_INST_IFETCH_PTR               ;
	delete    out_DECOD_BRANCH_STATE                  ;
	if (_param->_have_port_depth)
	delete    out_DECOD_BRANCH_UPDATE_PREDICTION_ID   ;
	delete    out_DECOD_EXCEPTION                     ;

	delete     in_EVENT_VAL                           ;
	delete    out_EVENT_ACK                           ;
	delete     in_EVENT_ADDRESS                       ;
	delete     in_EVENT_ADDRESS_NEXT                  ;
	delete     in_EVENT_ADDRESS_NEXT_VAL              ;
	delete     in_EVENT_IS_DS_TAKE                    ;
      }
    // ~~~~~[ 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              
