/*
 * $Id: Decod_unit_deallocation.cpp 88 2008-12-10 18:31:39Z rosiere $
 *
 * [ Description ]
 * 
 */

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

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


#undef  FUNCTION
#define FUNCTION "Decod_unit::deallocation"
  void Decod_unit::deallocation (void)
  {
    log_begin(Decod_unit,FUNCTION);

    if (usage_is_set(_usage,USE_SYSTEMC))
      {
	delete    in_CLOCK ;
	delete    in_NRESET;

	DELETE2_SIGNAL( in_IFETCH_VAL                         ,_param->_nb_context, _param->_nb_inst_fetch[it1],1);
        DELETE2_SIGNAL(out_IFETCH_ACK                         ,_param->_nb_context, _param->_nb_inst_fetch[it1],1);
        DELETE2_SIGNAL( in_IFETCH_INSTRUCTION                 ,_param->_nb_context, _param->_nb_inst_fetch[it1],_param->_size_instruction);
        
        DELETE1_SIGNAL(in_IFETCH_CONTEXT_ID                   ,_param->_nb_context,_param->_size_context_id      );
        DELETE1_SIGNAL(in_IFETCH_ADDRESS                      ,_param->_nb_context,_param->_size_general_data    );
//      DELETE1_SIGNAL(in_IFETCH_ADDRESS_NEXT                 ,_param->_nb_context,_param->_size_general_data    );
        DELETE1_SIGNAL(in_IFETCH_INST_IFETCH_PTR              ,_param->_nb_context,_param->_size_inst_ifetch_ptr );
        DELETE1_SIGNAL(in_IFETCH_BRANCH_STATE                 ,_param->_nb_context,_param->_size_branch_state    );
        DELETE1_SIGNAL(in_IFETCH_BRANCH_UPDATE_PREDICTION_ID  ,_param->_nb_context,_param->_size_depth           );
        DELETE1_SIGNAL(in_IFETCH_EXCEPTION                    ,_param->_nb_context,_param->_size_exception_ifetch);
        
        DELETE1_SIGNAL(out_DECOD_VAL                          ,_param->_nb_inst_decod,1);
        DELETE1_SIGNAL( in_DECOD_ACK                          ,_param->_nb_inst_decod,1);
        DELETE1_SIGNAL(out_DECOD_CONTEXT_ID                   ,_param->_nb_inst_decod,_param->_size_context_id            );
        DELETE1_SIGNAL(out_DECOD_DEPTH                        ,_param->_nb_inst_decod,_param->_size_depth                 );
        DELETE1_SIGNAL(out_DECOD_TYPE                         ,_param->_nb_inst_decod,_param->_size_type                  );
        DELETE1_SIGNAL(out_DECOD_OPERATION                    ,_param->_nb_inst_decod,_param->_size_operation             );
        DELETE1_SIGNAL(out_DECOD_NO_EXECUTE                   ,_param->_nb_inst_decod,1                                   );
        DELETE1_SIGNAL(out_DECOD_IS_DELAY_SLOT                ,_param->_nb_inst_decod,1                                   );
        DELETE1_SIGNAL(out_DECOD_ADDRESS                      ,_param->_nb_inst_decod,_param->_size_general_data          );
        DELETE1_SIGNAL(out_DECOD_HAS_IMMEDIAT                 ,_param->_nb_inst_decod,1                                   );
        DELETE1_SIGNAL(out_DECOD_IMMEDIAT                     ,_param->_nb_inst_decod,_param->_size_general_data          );
        DELETE1_SIGNAL(out_DECOD_READ_RA                      ,_param->_nb_inst_decod,1                                   );
        DELETE1_SIGNAL(out_DECOD_NUM_REG_RA                   ,_param->_nb_inst_decod,_param->_size_general_register_logic);
        DELETE1_SIGNAL(out_DECOD_READ_RB                      ,_param->_nb_inst_decod,1                                   );
        DELETE1_SIGNAL(out_DECOD_NUM_REG_RB                   ,_param->_nb_inst_decod,_param->_size_general_register_logic);
        DELETE1_SIGNAL(out_DECOD_READ_RC                      ,_param->_nb_inst_decod,1                                   );
        DELETE1_SIGNAL(out_DECOD_NUM_REG_RC                   ,_param->_nb_inst_decod,_param->_size_special_register_logic);
        DELETE1_SIGNAL(out_DECOD_WRITE_RD                     ,_param->_nb_inst_decod,1                                   );
        DELETE1_SIGNAL(out_DECOD_NUM_REG_RD                   ,_param->_nb_inst_decod,_param->_size_general_register_logic);
        DELETE1_SIGNAL(out_DECOD_WRITE_RE                     ,_param->_nb_inst_decod,1                                   );
        DELETE1_SIGNAL(out_DECOD_NUM_REG_RE                   ,_param->_nb_inst_decod,_param->_size_special_register_logic);
        DELETE1_SIGNAL(out_DECOD_EXCEPTION_USE                ,_param->_nb_inst_decod,_param->_size_exception_use         );
        DELETE1_SIGNAL(out_DECOD_EXCEPTION                    ,_param->_nb_inst_decod,_param->_size_exception_decod       );
        
        DELETE1_SIGNAL(out_PREDICT_VAL                        ,_param->_nb_inst_decod,1);
        DELETE1_SIGNAL( in_PREDICT_ACK                        ,_param->_nb_inst_decod,1);
        DELETE1_SIGNAL(out_PREDICT_CONTEXT_ID                 ,_param->_nb_inst_decod,_param->_size_context_id      );
        DELETE1_SIGNAL(out_PREDICT_MATCH_INST_IFETCH_PTR      ,_param->_nb_inst_decod,1                             );
        DELETE1_SIGNAL(out_PREDICT_BRANCH_STATE               ,_param->_nb_inst_decod,_param->_size_branch_state    );
        DELETE1_SIGNAL(out_PREDICT_BRANCH_UPDATE_PREDICTION_ID,_param->_nb_inst_decod,_param->_size_depth           );
        DELETE1_SIGNAL(out_PREDICT_BRANCH_CONDITION           ,_param->_nb_inst_decod,_param->_size_branch_condition);
//      DELETE1_SIGNAL(out_PREDICT_BRANCH_STACK_WRITE         ,_param->_nb_inst_decod,1                             );
        DELETE1_SIGNAL(out_PREDICT_BRANCH_DIRECTION           ,_param->_nb_inst_decod,1                             );
        DELETE1_SIGNAL(out_PREDICT_ADDRESS_SRC                ,_param->_nb_inst_decod,_param->_size_general_data    );
        DELETE1_SIGNAL(out_PREDICT_ADDRESS_DEST               ,_param->_nb_inst_decod,_param->_size_general_data    );
//      DELETE1_SIGNAL( in_PREDICT_CAN_CONTINUE               ,_param->_nb_inst_decod,1                             );
        
        DELETE1_SIGNAL( in_DEPTH_MIN                          ,_param->_nb_context,_param->_size_depth  );
        DELETE1_SIGNAL( in_DEPTH_MAX                          ,_param->_nb_context,_param->_size_depth+1);
        
        DELETE1_SIGNAL(out_NB_INST_DECOD_ALL                  ,_param->_nb_context,_param->_size_nb_inst_decod);
        
        DELETE1_SIGNAL(in_CONTEXT_DECOD_ENABLE                ,_param->_nb_context,1);
        DELETE1_SIGNAL(in_CONTEXT_DEPTH                       ,_param->_nb_context,_param->_size_depth);
        
        DELETE_SIGNAL(out_CONTEXT_EVENT_VAL                   ,1);
        DELETE_SIGNAL( in_CONTEXT_EVENT_ACK                   ,1);
        DELETE_SIGNAL(out_CONTEXT_EVENT_CONTEXT_ID            ,_param->_size_context_id  );
        DELETE_SIGNAL(out_CONTEXT_EVENT_DEPTH                 ,_param->_size_depth       );
        DELETE_SIGNAL(out_CONTEXT_EVENT_TYPE                  ,_param->_size_event_type  );
        DELETE_SIGNAL(out_CONTEXT_EVENT_IS_DELAY_SLOT         ,1                         );
        DELETE_SIGNAL(out_CONTEXT_EVENT_ADDRESS               ,_param->_size_general_data);
        DELETE_SIGNAL(out_CONTEXT_EVENT_ADDRESS_EPCR          ,_param->_size_general_data);
      }
    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    

    delete _component;
    delete _component_decod;
    delete _component_decod_queue;

    log_end(Decod_unit,FUNCTION);
  };

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

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