Index: /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/Makefile
===================================================================
--- /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/Makefile	(revision 9)
+++ /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/Makefile	(revision 9)
@@ -0,0 +1,23 @@
+# 
+# $Id$
+# 
+# [ Description ]
+# 
+# Makefile
+# 
+
+#-----[ Directory ]----------------------------------------
+DIR_MORPHEO			= ../../..
+
+#-----[ Library ]------------------------------------------
+LIBRARY				= $(DIR_LIB)/libRegisterFile.a
+
+
+#-----[ include ]------------------------------------------
+
+all				: $(LIBRARY_NEED)
+				@$(MAKE) all_component
+
+include                         $(DIR_MORPHEO)/Behavioural/Makefile.defs
+include				$(DIR_MORPHEO)/Behavioural/Makefile.Common
+include				$(DIR_MORPHEO)/Behavioural/Makefile.Component
Index: /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/Makefile.deps
===================================================================
--- /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/Makefile.deps	(revision 9)
+++ /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/Makefile.deps	(revision 9)
@@ -0,0 +1,37 @@
+# 
+# $Id$
+# 
+# [ Description ]
+# 
+# Makefile
+# 
+# DIR_MORPHEO must be defined
+
+ifndef Behavioural
+include 			$(DIR_MORPHEO)/Behavioural/Makefile.deps
+endif
+ifndef Group
+include 			$(DIR_MORPHEO)/Behavioural/Generic/Group/Makefile.deps
+endif
+
+RegisterFile			= yes
+#-----[ Library ]------------------------------------------
+RegisterFile_LIBRARY		= 	-lRegisterFile		\
+					$(Group_LIBRARY)	\
+					$(Behavioural_LIBRARY)	
+
+RegisterFile_DIR_LIBRARY	=	-L$(DIR_MORPHEO)/Behavioural/Generic/RegisterFile/lib	\
+					$(Group_DIR_LIBRARY)					\
+					$(Behavioural_DIR_LIBRARY)	
+
+#-----[ Rules ]--------------------------------------------
+
+RegisterFile_library		:
+				@$(MAKE)  Behavioural_library
+				@$(MAKE)  Group_library
+				@$(MAKE) --directory=$(DIR_MORPHEO)/Behavioural/Generic/RegisterFile --makefile=Makefile 
+	
+RegisterFile_library_clean	:
+				@$(MAKE)  Behavioural_library_clean
+				@$(MAKE)  Group_library_clean
+				@$(MAKE) --directory=$(DIR_MORPHEO)/Behavioural/Generic/RegisterFile --makefile=Makefile clean
Index: /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/SelfTest/Makefile
===================================================================
--- /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/SelfTest/Makefile	(revision 9)
+++ /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/SelfTest/Makefile	(revision 9)
@@ -0,0 +1,29 @@
+# 
+# $Id$
+# 
+# [ Description ]
+# 
+# Makefile
+# 
+
+#-----[ Directory ]----------------------------------------
+DIR_MORPHEO			= ../../../..
+
+LIBRARY				= $(RegisterFile_LIBRARY)
+
+DIR_LIBRARY			= $(RegisterFile_DIR_LIBRARY)
+
+#-----[ include ]------------------------------------------
+
+all				: library
+				@$(MAKE) all_selftest
+
+library				: RegisterFile_library
+
+library_clean			: RegisterFile_library_clean
+
+include                         ../Makefile.deps
+include                         $(DIR_MORPHEO)/Behavioural/Makefile.defs
+include				$(DIR_MORPHEO)/Behavioural/Makefile.Common
+include				$(DIR_MORPHEO)/Behavioural/Makefile.Selftest
+include				$(DIR_MORPHEO)/Behavioural/Makefile.Synthesis
Index: /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/SelfTest/configuration.cfg
===================================================================
--- /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/SelfTest/configuration.cfg	(revision 9)
+++ /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/SelfTest/configuration.cfg	(revision 9)
@@ -0,0 +1,5 @@
+RegisterFile
+1	8 	*2	# nb_port_read
+1	4	*2	# nb_port_write
+64	256	*2	# nb_word
+32	32	*2	# size_word
Index: /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/SelfTest/include/test.h
===================================================================
--- /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/SelfTest/include/test.h	(revision 9)
+++ /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/SelfTest/include/test.h	(revision 9)
@@ -0,0 +1,25 @@
+/*
+ * $Id$
+ *
+ * [ Description ]
+ * 
+ * Test "RegisterFile"
+ */
+
+#ifdef SYSTEMC
+#include "systemc.h"
+#endif
+
+#include <string>
+#include <iostream>
+
+#include "Behavioural/Generic/RegisterFile/include/RegisterFile.h"
+
+using namespace std;
+using namespace morpheo;
+using namespace morpheo::behavioural;
+using namespace morpheo::behavioural::generic;
+using namespace morpheo::behavioural::generic::registerfile;
+
+void test   (string name,
+	     morpheo::behavioural::generic::registerfile::Parameters param);
Index: /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/SelfTest/mkf.info
===================================================================
--- /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/SelfTest/mkf.info	(revision 9)
+++ /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/SelfTest/mkf.info	(revision 9)
@@ -0,0 +1,11 @@
+
+# RegisterFile_34
+target_dep	all	RegisterFile_34.ngc
+target_dep	RegisterFile_34.ngc	RegisterFile_34.prj
+target_dep	RegisterFile_34.prj	RegisterFile_34_Pack.vhdl RegisterFile_34.vhdl
+
+# RegisterFile_35
+target_dep	all	RegisterFile_35.ngc
+target_dep	RegisterFile_35.ngc	RegisterFile_35.prj
+target_dep	RegisterFile_35.prj	RegisterFile_35_Pack.vhdl RegisterFile_35.vhdl
+
Index: /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/SelfTest/src/main.cpp
===================================================================
--- /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/SelfTest/src/main.cpp	(revision 9)
+++ /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/SelfTest/src/main.cpp	(revision 9)
@@ -0,0 +1,46 @@
+/*
+ * $Id$
+ *
+ * [ Description ]
+ * 
+ */
+
+#include "Behavioural/Generic/RegisterFile/SelfTest/include/test.h"
+
+#define NB_PARAMS 4
+
+void usage (string exec)
+{
+  cerr << "<Usage> " << exec << " name_instance list_params" << endl
+       << "list_params is :" << endl
+       << " - nb_port_read  (unsigned int)" << endl
+       << " - nb_port_write (unsigned int)" << endl
+       << " - nb_word       (unsigned int)" << endl
+       << " - size_word     (unsigned int)" << endl;
+  exit (1);
+}
+
+#ifndef SYSTEMC
+int main    (int argc, char * argv[])
+#else
+int sc_main (int argc, char * argv[])
+#endif
+{
+  if (argc <  2+NB_PARAMS)
+    usage (argv[0]);
+
+  const string   name          = argv[1];
+  const uint32_t nb_port_read  = atoi(argv[2]);
+  const uint32_t nb_port_write = atoi(argv[3]);
+  const uint32_t nb_word       = atoi(argv[4]);
+  const uint32_t size_word     = atoi(argv[5]);
+  
+  morpheo::behavioural::generic::registerfile::Parameters param (nb_port_read ,
+								 nb_port_write,
+								 nb_word      ,
+								 size_word    );
+
+  test (name,param);
+
+  return (EXIT_SUCCESS);
+}
Index: /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/SelfTest/src/test.cpp
===================================================================
--- /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/SelfTest/src/test.cpp	(revision 9)
+++ /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/SelfTest/src/test.cpp	(revision 9)
@@ -0,0 +1,197 @@
+/*
+ * $Id$
+ *
+ * [ Description ]
+ * 
+ * Test
+ */
+
+#include "Behavioural/Generic/RegisterFile/SelfTest/include/test.h"
+#include "Include/Test.h"
+
+void test (string name,
+	   morpheo::behavioural::generic::registerfile::Parameters param)
+{
+  cout << "<" << name << "> : Simulation SystemC" << endl;
+
+  try 
+    {
+      cout << param.print(1);
+      param.test();
+    }
+  catch (morpheo::ErrorMorpheo & error)
+    {
+      cout << "<" << name << "> : " <<  error.what ();
+      return;
+    }
+  catch (...)
+    {
+      cerr << "<" << name << "> : This test must generate a error" << endl;
+      exit (EXIT_FAILURE);
+    }
+
+  RegisterFile * registerfile = new RegisterFile (name.c_str(),
+#ifdef STATISTICS
+						  morpheo::behavioural::Parameters_Statistics(5,50),
+#endif
+						  param);
+  
+#ifdef SYSTEMC
+  /*********************************************************************
+   * Déclarations des signaux
+   *********************************************************************/
+  sc_clock                                 CLOCK ("clock", 1.0, 0.5);
+  sc_signal<Tcontrol_t>                    NRESET;
+  
+  sc_signal<Tcontrol_t>                    READ_VAL      [param._nb_port_read];
+  sc_signal<Tcontrol_t>                    READ_ACK      [param._nb_port_read];
+  sc_signal<Taddress_t>                    READ_ADDRESS  [param._nb_port_read];
+  sc_signal<Tdata_t>                       READ_DATA     [param._nb_port_read];
+
+  sc_signal<Tcontrol_t>                    WRITE_VAL     [param._nb_port_write];
+  sc_signal<Tcontrol_t>                    WRITE_ACK     [param._nb_port_write];
+  sc_signal<Taddress_t>                    WRITE_ADDRESS [param._nb_port_write];
+  sc_signal<Tdata_t>                       WRITE_DATA    [param._nb_port_write];
+
+  /********************************************************
+   * Instanciation
+   ********************************************************/
+  
+  cout << "<" << name << "> Instanciation of registerFile" << endl;
+  
+  (*(registerfile->in_CLOCK))        (CLOCK);
+  (*(registerfile->in_NRESET))       (NRESET);
+
+  for (uint32_t i=0; i<param._nb_port_read; i++)
+    {
+      (*(registerfile-> in_READ_VAL      [i]))        (READ_VAL      [i]);
+      (*(registerfile->out_READ_ACK      [i]))        (READ_ACK      [i]);
+      (*(registerfile-> in_READ_ADDRESS  [i]))        (READ_ADDRESS  [i]);
+      (*(registerfile->out_READ_DATA     [i]))        (READ_DATA     [i]);
+    }
+
+  for (uint32_t i=0; i<param._nb_port_write; i++)
+    {
+      (*(registerfile-> in_WRITE_VAL     [i]))        (WRITE_VAL     [i]);
+      (*(registerfile->out_WRITE_ACK     [i]))        (WRITE_ACK     [i]);
+      (*(registerfile-> in_WRITE_ADDRESS [i]))        (WRITE_ADDRESS [i]);
+      (*(registerfile-> in_WRITE_DATA    [i]))        (WRITE_DATA    [i]);
+    }
+  
+  /********************************************************
+   * Simulation - Begin
+   ********************************************************/
+
+  cout << "<" << name << "> Start Simulation ............" << endl;
+  // Initialisation
+
+  sc_start(0);
+  
+  for (uint32_t i=0; i<param._nb_port_write; i++)
+    WRITE_VAL [i] .write (0);
+
+  for (uint32_t i=0; i<param._nb_port_read; i++)
+    READ_VAL  [i] .write (0);
+
+  sc_start(5);
+
+  cout << "<" << name << "> Write the RegisterFile (no read)" << endl;
+
+  uint32_t grain = 0;
+  //uint32_t grain = static_cast<uint32_t>(time(NULL));
+  
+  srand(grain);
+  
+  Tdata_t    data, data_wait;
+  Taddress_t address = 0;
+
+  while (address < param._nb_word)
+    {
+      uint32_t num_port = 0;
+      
+      cout << "cycle : " << static_cast<uint32_t> (sc_simulation_time()) << endl;
+
+      while (num_port<param._nb_port_write)
+	{
+	  data = rand()%(1<<(param._size_word-1));
+
+	  cout << "(" << num_port << ") [" << address << "] <= " << data << endl;
+	  WRITE_VAL  [num_port] .write(1);
+	  WRITE_DATA    [num_port] .write(data);
+	  WRITE_ADDRESS [num_port] .write(address);
+
+	  address  ++;
+	  num_port ++;
+	  // Address can be not a multiple of nb_port_write
+	  if (address >= param._nb_word)
+	    break;
+	}
+
+      while (num_port<param._nb_port_write)
+	{
+	  WRITE_VAL  [num_port] .write(0);
+	  num_port ++;
+	}
+
+      sc_start(1);
+    }
+  cout << "<" << name << "> Read the RegisterFile (no write)" << endl;
+
+  srand(grain);
+
+  for (uint32_t i=0; i<param._nb_port_write; i++)
+    WRITE_VAL [i] .write (0);
+
+  sc_start(1);
+
+  address  = 0;
+  while (address < param._nb_word)
+    {
+      uint32_t num_port = 0;
+
+      cout << "cycle : " << static_cast<uint32_t> (sc_simulation_time()) << endl;
+      
+      while (num_port<param._nb_port_read)
+	{
+	  READ_VAL  [num_port] .write(1);
+	  READ_ADDRESS [num_port] .write(address);
+
+	  sc_start(0); // evaluation
+
+	  data_wait = rand()%(1<<(param._size_word-1));
+	  data      = READ_DATA    [num_port] .read();
+
+	  cout << "(" << num_port << ") [" << address << "] => " << data << endl;
+
+	  TEST(Tdata_t,data,data_wait);
+
+	  address  ++;
+	  num_port ++;
+	  if (address >= param._nb_word)
+	    break;
+	}
+
+      while (num_port<param._nb_port_read)
+	{
+	  READ_VAL  [num_port] .write(0);
+	  num_port ++;
+	}
+
+      sc_start(1);
+    }
+
+  for (uint32_t i=0; i<param._nb_port_read; i++)
+    READ_VAL  [i] .write (0);
+
+  sc_start(1);
+
+  /********************************************************
+   * Simulation - End
+   ********************************************************/
+
+  cout << "<" << name << "> ............ Stop Simulation" << endl;
+
+#endif
+
+  delete registerfile;
+}
Index: /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/include/Parameters.h
===================================================================
--- /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/include/Parameters.h	(revision 9)
+++ /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/include/Parameters.h	(revision 9)
@@ -0,0 +1,46 @@
+#ifndef morpheo_behavioural_generic_registerfile_Parameters_h
+#define morpheo_behavioural_generic_registerfile_Parameters_h
+
+/*
+ * $Id$
+ *
+ * [ Description ]
+ * 
+ */
+
+#include "Include/Debug.h"
+#include "Behavioural/include/Parameters.h"
+#include <math.h>
+
+namespace morpheo                    {
+namespace behavioural                {
+namespace generic                    {
+namespace registerfile               {
+
+  class Parameters : public morpheo::behavioural::Parameters
+  {
+  public : const uint32_t _nb_port_read ;
+  public : const uint32_t _nb_port_write;
+  public : const uint32_t _nb_word      ;
+  public : const uint32_t _size_word    ;
+
+  public : Parameters (uint32_t nb_port_read ,
+		       uint32_t nb_port_write,
+		       uint32_t nb_word      ,
+		       uint32_t size_word    );
+  public : Parameters (Parameters & param) ;
+  public : ~Parameters () ;
+
+  public : string msg_error (void);
+
+  public :        string   print      (uint32_t depth);
+  public : friend ostream& operator<< (ostream& output_stream,
+				       morpheo::behavioural::generic::registerfile::Parameters & x);
+  };
+
+}; // end namespace registerfile 
+}; // end namespace generic
+}; // end namespace behavioural          
+}; // end namespace morpheo              
+
+#endif
Index: /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/include/RegisterFile.h
===================================================================
--- /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/include/RegisterFile.h	(revision 9)
+++ /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/include/RegisterFile.h	(revision 9)
@@ -0,0 +1,137 @@
+#ifndef morpheo_behavioural_generic_registerfile_RegisterFile
+#define morpheo_behavioural_generic_registerfile_RegisterFile
+
+/*
+ * $Id$
+ *
+ * [ Description ]
+ * 
+ */
+
+#ifdef SYSTEMC
+#include "systemc.h"
+#endif
+
+#include "Include/Debug.h"
+#include "Include/ToString.h"
+#include <iostream>
+using namespace std;
+
+#include "Behavioural/Generic/RegisterFile/include/Parameters.h"
+#include "Behavioural/Generic/RegisterFile/include/Types.h"
+#ifdef STATISTICS
+#include "Behavioural/Generic/RegisterFile/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               {
+
+  class RegisterFile 
+#if SYSTEMC
+    : public sc_module
+#endif
+  {
+    // -----[ fields ]----------------------------------------------------
+    // Parameters
+  protected : const string     _name;
+
+  protected : const Parameters _param;
+#ifdef STATISTICS
+  private   : Statistics                     * _stat;
+    
+  private   : uint32_t                         _stat_nb_read;
+  private   : uint32_t                         _stat_nb_write;
+#endif
+
+#ifdef VHDL_TESTBENCH
+  private   : Vhdl_Testbench                 * _vhdl_testbench;
+#endif
+
+#ifdef SYSTEMC
+    // ~~~~~[ Interface ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+    // Interface
+  public    : SC_CLOCK                      *  in_CLOCK        ;
+  public    : SC_CLOCK                      *  in_NRESET       ;
+
+    // ----- Interface Read
+  public    : SC_IN       (Tcontrol_t)     **  in_READ_VAL     ;
+  public    : SC_OUT      (Tcontrol_t)     ** out_READ_ACK     ;
+  public    : SC_IN       (Taddress_t)     **  in_READ_ADDRESS ;
+  public    : SC_OUT      (Tdata_t)        ** out_READ_DATA    ;
+
+    // ----- Interface Write
+  public    : SC_IN       (Tcontrol_t)     **  in_WRITE_VAL    ;
+  public    : SC_OUT      (Tcontrol_t)     ** out_WRITE_ACK    ;
+  public    : SC_IN       (Taddress_t)     **  in_WRITE_ADDRESS;
+  public    : SC_IN       (Tdata_t)        **  in_WRITE_DATA   ;
+
+    // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    
+  private   : SC_REGISTER (Tdata_t)        ** reg_DATA         ;
+
+    // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#endif
+
+    // -----[ methods ]---------------------------------------------------
+
+#ifdef SYSTEMC
+    SC_HAS_PROCESS (RegisterFile);
+#endif					       
+
+  public  :          RegisterFile              (
+#ifdef SYSTEMC
+						sc_module_name                              name,
+#else					       
+						string                                      name,
+#endif					       
+#ifdef STATISTICS
+						morpheo::behavioural::Parameters_Statistics param_statistics,
+#endif
+					        Parameters                                  param );
+					       
+  public  :          RegisterFile              (Parameters param );
+  public  :          ~RegisterFile             (void);
+					       
+#ifdef SYSTEMC				       
+  private : void     allocation                (void);
+  private : void     deallocation              (void);
+					       
+  public  : void     transition                (void);
+//public  : void     genMoore                  (void) {/* empty */};
+  public  : void     genMealy_read             (void);
+#endif					       
+
+#ifdef STATISTICS
+  public  : string  statistics                 (uint32_t depth);
+#endif					       
+#if VHDL				       
+  private : void     vhdl                      (void);
+  private : void     vhdl_port                 (Vhdl & vhdl);
+  private : void     vhdl_type                 (Vhdl & vhdl);
+  private : void     vhdl_signal               (Vhdl & vhdl);
+  private : void     vhdl_body                 (Vhdl & vhdl);
+#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 registerfile 
+}; // end namespace generic
+}; // end namespace behavioural          
+}; // end namespace morpheo              
+
+#endif
Index: /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/include/Statistics.h
===================================================================
--- /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/include/Statistics.h	(revision 9)
+++ /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/include/Statistics.h	(revision 9)
@@ -0,0 +1,56 @@
+#ifdef STATISTICS
+#ifndef morpheo_behavioural_generic_registerfile_Statistics_h
+#define morpheo_behavioural_generic_registerfile_Statistics_h
+
+/*
+ * $Id$
+ *
+ * [ Description ]
+ * 
+ */
+
+#include "Include/Debug.h"
+#include "Behavioural/include/Statistics.h"
+#include "Behavioural/include/Parameters_Statistics.h"
+#include "Behavioural/Generic/Group/include/Statistics.h"
+#include "Behavioural/Generic/RegisterFile/include/Parameters.h"
+
+using namespace morpheo::behavioural::generic::group;
+
+namespace morpheo                    {
+namespace behavioural                {
+namespace generic                    {
+namespace registerfile               {
+
+  class Statistics : public morpheo::behavioural::Statistics
+  {
+    // -----[ fields ]----------------------------------------------------
+  private  : const Parameters                                   _parameters;
+  private  : morpheo::behavioural::generic::group::Statistics * _stat_port_read;
+  private  : morpheo::behavioural::generic::group::Statistics * _stat_port_write;
+
+    // -----[ methods ]---------------------------------------------------
+  public   : Statistics (string                                      name                       ,
+			 morpheo::behavioural::Parameters_Statistics parameters_statistics      ,
+			 Parameters                                  parameters
+			 );
+//public   : Statistics (Statistics & stat);
+  public   : ~Statistics () ;
+    
+  public   : string   print_body (uint32_t depth);
+  public   : string   print      (uint32_t depth);
+  public   : void     add        (uint32_t nb_read,
+				  uint32_t nb_write);
+
+  public   : friend ostream& operator<< (ostream& output_stream,
+					 const Statistics & x);
+
+  };
+
+}; // end namespace registerfile 
+}; // end namespace generic
+}; // end namespace behavioural
+}; // end namespace morpheo
+
+#endif
+#endif
Index: /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/include/Types.h
===================================================================
--- /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/include/Types.h	(revision 9)
+++ /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/include/Types.h	(revision 9)
@@ -0,0 +1,26 @@
+#ifndef morpheo_behavioural_generic_registerfile_Type_h
+#define morpheo_behavioural_generic_registerfile_Type_h
+
+/*
+ * $Id$
+ *
+ * [ Description ]
+ * 
+ */
+
+#include "Include/Types.h"
+
+namespace morpheo                    {
+namespace behavioural                {
+namespace generic                    {
+namespace registerfile               {
+
+  typedef uint32_t Taddress_t;
+  typedef uint32_t Tdata_t;
+
+}; // end namespace registerfile 
+}; // end namespace generic
+}; // end namespace behavioural          
+}; // end namespace morpheo              
+
+#endif
Index: /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/Parameters.cpp
===================================================================
--- /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/Parameters.cpp	(revision 9)
+++ /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/Parameters.cpp	(revision 9)
@@ -0,0 +1,43 @@
+/*
+ * $Id$
+ *
+ * [ Description ]
+ * 
+ */
+
+#include "Behavioural/Generic/RegisterFile/include/Parameters.h"
+
+namespace morpheo                    {
+namespace behavioural                {
+namespace generic                    {
+namespace registerfile               {
+
+  Parameters::Parameters (uint32_t nb_port_read ,
+			  uint32_t nb_port_write,
+			  uint32_t nb_word      ,
+			  uint32_t size_word     
+			  ) :
+    _nb_port_read      (nb_port_read ),
+    _nb_port_write     (nb_port_write),
+    _nb_word           (nb_word      ),
+    _size_word         (size_word    )
+  { 
+    test();
+  };
+  
+  Parameters::Parameters (Parameters & param) :
+    _nb_port_read      (param._nb_port_read ),
+    _nb_port_write     (param._nb_port_write),
+    _nb_word           (param._nb_word      ),
+    _size_word         (param._size_word    )
+  {
+    test();
+  };
+
+  Parameters::~Parameters () 
+  { };
+
+}; // end namespace registerfile 
+}; // end namespace generic
+}; // end namespace behavioural          
+}; // end namespace morpheo              
Index: /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/Parameters_msg_error.cpp
===================================================================
--- /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/Parameters_msg_error.cpp	(revision 9)
+++ /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/Parameters_msg_error.cpp	(revision 9)
@@ -0,0 +1,50 @@
+/*
+ * $Id$
+ *
+ * [ Description ]
+ * 
+ */
+
+#include <stdint.h>
+#include "Behavioural/Generic/RegisterFile/include/Parameters.h"
+#include "Behavioural/Generic/RegisterFile/include/Types.h"
+#include <sstream>
+using namespace std;
+
+namespace morpheo                    {
+namespace behavioural                {
+namespace generic                    {
+namespace registerfile               {
+
+  string Parameters::msg_error(void)
+  {
+    string msg = "";
+
+    if ((8*sizeof(Tdata_t)) < _size_word)
+      {
+        msg += "  - type \"Tdata_t\" is too little to the size defined by size_word\n";
+        msg +=  "    * size_word                       : " + toString(_size_word) + "\n";
+	msg +=  "    * Tdata_t                   (bits): " + toString(8*(sizeof(Tdata_t))) + "\n";
+      }
+
+    if ((8*sizeof(Taddress_t)) < log2(_nb_word))
+      {
+        msg += "  - type \"Taddress_t\" is too little to the size defined by nb_word\n";
+        msg +=  "    * nb_word                         : " + toString(_nb_word)    + "\n";
+	msg +=  "      > size                   (bits) : " + toString(log2(_nb_word)) + "\n";
+	msg +=  "    * Taddress_t               (bits) : " + toString(8*(sizeof(Taddress_t))) + "\n";
+      }
+
+    if (_nb_word < 2)
+      {
+        msg += "  - nb_word must be >= 2\n";
+        msg += "    * nb_word                         : " + toString(_nb_word)    + "\n";
+      }
+
+    return msg;
+  };
+
+}; // end namespace registerfile 
+}; // end namespace generic
+}; // end namespace behavioural          
+}; // end namespace morpheo              
Index: /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/Parameters_print.cpp
===================================================================
--- /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/Parameters_print.cpp	(revision 9)
+++ /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/Parameters_print.cpp	(revision 9)
@@ -0,0 +1,43 @@
+/*
+ * $Id$
+ *
+ * [ Description ]
+ * 
+ */
+
+#include <stdint.h>
+#include "Behavioural/Generic/RegisterFile/include/Parameters.h"
+#include <sstream>
+using namespace std;
+
+namespace morpheo                    {
+namespace behavioural                {
+namespace generic                    {
+namespace registerfile               {
+
+  string Parameters::print (uint32_t depth)
+  {
+    string tab = string(depth,'\t');
+    ostringstream msg;
+    msg << tab << "<registerfile>" << endl
+	<< tab << "\t<nb_port_read  value=\"" << _nb_port_read  << "\" />" << endl
+	<< tab << "\t<nb_port_write value=\"" << _nb_port_write << "\" />" << endl
+	<< tab << "\t<nb_word       value=\"" << _nb_word       << "\" />" << endl
+	<< tab << "\t<size_word     value=\"" << _size_word     << "\" />" << endl
+	<< tab << "</registerfile>" << endl;
+    
+    return msg.str();
+  };
+
+  ostream& operator<< (ostream& output_stream ,
+		       morpheo::behavioural::generic::registerfile::Parameters & x)
+  {
+    output_stream << x.print(0);
+    
+    return output_stream;
+  };
+
+}; // end namespace registerfile 
+}; // end namespace generic
+}; // end namespace behavioural          
+}; // end namespace morpheo              
Index: /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile.cpp
===================================================================
--- /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile.cpp	(revision 9)
+++ /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile.cpp	(revision 9)
@@ -0,0 +1,95 @@
+/*
+ * $Id$
+ *
+ * [ Description ]
+ * 
+ */
+
+#include "Behavioural/Generic/RegisterFile/include/RegisterFile.h"
+
+namespace morpheo                    {
+namespace behavioural                {
+namespace generic                    {
+namespace registerfile               {
+
+#ifdef SYSTEMC
+  RegisterFile::RegisterFile (sc_module_name name,
+#else
+  RegisterFile::RegisterFile (string name        ,
+#endif
+#ifdef STATISTICS
+			      morpheo::behavioural::Parameters_Statistics             param_statistics,
+#endif
+			      morpheo::behavioural::generic::registerfile::Parameters param ):
+			      _name   (name)
+			      ,_param (param)
+  {
+#ifdef STATISTICS
+    _stat = new Statistics (static_cast<string>(_name),
+			    param_statistics          ,
+			    param);
+#endif
+
+#ifdef VHDL_TESTBENCH
+    _vhdl_testbench = new Vhdl_Testbench (_name);
+    vhdl_testbench_port           (*_vhdl_testbench);
+    _vhdl_testbench->set_clock    ("in_CLOCK",true);
+#endif
+
+#ifdef VHDL
+    // generate the vhdl
+    vhdl();
+#endif
+
+#ifdef SYSTEMC
+    allocation ();
+
+    SC_METHOD (transition);
+    dont_initialize ();
+    sensitive_pos << *(in_CLOCK);
+    
+    SC_METHOD (genMealy_read);
+    dont_initialize ();
+    sensitive_neg << *(in_CLOCK);
+    for (uint32_t i=0; i<_param._nb_port_read; i++)
+      sensitive << *(in_READ_VAL     [i])
+		<< *(in_READ_ADDRESS [i]);
+
+#ifdef SYSTEMCASS_SPECIFIC
+    // List dependency information
+    for (uint32_t i=0; i<_param._nb_port_read; i++)
+      {
+	(*(out_READ_DATA [i])) (*( in_READ_VAL     [i]));
+	(*(out_READ_DATA [i])) (*( in_READ_ADDRESS [i]));
+      }
+#endif    
+
+    for (uint32_t i=0; i<_param._nb_port_read ; i++)
+      PORT_WRITE(out_READ_ACK  [i], 1);
+    for (uint32_t i=0; i<_param._nb_port_write; i++)
+      PORT_WRITE(out_WRITE_ACK [i], 1);
+#endif
+  };
+  
+  RegisterFile::~RegisterFile (void)
+  {
+#ifdef SYSTEMC
+    deallocation ();
+#endif
+
+#ifdef VHDL_TESTBENCH
+    // generate the test bench
+    _vhdl_testbench->generate_file();
+    delete _vhdl_testbench;
+#endif
+
+#ifdef STATISTICS
+    _stat->generate_file(statistics(0));
+    delete _stat;
+#endif
+  };
+
+}; // end namespace registerfile 
+}; // end namespace generic
+}; // end namespace behavioural          
+}; // end namespace morpheo              
Index: /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_allocation.cpp
===================================================================
--- /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_allocation.cpp	(revision 9)
+++ /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_allocation.cpp	(revision 9)
@@ -0,0 +1,81 @@
+#ifdef SYSTEMC
+/*
+ * $Id$
+ *
+ * [ Description ]
+ * 
+ */
+
+#include "Behavioural/Generic/RegisterFile/include/RegisterFile.h"
+
+namespace morpheo                    {
+namespace behavioural                {
+namespace generic                    {
+namespace registerfile               {
+
+  void RegisterFile::allocation (void)
+  {
+    in_CLOCK  = new SC_CLOCK           ("in_CLOCK");
+    in_NRESET = new SC_IN (Tcontrol_t) ("in_NRESET");
+
+    // ----- Interface Read
+     in_READ_VAL         = new SC_IN (Tcontrol_t) * [_param._nb_port_read];
+    out_READ_ACK         = new SC_OUT(Tcontrol_t) * [_param._nb_port_read];
+     in_READ_ADDRESS     = new SC_IN (Taddress_t) * [_param._nb_port_read];
+    out_READ_DATA        = new SC_OUT(Tdata_t   ) * [_param._nb_port_read];
+
+    for (uint32_t i=0; i<_param._nb_port_read; i++)
+      {
+	string rename;
+
+	rename = "in_READ_VAL["     + toString(i) + "]";
+	in_READ_VAL     [i]  = new SC_IN (Tcontrol_t) (rename.c_str());
+
+	rename = "out_READ_ACK["     + toString(i) + "]";
+	out_READ_ACK    [i]  = new SC_OUT(Tcontrol_t) (rename.c_str());
+
+	rename = "in_READ_ADDRESS[" + toString(i) + "]";
+	in_READ_ADDRESS [i]  = new SC_IN (Taddress_t) (rename.c_str());
+
+	rename = "out_READ_DATA["    + toString(i) + "]";
+	out_READ_DATA   [i]  = new SC_OUT(Tdata_t)    (rename.c_str());
+      }
+
+    // ----- Interface Write
+     in_WRITE_VAL        = new SC_IN (Tcontrol_t) * [_param._nb_port_write];
+    out_WRITE_ACK        = new SC_OUT(Tcontrol_t) * [_param._nb_port_write];
+     in_WRITE_ADDRESS    = new SC_IN (Taddress_t) * [_param._nb_port_write];
+     in_WRITE_DATA       = new SC_IN (Tdata_t   ) * [_param._nb_port_write];
+    
+    for (uint32_t i=0; i<_param._nb_port_write; i++)
+      {
+	string rename;
+
+	rename = "in_WRITE_VAL["  + toString(i) + "]";
+	in_WRITE_VAL     [i]  = new SC_IN (Tcontrol_t) (rename.c_str());
+
+	rename = "out_WRITE_VAL["  + toString(i) + "]";
+	out_WRITE_ACK    [i]  = new SC_OUT(Tcontrol_t) (rename.c_str());
+
+	rename = "in_WRITE_ADDRESS[" + toString(i) + "]";
+	in_WRITE_ADDRESS [i]  = new SC_IN (Taddress_t) (rename.c_str());
+
+	rename = "in_WRITE_DATA["    + toString(i) + "]";
+	in_WRITE_DATA    [i]  = new SC_IN (Tdata_t)    (rename.c_str());
+      }
+
+    // ----- Register
+    reg_DATA = new SC_REGISTER (Tdata_t) * [_param._nb_word];
+    
+    for (uint32_t i=0; i<_param._nb_word; i++)
+      {
+	string rename = "reg_DATA["  + toString(i) + "]";
+	reg_DATA [i]  = new SC_REGISTER (Tdata_t) (rename.c_str());
+      }    
+  };
+
+}; // end namespace registerfile 
+}; // end namespace generic
+}; // end namespace behavioural          
+}; // end namespace morpheo              
+#endif
Index: /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_deallocation.cpp
===================================================================
--- /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_deallocation.cpp	(revision 9)
+++ /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_deallocation.cpp	(revision 9)
@@ -0,0 +1,61 @@
+#ifdef SYSTEMC
+/*
+ * $Id$
+ *
+ * [ Description ]
+ * 
+ */
+
+#include "Behavioural/Generic/RegisterFile/include/RegisterFile.h"
+
+namespace morpheo                    {
+namespace behavioural                {
+namespace generic                    {
+namespace registerfile               {
+
+  void RegisterFile::deallocation (void)
+  {
+    delete in_CLOCK;
+    delete in_NRESET;
+    // ----- Interface Read
+    for (uint32_t i=0; i<_param._nb_port_read; i++)
+      {
+	delete  in_READ_VAL     [i];
+	delete out_READ_ACK     [i];
+	delete  in_READ_ADDRESS [i];
+	delete out_READ_DATA    [i];
+      }
+
+    delete  in_READ_VAL    ;
+    delete out_READ_ACK    ;
+    delete  in_READ_ADDRESS;
+    delete out_READ_DATA   ;
+
+    // ----- Interface Write
+    for (uint32_t i=0; i<_param._nb_port_write; i++)
+      {
+	delete  in_WRITE_VAL     [i];
+	delete out_WRITE_ACK     [i];
+	delete  in_WRITE_ADDRESS [i];
+	delete  in_WRITE_DATA    [i];
+      }
+
+    delete  in_WRITE_VAL    ;
+    delete out_WRITE_ACK    ;
+    delete  in_WRITE_ADDRESS;
+    delete  in_WRITE_DATA   ;
+
+    // ----- Register
+    for (uint32_t i=0; i<_param._nb_word; i++)
+      {
+	delete reg_DATA [i];
+      }    
+
+    delete reg_DATA;
+  };
+
+}; // end namespace registerfile 
+}; // end namespace generic
+}; // end namespace behavioural          
+}; // end namespace morpheo              
+#endif
Index: /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_genMealy_read.cpp
===================================================================
--- /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_genMealy_read.cpp	(revision 9)
+++ /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_genMealy_read.cpp	(revision 9)
@@ -0,0 +1,54 @@
+#ifdef SYSTEMC
+/*
+ * $Id$
+ *
+ * [ Description ]
+ * 
+ */
+
+#include "Behavioural/Generic/RegisterFile/include/RegisterFile.h"
+
+namespace morpheo                    {
+namespace behavioural                {
+namespace generic                    {
+namespace registerfile               {
+
+  void RegisterFile::genMealy_read (void)
+  {
+    log_printf(FUNC,Register_File,"genMealy_read","Begin");
+
+#ifdef STATISTICS
+    _stat_nb_read = 0;
+#endif    
+
+    for (uint32_t i=0; i<_param._nb_port_read; i++)
+      {
+	// Have a write?
+ 	if ( PORT_READ(in_READ_VAL [i]) == 1)
+ 	  {
+	    Taddress_t address = PORT_READ(in_READ_ADDRESS[i]);
+	    Tdata_t    data    = REGISTER_READ(reg_DATA[address]);
+
+	    log_printf(TRACE,Register_File,"genMealy_read","[%d] -> %.8x",static_cast<uint32_t>(address),static_cast<uint32_t>(data));
+
+#ifdef STATISTICS
+	    _stat_nb_read ++;
+#endif    
+	    // Write in registerFile
+	    PORT_WRITE(out_READ_DATA[i],data);
+ 	  }
+	else
+	  {
+	    //log_printf(TRACE,Register_File,"genMealy_read","Read  [%d] : No   transaction",i);
+	    PORT_WRITE(out_READ_DATA[i],0);
+	  }
+      }
+    log_printf(FUNC,Register_File,"genMealy_read","End");
+	
+  };
+
+}; // end namespace registerfile 
+}; // end namespace generic
+}; // end namespace behavioural          
+}; // end namespace morpheo              
+#endif
Index: /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_statistics.cpp
===================================================================
--- /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_statistics.cpp	(revision 9)
+++ /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_statistics.cpp	(revision 9)
@@ -0,0 +1,25 @@
+#ifdef STATISTICS
+/*
+ * $Id$
+ *
+ * [ Description ]
+ * 
+ */
+
+#include "Behavioural/Generic/RegisterFile/include/RegisterFile.h"
+
+namespace morpheo                    {
+namespace behavioural                {
+namespace generic                    {
+namespace registerfile               {
+
+  string RegisterFile::statistics (uint32_t depth)
+  {
+    return _stat->print(depth);
+  };
+
+}; // end namespace registerfile 
+}; // end namespace generic
+}; // end namespace behavioural          
+}; // end namespace morpheo              
+#endif
Index: /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_transition.cpp
===================================================================
--- /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_transition.cpp	(revision 9)
+++ /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_transition.cpp	(revision 9)
@@ -0,0 +1,56 @@
+#ifdef SYSTEMC
+/*
+ * $Id$
+ *
+ * [ Description ]
+ * 
+ */
+
+#include "Behavioural/Generic/RegisterFile/include/RegisterFile.h"
+
+namespace morpheo                    {
+namespace behavioural                {
+namespace generic                    {
+namespace registerfile               {
+
+  void RegisterFile::transition (void)
+  {
+    log_printf(FUNC,Register_File,"transition","Begin");
+#ifdef STATISTICS
+    _stat_nb_write = 0;
+#endif    
+
+    for (uint32_t i=0; i<_param._nb_port_write; i++)
+      {
+	// Have a write?
+ 	if ( PORT_READ(in_WRITE_VAL[i]) == true)
+ 	  {
+#ifdef STATISTICS
+	    _stat_nb_write ++;
+#endif    
+
+	    Taddress_t address = PORT_READ(in_WRITE_ADDRESS[i]);
+	    Tdata_t    data    = PORT_READ(in_WRITE_DATA   [i]);
+	    
+	    log_printf(TRACE,Register_File,"transition","[%d] <- %.8x",static_cast<uint32_t>(address),static_cast<uint32_t>(data));
+
+	    // Write in registerFile
+	    REGISTER_WRITE(reg_DATA[address],data);
+ 	  }
+      }
+
+#ifdef STATISTICS
+    _stat->add(_stat_nb_read,_stat_nb_write);
+#endif    
+
+#ifdef VHDL_TESTBENCH
+    vhdl_testbench_transition (*_vhdl_testbench);
+#endif
+    log_printf(FUNC,Register_File,"transition","End");
+  };
+
+}; // end namespace registerfile 
+}; // end namespace generic
+}; // end namespace behavioural          
+}; // end namespace morpheo              
+#endif
Index: /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_vhdl.cpp
===================================================================
--- /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_vhdl.cpp	(revision 9)
+++ /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_vhdl.cpp	(revision 9)
@@ -0,0 +1,35 @@
+#ifdef VHDL
+/*
+ * $Id$
+ *
+ * [ Description ]
+ * 
+ */
+
+#include "Behavioural/Generic/RegisterFile/include/RegisterFile.h"
+#include "Behavioural/include/Vhdl.h"
+#include "Include/ToString.h"
+namespace morpheo                    {
+namespace behavioural                {
+namespace generic                    {
+namespace registerfile               {
+
+  void RegisterFile::vhdl (void)
+  {
+    Vhdl vhdl (_name);
+
+    vhdl.set_library_work (_name + "_Pack");
+
+    vhdl_port   (vhdl);
+    vhdl_type   (vhdl);
+    vhdl_signal (vhdl);
+    vhdl_body   (vhdl);
+
+    vhdl.generate_file();
+  };
+
+}; // end namespace registerfile 
+}; // end namespace generic
+}; // end namespace behavioural          
+}; // end namespace morpheo              
+#endif
Index: /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_vhdl_body.cpp
===================================================================
--- /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_vhdl_body.cpp	(revision 9)
+++ /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_vhdl_body.cpp	(revision 9)
@@ -0,0 +1,57 @@
+#ifdef VHDL
+/*
+ * $Id$
+ *
+ * [ Description ]
+ * 
+ */
+
+#include "Behavioural/Generic/RegisterFile/include/RegisterFile.h"
+
+namespace morpheo                    {
+namespace behavioural                {
+namespace generic                    {
+namespace registerfile               {
+
+  void RegisterFile::vhdl_body (Vhdl & vhdl)
+  {
+    vhdl.set_body ("");
+    vhdl.set_body ("-----------------------------------------------------------------------------");
+    vhdl.set_body ("-- Read RegisterFile");
+    vhdl.set_body ("-----------------------------------------------------------------------------");
+    vhdl.set_body ("");
+    
+    for (uint32_t i = 0; i < _param._nb_port_read; i++)
+      {
+	vhdl.set_body ("out_READ_ACK_"+toString(i)+"  <= '1';");
+	vhdl.set_body ("out_READ_DATA_"+toString(i)+" <= reg_DATA (conv_integer(in_READ_ADDRESS_"+toString(i)+")) when in_READ_VAL_"+toString(i)+" = '1' else "+std_logic_others(_param._size_word,0)+";");
+      }
+    vhdl.set_body ("");
+    vhdl.set_body ("-----------------------------------------------------------------------------");
+    vhdl.set_body ("-- Write RegisterFile");
+    vhdl.set_body ("-----------------------------------------------------------------------------");
+    vhdl.set_body ("");
+
+    vhdl.set_body ("RegisterFile_write: process (in_CLOCK)");
+    vhdl.set_body ("begin  -- process RegisterFile_write");
+    vhdl.set_body ("\tif in_CLOCK'event and in_CLOCK = '1' then");
+    
+    for (uint32_t i = 0; i < _param._nb_port_write; i++)
+      {
+      vhdl.set_body ("\t\tif (in_WRITE_VAL_"+toString(i)+" = '1') then");
+      vhdl.set_body ("\t\t\treg_DATA(conv_integer(in_WRITE_ADDRESS_"+toString(i)+")) <= in_WRITE_DATA_"+toString(i)+";");
+      vhdl.set_body ("\t\tend if;");
+      }
+
+    vhdl.set_body ("\tend if;");
+    vhdl.set_body ("end process RegisterFile_write;");
+
+    for (uint32_t i = 0; i < _param._nb_port_write; i++)
+      vhdl.set_body ("out_WRITE_ACK_"+toString(i)+"<= '1';");
+  };
+
+}; // end namespace registerfile 
+}; // end namespace generic
+}; // end namespace behavioural          
+}; // end namespace morpheo              
+#endif
Index: /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_vhdl_port.cpp
===================================================================
--- /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_vhdl_port.cpp	(revision 9)
+++ /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_vhdl_port.cpp	(revision 9)
@@ -0,0 +1,42 @@
+#ifdef VHDL
+/*
+ * $Id$
+ *
+ * [ Description ]
+ * 
+ */
+
+#include "Behavioural/Generic/RegisterFile/include/RegisterFile.h"
+
+namespace morpheo                    {
+namespace behavioural                {
+namespace generic                    {
+namespace registerfile               {
+
+  void RegisterFile::vhdl_port (Vhdl & vhdl)
+  {
+    vhdl.set_port ("in_CLOCK" , IN, 1);
+    vhdl.set_port ("in_NRESET", IN, 1);
+
+    for (uint32_t i = 0; i < _param._nb_port_read; i ++)
+      {
+	vhdl.set_port (" in_READ_VAL_"+toString(i)+"    ",IN ,std_logic(1)                    );
+	vhdl.set_port ("out_READ_ACK_"+toString(i)+"    ",OUT,std_logic(1)                    );
+	vhdl.set_port (" in_READ_ADDRESS_"+toString(i)+"",IN ,std_logic(static_cast<uint32_t>(log2(_param._nb_word))));
+	vhdl.set_port ("out_READ_DATA_"+toString(i)+"   ",OUT,std_logic(_param._size_word    ));
+      }
+
+    for (uint32_t i = 0; i < _param._nb_port_write; i ++)
+      {
+	vhdl.set_port (" in_WRITE_VAL_"+toString(i)+"    ",IN ,std_logic(1)                    );
+	vhdl.set_port ("out_WRITE_ACK_"+toString(i)+"    ",OUT,std_logic(1)                    );
+	vhdl.set_port (" in_WRITE_ADDRESS_"+toString(i)+"",IN ,std_logic(static_cast<uint32_t>(log2(_param._nb_word))));
+	vhdl.set_port (" in_WRITE_DATA_"+toString(i)+"   ",IN ,std_logic(_param._size_word    ));
+      }
+  };
+
+}; // end namespace registerfile 
+}; // end namespace generic
+}; // end namespace behavioural          
+}; // end namespace morpheo              
+#endif
Index: /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_vhdl_signal.cpp
===================================================================
--- /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_vhdl_signal.cpp	(revision 9)
+++ /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_vhdl_signal.cpp	(revision 9)
@@ -0,0 +1,25 @@
+#ifdef VHDL
+/*
+ * $Id$
+ *
+ * [ Description ]
+ * 
+ */
+
+#include "Behavioural/Generic/RegisterFile/include/RegisterFile.h"
+
+namespace morpheo                    {
+namespace behavioural                {
+namespace generic                    {
+namespace registerfile               {
+
+  void RegisterFile::vhdl_signal (Vhdl & vhdl)
+  {
+    vhdl.set_signal ("reg_DATA", "Tregfile");
+  };
+
+}; // end namespace registerfile 
+}; // end namespace generic
+}; // end namespace behavioural          
+}; // end namespace morpheo              
+#endif
Index: /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_vhdl_testbench_port.cpp
===================================================================
--- /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_vhdl_testbench_port.cpp	(revision 9)
+++ /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_vhdl_testbench_port.cpp	(revision 9)
@@ -0,0 +1,41 @@
+#ifdef VHDL_TESTBENCH
+/*
+ * $Id$
+ *
+ * [ Description ]
+ * 
+ */
+
+#include "Behavioural/Generic/RegisterFile/include/RegisterFile.h"
+
+namespace morpheo                    {
+namespace behavioural                {
+namespace generic                    {
+namespace registerfile               {
+
+  void RegisterFile::vhdl_testbench_port (Vhdl_Testbench & vhdl_testbench)
+  {
+    vhdl_testbench.set_port (" in_NRESET",IN ,1);
+
+    for (uint32_t i = 0; i < _param._nb_port_read; i ++)
+      {
+	vhdl_testbench.set_port (" in_READ_VAL_"+toString(i)+"    ",IN ,1);
+	vhdl_testbench.set_port ("out_READ_ACK_"+toString(i)+"    ",OUT,1);
+	vhdl_testbench.set_port (" in_READ_ADDRESS_"+toString(i)+"",IN ,static_cast<uint32_t>(log2(_param._nb_word)));
+	vhdl_testbench.set_port ("out_READ_DATA_"+toString(i)+"   ",OUT,_param._size_word);
+      }
+
+    for (uint32_t i = 0; i < _param._nb_port_write; i ++)
+      {
+	vhdl_testbench.set_port (" in_WRITE_VAL_"+toString(i)+"    ",IN ,1);
+	vhdl_testbench.set_port ("out_WRITE_ACK_"+toString(i)+"    ",OUT,1);
+	vhdl_testbench.set_port (" in_WRITE_ADDRESS_"+toString(i)+"",IN ,static_cast<uint32_t>(log2(_param._nb_word)));
+	vhdl_testbench.set_port (" in_WRITE_DATA_"+toString(i)+"   ",IN ,_param._size_word    );
+      }
+  };
+
+}; // end namespace registerfile 
+}; // end namespace generic
+}; // end namespace behavioural          
+}; // end namespace morpheo              
+#endif
Index: /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_vhdl_testbench_transition.cpp
===================================================================
--- /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_vhdl_testbench_transition.cpp	(revision 9)
+++ /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_vhdl_testbench_transition.cpp	(revision 9)
@@ -0,0 +1,47 @@
+#ifdef VHDL_TESTBENCH
+/*
+ * $Id$
+ *
+ * [ Description ]
+ * 
+ */
+
+#include "Behavioural/Generic/RegisterFile/include/RegisterFile.h"
+
+namespace morpheo                    {
+namespace behavioural                {
+namespace generic                    {
+namespace registerfile               {
+
+  void RegisterFile::vhdl_testbench_transition (Vhdl_Testbench & vhdl_testbench)
+  {
+#ifndef SYSTEMCASS_SPECIFIC
+    sc_cycle(0);
+#endif
+    vhdl_testbench.add_input (PORT_READ( in_NRESET));
+
+    for (uint32_t i = 0; i < _param._nb_port_read ; i ++)
+      {
+	vhdl_testbench.add_input (PORT_READ( in_READ_VAL     [i]));
+	vhdl_testbench.add_output(PORT_READ(out_READ_ACK     [i]));
+	vhdl_testbench.add_input (PORT_READ( in_READ_ADDRESS [i]));
+	vhdl_testbench.add_output(PORT_READ(out_READ_DATA    [i]));
+      }
+    for (uint32_t i = 0; i < _param._nb_port_write; i ++)
+      {
+	vhdl_testbench.add_input (PORT_READ( in_WRITE_VAL    [i]));
+	vhdl_testbench.add_output(PORT_READ(out_WRITE_ACK    [i]));
+	vhdl_testbench.add_input (PORT_READ( in_WRITE_ADDRESS[i]));
+	vhdl_testbench.add_input (PORT_READ( in_WRITE_DATA   [i]));
+      }
+
+    vhdl_testbench.add_test(true);
+
+    vhdl_testbench.new_cycle (); // always at the end
+  };
+
+}; // end namespace registerfile 
+}; // end namespace generic
+}; // end namespace behavioural          
+}; // end namespace morpheo              
+#endif
Index: /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_vhdl_type.cpp
===================================================================
--- /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_vhdl_type.cpp	(revision 9)
+++ /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_vhdl_type.cpp	(revision 9)
@@ -0,0 +1,25 @@
+#ifdef VHDL
+/*
+ * $Id$
+ *
+ * [ Description ]
+ * 
+ */
+
+#include "Behavioural/Generic/RegisterFile/include/RegisterFile.h"
+
+namespace morpheo                    {
+namespace behavioural                {
+namespace generic                    {
+namespace registerfile               {
+
+  void RegisterFile::vhdl_type (Vhdl & vhdl)
+  {
+    vhdl.set_type ("Tregfile", "array (" + toString(_param._nb_word-1) + " downto 0) of " + std_logic(_param._size_word));
+  };
+
+}; // end namespace registerfile 
+}; // end namespace generic
+}; // end namespace behavioural          
+}; // end namespace morpheo              
+#endif
Index: /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/Statistics.cpp
===================================================================
--- /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/Statistics.cpp	(revision 9)
+++ /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/Statistics.cpp	(revision 9)
@@ -0,0 +1,49 @@
+#ifdef STATISTICS
+/*
+ * $Id$
+ *
+ * [ Description ]
+ * 
+ */
+
+#include "Behavioural/Generic/RegisterFile/include/Statistics.h"
+
+namespace morpheo                    {
+namespace behavioural                {
+namespace generic                    {
+namespace registerfile               {
+
+  Statistics::Statistics (string                                      name                       ,
+			  morpheo::behavioural::Parameters_Statistics parameters_statistics      ,
+			  Parameters                                  parameters
+			  ) :
+    morpheo::behavioural::Statistics(name                  ,
+				     parameters_statistics ),
+    _parameters(parameters)
+  {
+    _stat_port_read  = new morpheo::behavioural::generic::group::Statistics (name + "_port_read"   ,
+									     parameters_statistics ,
+									     morpheo::behavioural::generic::group::Parameters(_parameters._nb_port_read));
+    _stat_port_write = new morpheo::behavioural::generic::group::Statistics (name + "_port_write"   ,
+									     parameters_statistics ,
+									     morpheo::behavioural::generic::group::Parameters(_parameters._nb_port_write));
+  };
+  
+  //   Statistics::Statistics (Statistics & stat) :
+  // 		       _nb_port_read      (param._nb_port_read ),
+  // 		       _nb_port_write     (param._nb_port_write),
+  // 		       _nb_word           (param._nb_word      ),
+  // 		       _size_word         (param._size_word    )
+  //     { };
+  
+  Statistics::~Statistics () 
+  { 
+    delete _stat_port_read ;
+    delete _stat_port_write;
+  };
+
+}; // end namespace registerfile
+}; // end namespace generic
+}; // end namespace behavioural          
+}; // end namespace morpheo              
+#endif
Index: /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/Statistics_add.cpp
===================================================================
--- /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/Statistics_add.cpp	(revision 9)
+++ /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/Statistics_add.cpp	(revision 9)
@@ -0,0 +1,30 @@
+#ifdef STATISTICS
+/*
+ * $Id$
+ *
+ * [ Description ]
+ * 
+ */
+
+#include "Behavioural/Generic/RegisterFile/include/Statistics.h"
+
+#include <sstream>
+using namespace std;
+
+namespace morpheo                    {
+namespace behavioural                {
+namespace generic                    {
+namespace registerfile               {
+
+  void Statistics::add (uint32_t nb_read,
+			uint32_t nb_write)
+  {
+    _stat_port_read ->add(nb_read );
+    _stat_port_write->add(nb_write);
+  };
+
+}; // end namespace registerfile
+}; // end namespace generic
+}; // end namespace behavioural          
+}; // end namespace morpheo              
+#endif
Index: /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/Statistics_print.cpp
===================================================================
--- /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/Statistics_print.cpp	(revision 9)
+++ /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/Statistics_print.cpp	(revision 9)
@@ -0,0 +1,43 @@
+#ifdef STATISTICS
+/*
+ * $Id$
+ *
+ * [ Description ]
+ * 
+ */
+
+#include "Behavioural/Generic/RegisterFile/include/Statistics.h"
+
+#include <sstream>
+using namespace std;
+
+namespace morpheo                    {
+namespace behavioural                {
+namespace generic                    {
+namespace registerfile               {
+
+  string Statistics::print (uint32_t depth)
+  {
+    string        tab = string(depth,'\t');
+    ostringstream msg;
+
+    msg << tab << "<registerfile name=\"" << _name << "\" >" << endl
+	<< print_body(depth+1)
+	<< tab << "</registerfile>" << endl;
+    
+    return msg.str();
+  };
+
+  ostream& operator<< (ostream& output_stream ,
+		       morpheo::behavioural::generic::registerfile::Statistics & x)
+  {
+    output_stream << x.print(0);
+
+    return output_stream;
+  };
+
+}; // end namespace registerfile
+}; // end namespace generic
+}; // end namespace behavioural          
+}; // end namespace morpheo              
+#endif
Index: /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/Statistics_print_body.cpp
===================================================================
--- /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/Statistics_print_body.cpp	(revision 9)
+++ /trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/Statistics_print_body.cpp	(revision 9)
@@ -0,0 +1,33 @@
+#ifdef STATISTICS
+/*
+ * $Id$
+ *
+ * [ Description ]
+ * 
+ */
+
+#include "Behavioural/Generic/RegisterFile/include/Statistics.h"
+
+#include <sstream>
+using namespace std;
+
+namespace morpheo                    {
+namespace behavioural                {
+namespace generic                    {
+namespace registerfile               {
+
+  string Statistics::print_body (uint32_t depth)
+  {
+    string        tab = string(depth,'\t');
+    ostringstream msg;
+
+    msg << _stat_port_read ->print(depth+1);
+    msg << _stat_port_write->print(depth+1);
+    
+    return msg.str();
+  };
+}; // end namespace registerfile
+}; // end namespace generic
+}; // end namespace behavioural          
+}; // end namespace morpheo              
+#endif
