#ifndef morpheo_behavioural_generic_shifter_Shifter_h
#define morpheo_behavioural_generic_shifter_Shifter_h

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

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

#include <iostream>
#include "Include/ToString.h"

#include "Behavioural/Generic/Shifter/include/Parameters.h"
#include "Behavioural/Generic/Shifter/include/Types.h"
#ifdef STATISTICS
#include "Behavioural/Generic/Shifter/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 shifter {


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

  protected : const Parameters _param;
#ifdef STATISTICS
  private   : Statistics                     * _stat;
#endif

#ifdef VHDL_TESTBENCH
  private   : Vhdl_Testbench                 * _vhdl_testbench;
#endif

#ifdef SYSTEMC
    // ~~~~~[ Interface ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  public    : SC_CLOCK                      *  in_CLOCK             ;
    // Interface "shifter"
  public    : SC_IN (Tdata_t)              **  in_SHIFTER_DATA      ;
  public    : SC_IN (Tshift_t)             **  in_SHIFTER_SHIFT     ;
  public    : SC_IN (Tdirection_t)         **  in_SHIFTER_DIRECTION ;
  public    : SC_IN (Ttype_t)              **  in_SHIFTER_TYPE      ;
  public    : SC_IN (Tcarry_t)             **  in_SHIFTER_CARRY     ;
  public    : SC_IN (Tcontrol_t)           **  in_SHIFTER_CARRY_IN  ; // Completion == type bool
  public    : SC_IN (Tdata_t)              **  in_SHIFTER_COMPLETION; // Completion != type bool
  public    : SC_OUT(Tdata_t)              ** out_SHIFTER_DATA      ;
    
    // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    

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

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

#ifdef SYSTEMC
    SC_HAS_PROCESS (Shifter);
#endif

  public  :          Shifter              (
#ifdef SYSTEMC
					   sc_module_name                              name,
#else					       
					   string                                      name,
#endif					       
#ifdef STATISTICS
					   morpheo::behavioural::Parameters_Statistics param_statistics,
#endif
					   Parameters                                  param );
    
  public  :          Shifter              (Parameters param );
  public  :          ~Shifter             (void);
					       
#ifdef SYSTEMC				       
  private : void     allocation                (void);
  private : void     deallocation              (void);
					       
#if (defined(STATISTICS) || defined (VHDL_TESTBENCH))
  public  : void     transition                (void);
#endif
  public  : void     genMealy_shift            (void);
#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 STATISTICS
  public  : string   statistics                (uint32_t depth);
#endif
					       
#ifdef VHDL_TESTBENCH			       
  private : void     vhdl_testbench            (Vhdl_Testbench & vhdl_testbench);
  private : void     vhdl_testbench_port       (Vhdl_Testbench & vhdl_testbench);
  private : void     vhdl_testbench_transition (Vhdl_Testbench & vhdl_testbench);
#endif

  };

}; // end namespace shifter
}; // end namespace generic

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

#endif
