#ifndef morpheo_behavioural_generic_registerfile_registerfile_multi_banked_registerfile_multi_banked_glue_RegisterFile_Multi_Banked_Glue_h
#define morpheo_behavioural_generic_registerfile_registerfile_multi_banked_registerfile_multi_banked_glue_RegisterFile_Multi_Banked_Glue_h

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

#ifdef SYSTEMC
#include "systemc.h"
#endif

#include <iostream>
#include "Common/include/ToString.h"
#include "Common/include/Debug.h"

#include "Behavioural/Generic/RegisterFile/RegisterFile_Multi_Banked/RegisterFile_Multi_Banked_Glue/include/Parameters.h"
#include "Behavioural/Generic/RegisterFile/RegisterFile_Multi_Banked/RegisterFile_Multi_Banked_Glue/include/Types.h"
#ifdef STATISTICS	     			  
#include "Behavioural/Generic/RegisterFile/RegisterFile_Multi_Banked/RegisterFile_Multi_Banked_Glue/include/Statistics.h"
#endif
#ifdef VHDL
#include "Behavioural/include/Vhdl.h"
#endif
#ifdef VHDL_TESTBENCH
#include "Behavioural/include/Vhdl_Testbench.h"
#endif

using namespace std;

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


  class RegisterFile_Multi_Banked_Glue 
#if SYSTEMC
    : public sc_module
#endif
  {
    // -----[ fields ]----------------------------------------------------
    // Parameters
  protected : const string     _name;

  protected : const Parameters _param;
//#ifdef STATISTICS
//  protected : const morpheo::behavioural::Parameters_Statistics _param_statistics;
//#endif

#ifdef STATISTICS
  private   : Statistics                     * _stat;
#endif

#ifdef VHDL_TESTBENCH
  private   : Vhdl_Testbench                 * _vhdl_testbench;
#endif

#ifdef SYSTEMC
    // ~~~~~[ Interface ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    // Interface
  public    : SC_CLOCK                      *  in_CLOCK             ;
								    
  public    : SC_IN (Tcontrol_t)           **  in_READ_IN_VAL       ;
  public    : SC_OUT(Tcontrol_t)           ** out_READ_IN_ACK       ;
  public    : SC_IN (Taddress_t)           **  in_READ_IN_ADDRESS   ;
  public    : SC_OUT(Tdata_t   )           ** out_READ_IN_DATA      ;

  public    : SC_OUT(Tcontrol_t)         **** out_READ_SELECT_VAL   ;
  public    : SC_IN (Tcontrol_t)         ****  in_READ_SELECT_ACK   ;

  public    : SC_OUT(Tcontrol_t)          *** out_READ_OUT_VAL      ;
  public    : SC_IN (Tcontrol_t)          ***  in_READ_OUT_ACK      ;
  public    : SC_OUT(Taddress_t)          *** out_READ_OUT_ADDRESS  ;
  public    : SC_IN (Tdata_t   )          ***  in_READ_OUT_DATA     ;

  public    : SC_IN (Tcontrol_t)           **  in_WRITE_IN_VAL      ;
  public    : SC_OUT(Tcontrol_t)           ** out_WRITE_IN_ACK      ;
  public    : SC_IN (Taddress_t)           **  in_WRITE_IN_ADDRESS  ;
  public    : SC_IN (Tdata_t   )           **  in_WRITE_IN_DATA     ;

  public    : SC_OUT(Tcontrol_t)         **** out_WRITE_SELECT_VAL  ;
  public    : SC_IN (Tcontrol_t)         ****  in_WRITE_SELECT_ACK  ;

  public    : SC_OUT(Tcontrol_t)          *** out_WRITE_OUT_VAL     ;
  public    : SC_IN (Tcontrol_t)          ***  in_WRITE_OUT_ACK     ;
  public    : SC_OUT(Taddress_t)          *** out_WRITE_OUT_ADDRESS ;
  public    : SC_OUT(Tdata_t   )          *** out_WRITE_OUT_DATA    ;
      
    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    

    // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    

    // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#endif

    // -----[ methods ]---------------------------------------------------

#ifdef SYSTEMC
    SC_HAS_PROCESS (RegisterFile_Multi_Banked_Glue);
#endif
  public  :          RegisterFile_Multi_Banked_Glue              (
#ifdef SYSTEMC
					      sc_module_name                              name,
#else					       
					      string                                      name,
#endif					       
#ifdef STATISTICS
					      morpheo::behavioural::Parameters_Statistics param_statistics,
#endif
					      Parameters                                  param );
					       
  public  :          RegisterFile_Multi_Banked_Glue              (Parameters param );
  public  :          ~RegisterFile_Multi_Banked_Glue             (void);
					       
#ifdef SYSTEMC				       
    // function pointer
  public : uint32_t  (morpheo::behavioural::generic::registerfile::registerfile_multi_banked::registerfile_multi_banked_glue::RegisterFile_Multi_Banked_Glue::*link_port_read_in_to_out    ) (uint32_t, uint32_t);
  public : uint32_t  (morpheo::behavioural::generic::registerfile::registerfile_multi_banked::registerfile_multi_banked_glue::RegisterFile_Multi_Banked_Glue::*link_port_read_in_to_select ) (uint32_t, uint32_t);
  public : uint32_t  (morpheo::behavioural::generic::registerfile::registerfile_multi_banked::registerfile_multi_banked_glue::RegisterFile_Multi_Banked_Glue::*link_port_write_in_to_out   ) (uint32_t, uint32_t);
  public : uint32_t  (morpheo::behavioural::generic::registerfile::registerfile_multi_banked::registerfile_multi_banked_glue::RegisterFile_Multi_Banked_Glue::*link_port_write_in_to_select) (uint32_t, uint32_t);

  public : uint32_t  full_crossbar_link_port_read_in_to_out        (uint32_t num_port, uint32_t num_bank);
  public : uint32_t  full_crossbar_link_port_read_in_to_select     (uint32_t num_port, uint32_t num_bank);
  public : uint32_t  full_crossbar_link_port_write_in_to_out       (uint32_t num_port, uint32_t num_bank);
  public : uint32_t  full_crossbar_link_port_write_in_to_select    (uint32_t num_port, uint32_t num_bank);
  public : uint32_t  partial_crossbar_link_port_read_in_to_out     (uint32_t num_port, uint32_t num_bank);
  public : uint32_t  partial_crossbar_link_port_read_in_to_select  (uint32_t num_port, uint32_t num_bank);
  public : uint32_t  partial_crossbar_link_port_write_in_to_out    (uint32_t num_port, uint32_t num_bank);
  public : uint32_t  partial_crossbar_link_port_write_in_to_select (uint32_t num_port, uint32_t num_bank);

  private : void     allocation                (void);
  private : void     deallocation              (void);
					       
#if defined(STATISTICS) or defined(VHDL_TESTBENCH)
  public  : void     transition                (void);
#endif
  public  : void     genMealy_read_in          (void);
  public  : void     genMealy_read_out         (void);
  public  : void     genMealy_read_select      (void);

#endif					       
#ifdef STATISTICS
  public  : string   statistics                (uint32_t depth);
#endif
					       
#if VHDL				       
  public  : void     vhdl                      (void);
  private : void     vhdl_port                 (Vhdl & vhdl);
  private : void     vhdl_declaration          (Vhdl & vhdl);
  private : void     vhdl_body                 (Vhdl & vhdl);
#endif					       
					       
#ifdef VHDL_TESTBENCH			       
  private : void     vhdl_testbench_transition (void);
#endif
  public  : void     vhdl_testbench_label      (string label);
  };

}; // end namespace registerfile_multi_banked_glue
}; // end namespace registerfile_multi_banked
}; // end namespace registerfile
}; // end namespace generic

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

#endif
