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

#include "Behavioural/Generic/RegisterFile/RegisterFile_Multi_Banked/RegisterFile_Multi_Banked_Glue/include/RegisterFile_Multi_Banked_Glue.h"

namespace morpheo {
namespace behavioural {
namespace generic {
namespace registerfile{
namespace registerfile_multi_banked {
namespace registerfile_multi_banked_glue {

  void RegisterFile_Multi_Banked_Glue::deallocation (void)
  {
    log_printf(FUNC,RegisterFile_Multi_Banked_Glue,"deallocation","Begin");

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

   for (uint32_t i=0; i<_param._nb_port_read; i++)
     {
       delete  in_READ_IN_VAL       [i];
       delete out_READ_IN_ACK       [i];
       delete  in_READ_IN_ADDRESS   [i];
       delete out_READ_IN_DATA      [i];
     }
   						      
   delete  in_READ_IN_VAL    ;
   delete out_READ_IN_ACK    ;
   delete  in_READ_IN_ADDRESS;
   delete out_READ_IN_DATA   ;
   
   for (uint32_t i=0; i<_param._nb_bank; i++)
     {
       for (uint32_t j=0; j<_param._nb_port_read_by_bank; j++)
	 {
	   for (uint32_t k=0; k<_param._nb_port_select_by_bank_read_port[j]; k++)
	     {
	       delete out_READ_SELECT_VAL [i][j][k];
	       delete  in_READ_SELECT_ACK [i][j][k];
	     }
	   delete out_READ_SELECT_VAL [i][j];
	   delete  in_READ_SELECT_ACK [i][j];
	 }
       delete out_READ_SELECT_VAL [i];
       delete  in_READ_SELECT_ACK [i];
     }
   delete out_READ_SELECT_VAL;
   delete  in_READ_SELECT_ACK;
   
   for (uint32_t i=0; i<_param._nb_bank; i++)
      {
	for (uint32_t j=0; j<_param._nb_port_read_by_bank; j++)
	  {
	    delete out_READ_OUT_VAL      [i][j];
	    delete  in_READ_OUT_ACK      [i][j];
	    delete out_READ_OUT_ADDRESS  [i][j];
	    delete  in_READ_OUT_DATA     [i][j];
	  }

	delete out_READ_OUT_VAL      [i];
	delete  in_READ_OUT_ACK      [i];
	delete out_READ_OUT_ADDRESS  [i];
	delete  in_READ_OUT_DATA     [i];
      }

   delete out_READ_OUT_VAL    ;
   delete  in_READ_OUT_ACK    ;
   delete out_READ_OUT_ADDRESS;
   delete  in_READ_OUT_DATA   ;

   for (uint32_t i=0; i<_param._nb_port_write; i++)
     {
       delete  in_WRITE_IN_VAL      [i];
       delete out_WRITE_IN_ACK      [i];
       delete  in_WRITE_IN_ADDRESS  [i];
       delete  in_WRITE_IN_DATA     [i];
     }

   delete  in_WRITE_IN_VAL    ;
   delete out_WRITE_IN_ACK    ;
   delete  in_WRITE_IN_ADDRESS;
   delete  in_WRITE_IN_DATA   ;

   for (uint32_t i=0; i<_param._nb_bank; i++)
     {
       for (uint32_t j=0; j<_param._nb_port_write_by_bank; j++)
	 {
	   for (uint32_t k=0; k<_param._nb_port_select_by_bank_write_port[j]; k++)
	     {
	       delete out_WRITE_SELECT_VAL [i][j][k];
	       delete  in_WRITE_SELECT_ACK [i][j][k];
	     }
	   delete out_WRITE_SELECT_VAL [i][j];
	   delete  in_WRITE_SELECT_ACK [i][j];
	 }
       delete out_WRITE_SELECT_VAL [i];
       delete  in_WRITE_SELECT_ACK [i];
     }
   delete out_WRITE_SELECT_VAL;
   delete  in_WRITE_SELECT_ACK;
   
   for (uint32_t i=0; i<_param._nb_bank; i++)
     {
       for (uint32_t j=0; j<_param._nb_port_write_by_bank; j++)
	 {
	   delete out_WRITE_OUT_VAL     [i][j];
	   delete  in_WRITE_OUT_ACK     [i][j];
	   delete out_WRITE_OUT_ADDRESS [i][j];
	   delete out_WRITE_OUT_DATA    [i][j];
	 }
       
       delete out_WRITE_OUT_VAL     [i];
       delete  in_WRITE_OUT_ACK     [i];
       delete out_WRITE_OUT_ADDRESS [i];
       delete out_WRITE_OUT_DATA    [i];
     }
      
   delete out_WRITE_OUT_VAL    ;
   delete  in_WRITE_OUT_ACK    ;
   delete out_WRITE_OUT_ADDRESS;
   delete out_WRITE_OUT_DATA   ;
   
   // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    
   
   log_printf(FUNC,RegisterFile_Multi_Banked_Glue,"deallocation","End");
  };
  
}; // end namespace registerfile_multi_banked_glue
}; // end namespace registerfile_multi_banked
}; // end namespace registerfile
}; // end namespace generic
}; // end namespace behavioural
}; // end namespace morpheo              
#endif
