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

#include "Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod/include/Decod.h"

namespace morpheo                    {
namespace behavioural {
namespace core {
namespace multi_front_end {
namespace front_end {
namespace decod_unit {
namespace decod {


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

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

	delete []  in_IFETCH_VAL                         ;
	delete [] out_IFETCH_ACK                         ;
	delete []  in_IFETCH_INSTRUCTION                 ;
	if (_param->_have_port_context_id)
	delete []  in_IFETCH_CONTEXT_ID                  ;
	delete []  in_IFETCH_ADDRESS                     ;
// 	delete []  in_IFETCH_ADDRESS_NEXT                ;
	if (_param->_have_port_inst_ifetch_ptr)
	delete []  in_IFETCH_INST_IFETCH_PTR             ;
	delete []  in_IFETCH_BRANCH_STATE                ;
	if (_param->_have_port_branch_update_prediction_id)
	delete []  in_IFETCH_BRANCH_UPDATE_PREDICTION_ID ;

	delete [] out_DECOD_VAL                          ;
	delete []  in_DECOD_ACK                          ;
	if (_param->_have_port_context_id)
	delete [] out_DECOD_CONTEXT_ID                   ;
	if (_param->_have_port_depth)
	delete [] out_DECOD_DEPTH                        ;
	delete [] out_DECOD_TYPE                         ;
	delete [] out_DECOD_OPERATION                    ;
	delete [] out_DECOD_IS_DELAY_SLOT                ;
	delete [] out_DECOD_ADDRESS                      ;
	delete [] out_DECOD_HAS_IMMEDIAT                 ;
	delete [] out_DECOD_IMMEDIAT                     ;
	delete [] out_DECOD_READ_RA                      ;
	delete [] out_DECOD_NUM_REG_RA                   ;
	delete [] out_DECOD_READ_RB                      ;
	delete [] out_DECOD_NUM_REG_RB                   ;
	delete [] out_DECOD_READ_RC                      ;
	delete [] out_DECOD_NUM_REG_RC                   ;
	delete [] out_DECOD_WRITE_RD                     ;
	delete [] out_DECOD_NUM_REG_RD                   ;
	delete [] out_DECOD_WRITE_RE                     ;
	delete [] out_DECOD_NUM_REG_RE                   ;
	delete [] out_DECOD_EXCEPTION_USE                ;

	delete [] out_PREDICT_VAL                        ;
	delete []  in_PREDICT_ACK                        ;
	if (_param->_have_port_context_id)
	delete [] out_PREDICT_CONTEXT_ID                 ;
	delete [] out_PREDICT_BRANCH_STATE               ;
	delete [] out_PREDICT_MATCH_INST_IFETCH_PTR      ;
	if (_param->_have_port_branch_update_prediction_id)
	delete [] out_PREDICT_BRANCH_UPDATE_PREDICTION_ID;
	delete [] out_PREDICT_BRANCH_CONDITION           ;
// 	delete [] out_PREDICT_BRANCH_STACK_WRITE         ;
	delete [] out_PREDICT_BRANCH_DIRECTION           ;
	delete [] out_PREDICT_ADDRESS_SRC                ;
	delete [] out_PREDICT_ADDRESS_DEST               ;
// 	delete []  in_PREDICT_CAN_CONTINUE               ;

	delete []  in_CONTEXT_DECOD_ENABLE               ;
	if (_param->_have_port_depth)
	delete []  in_CONTEXT_DEPTH                      ;

	delete    out_CONTEXT_EVENT_VAL                  ;
	delete     in_CONTEXT_EVENT_ACK                  ;
	if (_param->_have_port_context_id)
	delete    out_CONTEXT_EVENT_CONTEXT_ID           ;
	delete    out_CONTEXT_EVENT_TYPE                 ;
	delete    out_CONTEXT_EVENT_IS_DELAY_SLOT        ;
	delete    out_CONTEXT_EVENT_ADDRESS              ;
	delete    out_CONTEXT_EVENT_ADDRESS_EPCR         ;
      }

    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    
    delete    reg_CONTEXT_ADDRESS_PREVIOUS      ;
    delete    reg_CONTEXT_IS_DELAY_SLOT         ;

    delete    internal_CONTEXT_HAVE_TRANSACTION ;
    delete    internal_CONTEXT_ADDRESS_PREVIOUS ;
    delete    internal_CONTEXT_IS_DELAY_SLOT    ;

    delete [] _function_decod   ;
    delete    _decod_instruction;
    delete    _decod_param      ;
    delete    _component;

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

}; // end namespace decod
}; // end namespace decod_unit
}; // end namespace front_end
}; // end namespace multi_front_end
}; // end namespace core

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