#undef  FUNCTION
#define FUNCTION "Load_store_unit::"

#ifdef SYSTEMC
/*
 * $Id$
 *
 * [ Description ]
 * 
 */

#include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Execute_unit/Execute_unit/Load_store_unit/include/Load_store_unit.h"

namespace morpheo                    {
namespace behavioural {
namespace core {
namespace multi_execute_loop {
namespace execute_loop {
namespace multi_execute_unit {
namespace execute_unit {
namespace load_store_unit {


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

//#if defined(STATISTICS) or defined(VHDL_TESTBENCH)
    delete    in_CLOCK ;
//#endif
    delete    in_NRESET;

    delete     in_MEMORY_IN_VAL         ;
    delete    out_MEMORY_IN_ACK         ;
    delete     in_MEMORY_IN_CONTEXT_ID  ;
    delete     in_MEMORY_IN_PACKET_ID   ;
    delete     in_MEMORY_IN_OPERATION   ;
#ifdef HAVE_MEMORY_OUT_TYPE
    delete     in_MEMORY_IN_TYPE        ;
#endif
    delete     in_MEMORY_IN_STORE_QUEUE_PTR_WRITE;
    delete     in_MEMORY_IN_LOAD_QUEUE_PTR_WRITE ;
//  delete     in_MEMORY_IN_HAS_IMMEDIAT;
    delete     in_MEMORY_IN_IMMEDIAT    ;
    delete     in_MEMORY_IN_DATA_RA     ;
    delete     in_MEMORY_IN_DATA_RB     ;
//  delete     in_MEMORY_IN_DATA_RC     ;
    delete     in_MEMORY_IN_WRITE_RD    ;
    delete     in_MEMORY_IN_NUM_REG_RD  ;
//  delete     in_MEMORY_IN_WRITE_RE    ;
//  delete     in_MEMORY_IN_NUM_REG_RE  ;
    
    delete    out_MEMORY_OUT_VAL       ;
    delete     in_MEMORY_OUT_ACK       ;
    delete    out_MEMORY_OUT_CONTEXT_ID;
    delete    out_MEMORY_OUT_PACKET_ID ;
#ifdef HAVE_MEMORY_OUT_OPERATION
    delete    out_MEMORY_OUT_OPERATION ;
#endif
#ifdef HAVE_MEMORY_OUT_TYPE
    delete    out_MEMORY_OUT_TYPE      ;
#endif
    delete    out_MEMORY_OUT_WRITE_RD  ;
    delete    out_MEMORY_OUT_NUM_REG_RD;
    delete    out_MEMORY_OUT_DATA_RD   ;
//  delete    out_MEMORY_OUT_WRITE_RE  ;
//  delete    out_MEMORY_OUT_NUM_REG_RE;
//  delete    out_MEMORY_OUT_DATA_RE   ;
    delete    out_MEMORY_OUT_EXCEPTION ;
    
    delete    out_DCACHE_REQ_VAL       ;
    delete     in_DCACHE_REQ_ACK       ;
    delete    out_DCACHE_REQ_CONTEXT_ID;
    delete    out_DCACHE_REQ_PACKET_ID ;
    delete    out_DCACHE_REQ_ADDRESS   ;
    delete    out_DCACHE_REQ_TYPE      ;
    delete    out_DCACHE_REQ_UNCACHED  ;
    delete    out_DCACHE_REQ_WDATA     ;
    
    delete     in_DCACHE_RSP_VAL       ;
    delete    out_DCACHE_RSP_ACK       ;
    delete     in_DCACHE_RSP_CONTEXT_ID;
    delete     in_DCACHE_RSP_PACKET_ID ;
    delete     in_DCACHE_RSP_RDATA     ;
    delete     in_DCACHE_RSP_ERROR     ;
    
    if (_param->_speculative_load == SPECULATIVE_LOAD_BYPASS)
      {
	delete [] out_BYPASS_MEMORY_VAL       ;
	delete [] out_BYPASS_MEMORY_CONTEXT_ID;
	delete [] out_BYPASS_MEMORY_NUM_REG   ;
	delete [] out_BYPASS_MEMORY_DATA      ;
      }
    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    

    delete    _component;

    delete [] _store_queue                      ;
    delete [] _load_queue	                ;
    delete    _speculative_access_queue_control ;
    delete [] _speculative_access_queue         ;

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

}; // end namespace load_store_unit
}; // end namespace execute_unit
}; // end namespace multi_execute_unit
}; // end namespace execute_loop
}; // end namespace multi_execute_loop
}; // end namespace core

}; // end namespace behavioural
}; // end namespace morpheo              
#endif
