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

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

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


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

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

	delete []  in_PREDICT_VAL                    ;
	delete [] out_PREDICT_ACK                    ;
	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 [] out_PREDICT_REGISTER_VAL           ;
	delete []  in_PREDICT_REGISTER_ACK           ;
	delete []  in_PREDICT_REGISTER_HIT           ;
	delete []  in_PREDICT_REGISTER_ADDRESS_SRC   ;
	delete []  in_PREDICT_REGISTER_ADDRESS_DEST  ;
	delete []  in_PREDICT_REGISTER_CONDITION     ;
	delete []  in_PREDICT_REGISTER_LAST_TAKE     ;
	delete []  in_PREDICT_REGISTER_IS_ACCURATE   ;
	if (_param->_have_port_victim)
	  {
	delete []  in_PREDICT_SORT_VAL               ;
	delete []  in_PREDICT_SORT_INDEX             ;
	delete [] out_PREDICT_VICTIM_VAL             ;
	delete []  in_PREDICT_VICTIM_ACK             ;
	delete [] out_PREDICT_VICTIM_HIT             ;
	if (not _param->_is_full_associative)
	delete [] out_PREDICT_VICTIM_ADDRESS         ;
	delete [] out_PREDICT_VICTIM_INDEX           ;
	delete []  in_PREDICT_VICTIM_VICTIM          ;
	  }
	delete []  in_DECOD_VAL                      ;
	delete [] out_DECOD_ACK                      ;
	if (not _param->_is_full_associative)
	delete []  in_DECOD_ADDRESS_SRC              ;
	delete [] out_DECOD_REGISTER_VAL             ;
	delete []  in_DECOD_REGISTER_ACK             ;
	if (_param->_have_port_victim)
	  {
	delete [] out_DECOD_VICTIM_VAL               ;
	delete []  in_DECOD_VICTIM_ACK               ;
	if (not _param->_is_full_associative)
	delete [] out_DECOD_VICTIM_ADDRESS           ;
	  }
	delete []  in_UPDATE_VAL                     ;
	delete [] out_UPDATE_ACK                     ;
	if (not _param->_is_full_associative)
	delete []  in_UPDATE_ADDRESS_SRC             ;
	delete [] out_UPDATE_REGISTER_VAL            ;
	delete []  in_UPDATE_REGISTER_ACK            ;
	if (_param->_have_port_victim)
	  {
	delete [] out_UPDATE_VICTIM_VAL              ;
	delete []  in_UPDATE_VICTIM_ACK              ;
	if (not _param->_is_full_associative)
	delete [] out_UPDATE_VICTIM_ADDRESS          ;
	  }
      }
    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    

    delete _component;

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

}; // end namespace branch_target_buffer_glue
}; // 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              
