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

#include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Branch_Target_Buffer/include/Branch_Target_Buffer.h"

namespace morpheo                    {
namespace behavioural {
namespace core {
namespace multi_front_end {
namespace front_end {
namespace prediction_unit {
namespace branch_target_buffer {


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

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

	delete []  in_PREDICT_VAL           ;
	delete [] out_PREDICT_ACK           ;
	if (_param->_have_port_context_id)
	delete []  in_PREDICT_CONTEXT_ID    ;
	delete []  in_PREDICT_ADDRESS       ;
	delete [] out_PREDICT_HIT           ;
	delete [] out_PREDICT_ADDRESS_SRC   ;
	delete [] out_PREDICT_ADDRESS_DEST  ;
	delete [] out_PREDICT_CONDITION     ;
	delete [] out_PREDICT_LAST_TAKE     ;
	delete [] out_PREDICT_IS_ACCURATE   ;

	delete []  in_DECOD_VAL             ;
	delete [] out_DECOD_ACK             ;
	if (_param->_have_port_context_id)
	delete []  in_DECOD_CONTEXT_ID      ;
	delete []  in_DECOD_ADDRESS_SRC     ;
	delete []  in_DECOD_ADDRESS_DEST    ;
	delete []  in_DECOD_CONDITION       ;
	delete []  in_DECOD_LAST_TAKE       ;
	delete []  in_DECOD_MISS_PREDICTION ;

	delete []  in_UPDATE_VAL            ;
	delete [] out_UPDATE_ACK            ;
	if (_param->_have_port_context_id)
	delete []  in_UPDATE_CONTEXT_ID     ;
	delete []  in_UPDATE_ADDRESS_SRC    ;
	delete []  in_UPDATE_ADDRESS_DEST   ;
	delete []  in_UPDATE_CONDITION      ;
	delete []  in_UPDATE_LAST_TAKE      ;
	delete []  in_UPDATE_MISS_PREDICTION;
      }
    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    

    if (_param->_have_component_victim)
      {
    delete [] _component_sort;
    delete _component_victim;
      }
    delete _component_branch_target_buffer_glue;
    delete _component_branch_target_buffer_register;

    delete _component;

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

}; // end namespace branch_target_buffer
}; // end namespace prediction_unit
}; // end namespace front_end
}; // end namespace multi_front_end
}; // end namespace core

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