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 50)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/SelfTest/src/main.cpp	(revision 55)
@@ -8,5 +8,5 @@
 #include "Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/SelfTest/include/test.h"
 
-#define NB_PARAMS 4
+#define NB_PARAMS 5
 
 void usage (string exec)
@@ -14,8 +14,9 @@
   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;
+       << " - nb_port_read       (unsigned int)" << endl
+       << " - nb_port_write      (unsigned int)" << endl
+       << " - nb_port_read_write (unsigned int)" << endl
+       << " - nb_word            (unsigned int)" << endl
+       << " - size_word          (unsigned int)" << endl;
   exit (1);
 }
@@ -30,15 +31,18 @@
     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]);
+  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_port_read_write = atoi(argv[4]);
+  const uint32_t nb_word            = atoi(argv[5]);
+  const uint32_t size_word          = atoi(argv[6]);
   
-  morpheo::behavioural::generic::registerfile::registerfile_monolithic::Parameters param (nb_port_read ,
-											  nb_port_write,
-								 nb_word      ,
-								 size_word    );
-
+  morpheo::behavioural::generic::registerfile::registerfile_monolithic::Parameters * param = new morpheo::behavioural::generic::registerfile::registerfile_monolithic::Parameters
+    (nb_port_read ,
+     nb_port_write,
+     nb_port_read_write,
+     nb_word      ,
+     size_word    );
+  
   test (name,param);
 
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 50)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/SelfTest/src/test.cpp	(revision 55)
@@ -7,5 +7,5 @@
  */
 
-#define NB_ITERATION 32
+#define NB_ITERATION 2
 
 #include "Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/SelfTest/include/test.h"
@@ -13,5 +13,5 @@
 
 void test (string name,
-	   morpheo::behavioural::generic::registerfile::registerfile_monolithic::Parameters param)
+	   morpheo::behavioural::generic::registerfile::registerfile_monolithic::Parameters * _param)
 {
   cout << "<" << name << "> : Simulation SystemC" << endl;
@@ -19,6 +19,6 @@
   try 
     {
-      cout << param.print(1);
-      param.test();
+      cout << _param->print(1);
+      _param->test();
     }
   catch (morpheo::ErrorMorpheo & error)
@@ -33,9 +33,12 @@
     }
 
+#ifdef STATISTICS
+  morpheo::behavioural::Parameters_Statistics * _param_stat = new morpheo::behavioural::Parameters_Statistics (5,1000);
+#endif
   RegisterFile_Monolithic * registerfile = new RegisterFile_Monolithic (name.c_str()
 #ifdef STATISTICS
-									,morpheo::behavioural::Parameters_Statistics(5,1000)
+									,_param_stat
 #endif
-									,param);
+									,_param);
   
 #ifdef SYSTEMC
@@ -46,13 +49,20 @@
   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];
+  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];
+
+  sc_signal<Tcontrol_t>                    READ_WRITE_VAL     [_param->_nb_port_read_write];
+  sc_signal<Tcontrol_t>                    READ_WRITE_ACK     [_param->_nb_port_read_write];
+  sc_signal<Tcontrol_t>                    READ_WRITE_RW      [_param->_nb_port_read_write];
+  sc_signal<Taddress_t>                    READ_WRITE_ADDRESS [_param->_nb_port_read_write];
+  sc_signal<Tdata_t>                       READ_WRITE_RDATA   [_param->_nb_port_read_write];
+  sc_signal<Tdata_t>                       READ_WRITE_WDATA   [_param->_nb_port_read_write];
 
   /********************************************************
@@ -65,5 +75,5 @@
   (*(registerfile->in_NRESET))       (NRESET);
 
-  for (uint32_t i=0; i<param._nb_port_read; i++)
+  for (uint32_t i=0; i<_param->_nb_port_read; i++)
     {
       (*(registerfile-> in_READ_VAL      [i]))        (READ_VAL      [i]);
@@ -72,6 +82,5 @@
       (*(registerfile->out_READ_DATA     [i]))        (READ_DATA     [i]);
     }
-
-  for (uint32_t i=0; i<param._nb_port_write; i++)
+  for (uint32_t i=0; i<_param->_nb_port_write; i++)
     {
       (*(registerfile-> in_WRITE_VAL     [i]))        (WRITE_VAL     [i]);
@@ -80,4 +89,13 @@
       (*(registerfile-> in_WRITE_DATA    [i]))        (WRITE_DATA    [i]);
     }
+  for (uint32_t i=0; i<_param->_nb_port_read_write; i++)
+    {
+      (*(registerfile-> in_READ_WRITE_VAL     [i])) (READ_WRITE_VAL      [i]);
+      (*(registerfile->out_READ_WRITE_ACK     [i])) (READ_WRITE_ACK      [i]);
+      (*(registerfile-> in_READ_WRITE_RW      [i])) (READ_WRITE_RW       [i]);
+      (*(registerfile-> in_READ_WRITE_ADDRESS [i])) (READ_WRITE_ADDRESS  [i]);
+      (*(registerfile-> in_READ_WRITE_WDATA   [i])) (READ_WRITE_WDATA    [i]);
+      (*(registerfile->out_READ_WRITE_RDATA   [i])) (READ_WRITE_RDATA    [i]);
+    }
   
   cout << "<" << name << "> Start Simulation ............" << endl;
@@ -92,9 +110,10 @@
   sc_start(0);
   
-  for (uint32_t i=0; i<param._nb_port_write; i++)
+  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++)
+  for (uint32_t i=0; i<_param->_nb_port_read; i++)
     READ_VAL  [i] .write (0);
+  for (uint32_t i=0; i<_param->_nb_port_read_write; i++)
+    READ_WRITE_VAL  [i] .write (0);
 
   NRESET.write(0);
@@ -115,19 +134,19 @@
       srand(grain);
 
-      Tdata_t tab [param._nb_word];
-      
-      for (uint32_t i=0; i<param._nb_word; i++)
-	tab[i]= rand()%(1<<(param._size_word-1));
+      Tdata_t tab [_param->_nb_word];
+      
+      for (uint32_t i=0; i<_param->_nb_word; i++)
+	tab[i]= rand()%(1<<(_param->_size_word-1));
       
       Taddress_t address_next = 0;
       Taddress_t nb_ack = 0;
       
-      while (nb_ack < param._nb_word)
+      while (nb_ack < _param->_nb_word)
 	{
 	  cout << "cycle : " << static_cast<uint32_t> (sc_simulation_time()) << endl;
 
-	  for (uint32_t num_port=0; num_port < param._nb_port_write; num_port ++)
-	    {
-	      if ((address_next < param._nb_word) and
+	  for (uint32_t num_port=0; num_port < _param->_nb_port_write; num_port ++)
+	    {
+	      if ((address_next < _param->_nb_word) and
 		  (WRITE_VAL [num_port].read() == 0))
 		{
@@ -139,5 +158,23 @@
 		  
 		  // Address can be not a multiple of nb_port_write
-		  if (address_next >= param._nb_word)
+		  if (address_next >= _param->_nb_word)
+		    break;
+		}
+	    }
+
+	  for (uint32_t num_port=0; num_port < _param->_nb_port_read_write; num_port ++)
+	    {
+	      if ((address_next < _param->_nb_word) and
+		  (READ_WRITE_VAL [num_port].read() == 0))
+		{
+		  cout << "(" << num_port << ") [" << address_next << "] <= " << tab[address_next] << endl;
+		  
+		  READ_WRITE_VAL     [num_port] .write(1);
+		  READ_WRITE_RW      [num_port] .write(RW_WRITE);
+		  READ_WRITE_WDATA   [num_port] .write(tab[address_next]);
+		  READ_WRITE_ADDRESS [num_port] .write(address_next++);
+		  
+		  // Address can be not a multiple of nb_port_write
+		  if (address_next >= _param->_nb_word)
 		    break;
 		}
@@ -147,5 +184,5 @@
 
 	  // reset write_val port
-	  for (uint32_t num_port=0; num_port < param._nb_port_write; num_port ++)
+	  for (uint32_t num_port=0; num_port < _param->_nb_port_write; num_port ++)
 	    {
 	      if ((WRITE_ACK [num_port].read() == 1) and
@@ -156,4 +193,14 @@
 		}
 	    }
+	  // reset write_val port
+	  for (uint32_t num_port=0; num_port < _param->_nb_port_read_write; num_port ++)
+	    {
+	      if ((READ_WRITE_ACK [num_port].read() == 1) and
+		  (READ_WRITE_VAL [num_port].read() == 1))
+		{
+		  READ_WRITE_VAL  [num_port] .write(0);
+		  nb_ack ++;
+		}
+	    }
 
 	  sc_start(0);
@@ -165,13 +212,14 @@
       cout << "<" << name << "> 2) Read the RegisterFile (no write)" << endl;
       
-      Tdata_t read_address [param._nb_port_read];
-
-      while (nb_ack < param._nb_word)
+      Tdata_t read_address       [_param->_nb_port_read];
+      Tdata_t read_write_address [_param->_nb_port_read_write];
+
+      while (nb_ack < _param->_nb_word)
 	{
 	  cout << "cycle : " << static_cast<uint32_t> (sc_simulation_time()) << endl;
 	  
-	  for (uint32_t num_port=0; num_port < param._nb_port_read; num_port ++)
-	    {
-	      if ((address_next < param._nb_word) and
+	  for (uint32_t num_port=0; num_port < _param->_nb_port_read; num_port ++)
+	    {
+	      if ((address_next < _param->_nb_word) and
 		  (READ_VAL [num_port].read() == 0))
 		{
@@ -181,13 +229,30 @@
 		  READ_ADDRESS [num_port].write(read_address [num_port]);
 
-		  if (address_next >= param._nb_word)
-		    break;
-		}
-	    }
+		  if (address_next >= _param->_nb_word)
+		    break;
+		}
+	    }
+
+	  for (uint32_t num_port=0; num_port < _param->_nb_port_read_write; num_port ++)
+	    {
+	      if ((address_next < _param->_nb_word) and
+		  (READ_WRITE_VAL [num_port].read() == 0))
+		{
+		  read_write_address [num_port] = address_next++;
+
+		  READ_WRITE_VAL     [num_port].write(1);
+		  READ_WRITE_RW      [num_port].write(RW_READ);
+		  READ_WRITE_ADDRESS [num_port].write(read_write_address [num_port]);
+
+		  if (address_next >= _param->_nb_word)
+		    break;
+		}
+	    }
+
 
 	  sc_start(1);
 
 	  // reset write_val port
-	  for (uint32_t num_port=0; num_port < param._nb_port_read; num_port ++)
+	  for (uint32_t num_port=0; num_port < _param->_nb_port_read; num_port ++)
 	    {
 	      if ((READ_ACK [num_port].read() == 1) and
@@ -199,4 +264,18 @@
 
 		  TEST(Tdata_t,READ_DATA [num_port].read(), tab[read_address [num_port]]);
+		  nb_ack ++;
+		}
+	    }
+
+	  for (uint32_t num_port=0; num_port < _param->_nb_port_read_write; num_port ++)
+	    {
+	      if ((READ_WRITE_ACK [num_port].read() == 1) and
+		  (READ_WRITE_VAL [num_port].read() == 1))
+		{
+		  READ_WRITE_VAL  [num_port] .write(0);
+
+		  cout << "(" << num_port << ") [" << read_write_address [num_port] << "] => " << READ_WRITE_RDATA [num_port].read() << endl;
+
+		  TEST(Tdata_t,READ_WRITE_RDATA [num_port].read(), tab[read_write_address [num_port]]);
 		  nb_ack ++;
 		}
