Index: trunk/IPs/systemC/Environment/Cache/Makefile
===================================================================
--- trunk/IPs/systemC/Environment/Cache/Makefile	(revision 80)
+++ trunk/IPs/systemC/Environment/Cache/Makefile	(revision 81)
@@ -5,5 +5,5 @@
 #-----[ Variable ]-----------------------------------------
 
-OBJECTS_DEPS			= $(patsubst $(DIR_QUEUE)/%.cpp,$(DIR_OBJ)/%.o,$(wildcard $(DIR_QUEUE)/*.cpp))
+OBJECTS_DEPS			= $(patsubst $(DIR_QUEUE)/$(DIR_SRC)/%.cpp,$(DIR_QUEUE)/$(DIR_OBJ)/%.o,$(wildcard $(DIR_QUEUE)/$(DIR_SRC)/*.cpp))
 
 #-----[ Rules ]--------------------------------------------
Index: trunk/IPs/systemC/Environment/Cache/include/Cache_MultiLevel_Access.h
===================================================================
--- trunk/IPs/systemC/Environment/Cache/include/Cache_MultiLevel_Access.h	(revision 80)
+++ trunk/IPs/systemC/Environment/Cache/include/Cache_MultiLevel_Access.h	(revision 81)
@@ -17,4 +17,8 @@
   public : Access ()
     {
+      this->num_port      = 0;
+      this->hit           = MISS;
+      this->latence       = 0;
+      this->last_nb_level = 0;
     }
 
Index: trunk/IPs/systemC/Environment/Cache/include/Cache_OneLevel.h
===================================================================
--- trunk/IPs/systemC/Environment/Cache/include/Cache_OneLevel.h	(revision 80)
+++ trunk/IPs/systemC/Environment/Cache/include/Cache_OneLevel.h	(revision 81)
@@ -8,4 +8,5 @@
 #include "Cache_OneLevel_Parameters.h"
 #include "../../Queue/include/Sort_Queue_Dynamic.h"
+#include "../../Common/include/Debug.h"
 
 namespace environment {
Index: trunk/IPs/systemC/Environment/Cache/include/Cache_Parameters.h
===================================================================
--- trunk/IPs/systemC/Environment/Cache/include/Cache_Parameters.h	(revision 80)
+++ trunk/IPs/systemC/Environment/Cache/include/Cache_Parameters.h	(revision 81)
@@ -14,4 +14,5 @@
   public : uint32_t nb_cache_dedicated;
   public : uint32_t nb_iport;
+  public : uint32_t nb_dport;
 
   public : cache_multilevel::Parameters ** param_icache_dedicated;
@@ -47,9 +48,18 @@
       this->nb_cache_dedicated = nb_cache_dedicated;
 
+      if (nb_cache_dedicated == 0)
+	{
+	  std::cerr << "[  ERROR  ] nb_cache_dedicated > 0" << std::endl;
+	  exit(0);
+	}
+
       uint32_t cache_shared_nb_port = 0;
-      uint32_t nb_iport = 0;
+      nb_iport = 0;
+      nb_dport = 0;
+
       for (uint32_t i=0; i<nb_cache_dedicated; i++)
 	{
 	  nb_iport             += icache_dedicated_nb_port [i];
+	  nb_dport             += dcache_dedicated_nb_port [i];
 	  cache_shared_nb_port += icache_dedicated_nb_port [i];
 	  cache_shared_nb_port += dcache_dedicated_nb_port [i];
@@ -108,8 +118,10 @@
     {
       std::string tab (depth,'\t');
-      std::stringstream str;
+      std::stringstream str ("");
 
       str << tab << "* Nb Cache dedicated    : " << nb_cache_dedicated << std::endl
-	  << tab << "* Nb iport              : " << nb_iport << std::endl;
+	  << tab << "* Nb iport              : " << nb_iport << std::endl
+	  << tab << "* Nb dport              : " << nb_dport << std::endl
+;
 
       for (uint32_t i=0; i<nb_cache_dedicated; i++)
Index: trunk/IPs/systemC/Environment/Cache/selftest/main.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Cache/selftest/main.cpp	(revision 80)
+++ trunk/IPs/systemC/Environment/Cache/selftest/main.cpp	(revision 81)
@@ -1,4 +1,4 @@
+#include "../include/Cache.h"
 #include <iostream>
-#include "../include/Cache.h"
 
 using namespace std;
@@ -6,21 +6,24 @@
 using namespace environment::cache;
 
-#define TEST(x,y)				\
-  {						\
-    cout << "Line " << __LINE__ << " : ";	\
-    if (x==y)					\
-      {						\
-	cout << "Test OK" << endl;		\
-      }						\
-    else					\
-      {						\
-	cout << "Test KO" << endl;		\
-	exit (EXIT_FAILURE);			\
-      }						\
+#define TEST(x,y)							\
+  {									\
+    if (x==y)								\
+      {									\
+	cout << "Line " << __LINE__ << " : " << "Test OK" << endl;	\
+      }									\
+    else								\
+      {									\
+	cout << "Line " << __LINE__ << " : " << "Test KO" << endl;	\
+	exit (EXIT_FAILURE);						\
+      }									\
   } while (0)
     
 
 
-int main (void)
+#ifdef SYSTEMC
+int sc_main (int argc, char * argv[])
+#else
+int    main (int argc, char * argv[])
+#endif
 {
   cout << "<main> Begin" << endl;
@@ -38,15 +41,15 @@
        );
 
-    cout << *param << endl;
+//     cout << *param << endl;
 
     cache_onelevel::Cache_OneLevel * cache = new cache_onelevel::Cache_OneLevel ("my_cache",param);
     cache->reset();
     
-    cout << *cache << endl;
+//     cout << *cache << endl;
     
     cache->transition();
     cache->transition();
 
-    cout << *cache << endl;
+//     cout << *cache << endl;
 
     TEST(cache->access(0, 0x100, 0, CACHED, WRITE), MISS);
@@ -89,5 +92,5 @@
 
     cache->transition(); // miss cycle 1
-    cout << *cache << endl;
+//     cout << *cache << endl;
 
     TEST(cache->access(0, 0x200, 0, CACHED, WRITE), MISS      );
@@ -99,5 +102,5 @@
     cache->transition(); // miss cycle 2
     cache->transition(); // miss cycle 3
-    cout << *cache << endl;
+//     cout << *cache << endl;
 
     // line 0 : all way is use
@@ -113,5 +116,5 @@
 
     cache->transition();
-    cout << *cache << endl;
+//     cout << *cache << endl;
     
     TEST(cache->access(0, 0x500, 0,  CACHED, WRITE), MISS      );
@@ -141,5 +144,5 @@
     TEST(cache->latence(3), 5);
     
-    cout << *cache << endl;
+//     cout << *cache << endl;
 
     delete cache;
@@ -174,11 +177,10 @@
        );
 
-    cout << *param << endl;
+//     cout << *param << endl;
   
     cache_multilevel::Cache_MultiLevel * cache = new cache_multilevel::Cache_MultiLevel ("my_cache",param);
 
-    cout << *cache << endl;
     cache->reset();
-    cout << *cache << endl;
+//     cout << *cache << endl;
   
     cache_multilevel::Access access;
@@ -202,5 +204,5 @@
     cache->transition(); //11
     cache->transition(); //10
-    cout << *cache << endl;
+//     cout << *cache << endl;
 
     access = cache->access (0, 0x100, 0, CACHED, WRITE);
@@ -238,5 +240,5 @@
     TEST(access.latence      , 1);
     TEST(access.last_nb_level, 0);
-    cout << *cache << endl;
+//     cout << *cache << endl;
 
     cache->transition();
@@ -303,5 +305,5 @@
     cache->transition(); //11
     cache->transition(); //10
-    cout << *cache << endl;
+//     cout << *cache << endl;
 
     access = cache->access (0, 0x100, 0, CACHED, WRITE);
@@ -358,5 +360,5 @@
 
     access = cache->access (1, 0x100, 0, CACHED, WRITE);
-    cout << access<< endl;
+//     cout << access<< endl;
     
     cache->update_access(access);
@@ -367,5 +369,5 @@
     TEST(access.last_nb_level, 1);
 
-    cout << *cache << endl;
+//     cout << *cache << endl;
     delete cache;
     delete param;
@@ -389,5 +391,5 @@
     cache_shared_size_line     [0] = 8 ;
     cache_shared_size_word     [0] = 4 ;
-    cache_shared_associativity [0] = 4 ;
+    cache_shared_associativity [0] = 8 ;
     cache_shared_hit_latence   [0] = 2 ;
     cache_shared_miss_penality [0] = 5 ;
@@ -467,5 +469,5 @@
 
     dcache_nb_level      [1]    = 2;
-    dcache_nb_port       [1]    = 2;
+    dcache_nb_port       [1]    = 8; // to test
     dcache_nb_line       [1]    = new uint32_t [2];
     dcache_size_line     [1]    = new uint32_t [2];
@@ -519,21 +521,214 @@
        );
 
-    cout << *param << endl;
+//     cout << *param << endl;
 
     cache::Cache * cache = new cache::Cache ("my_cache",param);
 
+    cache->reset();
+//     cout << *cache << endl;
+
+    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 16);
+    cache->transition();
+    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 15);
+    cache->transition();
+    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 14);
+    cache->transition();
+    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 13);
+    cache->transition();
+    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 12);
+    cache->transition();
+    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 11);
+    cache->transition();
+    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 10);
+    cache->transition();
+    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  9);
+    cache->transition();
+    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  8);
+    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE), 16); // miss thread !=
+    TEST(cache->latence (DATA_CACHE, 0, 0, 0x100, 0, CACHED, WRITE),  6); // miss L1, hit L2
+    cache->transition();
+    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  7);
+    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE), 15);
+    cache->transition();
+    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  6);
+    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE), 14);
+    cache->transition();
+    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  5);
+    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE), 13);
+    cache->transition();
+    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  4);
+    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE), 12);
+    cache->transition();
+    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  3);
+    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE), 11);
+    cache->transition();
+    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  2);
+    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE), 10);
+    cache->transition();
+    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  1);
+    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  9);
+    cache->transition();
+    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  1);
+    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  8);
+    cache->transition();
+    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  1);
+    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  7);
+    cache->transition();
+    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  1);
+    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  6);
+    cache->transition();
+    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  1);
+    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  5);
+    cache->transition();
+    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  1);
+    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  4);
+    cache->transition();
+    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  1);
+    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  3);
+    cache->transition();
+    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  1);
+    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  2);
+    cache->transition();
+
+    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  5); // L1 is direct map, hit L2
+    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  1); // write in L1
+    TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE), 16);
+    TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE), 16);
+    cache->transition();
+
+    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  4);
+    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  1);
+    TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE), 15);
+    TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE), 15);
+    cache->transition();
+    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  3);
+    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  1);
+    TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE), 14);
+    TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE), 14);
+    TEST(cache->latence (DATA_CACHE, 1, 4, 0x100, 4, CACHED, WRITE), 16);
+    TEST(cache->latence (DATA_CACHE, 1, 5, 0x100, 5, CACHED, WRITE), 16);
+    cache->transition();
+    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  2);
+    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  1);
+    TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE), 13);
+    TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE), 13);
+    TEST(cache->latence (DATA_CACHE, 1, 4, 0x100, 4, CACHED, WRITE), 15);
+    TEST(cache->latence (DATA_CACHE, 1, 5, 0x100, 5, CACHED, WRITE), 15);
+
+
+    cache->transition();
+    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  1);
+    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  5);
+    TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE), 12);
+    TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE), 12);
+    TEST(cache->latence (DATA_CACHE, 1, 4, 0x100, 4, CACHED, WRITE), 14);
+    TEST(cache->latence (DATA_CACHE, 1, 5, 0x100, 5, CACHED, WRITE), 14);
+
+
+    cache->transition();
+    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  1);
+    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  4);
+    TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE), 11);
+    TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE), 11);
+    TEST(cache->latence (DATA_CACHE, 1, 4, 0x100, 4, CACHED, WRITE), 13);
+    TEST(cache->latence (DATA_CACHE, 1, 5, 0x100, 5, CACHED, WRITE), 13);
+
+    // in cache L2 : context 0,1,2,3
+
+    cache->transition();
+    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  1);
+    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  3);
+    TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE), 10);
+    TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE), 10);
+    TEST(cache->latence (DATA_CACHE, 1, 4, 0x100, 4, CACHED, WRITE), 12);
+    TEST(cache->latence (DATA_CACHE, 1, 5, 0x100, 5, CACHED, WRITE), 12);
+
+    cache->transition();
+    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  1);
+    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  2);
+    TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE),  9);
+    TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE),  9);
+    TEST(cache->latence (DATA_CACHE, 1, 4, 0x100, 4, CACHED, WRITE), 11);
+    TEST(cache->latence (DATA_CACHE, 1, 5, 0x100, 5, CACHED, WRITE), 11);
+
+    cache->transition();
+    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  5);
+    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  1);
+    TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE),  8);
+    TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE),  8);
+    TEST(cache->latence (DATA_CACHE, 1, 4, 0x100, 4, CACHED, WRITE), 10); // write in L2
+    TEST(cache->latence (DATA_CACHE, 1, 5, 0x100, 5, CACHED, WRITE), 10); // write in L2
+
+    cache->transition();
+    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  4);
+    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  1);
+    TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE),  7);
+    TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE),  7);
+    TEST(cache->latence (DATA_CACHE, 1, 4, 0x100, 4, CACHED, WRITE),  9);
+    TEST(cache->latence (DATA_CACHE, 1, 5, 0x100, 5, CACHED, WRITE),  9);
+
+    cache->transition();
+    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  3);
+    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  1);
+    TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE),  6);
+    TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE),  6);
+    TEST(cache->latence (DATA_CACHE, 1, 4, 0x100, 4, CACHED, WRITE),  8);
+    TEST(cache->latence (DATA_CACHE, 1, 5, 0x100, 5, CACHED, WRITE),  8);
+
+    cache->transition();
+    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  2);
+    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  1);
+    TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE),  5);
+    TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE),  5);
+    TEST(cache->latence (DATA_CACHE, 1, 4, 0x100, 4, CACHED, WRITE),  7);
+    TEST(cache->latence (DATA_CACHE, 1, 5, 0x100, 5, CACHED, WRITE),  7);
+
+    cache->transition();
+    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  1);
+    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  5);
+    TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE),  4);
+    TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE),  4);
+    TEST(cache->latence (DATA_CACHE, 1, 4, 0x100, 4, CACHED, WRITE),  6);
+    TEST(cache->latence (DATA_CACHE, 1, 5, 0x100, 5, CACHED, WRITE),  6);
+
+    cache->transition();
+    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  1);
+    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  4);
+    TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE),  3);
+    TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE),  3);
+    TEST(cache->latence (DATA_CACHE, 1, 4, 0x100, 4, CACHED, WRITE),  5);
+    TEST(cache->latence (DATA_CACHE, 1, 5, 0x100, 5, CACHED, WRITE),  5);
+
+    cache->transition();
+    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  1);
+    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  3);
+    TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE),  2);
+    TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE),  2);
+    TEST(cache->latence (DATA_CACHE, 1, 4, 0x100, 4, CACHED, WRITE),  4);
+    TEST(cache->latence (DATA_CACHE, 1, 5, 0x100, 5, CACHED, WRITE),  4);
+
     cout << *cache << endl;
-    cache->reset();
-    cout << *cache << endl;
-
-    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 16);
-    cache->transition();
-    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 15);
-    cache->transition();
-
-    cout << *cache << endl;
-
+
+    cache->transition();
+    // In L2 : context 1,2,4,5 : also context 0 and 3 miss L1 and L2, hit L3
+    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 11);
+    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  2);
+    TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE),  1);
+    TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE), 11);
+    TEST(cache->latence (DATA_CACHE, 1, 4, 0x100, 4, CACHED, WRITE),  3);
+    TEST(cache->latence (DATA_CACHE, 1, 5, 0x100, 5, CACHED, WRITE),  3);
+
+    cache->transition();
+    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 10);
+    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  1);
+    TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE),  5);
+    TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE), 10);
+    TEST(cache->latence (DATA_CACHE, 1, 4, 0x100, 4, CACHED, WRITE),  2);
+    TEST(cache->latence (DATA_CACHE, 1, 5, 0x100, 5, CACHED, WRITE),  2);
+
+// //     cout << *cache << endl;
 
     delete    cache;
+
     delete    param;
     delete [] cache_shared_nb_line      ;
Index: trunk/IPs/systemC/Environment/Cache/src/Cache_MultiLevel_access.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Cache/src/Cache_MultiLevel_access.cpp	(revision 80)
+++ trunk/IPs/systemC/Environment/Cache/src/Cache_MultiLevel_access.cpp	(revision 81)
@@ -16,11 +16,9 @@
       {
 	hit   = hierarchy_cache[i]->access (num_port,address,trdid,type,dir);
-	time += hierarchy_cache[i]->latence(num_port);
+	uint32_t latence = hierarchy_cache[i]->latence(num_port);
+	time += latence;
 
-	std::cout << "SETH : "
-		  << " * i    : " << i
-		  << " * hit  : " << hit
-		  << " * time  :" << time << std::endl;
-	
+	_cout(CACHE,"    * Level [%d] - type_hit %d, latence %d, Sum latence %d\n",i,hit,latence,time);
+
 	if ( (hit == HIT_CACHE)        or
 	     (hit == HIT_WRITE_BUFFER) or
Index: trunk/IPs/systemC/Environment/Cache/src/Cache_MultiLevel_update_access.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Cache/src/Cache_MultiLevel_update_access.cpp	(revision 80)
+++ trunk/IPs/systemC/Environment/Cache/src/Cache_MultiLevel_update_access.cpp	(revision 81)
@@ -8,11 +8,14 @@
   uint32_t Cache_MultiLevel::update_access (Access cur_access)
   {
-    if (cur_access.last_nb_level > 0)
+//     if (cur_access.last_nb_level > 0)
       {
 	uint32_t latence = cur_access.latence;
+
+	_cout(CACHE,"Cache_MultiLevel::update_access [%d] : latence : %d, last_nb_level : %d (nb_level : %d)\n",cur_access.num_port,latence,cur_access.last_nb_level,param->nb_level);
 	
-	for (uint32_t it = 0; it <= cur_access.last_nb_level; it ++)
-	  latence = hierarchy_cache [it]->update_latence (cur_access.num_port,latence);
-	
+	for (uint32_t it = 0; it < cur_access.last_nb_level; it ++)
+	  {
+	    latence = hierarchy_cache [it]->update_latence (cur_access.num_port,latence);
+	  }
 // 	if (latence != 0)
 // 	  {
Index: trunk/IPs/systemC/Environment/Cache/src/Cache_OneLevel_transition.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Cache/src/Cache_OneLevel_transition.cpp	(revision 80)
+++ trunk/IPs/systemC/Environment/Cache/src/Cache_OneLevel_transition.cpp	(revision 81)
@@ -34,11 +34,12 @@
 
     // Test if a write_buffer have the result
-    while ((write_buffer->empty() == false) && (write_buffer->read(0)._delay == 0))
+    while ((write_buffer->empty() == false) and 
+	   (write_buffer->read(0)._delay == 0))
       {
 	// Save in the cache
-	Write_Buffer val     = write_buffer->pop();
+	Write_Buffer val = write_buffer->pop();
 	
-	uint32_t num_tag     = val.address.tag;
-	uint32_t num_familly = val.address.familly;
+	uint32_t num_tag           = val.address.tag;
+	uint32_t num_familly       = val.address.familly;
 	uint32_t num_associativity = index_victim(num_familly);
 	
Index: trunk/IPs/systemC/Environment/Cache/src/Cache_latence.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Cache/src/Cache_latence.cpp	(revision 80)
+++ trunk/IPs/systemC/Environment/Cache/src/Cache_latence.cpp	(revision 81)
@@ -22,8 +22,19 @@
 
     cache_multilevel::Cache_MultiLevel * cache;
+    cache_multilevel::Parameters * param_cache_dedicated;
+    _cout(CACHE," * Access Cache_Dedicated_");
     if (type_cache == INSTRUCTION_CACHE)
-      cache = icache_dedicated [num_entity];
+      {
+	_cout(CACHE,"Instruction");
+	cache                 = icache_dedicated [num_entity];
+	param_cache_dedicated = param->param_icache_dedicated [num_entity];
+      }
     else
-      cache = dcache_dedicated [num_entity];
+      {
+	_cout(CACHE,"Data");
+	cache                 = dcache_dedicated [num_entity];
+	param_cache_dedicated = param->param_dcache_dedicated [num_entity];
+      }
+    _cout(CACHE," [%d] - entity : %d, address : 0x%.x\n",num_port,num_entity,address);
 
     if (num_port >= cache->param->nb_port)
@@ -34,10 +45,10 @@
 
     // Make a access with this level "dedicated"
-    std::cout << "cache dedicated : access" << std::endl;
     cache_multilevel::Access access_dedicated = cache->access(num_port,address,trdid,type,dir);
 
     if (access_dedicated.hit == MISS)
       {
-	std::cout << "cache shared    : access" << std::endl;
+	_cout(CACHE," * Access Cache_shared");
+
 	// Make a access with this level "shared"
 	cache_multilevel::Access access_shared  = cache_shared->access(range_port (type_cache,num_entity)+num_port,address,trdid,type,dir);
@@ -45,14 +56,11 @@
 	cache_shared->update_access (access_shared);
 	
-	access_dedicated.last_nb_level = param->nb_cache_dedicated-1; // Update all cache
+	access_dedicated.last_nb_level = param_cache_dedicated->nb_level; // Update all cache
 	access_dedicated.latence += access_shared.latence;
       }
 
-    std::cout << "end access, update access" << std::endl;
-
     cache->update_access (access_dedicated);
 
-    std::cout << "end access, update access" << std::endl;
-
+    _cout(CACHE,"Access latence : %d\n",access_dedicated.latence);
     return access_dedicated.latence;
   }
Index: trunk/IPs/systemC/Environment/Cache/src/Cache_range_port.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Cache/src/Cache_range_port.cpp	(revision 80)
+++ trunk/IPs/systemC/Environment/Cache/src/Cache_range_port.cpp	(revision 81)
@@ -16,7 +16,7 @@
     else
       {
-	std::cout << "nb_port_dedicated : " << nb_port_dedicated<< std::endl;
+// 	std::cout << "nb_port_dedicated : " << nb_port_dedicated<< std::endl;
 	nb_port_dedicated += param->nb_iport;
-	std::cout << "nb_port_dedicated : " << param->nb_iport<< std::endl;
+// 	std::cout << "nb_port_dedicated : " << param->nb_iport<< std::endl;
     
 	for (uint32_t i = 1; i < num_entity; i++)
@@ -24,6 +24,6 @@
       }
 
-    std::cout << "nb_port_dedicated : " << num_entity << std::endl;
-    std::cout << "nb_port_dedicated : " << nb_port_dedicated<< std::endl;
+//     std::cout << "nb_port_dedicated : " << num_entity << std::endl;
+//     std::cout << "nb_port_dedicated : " << nb_port_dedicated<< std::endl;
 	
     return nb_port_dedicated;
Index: trunk/IPs/systemC/Environment/Common/include/Debug.h
===================================================================
--- trunk/IPs/systemC/Environment/Common/include/Debug.h	(revision 81)
+++ trunk/IPs/systemC/Environment/Common/include/Debug.h	(revision 81)
@@ -0,0 +1,29 @@
+#ifndef ENVIRONMENT_COMMON_DEBUG_H
+#define ENVIRONMENT_COMMON_DEBUG_H
+
+#define DEBUG_ENVIRONMENT true
+#define DEBUG_CACHE       false
+#define DEBUG_DATA        false
+#define DEBUG_ENDIANNESS  false
+#define DEBUG_QUEUE       false
+#define DEBUG_RAMLOCK     false
+#define DEBUG_SIM2OS      false
+#define DEBUG_TTY         false
+
+#ifdef DEBUG
+# define _cout(component, str...)					\
+  do									\
+    {									\
+      if ( DEBUG_ ## component == true )				\
+	{								\
+	  fprintf(stdout,str);						\
+	}								\
+    } while(0)
+#else
+# define _cout(component, str...)					\
+  do									\
+    {									\
+    } while(0)
+#endif
+
+#endif
Index: trunk/IPs/systemC/Environment/Data/Makefile
===================================================================
--- trunk/IPs/systemC/Environment/Data/Makefile	(revision 81)
+++ trunk/IPs/systemC/Environment/Data/Makefile	(revision 81)
@@ -0,0 +1,26 @@
+#-----[ Directory ]----------------------------------------
+
+# DIR_ENDIANNESS			= ../Endianness
+
+#-----[ Variable ]-----------------------------------------
+
+# OBJECTS_DEPS			= $(patsubst $(DIR_ENDIANNESS)/$(DIR_SRC)/%.cpp,$(DIR_ENDIANNESS)/$(DIR_OBJ)/%.o,$(wildcard $(DIR_ENDIANNESS)/$(DIR_SRC)/*.cpp))
+
+#-----[ Rules ]--------------------------------------------
+
+all				:
+				@\
+				$(MAKE) all_environment
+
+# 				$(MAKE) --directory=$(DIR_ENDIANNESS) all; \
+
+clean				:
+				@\
+				$(MAKE) environment_clean
+
+# 				$(MAKE) --directory=$(DIR_ENDIANNESS) clean; \
+
+help				:
+				@$(MAKE) environment_help
+
+include                         ../Makefile.Environment
Index: trunk/IPs/systemC/Environment/Data/include/Data.h
===================================================================
--- trunk/IPs/systemC/Environment/Data/include/Data.h	(revision 81)
+++ trunk/IPs/systemC/Environment/Data/include/Data.h	(revision 81)
@@ -0,0 +1,31 @@
+#ifndef ENVIRONMENT_DATA_H
+#define ENVIRONMENT_DATA_H
+
+#include "Data_Parameters.h"
+#include "Entity.h"
+
+namespace environment {
+namespace data {
+
+  class Data
+  {
+  private  : std::string  name;
+  private  : uint32_t     nb_seg;
+  private  : Segment   ** segment;
+  private  : Parameters * param;
+
+  public   :  Data (std::string name, Parameters * param);
+  public   : ~Data (void);
+
+  public   : bool   init   (std::string section, const char * filename, const char ** list_section);
+  public   : void   reset  (void);
+  public   : bool   read   (uint32_t address, uint32_t size, char * & data_dest);
+  public   : bool   write  (uint32_t address, uint32_t size, char * & data_src);
+  public   : Entity entity (uint32_t address, uint32_t size);
+  public   : Entity entity (std::string name);
+  public   : friend std::ostream& operator<< (std::ostream& output, const Data & x);
+  };
+
+};
+};
+#endif
Index: trunk/IPs/systemC/Environment/Data/include/Data_Parameters.h
===================================================================
--- trunk/IPs/systemC/Environment/Data/include/Data_Parameters.h	(revision 81)
+++ trunk/IPs/systemC/Environment/Data/include/Data_Parameters.h	(revision 81)
@@ -0,0 +1,31 @@
+#ifndef ENVIRONMENT_DATA_PARAMETERS_H
+#define ENVIRONMENT_DATA_PARAMETERS_H
+
+#include <iostream>
+#include "../../../shared/soclib_segment_table.h"
+
+namespace environment {
+namespace data {
+  
+  class Parameters
+  {
+  public : uint32_t               max_seg    ;
+  public : uint32_t               globalIndex;
+  public : uint32_t               localIndex ;
+  public : SOCLIB_SEGMENT_TABLE * segtab     ;
+
+  public : Parameters (uint32_t               max_seg    ,
+		       uint32_t               globalIndex,
+		       uint32_t               localIndex ,
+		       SOCLIB_SEGMENT_TABLE * segtab     )
+    {
+      this->max_seg     = max_seg    ;
+      this->globalIndex = globalIndex;
+      this->localIndex  = localIndex ;
+      this->segtab      = segtab     ;
+    }    
+  }; //end Parameters
+  
+};
+};
+#endif
Index: trunk/IPs/systemC/Environment/Data/include/Entity.h
===================================================================
--- trunk/IPs/systemC/Environment/Data/include/Entity.h	(revision 81)
+++ trunk/IPs/systemC/Environment/Data/include/Entity.h	(revision 81)
@@ -0,0 +1,22 @@
+#ifndef ENVIRONMENT_DATA_ENTITY_H
+#define ENVIRONMENT_DATA_ENTITY_H
+
+#include "Segment.h"
+
+namespace environment {
+namespace data {
+
+  class Entity
+  {
+  public : bool      present;
+  public : Segment * segment;
+
+
+  public : Entity (bool present);
+  public : Entity (bool present, Segment * segment);
+  public : friend std::ostream& operator<< (std::ostream& output, Entity & x);
+  };
+
+};
+};
+#endif
Index: trunk/IPs/systemC/Environment/Data/include/Segment.h
===================================================================
--- trunk/IPs/systemC/Environment/Data/include/Segment.h	(revision 81)
+++ trunk/IPs/systemC/Environment/Data/include/Segment.h	(revision 81)
@@ -0,0 +1,46 @@
+#ifndef ENVIRONMENT_DATA_SEGMENT_H
+#define ENVIRONMENT_DATA_SEGMENT_H
+
+#include "../../../shared/soclib_segment_table.h"
+#include "Type_target.h"
+
+#include <iomanip>
+
+extern "C" void loadexec(void **emem, int *esize, int *eoffset, const char *file, const char ** sections);
+
+namespace environment {
+namespace data {
+
+  class Segment
+  {
+  protected : std::string   name;
+
+  protected : uint32_t      base;
+  protected : uint32_t      index;
+  protected : uint32_t      size;
+  protected : bool          uncached;
+  protected : char        * data;
+  protected : type_target_t type;
+
+  public :  Segment (void);
+  public :  Segment (SEGMENT_TABLE_ENTRY * segment);
+  public : ~Segment (void);
+
+  public : bool                 init          (const char * filename, const  char ** sections);
+  public : void                 define_target (type_target_t type, uint32_t index);
+  public : type_target_t        getType       (void);
+  public : uint32_t             getIndex      (void);
+  public : uint32_t             getBase       (void);
+  public : uint32_t             getSize       (void);
+  public : bool                 getUncached   (void);
+  public : char *               data_addr     (void);
+  public : bool                 test          (std::string name);
+  public : bool                 test          (uint32_t address, uint32_t size);
+  public : void                 read          (uint32_t address, uint32_t size, char * & data_dest);
+  public : void                 write         (uint32_t address, uint32_t size, char * & data_src);
+  public : friend std::ostream& operator<<    (std::ostream& output, Segment & x);
+  };
+
+};
+};
+#endif
Index: trunk/IPs/systemC/Environment/Data/include/Type_target.h
===================================================================
--- trunk/IPs/systemC/Environment/Data/include/Type_target.h	(revision 81)
+++ trunk/IPs/systemC/Environment/Data/include/Type_target.h	(revision 81)
@@ -0,0 +1,17 @@
+#ifndef ENVIRONMENT_DATA_TYPE_TARGET_H
+#define ENVIRONMENT_DATA_TYPE_TARGET_H
+
+namespace environment {
+namespace data {
+
+  typedef enum 
+    {
+      TYPE_TARGET_MEMORY      ,
+      TYPE_TARGET_TTY         ,
+      TYPE_TARGET_RAMLOCK     ,
+      TYPE_TARGET_SIM2OS
+    } type_target_t;
+
+};
+};
+#endif
Index: trunk/IPs/systemC/Environment/Data/selftest/data/soft.x.txt
===================================================================
--- trunk/IPs/systemC/Environment/Data/selftest/data/soft.x.txt	(revision 81)
+++ trunk/IPs/systemC/Environment/Data/selftest/data/soft.x.txt	(revision 81)
@@ -0,0 +1,433 @@
+
+bin/soft.x:     file format elf32-or32
+
+Disassembly of section .text:
+
+00000000 <_exception_reset-0x100>:
+       0:	15 00 00 00 	l.nop 0x0
+       4:	15 00 ff ff 	l.nop 0xffff
+       8:	15 00 ff fe 	l.nop 0xfffe
+       c:	15 00 ff fd 	l.nop 0xfffd
+      10:	15 00 ff fc 	l.nop 0xfffc
+      14:	15 00 ff fb 	l.nop 0xfffb
+      18:	15 00 ff fa 	l.nop 0xfffa
+      1c:	15 00 ff f9 	l.nop 0xfff9
+      20:	15 00 ff f8 	l.nop 0xfff8
+      24:	15 00 ff f7 	l.nop 0xfff7
+      28:	15 00 ff f6 	l.nop 0xfff6
+      2c:	15 00 ff f5 	l.nop 0xfff5
+      30:	15 00 ff f4 	l.nop 0xfff4
+      34:	15 00 ff f3 	l.nop 0xfff3
+      38:	15 00 ff f2 	l.nop 0xfff2
+      3c:	15 00 ff f1 	l.nop 0xfff1
+      40:	15 00 ff f0 	l.nop 0xfff0
+      44:	15 00 ff ef 	l.nop 0xffef
+      48:	15 00 ff ee 	l.nop 0xffee
+      4c:	15 00 ff ed 	l.nop 0xffed
+      50:	15 00 ff ec 	l.nop 0xffec
+      54:	15 00 ff eb 	l.nop 0xffeb
+      58:	15 00 ff ea 	l.nop 0xffea
+      5c:	15 00 ff e9 	l.nop 0xffe9
+      60:	15 00 ff e8 	l.nop 0xffe8
+      64:	15 00 ff e7 	l.nop 0xffe7
+      68:	15 00 ff e6 	l.nop 0xffe6
+      6c:	15 00 ff e5 	l.nop 0xffe5
+      70:	15 00 ff e4 	l.nop 0xffe4
+      74:	15 00 ff e3 	l.nop 0xffe3
+      78:	15 00 ff e2 	l.nop 0xffe2
+      7c:	15 00 ff e1 	l.nop 0xffe1
+      80:	15 00 ff e0 	l.nop 0xffe0
+      84:	15 00 ff df 	l.nop 0xffdf
+      88:	15 00 ff de 	l.nop 0xffde
+      8c:	15 00 ff dd 	l.nop 0xffdd
+      90:	15 00 ff dc 	l.nop 0xffdc
+      94:	15 00 ff db 	l.nop 0xffdb
+      98:	15 00 ff da 	l.nop 0xffda
+      9c:	15 00 ff d9 	l.nop 0xffd9
+      a0:	15 00 ff d8 	l.nop 0xffd8
+      a4:	15 00 ff d7 	l.nop 0xffd7
+      a8:	15 00 ff d6 	l.nop 0xffd6
+      ac:	15 00 ff d5 	l.nop 0xffd5
+      b0:	15 00 ff d4 	l.nop 0xffd4
+      b4:	15 00 ff d3 	l.nop 0xffd3
+      b8:	15 00 ff d2 	l.nop 0xffd2
+      bc:	15 00 ff d1 	l.nop 0xffd1
+      c0:	15 00 ff d0 	l.nop 0xffd0
+      c4:	15 00 ff cf 	l.nop 0xffcf
+      c8:	15 00 ff ce 	l.nop 0xffce
+      cc:	15 00 ff cd 	l.nop 0xffcd
+      d0:	15 00 ff cc 	l.nop 0xffcc
+      d4:	15 00 ff cb 	l.nop 0xffcb
+      d8:	15 00 ff ca 	l.nop 0xffca
+      dc:	15 00 ff c9 	l.nop 0xffc9
+      e0:	15 00 ff c8 	l.nop 0xffc8
+      e4:	15 00 ff c7 	l.nop 0xffc7
+      e8:	15 00 ff c6 	l.nop 0xffc6
+      ec:	15 00 ff c5 	l.nop 0xffc5
+      f0:	15 00 ff c4 	l.nop 0xffc4
+      f4:	15 00 ff c3 	l.nop 0xffc3
+      f8:	15 00 ff c2 	l.nop 0xffc2
+      fc:	15 00 ff c1 	l.nop 0xffc1
+
+00000100 <_exception_reset>:
+     100:	18 40 00 00 	l.movhi r2,0x0
+     104:	a8 42 20 00 	l.ori r2,r2,0x2000
+     108:	44 00 10 00 	l.jr r2
+     10c:	15 00 00 00 	l.nop 0x0
+	...
+     200:	9c 21 ff 80 	l.addi r1,r1,0xffffff80
+     204:	d4 01 18 04 	l.sw 0x4(r1),r3
+     208:	d4 01 20 08 	l.sw 0x8(r1),r4
+     20c:	b4 60 00 10 	l.mfspr r3,r0,0x10
+     210:	b4 80 00 20 	l.mfspr r4,r0,0x20
+     214:	00 00 07 88 	l.j 2034 <default_exception_handler>
+     218:	15 00 00 00 	l.nop 0x0
+	...
+     300:	9c 21 ff 80 	l.addi r1,r1,0xffffff80
+     304:	d4 01 18 04 	l.sw 0x4(r1),r3
+     308:	d4 01 20 08 	l.sw 0x8(r1),r4
+     30c:	b4 60 00 10 	l.mfspr r3,r0,0x10
+     310:	b4 80 00 20 	l.mfspr r4,r0,0x20
+     314:	00 00 07 48 	l.j 2034 <default_exception_handler>
+     318:	15 00 00 00 	l.nop 0x0
+	...
+     400:	9c 21 ff 80 	l.addi r1,r1,0xffffff80
+     404:	d4 01 18 04 	l.sw 0x4(r1),r3
+     408:	d4 01 20 08 	l.sw 0x8(r1),r4
+     40c:	b4 60 00 10 	l.mfspr r3,r0,0x10
+     410:	b4 80 00 20 	l.mfspr r4,r0,0x20
+     414:	00 00 07 08 	l.j 2034 <default_exception_handler>
+     418:	15 00 00 00 	l.nop 0x0
+	...
+     500:	9c 21 ff 80 	l.addi r1,r1,0xffffff80
+     504:	d4 01 18 04 	l.sw 0x4(r1),r3
+     508:	d4 01 20 08 	l.sw 0x8(r1),r4
+     50c:	b4 60 00 10 	l.mfspr r3,r0,0x10
+     510:	b4 80 00 20 	l.mfspr r4,r0,0x20
+     514:	00 00 06 c8 	l.j 2034 <default_exception_handler>
+     518:	15 00 00 00 	l.nop 0x0
+	...
+     600:	9c 21 ff 80 	l.addi r1,r1,0xffffff80
+     604:	d4 01 18 04 	l.sw 0x4(r1),r3
+     608:	d4 01 20 08 	l.sw 0x8(r1),r4
+     60c:	b4 60 00 10 	l.mfspr r3,r0,0x10
+     610:	b4 80 00 20 	l.mfspr r4,r0,0x20
+     614:	00 00 06 88 	l.j 2034 <default_exception_handler>
+     618:	15 00 00 00 	l.nop 0x0
+	...
+     700:	9c 21 ff 80 	l.addi r1,r1,0xffffff80
+     704:	d4 01 18 04 	l.sw 0x4(r1),r3
+     708:	d4 01 20 08 	l.sw 0x8(r1),r4
+     70c:	b4 60 00 10 	l.mfspr r3,r0,0x10
+     710:	b4 80 00 20 	l.mfspr r4,r0,0x20
+     714:	00 00 06 48 	l.j 2034 <default_exception_handler>
+     718:	15 00 00 00 	l.nop 0x0
+	...
+     800:	9c 21 ff 80 	l.addi r1,r1,0xffffff80
+     804:	d4 01 18 04 	l.sw 0x4(r1),r3
+     808:	d4 01 20 08 	l.sw 0x8(r1),r4
+     80c:	b4 60 00 10 	l.mfspr r3,r0,0x10
+     810:	b4 80 00 20 	l.mfspr r4,r0,0x20
+     814:	00 00 06 08 	l.j 2034 <default_exception_handler>
+     818:	15 00 00 00 	l.nop 0x0
+	...
+     900:	9c 21 ff 80 	l.addi r1,r1,0xffffff80
+     904:	d4 01 18 04 	l.sw 0x4(r1),r3
+     908:	d4 01 20 08 	l.sw 0x8(r1),r4
+     90c:	b4 60 00 10 	l.mfspr r3,r0,0x10
+     910:	b4 80 00 20 	l.mfspr r4,r0,0x20
+     914:	00 00 05 c8 	l.j 2034 <default_exception_handler>
+     918:	15 00 00 00 	l.nop 0x0
+	...
+     a00:	9c 21 ff 80 	l.addi r1,r1,0xffffff80
+     a04:	d4 01 18 04 	l.sw 0x4(r1),r3
+     a08:	d4 01 20 08 	l.sw 0x8(r1),r4
+     a0c:	b4 60 00 10 	l.mfspr r3,r0,0x10
+     a10:	b4 80 00 20 	l.mfspr r4,r0,0x20
+     a14:	00 00 05 88 	l.j 2034 <default_exception_handler>
+     a18:	15 00 00 00 	l.nop 0x0
+	...
+     b00:	9c 21 ff 80 	l.addi r1,r1,0xffffff80
+     b04:	d4 01 18 04 	l.sw 0x4(r1),r3
+     b08:	d4 01 20 08 	l.sw 0x8(r1),r4
+     b0c:	b4 60 00 10 	l.mfspr r3,r0,0x10
+     b10:	b4 80 00 20 	l.mfspr r4,r0,0x20
+     b14:	00 00 05 48 	l.j 2034 <default_exception_handler>
+     b18:	15 00 00 00 	l.nop 0x0
+	...
+     c00:	9c 21 ff 80 	l.addi r1,r1,0xffffff80
+     c04:	d4 01 18 04 	l.sw 0x4(r1),r3
+     c08:	d4 01 20 08 	l.sw 0x8(r1),r4
+     c0c:	b4 60 00 10 	l.mfspr r3,r0,0x10
+     c10:	b4 80 00 20 	l.mfspr r4,r0,0x20
+     c14:	00 00 05 08 	l.j 2034 <default_exception_handler>
+     c18:	15 00 00 00 	l.nop 0x0
+	...
+     d00:	9c 21 ff 80 	l.addi r1,r1,0xffffff80
+     d04:	d4 01 18 04 	l.sw 0x4(r1),r3
+     d08:	d4 01 20 08 	l.sw 0x8(r1),r4
+     d0c:	b4 60 00 10 	l.mfspr r3,r0,0x10
+     d10:	b4 80 00 20 	l.mfspr r4,r0,0x20
+     d14:	00 00 04 c8 	l.j 2034 <default_exception_handler>
+     d18:	15 00 00 00 	l.nop 0x0
+	...
+     e00:	9c 21 ff 80 	l.addi r1,r1,0xffffff80
+     e04:	d4 01 18 04 	l.sw 0x4(r1),r3
+     e08:	d4 01 20 08 	l.sw 0x8(r1),r4
+     e0c:	b4 60 00 10 	l.mfspr r3,r0,0x10
+     e10:	b4 80 00 20 	l.mfspr r4,r0,0x20
+     e14:	00 00 04 88 	l.j 2034 <default_exception_handler>
+     e18:	15 00 00 00 	l.nop 0x0
+	...
+     f00:	9c 21 ff 80 	l.addi r1,r1,0xffffff80
+     f04:	d4 01 18 04 	l.sw 0x4(r1),r3
+     f08:	d4 01 20 08 	l.sw 0x8(r1),r4
+     f0c:	b4 60 00 10 	l.mfspr r3,r0,0x10
+     f10:	b4 80 00 20 	l.mfspr r4,r0,0x20
+     f14:	00 00 04 48 	l.j 2034 <default_exception_handler>
+     f18:	15 00 00 00 	l.nop 0x0
+	...
+    1000:	9c 21 ff 80 	l.addi r1,r1,0xffffff80
+    1004:	d4 01 18 04 	l.sw 0x4(r1),r3
+    1008:	d4 01 20 08 	l.sw 0x8(r1),r4
+    100c:	b4 60 00 10 	l.mfspr r3,r0,0x10
+    1010:	b4 80 00 20 	l.mfspr r4,r0,0x20
+    1014:	00 00 04 08 	l.j 2034 <default_exception_handler>
+    1018:	15 00 00 00 	l.nop 0x0
+	...
+    1100:	9c 21 ff 80 	l.addi r1,r1,0xffffff80
+    1104:	d4 01 18 04 	l.sw 0x4(r1),r3
+    1108:	d4 01 20 08 	l.sw 0x8(r1),r4
+    110c:	b4 60 00 10 	l.mfspr r3,r0,0x10
+    1110:	b4 80 00 20 	l.mfspr r4,r0,0x20
+    1114:	00 00 03 c8 	l.j 2034 <default_exception_handler>
+    1118:	15 00 00 00 	l.nop 0x0
+	...
+    1200:	9c 21 ff 80 	l.addi r1,r1,0xffffff80
+    1204:	d4 01 18 04 	l.sw 0x4(r1),r3
+    1208:	d4 01 20 08 	l.sw 0x8(r1),r4
+    120c:	b4 60 00 10 	l.mfspr r3,r0,0x10
+    1210:	b4 80 00 20 	l.mfspr r4,r0,0x20
+    1214:	00 00 03 88 	l.j 2034 <default_exception_handler>
+    1218:	15 00 00 00 	l.nop 0x0
+	...
+    1300:	9c 21 ff 80 	l.addi r1,r1,0xffffff80
+    1304:	d4 01 18 04 	l.sw 0x4(r1),r3
+    1308:	d4 01 20 08 	l.sw 0x8(r1),r4
+    130c:	b4 60 00 10 	l.mfspr r3,r0,0x10
+    1310:	b4 80 00 20 	l.mfspr r4,r0,0x20
+    1314:	00 00 03 48 	l.j 2034 <default_exception_handler>
+    1318:	15 00 00 00 	l.nop 0x0
+	...
+    1400:	9c 21 ff 80 	l.addi r1,r1,0xffffff80
+    1404:	d4 01 18 04 	l.sw 0x4(r1),r3
+    1408:	d4 01 20 08 	l.sw 0x8(r1),r4
+    140c:	b4 60 00 10 	l.mfspr r3,r0,0x10
+    1410:	b4 80 00 20 	l.mfspr r4,r0,0x20
+    1414:	00 00 03 08 	l.j 2034 <default_exception_handler>
+    1418:	15 00 00 00 	l.nop 0x0
+	...
+    1500:	9c 21 ff 80 	l.addi r1,r1,0xffffff80
+    1504:	d4 01 18 04 	l.sw 0x4(r1),r3
+    1508:	d4 01 20 08 	l.sw 0x8(r1),r4
+    150c:	b4 60 00 10 	l.mfspr r3,r0,0x10
+    1510:	b4 80 00 20 	l.mfspr r4,r0,0x20
+    1514:	00 00 02 c8 	l.j 2034 <default_exception_handler>
+    1518:	15 00 00 00 	l.nop 0x0
+	...
+    1600:	9c 21 ff 80 	l.addi r1,r1,0xffffff80
+    1604:	d4 01 18 04 	l.sw 0x4(r1),r3
+    1608:	d4 01 20 08 	l.sw 0x8(r1),r4
+    160c:	b4 60 00 10 	l.mfspr r3,r0,0x10
+    1610:	b4 80 00 20 	l.mfspr r4,r0,0x20
+    1614:	00 00 02 88 	l.j 2034 <default_exception_handler>
+    1618:	15 00 00 00 	l.nop 0x0
+	...
+    1700:	9c 21 ff 80 	l.addi r1,r1,0xffffff80
+    1704:	d4 01 18 04 	l.sw 0x4(r1),r3
+    1708:	d4 01 20 08 	l.sw 0x8(r1),r4
+    170c:	b4 60 00 10 	l.mfspr r3,r0,0x10
+    1710:	b4 80 00 20 	l.mfspr r4,r0,0x20
+    1714:	00 00 02 48 	l.j 2034 <default_exception_handler>
+    1718:	15 00 00 00 	l.nop 0x0
+	...
+    1800:	9c 21 ff 80 	l.addi r1,r1,0xffffff80
+    1804:	d4 01 18 04 	l.sw 0x4(r1),r3
+    1808:	d4 01 20 08 	l.sw 0x8(r1),r4
+    180c:	b4 60 00 10 	l.mfspr r3,r0,0x10
+    1810:	b4 80 00 20 	l.mfspr r4,r0,0x20
+    1814:	00 00 02 08 	l.j 2034 <default_exception_handler>
+    1818:	15 00 00 00 	l.nop 0x0
+	...
+    1900:	9c 21 ff 80 	l.addi r1,r1,0xffffff80
+    1904:	d4 01 18 04 	l.sw 0x4(r1),r3
+    1908:	d4 01 20 08 	l.sw 0x8(r1),r4
+    190c:	b4 60 00 10 	l.mfspr r3,r0,0x10
+    1910:	b4 80 00 20 	l.mfspr r4,r0,0x20
+    1914:	00 00 01 c8 	l.j 2034 <default_exception_handler>
+    1918:	15 00 00 00 	l.nop 0x0
+	...
+    1a00:	9c 21 ff 80 	l.addi r1,r1,0xffffff80
+    1a04:	d4 01 18 04 	l.sw 0x4(r1),r3
+    1a08:	d4 01 20 08 	l.sw 0x8(r1),r4
+    1a0c:	b4 60 00 10 	l.mfspr r3,r0,0x10
+    1a10:	b4 80 00 20 	l.mfspr r4,r0,0x20
+    1a14:	00 00 01 88 	l.j 2034 <default_exception_handler>
+    1a18:	15 00 00 00 	l.nop 0x0
+	...
+    1b00:	9c 21 ff 80 	l.addi r1,r1,0xffffff80
+    1b04:	d4 01 18 04 	l.sw 0x4(r1),r3
+    1b08:	d4 01 20 08 	l.sw 0x8(r1),r4
+    1b0c:	b4 60 00 10 	l.mfspr r3,r0,0x10
+    1b10:	b4 80 00 20 	l.mfspr r4,r0,0x20
+    1b14:	00 00 01 48 	l.j 2034 <default_exception_handler>
+    1b18:	15 00 00 00 	l.nop 0x0
+	...
+    1c00:	9c 21 ff 80 	l.addi r1,r1,0xffffff80
+    1c04:	d4 01 18 04 	l.sw 0x4(r1),r3
+    1c08:	d4 01 20 08 	l.sw 0x8(r1),r4
+    1c0c:	b4 60 00 10 	l.mfspr r3,r0,0x10
+    1c10:	b4 80 00 20 	l.mfspr r4,r0,0x20
+    1c14:	00 00 01 08 	l.j 2034 <default_exception_handler>
+    1c18:	15 00 00 00 	l.nop 0x0
+	...
+    1d00:	9c 21 ff 80 	l.addi r1,r1,0xffffff80
+    1d04:	d4 01 18 04 	l.sw 0x4(r1),r3
+    1d08:	d4 01 20 08 	l.sw 0x8(r1),r4
+    1d0c:	b4 60 00 10 	l.mfspr r3,r0,0x10
+    1d10:	b4 80 00 20 	l.mfspr r4,r0,0x20
+    1d14:	00 00 00 c8 	l.j 2034 <default_exception_handler>
+    1d18:	15 00 00 00 	l.nop 0x0
+	...
+    1e00:	9c 21 ff 80 	l.addi r1,r1,0xffffff80
+    1e04:	d4 01 18 04 	l.sw 0x4(r1),r3
+    1e08:	d4 01 20 08 	l.sw 0x8(r1),r4
+    1e0c:	b4 60 00 10 	l.mfspr r3,r0,0x10
+    1e10:	b4 80 00 20 	l.mfspr r4,r0,0x20
+    1e14:	00 00 00 88 	l.j 2034 <default_exception_handler>
+    1e18:	15 00 00 00 	l.nop 0x0
+	...
+    1f00:	9c 21 ff 80 	l.addi r1,r1,0xffffff80
+    1f04:	d4 01 18 04 	l.sw 0x4(r1),r3
+    1f08:	d4 01 20 08 	l.sw 0x8(r1),r4
+    1f0c:	b4 60 00 10 	l.mfspr r3,r0,0x10
+    1f10:	b4 80 00 20 	l.mfspr r4,r0,0x20
+    1f14:	00 00 00 48 	l.j 2034 <default_exception_handler>
+    1f18:	15 00 00 00 	l.nop 0x0
+	...
+
+00002000 <_start>:
+    2000:	18 20 51 ff 	l.movhi r1,0x51ff
+    2004:	a8 21 ff fc 	l.ori r1,r1,0xfffc
+    2008:	9c 40 ff fd 	l.addi r2,r0,0xfffffffd
+    200c:	04 00 00 4b 	l.jal 2138 <_get_cpu_id>
+    2010:	e0 21 10 03 	l.and r1,r1,r2
+    2014:	18 80 00 50 	l.movhi r4,0x50
+    2018:	a8 84 00 00 	l.ori r4,r4,0x0
+    201c:	e0 8b 23 06 	l.mul r4,r11,r4
+    2020:	e0 21 20 02 	l.sub r1,r1,r4
+    2024:	e0 41 00 04 	l.or r2,r1,r0
+    2028:	e0 60 00 03 	l.and r3,r0,r0
+    202c:	04 00 00 51 	l.jal 2170 <_main>
+    2030:	e0 80 00 03 	l.and r4,r0,r0
+
+00002034 <default_exception_handler>:
+    2034:	d4 01 10 00 	l.sw 0x0(r1),r2
+    2038:	d4 01 28 0c 	l.sw 0xc(r1),r5
+    203c:	d4 01 30 10 	l.sw 0x10(r1),r6
+    2040:	d4 01 38 14 	l.sw 0x14(r1),r7
+    2044:	d4 01 40 18 	l.sw 0x18(r1),r8
+    2048:	d4 01 48 1c 	l.sw 0x1c(r1),r9
+    204c:	d4 01 50 20 	l.sw 0x20(r1),r10
+    2050:	d4 01 58 24 	l.sw 0x24(r1),r11
+    2054:	d4 01 60 28 	l.sw 0x28(r1),r12
+    2058:	d4 01 68 2c 	l.sw 0x2c(r1),r13
+    205c:	d4 01 70 30 	l.sw 0x30(r1),r14
+    2060:	d4 01 78 34 	l.sw 0x34(r1),r15
+    2064:	d4 01 80 38 	l.sw 0x38(r1),r16
+    2068:	d4 01 88 3c 	l.sw 0x3c(r1),r17
+    206c:	d4 01 90 40 	l.sw 0x40(r1),r18
+    2070:	d4 01 98 44 	l.sw 0x44(r1),r19
+    2074:	d4 01 a0 48 	l.sw 0x48(r1),r20
+    2078:	d4 01 a8 4c 	l.sw 0x4c(r1),r21
+    207c:	d4 01 b0 50 	l.sw 0x50(r1),r22
+    2080:	d4 01 b8 54 	l.sw 0x54(r1),r23
+    2084:	d4 01 c0 58 	l.sw 0x58(r1),r24
+    2088:	d4 01 c8 5c 	l.sw 0x5c(r1),r25
+    208c:	d4 01 d0 60 	l.sw 0x60(r1),r26
+    2090:	d4 01 d8 64 	l.sw 0x64(r1),r27
+    2094:	d4 01 e0 68 	l.sw 0x68(r1),r28
+    2098:	d4 01 e8 6c 	l.sw 0x6c(r1),r29
+    209c:	d4 01 f0 70 	l.sw 0x70(r1),r30
+    20a0:	d4 01 f8 74 	l.sw 0x74(r1),r31
+    20a4:	d4 01 00 78 	l.sw 0x78(r1),r0
+    20a8:	07 ff f7 d6 	l.jal 0 <_exception_reset-0x100>
+    20ac:	15 00 00 00 	l.nop 0x0
+    20b0:	84 41 00 00 	l.lwz r2,0x0(r1)
+    20b4:	84 61 00 04 	l.lwz r3,0x4(r1)
+    20b8:	84 81 00 08 	l.lwz r4,0x8(r1)
+    20bc:	84 a1 00 0c 	l.lwz r5,0xc(r1)
+    20c0:	84 c1 00 10 	l.lwz r6,0x10(r1)
+    20c4:	84 e1 00 14 	l.lwz r7,0x14(r1)
+    20c8:	85 01 00 18 	l.lwz r8,0x18(r1)
+    20cc:	85 21 00 1c 	l.lwz r9,0x1c(r1)
+    20d0:	85 41 00 20 	l.lwz r10,0x20(r1)
+    20d4:	85 61 00 24 	l.lwz r11,0x24(r1)
+    20d8:	85 81 00 28 	l.lwz r12,0x28(r1)
+    20dc:	85 a1 00 2c 	l.lwz r13,0x2c(r1)
+    20e0:	85 c1 00 30 	l.lwz r14,0x30(r1)
+    20e4:	85 e1 00 34 	l.lwz r15,0x34(r1)
+    20e8:	86 01 00 38 	l.lwz r16,0x38(r1)
+    20ec:	86 21 00 3c 	l.lwz r17,0x3c(r1)
+    20f0:	86 41 00 40 	l.lwz r18,0x40(r1)
+    20f4:	86 61 00 44 	l.lwz r19,0x44(r1)
+    20f8:	86 81 00 48 	l.lwz r20,0x48(r1)
+    20fc:	86 a1 00 4c 	l.lwz r21,0x4c(r1)
+    2100:	86 c1 00 50 	l.lwz r22,0x50(r1)
+    2104:	86 e1 00 54 	l.lwz r23,0x54(r1)
+    2108:	87 01 00 58 	l.lwz r24,0x58(r1)
+    210c:	87 21 00 5c 	l.lwz r25,0x5c(r1)
+    2110:	87 41 00 60 	l.lwz r26,0x60(r1)
+    2114:	87 61 00 64 	l.lwz r27,0x64(r1)
+    2118:	87 81 00 68 	l.lwz r28,0x68(r1)
+    211c:	87 a1 00 6c 	l.lwz r29,0x6c(r1)
+    2120:	87 c1 00 70 	l.lwz r30,0x70(r1)
+    2124:	87 e1 00 74 	l.lwz r31,0x74(r1)
+    2128:	84 01 00 78 	l.lwz r0,0x78(r1)
+    212c:	9c 21 00 80 	l.addi r1,r1,0x80
+    2130:	24 00 00 00 	l.rfe 
+    2134:	15 00 00 00 	l.nop 0x0
+
+00002138 <_get_cpu_id>:
+    2138:	44 00 48 00 	l.jr r9
+    213c:	b5 60 f8 00 	l.mfspr r11,r0,0xf800
+
+00002140 <_set_cpu_id>:
+    2140:	44 00 48 00 	l.jr r9
+    2144:	c3 e0 18 00 	l.mtspr r0,r3,0xf800
+
+00002148 <_find_first_one>:
+    2148:	44 00 48 00 	l.jr r9
+    214c:	e1 63 00 0f 	l.ff1 r11,r3
+
+00002150 <_get_thread_id>:
+    2150:	44 00 48 00 	l.jr r9
+    2154:	b5 60 f8 01 	l.mfspr r11,r0,0xf801
+
+00002158 <_set_thread_id>:
+    2158:	44 00 48 00 	l.jr r9
+    215c:	c3 e0 18 01 	l.mtspr r0,r3,0xf801
+
+00002160 <_get_thread_priority>:
+    2160:	44 00 48 00 	l.jr r9
+    2164:	b5 60 f8 02 	l.mfspr r11,r0,0xf802
+
+00002168 <_set_thread_priority>:
+    2168:	44 00 48 00 	l.jr r9
+    216c:	c3 e0 18 02 	l.mtspr r0,r3,0xf802
+
+00002170 <_main>:
+    2170:	00 00 00 00 	l.j 2170 <_main>
+    2174:	15 00 00 00 	l.nop 0x0
+    2178:	44 00 48 00 	l.jr r9
+    217c:	15 00 00 00 	l.nop 0x0
Index: trunk/IPs/systemC/Environment/Data/selftest/data/soft.x.txt.nm
===================================================================
--- trunk/IPs/systemC/Environment/Data/selftest/data/soft.x.txt.nm	(revision 81)
+++ trunk/IPs/systemC/Environment/Data/selftest/data/soft.x.txt.nm	(revision 81)
@@ -0,0 +1,27 @@
+         U _exception_handler
+00000100 T _exception_reset
+00002000 T _start
+00002034 t default_exception_handler
+00002138 T _get_cpu_id
+00002140 T _set_cpu_id
+00002148 T _find_first_one
+00002150 T _get_thread_id
+00002158 T _set_thread_id
+00002160 T _get_thread_priority
+00002168 T _set_thread_priority
+00002170 T _main
+00500000 A _stack_alloc
+10000000 B ___bss_start
+10000000 B __bss_start
+10000000 B __end
+10000000 B _ebss
+10000000 D _edata
+10000000 B _end
+10000000 B _sbss
+10000000 D _sdata
+10000000 B ebss
+10000000 D edata
+10000000 B end
+10000000 B sbss
+10000000 D sdata
+51fffffc A _stack
Index: trunk/IPs/systemC/Environment/Data/selftest/main.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Data/selftest/main.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/Data/selftest/main.cpp	(revision 81)
@@ -0,0 +1,198 @@
+#include <iostream>
+#include "../include/Data.h"
+
+using namespace std;
+using namespace environment;
+using namespace environment::data;
+
+#define TEST(x,y)				\
+  {						\
+    cout << "Line " << __LINE__ << " : ";	\
+    if (x==y)					\
+      {						\
+	cout << "Test OK" << endl;		\
+      }						\
+    else					\
+      {						\
+	cout << "Test KO" << endl;		\
+	exit (EXIT_FAILURE);			\
+      }						\
+  } while (0)
+    
+
+
+#ifdef SYSTEMC
+int sc_main (int argc, char * argv[])
+#else
+int    main (int argc, char * argv[])
+#endif
+{
+  cout << "<main> Begin" << endl;
+
+  {
+    Segment * seg1 = new Segment ();
+    
+    TEST(seg1->getType     (), TYPE_TARGET_MEMORY);
+    TEST(seg1->getIndex    (), 0);
+    TEST(seg1->getBase     (), 0);
+    TEST(seg1->getSize     (), 0);
+    TEST(seg1->getUncached (), false);
+    
+    seg1->define_target(TYPE_TARGET_SIM2OS,4);
+    TEST(seg1->getType     (), TYPE_TARGET_SIM2OS);
+    TEST(seg1->getIndex    (), 4);
+    
+    cout << *seg1 << endl;
+    
+    SEGMENT_TABLE_ENTRY * entry = new SEGMENT_TABLE_ENTRY("entry", 0x100, 0x1024, 21, 7, true);
+    
+    Segment * seg2 = new Segment (entry);
+    
+    cout << *seg2 << endl;
+    
+    TEST(seg2->test(0x100, 0x0   ), true);
+    TEST(seg2->test(0x100, 0x1024), true);
+    TEST(seg2->test(0x100, 0x1025), false);
+    
+    char * str = new char [10];
+    
+    str [0] = 'k';
+    str [1] = 'a';
+    str [2] = 'n';
+    str [3] = 'e';
+    str [4] = 'd';
+    str [5] = 'e';
+    str [6] = 'a';
+    str [7] = 'd';
+    
+    seg2->write(0x200,8,str);
+    
+    for (uint32_t i=0; i<10; i++)
+      str [i] = '.';
+    
+    for (uint32_t i=0; i<10; i++)
+      cout << str [i];
+    cout << endl;
+    
+    str [0] = 'i';
+    str [1] = 's';
+    str [2] = 'b';
+    str [3] = 'a';
+    str [4] = 'c';
+    str [5] = 'k';
+    
+    seg2->write(0x204,6,str);
+
+    for (uint32_t i=0; i<10; i++)
+      str [i] = '.';
+    
+    seg2->read(0x200,10,str);
+    
+    for (uint32_t i=0; i<10; i++)
+      cout << str [i];
+    cout << endl;
+  
+    Entity * entity1 = new Entity (false);
+    Entity * entity2 = new Entity (true, seg2);
+    
+    cout << *entity1 << endl;
+    cout << *entity2 << endl;  
+    
+    delete    entity2;
+    delete    entity1;
+    delete [] str;
+    delete    seg2;
+    delete    entry;
+    delete    seg1;
+  }
+
+  {
+    SOCLIB_SEGMENT_TABLE * segtable = new SOCLIB_SEGMENT_TABLE;
+    segtable->setMSBNumber    (8);
+    segtable->setDefaultTarget(0,0);
+    
+    //shared data segment
+    
+    const int TEXT_BASE          = 0x0;
+    const int DATA_CACHED_BASE   = 0x10000000;
+    const int DATA_UNCACHED_BASE = 0x40000000;
+    
+    const int TEXT_SIZE          = 0x4000;
+    const int DATA_CACHED_SIZE   = 0x4000;
+    const int DATA_UNCACHED_SIZE = 0x4000;
+    
+    // Add a segment   :name        , address of base    , size               , global index , local index, uncache
+    segtable->addSegment("text"      , TEXT_BASE          , TEXT_SIZE          , 0            ,0           , false);
+    segtable->addSegment("data"      , DATA_CACHED_BASE   , DATA_CACHED_SIZE   , 0            ,0           , false);
+    segtable->addSegment("data_unc"  , DATA_UNCACHED_BASE , DATA_UNCACHED_SIZE , 0            ,0           , true );
+    
+    segtable->print();
+
+    Parameters * param = new Parameters (16,0,0,segtable);
+    
+    Data * data = new Data ("my_data", param);
+
+    cout << *data << endl;
+    
+    const char * filename = "selftest/data/soft.x";
+    const char * sections_text  []  = {".text",NULL}; 
+    const char * sections_data  []  = {".data",".rodata",".bss",".sdata",".sbss", NULL}; 
+
+    data->init("text"   , filename, sections_text);
+    data->init("data"   , filename, sections_data);
+
+    char * str = new char [8];
+    
+    data->read(0x100,8,str);
+    
+    cout << hex;
+    for (uint32_t i=0; i<8; i++)
+      {
+	if (i==4)
+	  cout << endl;
+	cout << std::setw(2) << std::setfill('0') << ((static_cast<uint32_t>(str [i]))&0xff);
+      }
+    cout << dec << endl;
+
+    str [0] = 0xde;
+    str [1] = 0xad;
+    str [2] = 0xbe;
+    str [3] = 0xef;
+    str [4] = 0xba;
+    str [5] = 0xbe;
+    str [6] = 0xbe;
+    str [7] = 0xef;
+
+    data->write(0x104,8,str);
+
+    data->read(0x100,8,str);
+    
+    cout << hex;
+    for (uint32_t i=0; i<8; i++)
+      {
+	if (i==4)
+	  cout << endl;
+	cout << std::setw(2) << std::setfill('0') << ((static_cast<uint32_t>(str [i]))&0xff);
+      }
+    cout << dec << endl;
+
+    data->read(0x108,8,str);
+    
+    cout << hex;
+    for (uint32_t i=0; i<8; i++)
+      {
+	if (i==4)
+	  cout << endl;
+	cout << std::setw(2) << std::setfill('0') << ((static_cast<uint32_t>(str [i]))&0xff);
+      }
+    cout << dec << endl;
+
+    delete [] str;
+    delete data;
+    delete param;
+    delete segtable;
+  }
+  cout << "<main> End" << endl;
+  
+  return EXIT_SUCCESS;
+}
Index: trunk/IPs/systemC/Environment/Data/src/Data.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Data/src/Data.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/Data/src/Data.cpp	(revision 81)
@@ -0,0 +1,43 @@
+#include "../include/Data.h"
+
+namespace environment {
+namespace data {
+
+  Data::Data (std::string name, Parameters * param)
+  {
+    this->name  = name;
+    this->param = param;
+
+    std::list<SEGMENT_TABLE_ENTRY> seglist = param->segtab->getSegmentList(param->globalIndex,param->localIndex);
+    nb_seg = seglist.size();
+
+    if (nb_seg >= param->max_seg)
+      {
+	std::cerr << "The number of seg can't be higher that " << param->max_seg << std::endl;
+	exit (1);
+      }
+    
+    segment = new Segment * [param->max_seg];
+    
+    uint32_t i=0;
+    for (std::list<SEGMENT_TABLE_ENTRY>::iterator iter = seglist.begin(); iter != seglist.end() ; ++iter)
+      {
+	SEGMENT_TABLE_ENTRY * entry = &(*iter);
+
+	segment [i] = new Segment (entry);
+	
+	param->segtab->setAddrAlloc(entry->getBase(),(void *)(segment [i]->data_addr()));
+
+	i ++;
+      }
+  }
+
+  Data::~Data (void)
+  {
+    for (uint32_t i=0; i<nb_seg; i++)
+      delete segment [i];
+    delete [] segment;
+  }
+
+};
+};
Index: trunk/IPs/systemC/Environment/Data/src/Data_entity.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Data/src/Data_entity.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/Data/src/Data_entity.cpp	(revision 81)
@@ -0,0 +1,25 @@
+#include "../include/Data.h"
+
+namespace environment {
+namespace data {
+
+  Entity Data::entity (uint32_t address, uint32_t size)
+  {
+    for (uint32_t num_seg = 0; num_seg < nb_seg; num_seg ++)
+      if (segment[num_seg]->test (address,size) == true)
+	return Entity (true,segment[num_seg]);
+    
+    return Entity (false);
+  }
+  
+  Entity Data::entity (std::string name)
+  {
+    for (uint32_t num_seg = 0; num_seg < nb_seg; num_seg ++)
+      if (segment[num_seg]->test(name) == true)
+	return Entity (true,segment[num_seg]);
+    
+    return Entity (false);
+  }
+
+};
+};
Index: trunk/IPs/systemC/Environment/Data/src/Data_init.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Data/src/Data_init.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/Data/src/Data_init.cpp	(revision 81)
@@ -0,0 +1,16 @@
+#include "../include/Data.h"
+
+namespace environment {
+namespace data {
+
+  bool Data::init (std::string section, const char * filename, const char ** list_section)
+  {
+    for (uint32_t it = 0; it < nb_seg; it ++)
+      if (segment[it]->test(section) == true)
+	return segment[it]->init(filename,list_section);
+    
+    return false;
+  }
+  
+};
+};
Index: trunk/IPs/systemC/Environment/Data/src/Data_print.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Data/src/Data_print.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/Data/src/Data_print.cpp	(revision 81)
@@ -0,0 +1,19 @@
+#include "../include/Data.h"
+
+namespace environment {
+namespace data {
+
+  std::ostream& operator<< (std::ostream& output, const Data & x)
+    {
+      output << "<" << x.name << ">" << std::endl
+	     << "  * nb_seg  : " << x.nb_seg  << std::endl 
+	     << "  * max_seg : " << x.param->max_seg << std::endl;
+      
+      for (uint32_t it = 0; it < x.nb_seg; it ++)
+	output << *x.segment[it] << std::endl;
+      return output;
+    };
+
+
+};
+};
Index: trunk/IPs/systemC/Environment/Data/src/Data_read.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Data/src/Data_read.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/Data/src/Data_read.cpp	(revision 81)
@@ -0,0 +1,25 @@
+#include "../include/Data.h"
+
+namespace environment {
+namespace data {
+
+  bool Data::read (uint32_t address, uint32_t size, char * & data_dest)
+  {
+    uint32_t num_seg = 0;
+    bool     res     = false;
+
+    // Scan all segment
+    for (num_seg = 0; num_seg < nb_seg; num_seg ++)
+      if (segment[num_seg]->test (address,size) == true)
+	{
+	  segment[num_seg]->read (address,size,data_dest);
+	  res = true;
+	  break;
+	}
+    
+    return res;
+  }
+
+
+};
+};
Index: trunk/IPs/systemC/Environment/Data/src/Data_reset.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Data/src/Data_reset.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/Data/src/Data_reset.cpp	(revision 81)
@@ -0,0 +1,11 @@
+#include "../include/Data.h"
+
+namespace environment {
+namespace data {
+
+  void Data::reset (void)
+  {
+  }
+  
+};
+};
Index: trunk/IPs/systemC/Environment/Data/src/Data_write.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Data/src/Data_write.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/Data/src/Data_write.cpp	(revision 81)
@@ -0,0 +1,22 @@
+#include "../include/Data.h"
+
+namespace environment {
+namespace data {
+
+  bool Data::write (uint32_t address, uint32_t size, char * & data_src)
+  {
+    uint32_t num_seg = 0;
+    bool     res     = false;
+    for (num_seg = 0; num_seg < nb_seg; num_seg ++)
+      if (segment[num_seg]->test (address,size) == true)
+	{
+	  segment[num_seg]->write (address,size,data_src);
+	  res = true;
+	  break;
+	}
+    
+    return res;
+  }
+  
+};
+};
Index: trunk/IPs/systemC/Environment/Data/src/Entity.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Data/src/Entity.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/Data/src/Entity.cpp	(revision 81)
@@ -0,0 +1,19 @@
+#include "../include/Entity.h"
+
+namespace environment {
+namespace data {
+
+  Entity::Entity (bool present)
+  {
+    this->present = present;
+  }
+  
+  Entity::Entity (bool      present ,
+		  Segment * segment )
+  {
+    this->present = present;
+    this->segment = segment;
+  }
+
+};
+};
Index: trunk/IPs/systemC/Environment/Data/src/Entity_print.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Data/src/Entity_print.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/Data/src/Entity_print.cpp	(revision 81)
@@ -0,0 +1,16 @@
+#include "../include/Entity.h"
+
+namespace environment {
+namespace data {
+
+  std::ostream& operator<< (std::ostream& output, Entity & x)
+  {
+    output << "present : " << x.present;
+    if (x.present == true)
+      output << std::endl << *x.segment;
+    
+    return output;
+  }
+
+};
+};
Index: trunk/IPs/systemC/Environment/Data/src/Segment.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Data/src/Segment.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/Data/src/Segment.cpp	(revision 81)
@@ -0,0 +1,36 @@
+#include "../include/Segment.h"
+
+namespace environment {
+namespace data {
+  
+  Segment::Segment (void)
+  {
+    name     = "";
+    base     = 0;
+    size     = 0;
+    uncached = false;
+    data     = NULL;
+    type     = TYPE_TARGET_MEMORY;
+    index    = 0;
+  }
+
+  Segment::Segment (SEGMENT_TABLE_ENTRY * segment)
+  {
+    name     = segment->getName();
+    
+    base     = segment->getBase();
+    size     = segment->getSize();
+    uncached = segment->getUncached();
+    data     = new char [size];
+    type     = TYPE_TARGET_MEMORY;
+    index    = 0;
+  }
+
+  Segment::~Segment(void)
+  {
+    if (size>0)
+      delete [] data;
+  }
+
+};
+};
Index: trunk/IPs/systemC/Environment/Data/src/Segment_data_addr.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Data/src/Segment_data_addr.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/Data/src/Segment_data_addr.cpp	(revision 81)
@@ -0,0 +1,13 @@
+#include "../include/Segment.h"
+
+namespace environment {
+namespace data {
+  
+  // Return the data address
+  char * Segment::data_addr (void)
+  {
+    return data;
+  }
+  
+};
+};
Index: trunk/IPs/systemC/Environment/Data/src/Segment_define_target.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Data/src/Segment_define_target.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/Data/src/Segment_define_target.cpp	(revision 81)
@@ -0,0 +1,13 @@
+#include "../include/Segment.h"
+
+namespace environment {
+namespace data {
+  
+  void Segment::define_target (type_target_t type, uint32_t index)
+  {
+    this->type  = type;
+    this->index = index;
+  }
+
+};
+};
Index: trunk/IPs/systemC/Environment/Data/src/Segment_getBase.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Data/src/Segment_getBase.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/Data/src/Segment_getBase.cpp	(revision 81)
@@ -0,0 +1,12 @@
+#include "../include/Segment.h"
+
+namespace environment {
+namespace data {
+  
+  uint32_t Segment::getBase (void)
+  {
+    return base;
+  }
+  
+};
+};
Index: trunk/IPs/systemC/Environment/Data/src/Segment_getIndex.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Data/src/Segment_getIndex.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/Data/src/Segment_getIndex.cpp	(revision 81)
@@ -0,0 +1,12 @@
+#include "../include/Segment.h"
+
+namespace environment {
+namespace data {
+  
+  uint32_t Segment::getIndex (void)
+  {
+    return index;
+  }
+  
+};
+};
Index: trunk/IPs/systemC/Environment/Data/src/Segment_getSize.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Data/src/Segment_getSize.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/Data/src/Segment_getSize.cpp	(revision 81)
@@ -0,0 +1,12 @@
+#include "../include/Segment.h"
+
+namespace environment {
+namespace data {
+  
+  uint32_t Segment::getSize (void)
+  {
+    return size;
+  }
+  
+};
+};
Index: trunk/IPs/systemC/Environment/Data/src/Segment_getType.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Data/src/Segment_getType.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/Data/src/Segment_getType.cpp	(revision 81)
@@ -0,0 +1,12 @@
+#include "../include/Segment.h"
+
+namespace environment {
+namespace data {
+  
+  type_target_t Segment::getType (void)
+  {
+    return type;
+  }
+  
+};
+};
Index: trunk/IPs/systemC/Environment/Data/src/Segment_getUncached.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Data/src/Segment_getUncached.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/Data/src/Segment_getUncached.cpp	(revision 81)
@@ -0,0 +1,12 @@
+#include "../include/Segment.h"
+
+namespace environment {
+namespace data {
+  
+  bool Segment::getUncached (void)
+  {
+    return uncached;
+  }
+  
+};
+};
Index: trunk/IPs/systemC/Environment/Data/src/Segment_init.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Data/src/Segment_init.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/Data/src/Segment_init.cpp	(revision 81)
@@ -0,0 +1,31 @@
+#include "../include/Segment.h"
+
+namespace environment {
+namespace data {
+  
+  bool Segment::init (const char * filename,const char ** sections)
+  {
+    void * ptab;
+    int    size   = this->size;
+    int    offset = 0;
+    
+    loadexec(&ptab,&size,&offset,filename,sections);
+    
+//     std::cout << "    - size         : " << size         << std::endl;
+//     std::cout << "    - offset       : " << offset       << std::endl;
+    
+    if (size > (int)this->size)
+      {
+	std::cerr << "<segment.init> : segment \"" << name << "\" is to small : size is " << this->size << " and requiert is " << size << std::endl;
+	return false;
+      }
+    
+    memcpy(data, ptab, size);
+    
+    free  (ptab);
+    
+    return true;
+  }
+  
+};
+};
Index: trunk/IPs/systemC/Environment/Data/src/Segment_print.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Data/src/Segment_print.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/Data/src/Segment_print.cpp	(revision 81)
@@ -0,0 +1,20 @@
+#include "../include/Segment.h"
+
+namespace environment {
+namespace data {
+  
+  std::ostream& operator<< (std::ostream& output, Segment & x)
+  {
+    output << "Segment \"" << x.name << "\""     << std::endl
+	   << std::hex
+	   << "  * base     : " << std::setw(8) << std::setfill('0') << x.base << std::endl
+	   << "  * size     : " << std::setw(8) << std::setfill('0') << x.size << std::endl
+	   << std::dec
+	   << "  * uncached : " << x.uncached    << std::endl
+	   << "  * type     : " << x.type;
+	
+    return output;
+  };
+  
+};
+};
Index: trunk/IPs/systemC/Environment/Data/src/Segment_read.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Data/src/Segment_read.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/Data/src/Segment_read.cpp	(revision 81)
@@ -0,0 +1,13 @@
+#include "../include/Segment.h"
+
+namespace environment {
+namespace data {
+  
+  void Segment::read (uint32_t address, uint32_t size, char * & data_dest)
+  {
+    for (uint32_t it = 0; it < size ; it ++)
+      data_dest [it] = data[address-base+it];
+  }
+  
+};
+};
Index: trunk/IPs/systemC/Environment/Data/src/Segment_test.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Data/src/Segment_test.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/Data/src/Segment_test.cpp	(revision 81)
@@ -0,0 +1,20 @@
+#include "../include/Segment.h"
+
+namespace environment {
+namespace data {
+  
+  bool Segment::test (std::string name)
+  {
+    return (this->name == name);
+  }
+  
+  bool Segment::test (uint32_t address, uint32_t size)
+  {
+    bool res = (((address     ) >= (this->base           )) and
+		((address+size) <= (this->base+this->size)));
+    
+    return res;
+  }
+  
+};
+};
Index: trunk/IPs/systemC/Environment/Data/src/Segment_write.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Data/src/Segment_write.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/Data/src/Segment_write.cpp	(revision 81)
@@ -0,0 +1,13 @@
+#include "../include/Segment.h"
+
+namespace environment {
+namespace data {
+  
+  void Segment::write (uint32_t address, uint32_t size, char * & data_src)
+  {
+    for (uint32_t it = 0; it < size ; it ++)
+      data[address-base+it] = data_src [it];
+  }
+  
+};
+};
Index: trunk/IPs/systemC/Environment/Data/src/loadexec.c
===================================================================
--- trunk/IPs/systemC/Environment/Data/src/loadexec.c	(revision 81)
+++ trunk/IPs/systemC/Environment/Data/src/loadexec.c	(revision 81)
@@ -0,0 +1,154 @@
+/*
+ * File       : loadexec.c
+ * Author     : Frédéric Pétrot
+ *
+ * Load an executable into an array using the GNU BFD
+ *
+ * $Log: loadexec.c,v $
+ * Revision 1.3  2006/06/08 14:32:41  nipo
+ * Use _loading_ memory address rather than _virtual_ memory address when
+ * loading objects.
+ *
+ * Patch from Alexandre Becoulet
+ *
+ * Revision 1.2  2006/02/21 10:37:40  buchmann
+ * Changes :
+ * - random optimizations
+ *   - now uses conditional expressions instead of if statements
+ *   - disables some useless assignments
+ *   - now uses shift operators instead of arithmetic operators
+ * - fix documentations
+ *
+ * Revision 1.1.1.1  2005/01/27 13:42:45  wahid
+ * First project import
+ * Wahid
+ *
+ * Revision 1.1  2003/03/10 10:38:05  fred
+ * Adding the bfd loader for good.
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <bfd.h>
+
+#ifndef TRUE
+#define TRUE true
+#endif
+
+#ifndef FALSE
+#define FALSE false
+#endif
+
+/* Loading the sections sections of file file into the array 
+ * pointed to by emem.
+ * esize is the expected size, but it can be modified by the function if it too 
+ * small for the sections
+ * All sizes and addresses are given in bytes
+ * eoffset is the address of the section with the lowest address among
+ * all required sections.
+ * Code should be self explanatory once you've read the 230 pages of
+ * the BFD documentation :) */
+
+typedef struct raminfo {
+  void *mem;
+  unsigned int  size;
+  unsigned int  ladr;
+  unsigned int  hadr;
+  const char *file;
+  const char **sections;
+} raminfo;
+
+static void bindsection(bfd *exec, asection *sect, PTR x)
+{
+   int i;
+   raminfo *rinfo = x; 
+
+   for (i = 0; rinfo->sections[i]; i++)
+      if (!strcmp(sect->name, rinfo->sections[i]))
+         break;
+   if (!rinfo->sections[i])
+      return;
+
+   if ((sect->flags & SEC_LOAD) && !(sect->flags & SEC_IN_MEMORY)) {
+      bfd_get_section_contents(exec, sect,
+                               rinfo->mem + (sect->lma - rinfo->ladr),
+                               0, bfd_section_size(exec, sect));
+      sect->contents = rinfo->mem;
+   }
+}
+
+static void sectionssize(bfd *exec, asection *sect, PTR x)
+{
+   int i;
+   raminfo *rinfo = x; 
+
+   for (i = 0; rinfo->sections[i]; i++)
+      if (!strcmp(sect->name, rinfo->sections[i]))
+         break;
+   if (!rinfo->sections[i])
+      return;
+
+   rinfo->size += bfd_section_size(exec, sect);
+   rinfo->ladr  = sect->lma < rinfo->ladr ? sect->lma : rinfo->ladr;
+   rinfo->hadr  = sect->lma + rinfo->size > rinfo->hadr ?
+                  sect->lma + rinfo->size : rinfo->hadr;
+}
+
+void loadexec(void **emem, int *esize, int *eoffset, const char *file, const char **sections)
+{
+  bfd      *exec;
+  static   int x;
+  int      i;
+  raminfo  ringo;
+
+   if (!x)
+      bfd_init();
+
+   exec = bfd_openr(file, NULL);
+
+   if (!exec) {
+      fprintf(stderr, "Cannot open File '%s'\n", file);
+      exit(1);
+   }
+
+   if (bfd_check_format(exec, bfd_object) != TRUE && !(exec->flags & EXEC_P)) {
+      fprintf(stderr, "File %s is not an executable file\n",
+                       file); //bfd_get_filename(exec));
+      exit(1);
+   }
+
+#if 1
+   printf("Loading sections ");
+   for (i = 0; sections[i]; i++)
+      printf("%s%s", sections[i], sections[i+1] ? ", " : " ");
+   printf("from \"%s\"\n",bfd_get_filename(exec));
+   //printf("of executable '%s' for '%s' architecture in format '%s'\n",
+   //        bfd_get_filename(exec), bfd_printable_name(exec), exec->xvec->name);
+#endif
+
+   /* Set input parameters to bindsection */
+   ringo.file     = file;
+   ringo.sections = sections;
+   ringo.size     = 0;
+   ringo.ladr     = ~0;
+   ringo.hadr     = 0;
+   bfd_map_over_sections(exec, sectionssize, &ringo);
+   /* Get output parameters from sectionssize */
+   if (ringo.size < ringo.hadr - ringo.ladr)
+      ringo.size = ringo.hadr - ringo.ladr;
+   *esize         = ringo.size > *esize ? ringo.size : *esize;
+   *eoffset       = ringo.ladr;
+   ringo.mem      = malloc(*esize * sizeof(char));
+   /* Start over again from the start of the memory */
+   bfd_map_over_sections(exec, bindsection, &ringo);
+   /* Get output parameters from bindsection */
+
+   *emem          = ringo.mem;
+
+   if (bfd_close(exec) == FALSE) {
+      bfd_perror(exec->filename);
+      exit(1);
+   }
+}
Index: trunk/IPs/systemC/Environment/Endianness/Makefile
===================================================================
--- trunk/IPs/systemC/Environment/Endianness/Makefile	(revision 81)
+++ trunk/IPs/systemC/Environment/Endianness/Makefile	(revision 81)
@@ -0,0 +1,20 @@
+#-----[ Directory ]----------------------------------------
+
+#-----[ Variable ]-----------------------------------------
+
+#OBJECTS_DEPS			=
+
+#-----[ Rules ]--------------------------------------------
+
+all				:
+				@\
+				$(MAKE) all_environment;
+
+clean				:
+				@\
+				$(MAKE) environment_clean;
+
+help				:
+				@$(MAKE) environment_help
+
+include                         ../Makefile.Environment
Index: trunk/IPs/systemC/Environment/Endianness/include/Endianness.h
===================================================================
--- trunk/IPs/systemC/Environment/Endianness/include/Endianness.h	(revision 81)
+++ trunk/IPs/systemC/Environment/Endianness/include/Endianness.h	(revision 81)
@@ -0,0 +1,34 @@
+#ifndef ENVIRONMENT_ENDIANNESS_H
+#define ENVIRONMENT_ENDIANNESS_H
+
+#include <stdint.h>
+
+namespace environment {
+namespace endianness {
+
+#define LittleEndian false
+#define BigEndian    true
+  
+  typedef union 
+  {
+    uint32_t word;
+    
+    struct 
+    {
+      uint8_t byte1;
+      uint8_t byte2;
+      uint8_t byte3;
+      uint8_t byte4;
+    } bytes;
+  } TestEndian ;
+  
+  bool   hostEndianness   ();
+  bool   cpuEndianness    (uint32_t cpu_id);
+  bool   isSameEndianness (uint32_t cpu_id);
+  char * swapBytes        (char *   string_src , 
+			   uint32_t size_string, 
+			   uint32_t size_access);
+  
+};
+};
+#endif
Index: trunk/IPs/systemC/Environment/Endianness/selftest/main.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Endianness/selftest/main.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/Endianness/selftest/main.cpp	(revision 81)
@@ -0,0 +1,65 @@
+#include <iostream>
+#include "../include/Endianness.h"
+
+using namespace std;
+using namespace environment;
+using namespace environment::endianness;
+
+#ifdef SYSTEMC
+int sc_main (int argc, char * argv[])
+#else
+int    main (int argc, char * argv[])
+#endif
+{
+  cout << "<main> Begin" << endl;
+
+  cout << "hostEndianness : " << hostEndianness() << endl;
+  cout << "cpuEndianness  : " << cpuEndianness (0) << endl;
+  cout << "same ?         : " << isSameEndianness (0) << endl;
+
+  char * str = new char [16];
+
+  str [0] = 'a';
+  for (uint32_t i=1; i<16; i++)
+    str [i] = str[i-1]+1;
+
+  cout << "str : ";
+  for (uint32_t i=0; i<16; i++)
+    cout << str [i];
+  cout << endl;
+
+  str = swapBytes (str, 16, 4);
+
+  cout << "str : ";
+  for (uint32_t i=0; i<16; i++)
+    cout << str [i];
+  cout << endl;
+
+  str = swapBytes (str, 16, 1);
+
+  cout << "str : ";
+  for (uint32_t i=0; i<16; i++)
+    cout << str [i];
+  cout << endl;
+
+  str = swapBytes (str, 16, 8);
+
+  cout << "str : ";
+  for (uint32_t i=0; i<16; i++)
+    cout << str [i];
+  cout << endl;
+
+  str = swapBytes (str, 16, 4);
+
+  cout << "str : ";
+  for (uint32_t i=0; i<16; i++)
+    cout << str [i];
+  cout << endl;
+
+  delete [] str;
+  
+
+  cout << "<main> End" << endl;
+  
+  return EXIT_SUCCESS;
+}
Index: trunk/IPs/systemC/Environment/Endianness/src/Endianness_cpuEndianness.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Endianness/src/Endianness_cpuEndianness.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/Endianness/src/Endianness_cpuEndianness.cpp	(revision 81)
@@ -0,0 +1,19 @@
+#include "../include/Endianness.h"
+
+namespace environment {
+namespace endianness {
+
+  bool cpuEndianness (uint32_t cpu_id)
+  {
+    // OpenRisc is big endian
+    return(BigEndian);
+
+    /*
+     * Comment connaitre l'endianness ?
+     * static    : table generee dans le top level
+     * dynamique : table generee par un l'equivalent de hostEndianness et ecrivant dans un segment precis de la ram
+     */
+  }
+
+};
+};
Index: trunk/IPs/systemC/Environment/Endianness/src/Endianness_hostEndianness.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Endianness/src/Endianness_hostEndianness.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/Endianness/src/Endianness_hostEndianness.cpp	(revision 81)
@@ -0,0 +1,16 @@
+#include "../include/Endianness.h"
+
+namespace environment {
+namespace endianness {
+
+  bool hostEndianness ()
+  {
+    TestEndian test;
+    
+    test.word = 0x000000FF;
+    
+    return (test.bytes.byte1 == 0xFF)?LittleEndian:BigEndian;
+  }
+
+};
+};
Index: trunk/IPs/systemC/Environment/Endianness/src/Endianness_isSameEndianness.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Endianness/src/Endianness_isSameEndianness.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/Endianness/src/Endianness_isSameEndianness.cpp	(revision 81)
@@ -0,0 +1,12 @@
+#include "../include/Endianness.h"
+
+namespace environment {
+namespace endianness {
+
+  bool isSameEndianness (uint32_t cpu_id)
+  {
+    return ((hostEndianness() xor cpuEndianness(cpu_id)) == false);
+  }
+
+};
+};
Index: trunk/IPs/systemC/Environment/Endianness/src/Endianness_swapBytes.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Endianness/src/Endianness_swapBytes.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/Endianness/src/Endianness_swapBytes.cpp	(revision 81)
@@ -0,0 +1,77 @@
+#include "../include/Endianness.h"
+#include <iostream>
+
+namespace environment {
+namespace endianness {
+
+/*
+ * swapBytes -> change the endiannes
+ * exemple for 16 and size_access = 4, [0123456789abcdef] -> [32107654ba98fedc]
+ */
+  char * swapBytes (char * string_src , uint32_t size_string, uint32_t size_access)
+  {
+    char string_tmp [size_string];
+    
+    if ( (size_access == 1) or
+	 (size_access >  size_string))
+      return string_src;
+    
+//     if (size_string % size_access != 0)
+//       {
+// 	std::cerr << "<swapBytes> : Size of string must be a multiple of size_access." << std::endl;
+// 	exit(1);
+//       }
+    
+    // size_access :
+    // 1 -> bytes
+    // 2 -> half
+    // 4 -> word
+    // 8 -> doubleword
+    
+    memcpy (string_tmp,string_src,size_string);
+    
+  // Loop to reorganize the string
+    for (uint32_t i = 0 ; i < size_string; i += size_access)
+      {
+	switch (size_access)
+	  {
+	  case 2  : 
+	    {
+	      string_src[i+0] = string_tmp[i+1];
+	      string_src[i+1] = string_tmp[i+0];
+	      break;
+	    }
+	  case 4  :
+	    {
+	      string_src[i+0] = string_tmp[i+3];
+	      string_src[i+1] = string_tmp[i+2];
+	      string_src[i+2] = string_tmp[i+1];
+	      string_src[i+3] = string_tmp[i+0];
+	      break;
+	    }
+	  case 8  :
+	    {
+	      string_src[i+0] = string_tmp[i+7];
+	      string_src[i+1] = string_tmp[i+6];
+	      string_src[i+2] = string_tmp[i+5];
+	      string_src[i+3] = string_tmp[i+4];
+	      string_src[i+4] = string_tmp[i+3];
+	      string_src[i+5] = string_tmp[i+2];
+	      string_src[i+6] = string_tmp[i+1];
+	      string_src[i+7] = string_tmp[i+0];
+	      break;
+	    }
+	  default :  
+	    {
+	      std::cerr << "<swapBytes> : Illegal size of access (size_access = " << size_access << ")" << std::endl;
+	      exit(1);
+	      break;
+	    }
+	  }//end switch(size_access)
+      }//end i
+    
+    return string_src;
+  }
+
+};
+};
Index: trunk/IPs/systemC/Environment/Makefile
===================================================================
--- trunk/IPs/systemC/Environment/Makefile	(revision 81)
+++ trunk/IPs/systemC/Environment/Makefile	(revision 81)
@@ -0,0 +1,52 @@
+#-----[ Directory ]----------------------------------------
+
+DIR_CACHE			= Cache
+DIR_DATA			= Data
+DIR_ENDIANNESS			= Endianness
+DIR_QUEUE			= Queue
+DIR_RAMLOCK			= RamLock
+DIR_SIM2OS			= Sim2OS
+DIR_TTY   			= TTY
+
+#-----[ Variable ]-----------------------------------------
+
+OBJECTS_DEPS			= 	$(patsubst $(DIR_CACHE)/$(DIR_SRC)/%.cpp,$(DIR_CACHE)/$(DIR_OBJ)/%.o,$(wildcard $(DIR_CACHE)/$(DIR_SRC)/*.cpp))			\
+					$(patsubst $(DIR_DATA)/$(DIR_SRC)/%.cpp,$(DIR_DATA)/$(DIR_OBJ)/%.o,$(wildcard $(DIR_DATA)/$(DIR_SRC)/*.cpp))			\
+					$(patsubst $(DIR_DATA)/$(DIR_SRC)/%.c,$(DIR_DATA)/$(DIR_OBJ)/%.o,$(wildcard $(DIR_DATA)/$(DIR_SRC)/*.c))			\
+					$(patsubst $(DIR_ENDIANNESS)/$(DIR_SRC)/%.cpp,$(DIR_ENDIANNESS)/$(DIR_OBJ)/%.o,$(wildcard $(DIR_ENDIANNESS)/$(DIR_SRC)/*.cpp))	\
+					$(patsubst $(DIR_QUEUE)/$(DIR_SRC)/%.cpp,$(DIR_QUEUE)/$(DIR_OBJ)/%.o,$(wildcard $(DIR_QUEUE)/$(DIR_SRC)/*.cpp))			\
+					$(patsubst $(DIR_RAMLOCK)/$(DIR_SRC)/%.cpp,$(DIR_RAMLOCK)/$(DIR_OBJ)/%.o,$(wildcard $(DIR_RAMLOCK)/$(DIR_SRC)/*.cpp))		\
+					$(patsubst $(DIR_SIM2OS)/$(DIR_SRC)/%.cpp,$(DIR_SIM2OS)/$(DIR_OBJ)/%.o,$(wildcard $(DIR_SIM2OS)/$(DIR_SRC)/*.cpp)) 		\
+					$(patsubst $(DIR_TTY)/$(DIR_SRC)/%.cpp,$(DIR_TTY)/$(DIR_OBJ)/%.o,$(wildcard $(DIR_TTY)/$(DIR_SRC)/*.cpp))
+
+
+#-----[ Rules ]--------------------------------------------
+
+all				:
+				@\
+				$(MAKE) --directory=$(DIR_CACHE)      all; \
+				$(MAKE) --directory=$(DIR_DATA)       all; \
+				$(MAKE) --directory=$(DIR_ENDIANNESS) all; \
+				$(MAKE) --directory=$(DIR_QUEUE)      all; \
+				$(MAKE) --directory=$(DIR_RAMLOCK)    all; \
+				$(MAKE) --directory=$(DIR_SIM2OS)     all; \
+				$(MAKE) --directory=$(DIR_TTY)        all; \
+				$(MAKE) all_environment;
+
+clean				:
+				@\
+				$(MAKE) --directory=$(DIR_CACHE)      clean; \
+				$(MAKE) --directory=$(DIR_DATA)       clean; \
+				$(MAKE) --directory=$(DIR_ENDIANNESS) clean; \
+				$(MAKE) --directory=$(DIR_QUEUE)      clean; \
+				$(MAKE) --directory=$(DIR_RAMLOCK)    clean; \
+				$(MAKE) --directory=$(DIR_SIM2OS)     clean; \
+				$(MAKE) --directory=$(DIR_TTY)        clean; \
+				$(MAKE) environment_clean; \
+				$(RM) tty_*;
+
+
+help				:
+				@$(MAKE) environment_help
+
+include                         Makefile.Environment
Index: trunk/IPs/systemC/Environment/Makefile.Environment
===================================================================
--- trunk/IPs/systemC/Environment/Makefile.Environment	(revision 81)
+++ trunk/IPs/systemC/Environment/Makefile.Environment	(revision 81)
@@ -0,0 +1,108 @@
+include                         $(MORPHEO_TOPLEVEL)/Makefile.tools
+include                         $(MORPHEO_IPS)/processor/Morpheo/Behavioural/Makefile.flags 
+
+#-----[ Directory ]----------------------------------------
+DIR_TST                         = selftest
+DIR_INC				= include
+DIR_SRC				= src
+DIR_OBJ				= obj
+DIR_BIN				= bin
+
+#-----[ Compilation ]--------------------------------------
+INCDIR 				= $(SYSTEMC_INCDIR_$(SIMULATOR)) 	\
+				  -I$(DIR_INC)				\
+				  -I../processor/Morpheo
+
+LIBDIR 				= $(SYSTEMC_LIBDIR_$(SIMULATOR))
+
+LIBNAME  			= $(SYSTEMC_LIBNAME_$(SIMULATOR)) 	\
+				  -lbfd
+
+FLAGS				= $(SYSTEMC_CFLAGS_$(SIMULATOR))
+
+MORPHEO_CC_FLAGS		= $(MORPHEO_FLAGS) $(CC_FLAGS)           $(INCDIR)
+MORPHEO_CXX_FLAGS		= $(MORPHEO_FLAGS) $(CXX_FLAGS) $(FLAGS) $(INCDIR) 
+MORPHEO_L_FLAGS			= $(MORPHEO_FLAGS) $(CXX_FLAGS) $(FLAGS) $(LIBDIR)
+
+#-----[ Variable ]-----------------------------------------
+
+ENTITY				= `$(BASENAME) $$PWD`
+
+OBJECTS				= $(patsubst $(DIR_SRC)/%.cpp,$(DIR_OBJ)/%.o,$(wildcard $(DIR_SRC)/*.cpp)) \
+				  $(patsubst $(DIR_SRC)/%.c,$(DIR_OBJ)/%.o,$(wildcard $(DIR_SRC)/*.c))
+OBJECTS_BIN			= $(patsubst $(DIR_TST)/%.cpp,$(DIR_OBJ)/%.o,$(wildcard $(DIR_TST)/*.cpp))
+
+HEADERS  			= $(wildcard $(DIR_INC)/*.h)
+
+EXE				= $(DIR_BIN)/soft.x
+
+EXEC_PREFIX			= 
+#$(VALGRIND) 
+
+#-----[ Rules ]--------------------------------------------
+
+.PRECIOUS			: $(DIR_OBJ)/%.o $(DIR_BIN)/%.x
+
+test_env			:
+				@\
+				$(ECHO) "-------------------| $(ENTITY)"
+
+$(DIR_OBJ)/%.o			: $(DIR_SRC)/%.cpp $(HEADERS)
+				@\
+				$(ECHO) "Compilation        : $*";\
+				$(DISTCXX) $(MORPHEO_CXX_FLAGS) -c -o $@ $<;
+
+$(DIR_OBJ)/%.o			: $(DIR_SRC)/%.c $(HEADERS)
+				@\
+				$(ECHO) "Compilation        : $*";\
+				$(DISTCC)  $(MORPHEO_CC_FLAGS)  -c -o $@ $<;
+
+$(DIR_OBJ)/%.o			: $(DIR_TST)/%.cpp $(HEADERS)
+				@\
+				$(ECHO) "Compilation        : $*";\
+				$(DISTCXX) $(MORPHEO_CXX_FLAGS) -c -o $@ $<;
+
+$(DIR_BIN)/%.x			: $(OBJECTS_DEPS) $(OBJECTS) $(OBJECTS_BIN)
+				\
+				$(ECHO) "Compilation        : $*";\
+				$(CXX) $(MORPHEO_L_FLAGS)      -o $@ $^ $(LIBNAME);
+
+$(DIR_OBJ)			:
+				@\
+				$(ECHO) "Create directory   : $@";\
+				$(MKDIR) $@
+
+$(DIR_BIN)			:
+				@\
+				$(ECHO) "Create directory   : $@";\
+				$(MKDIR) $@
+
+
+exe				: all
+				@\
+				export SYSTEMC=$(SYSTEMC_$(SIMULATOR)) ; $(EXEC_PREFIX) ./$(EXE) $(SYSTEMC_EXEC_PARAMS_$(SIMULATOR))
+
+
+all_environment			: test_env $(DIR_OBJ) $(DIR_BIN)
+				@\
+				$(MAKE) $(EXE)
+
+environment_clean		:
+				@\
+				$(ECHO) "Delete     temporary files in directory "$(PWD);\
+				$(RM) 	*~ 		\
+					$(DIR_OBJ) 	\
+					$(DIR_BIN) 	\
+					$(DIR_TST)/*~	\
+					$(DIR_SRC)/*~	\
+					$(DIR_INC)/*~	\
+					*.dot		\
+					*.txt;
+
+environment_help		:
+				@\
+				$(ECHO) " -----[ Environment ]------------------------------";\
+				$(ECHO) "";\
+				$(ECHO) " * test_env             : test if environnment's variable is set";\
+				$(ECHO) " * all_environment    : generate object";\
+				$(ECHO) "";
Index: trunk/IPs/systemC/Environment/Makefile.Environnement
===================================================================
--- trunk/IPs/systemC/Environment/Makefile.Environnement	(revision 80)
+++ 	(revision )
@@ -1,90 +1,0 @@
-include                         $(MORPHEO_TOPLEVEL)/Makefile.tools
-
-#-----[ Directory ]----------------------------------------
-DIR_TST                         = selftest
-DIR_INC				= include
-DIR_SRC				= src
-DIR_OBJ				= obj
-DIR_BIN				= bin
-
-#-----[ Compilation ]--------------------------------------
-INCDIR 				= $(SYSTEMC_INCDIR_$(SIMULATOR)) 	\
-				  -I$(DIR_INC) 
-
-LIBDIR 				= 
-
-FLAGS				= $(SYSTEMC_CFLAGS_$(SIMULATOR))	\
-				  $(CXX_FLAGS)
-
-CFLAGS				= $(MORPHEO_FLAGS) $(FLAGS) $(INCDIR)
-LFLAGS				= $(MORPHEO_FLAGS) $(FLAGS) $(LIBDIR)
-
-#-----[ Variable ]-----------------------------------------
-
-ENTITY				= `$(BASENAME) $$PWD`
-
-OBJECTS				= $(patsubst $(DIR_SRC)/%.cpp,$(DIR_OBJ)/%.o,$(wildcard $(DIR_SRC)/*.cpp))
-OBJECTS_BIN			= $(patsubst $(DIR_TST)/%.cpp,$(DIR_OBJ)/%.o,$(wildcard $(DIR_TST)/*.cpp))
-
-HEADERS  			= $(wildcard $(DIR_INC)/*.h)
-
-EXE				= $(DIR_BIN)/soft.x
-
-#-----[ Rules ]--------------------------------------------
-
-.PRECIOUS			: $(DIR_OBJ)/%.o $(DIR_BIN)/%.x
-
-test_env			:
-				@$(ECHO) "-------------------[ $(ENTITY) ]"
-
-$(DIR_OBJ)/%.o			: $(DIR_SRC)/%.cpp $(HEADERS)
-				@\
-				$(ECHO) "Compilation        : $*";\
-				$(CXX) $(CFLAGS) -c -o $@ $<;
-
-$(DIR_OBJ)/%.o			: $(DIR_TST)/%.cpp $(HEADERS)
-				@\
-				$(ECHO) "Compilation        : $*";\
-				$(CXX) $(CFLAGS) -c -o $@ $<;
-
-$(DIR_BIN)/%.x			: $(OBJECTS_DEPS) $(OBJECTS) $(OBJECTS_BIN)
-				\
-				$(ECHO) "Compilation        : $*";\
-				$(CXX) $(LFLAGS)    -o $@ $^;
-
-$(DIR_OBJ)			:
-				@\
-				$(ECHO) "Create directory   : $@";\
-				$(MKDIR) $@
-
-$(DIR_BIN)			:
-				@\
-				$(ECHO) "Create directory   : $@";\
-				$(MKDIR) $@
-
-
-exe				: all_environment
-				@\
-				$(VALGRIND) ./$(EXE)
-
-all_environment		: test_env $(DIR_OBJ) $(DIR_BIN)
-				@\
-				$(MAKE) $(EXE)
-
-environment_clean		:
-				@\
-				$(ECHO) "Delete     temporary files in directory "$(PWD);\
-				$(RM) 	*~ 		\
-					$(DIR_OBJ) 	\
-					$(DIR_BIN) 	\
-					$(DIR_TST)/*~	\
-					$(DIR_SRC)/*~	\
-					$(DIR_INC)/*~;
-
-environment_help		:
-				@\
-				$(ECHO) " -----[ Environment ]------------------------------";\
-				$(ECHO) "";\
-				$(ECHO) " * test_env             : test if environnment's variable is set";\
-				$(ECHO) " * all_environment    : generate object";\
-				$(ECHO) "";
Index: trunk/IPs/systemC/Environment/Queue/include/Queue.h
===================================================================
--- trunk/IPs/systemC/Environment/Queue/include/Queue.h	(revision 80)
+++ trunk/IPs/systemC/Environment/Queue/include/Queue.h	(revision 81)
@@ -61,13 +61,13 @@
       // *****[ pop ]*****
       // read the queue, and update the pointer
-    public : virtual T    pop  ()             {return T();};
+    public : virtual T    pop  ()             = 0;
 
       // *****[ pop ]*****
       // read the queue, and update the pointer
-    public : virtual T    pop  (uint32_t num) {return T();};
+    public : virtual T    pop  (uint32_t num) = 0;
 
       // *****[ push ]*****
       // Push a new value (they must have a slot free)
-    public : virtual bool push (T val)        {return false;};
+    public : virtual bool push (T val)        = 0;
   
     }; // Queue
Index: trunk/IPs/systemC/Environment/Queue/include/Sort_Queue.h
===================================================================
--- trunk/IPs/systemC/Environment/Queue/include/Sort_Queue.h	(revision 80)
+++ trunk/IPs/systemC/Environment/Queue/include/Sort_Queue.h	(revision 81)
@@ -25,4 +25,6 @@
 			 Parameters * param) : Queue <T> (name,param->_size)
       {
+	_ptr_read  = 0;
+	_ptr_write = 0;
       };
       
@@ -104,4 +106,9 @@
       
       // *****[ push ]*****
+  public : bool push (T val)
+    {
+      return push (0, val);
+    }
+
       // Push a new value (they must have a slot free)
       // Is sort by delay
Index: trunk/IPs/systemC/Environment/Queue/include/Sort_Queue_Dynamic.h
===================================================================
--- trunk/IPs/systemC/Environment/Queue/include/Sort_Queue_Dynamic.h	(revision 80)
+++ trunk/IPs/systemC/Environment/Queue/include/Sort_Queue_Dynamic.h	(revision 81)
@@ -143,9 +143,13 @@
 	// Reorganize the queue
 
- 	for (uint32_t it = num; it < Queue <T>::_nb_slot; it ++)
+ 	for (uint32_t it = num; it+1 < Queue <T>::_nb_slot; it ++)
 	  {
 	    uint32_t ptr      = (it);
 	    uint32_t ptr_next = (it+1);
 
+// 	    std::cout << "ptr      : " << ptr << std::endl
+// 		      << "ptr_next : " << ptr_next << std::endl
+// 		      << "nb_slot  : " << Queue <T>::_nb_slot << std::endl;
+	    
 	    Queue <T>::_slot [ptr] = Queue <T>::_slot [ptr_next];
 	  }
@@ -157,4 +161,9 @@
       
       // *****[ push ]*****
+    public : bool push (T val)
+      {
+	return push (0, val);
+      }
+      
       // Push a new value (they must have a slot free)
       // Is sort by delay
Index: trunk/IPs/systemC/Environment/Queue/selftest/main.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Queue/selftest/main.cpp	(revision 80)
+++ trunk/IPs/systemC/Environment/Queue/selftest/main.cpp	(revision 81)
@@ -1,5 +1,5 @@
-#include <iostream>
 #include "../include/Sort_Queue.h"
 #include "../include/Sort_Queue_Dynamic.h"
+#include <iostream>
 
 using namespace std;
@@ -52,5 +52,9 @@
 
 
-int main (void)
+#ifdef SYSTEMC
+int sc_main (int argc, char * argv[])
+#else
+int    main (int argc, char * argv[])
+#endif
 {
   cout << "<main> Begin" << endl;
Index: trunk/IPs/systemC/Environment/RamLock/include/Parameters.h
===================================================================
--- trunk/IPs/systemC/Environment/RamLock/include/Parameters.h	(revision 80)
+++ 	(revision )
@@ -1,25 +1,0 @@
-#ifndef Environment_Parameters_H
-#define Environment_Parameters_H
-
-#include <stdint.h>
-
-namespace environment {
-namespace ramlock {
-
-  class Parameters
-  {
-  public  : uint32_t _size;
-
-  public  :  Parameters (uint32_t size)
-    {
-      _size = size;
-    }
-
-  public  : ~Parameters (void)
-    {};
-
-  };
-
-};
-};
-#endif
Index: trunk/IPs/systemC/Environment/RamLock/include/RamLock.h
===================================================================
--- trunk/IPs/systemC/Environment/RamLock/include/RamLock.h	(revision 80)
+++ trunk/IPs/systemC/Environment/RamLock/include/RamLock.h	(revision 81)
@@ -5,5 +5,5 @@
 #include <iostream>
 
-#include "Parameters.h"
+#include "RamLock_Parameters.h"
 
 namespace environment {
Index: trunk/IPs/systemC/Environment/RamLock/include/RamLock_Parameters.h
===================================================================
--- trunk/IPs/systemC/Environment/RamLock/include/RamLock_Parameters.h	(revision 81)
+++ trunk/IPs/systemC/Environment/RamLock/include/RamLock_Parameters.h	(revision 81)
@@ -0,0 +1,25 @@
+#ifndef Environment_Parameters_H
+#define Environment_Parameters_H
+
+#include <stdint.h>
+
+namespace environment {
+namespace ramlock {
+
+  class Parameters
+  {
+  public  : uint32_t _size;
+
+  public  :  Parameters (uint32_t size)
+    {
+      _size = size;
+    }
+
+  public  : ~Parameters (void)
+    {};
+
+  };
+
+};
+};
+#endif
Index: trunk/IPs/systemC/Environment/RamLock/selftest/main.cpp
===================================================================
--- trunk/IPs/systemC/Environment/RamLock/selftest/main.cpp	(revision 80)
+++ trunk/IPs/systemC/Environment/RamLock/selftest/main.cpp	(revision 81)
@@ -1,4 +1,4 @@
+#include "../include/RamLock.h"
 #include <iostream>
-#include "../include/RamLock.h"
 
 using namespace std;
@@ -24,5 +24,9 @@
 
 
-int main (void)
+#ifdef SYSTEMC
+int sc_main (int argc, char * argv[])
+#else
+int    main (int argc, char * argv[])
+#endif
 {
   cout << "<main> Begin" << endl;
Index: trunk/IPs/systemC/Environment/RamLock/src/RamLock_test.cpp
===================================================================
--- trunk/IPs/systemC/Environment/RamLock/src/RamLock_test.cpp	(revision 80)
+++ trunk/IPs/systemC/Environment/RamLock/src/RamLock_test.cpp	(revision 81)
@@ -8,4 +8,5 @@
 //     return num_lock < _param->_size;
 //   }
+
 };
 };
Index: trunk/IPs/systemC/Environment/Sim2OS/Makefile
===================================================================
--- trunk/IPs/systemC/Environment/Sim2OS/Makefile	(revision 81)
+++ trunk/IPs/systemC/Environment/Sim2OS/Makefile	(revision 81)
@@ -0,0 +1,24 @@
+#-----[ Directory ]----------------------------------------
+
+DIR_ENDIANNESS			= ../Endianness
+
+#-----[ Variable ]-----------------------------------------
+
+OBJECTS_DEPS			= $(patsubst $(DIR_ENDIANNESS)/$(DIR_SRC)/%.cpp,$(DIR_ENDIANNESS)/$(DIR_OBJ)/%.o,$(wildcard $(DIR_ENDIANNESS)/$(DIR_SRC)/*.cpp))
+
+#-----[ Rules ]--------------------------------------------
+
+all				:
+				@\
+				$(MAKE) --directory=$(DIR_ENDIANNESS) all; \
+				$(MAKE) all_environment
+
+clean				:
+				@\
+				$(MAKE) --directory=$(DIR_ENDIANNESS) clean; \
+				$(MAKE) environment_clean
+
+help				:
+				@$(MAKE) environment_help
+
+include                         ../Makefile.Environment
Index: trunk/IPs/systemC/Environment/Sim2OS/include/Service.h
===================================================================
--- trunk/IPs/systemC/Environment/Sim2OS/include/Service.h	(revision 81)
+++ trunk/IPs/systemC/Environment/Sim2OS/include/Service.h	(revision 81)
@@ -0,0 +1,17 @@
+#ifndef ENVIRONMENT_SIM2OS_SERVICE_H
+#define ENVIRONMENT_SIM2OS_SERVICE_H
+
+typedef enum 
+  {
+    SERVICE_OPEN          ,
+    SERVICE_CLOSE         ,
+    SERVICE_READ          ,
+    SERVICE_WRITE         ,
+    SERVICE_TIME          ,
+    SERVICE_CLOCK         ,
+    SERVICE_LSEEK         ,
+    SERVICE_UNDEFINED     ,
+    SERVICE_UNIMPLEMENTED
+  } service_t;
+
+#endif
Index: trunk/IPs/systemC/Environment/Sim2OS/include/Service_conversion.h
===================================================================
--- trunk/IPs/systemC/Environment/Sim2OS/include/Service_conversion.h	(revision 81)
+++ trunk/IPs/systemC/Environment/Sim2OS/include/Service_conversion.h	(revision 81)
@@ -0,0 +1,14 @@
+#ifndef ENVIRONMENT_SIM2OS_SERVICE_CONVERSION_H
+#define ENVIRONMENT_SIM2OS_SERVICE_CONVERSION_H
+
+#include "Service.h"
+
+namespace environment {
+namespace sim2os {
+
+  int       service2int (service_t num_service);
+  service_t int2service (int val);
+
+};
+};
+#endif
Index: trunk/IPs/systemC/Environment/Sim2OS/include/Sim2OS.h
===================================================================
--- trunk/IPs/systemC/Environment/Sim2OS/include/Sim2OS.h	(revision 81)
+++ trunk/IPs/systemC/Environment/Sim2OS/include/Sim2OS.h	(revision 81)
@@ -0,0 +1,55 @@
+#ifndef ENVIRONMENT_SIM2OS_H
+#define ENVIRONMENT_SIM2OS_H
+
+#include <iostream>
+#include <map>
+#include <stdarg.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include "Sim2OS_Parameters.h"
+#include "Service_conversion.h"
+#include "../../Endianness/include/Endianness.h"
+namespace environment {
+namespace sim2os {
+
+  class Sim2OS
+  {
+  private : std::string               name;
+  private : Parameters *              param;
+  private : service_t                 num_service;    // number of service
+  private : std::map<uint32_t,void *> arguments;
+  private : uint32_t                  nb_cycle;
+  public  : void *                    result;
+  public  : int                       error; // It's errno
+    
+  public  :  Sim2OS (std::string  name,
+		     Parameters * param);
+  public  : ~Sim2OS (void);
+
+  public  : void                 reset              (void);
+
+  private : bool                 have_all_arguments (uint32_t);
+  private : void *               convert_address    (void *);
+    
+  private : void *               service_open       (void);
+  private : void *               service_close      (void);
+  private : void *               service_read       (void);
+  private : void *               service_write      (void);
+  private : void *               service_time       (void);
+  private : void *               service_clock      (void);
+  private : void *               service_lseek      (void);
+
+  public  : void *               execute            (void);
+  public  : void *               execute            (service_t);
+  public  : void *               execute            (service_t, void *, ...);
+  public  : void                 parameter          (uint32_t, void *);
+  public  : void                 transition         (void);
+  public  : friend std::ostream& operator<<         (std::ostream&, Sim2OS&);
+  };
+
+};
+};
+#endif
Index: trunk/IPs/systemC/Environment/Sim2OS/include/Sim2OS_Parameters.h
===================================================================
--- trunk/IPs/systemC/Environment/Sim2OS/include/Sim2OS_Parameters.h	(revision 81)
+++ trunk/IPs/systemC/Environment/Sim2OS/include/Sim2OS_Parameters.h	(revision 81)
@@ -0,0 +1,21 @@
+#ifndef ENVIRONMENT_SIM2OS_PARAMETERS_H
+#define ENVIRONMENT_SIM2OS_PARAMETERS_H
+
+#include "../../../shared/soclib_segment_table.h"
+
+namespace environment {
+namespace sim2os {
+
+  class Parameters
+  {
+  public : SOCLIB_SEGMENT_TABLE * segment_table;
+
+  public : Parameters (SOCLIB_SEGMENT_TABLE * segment_table)
+    {
+      this->segment_table = segment_table;
+    }
+  };
+
+};
+};
+#endif
Index: trunk/IPs/systemC/Environment/Sim2OS/selftest/main.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Sim2OS/selftest/main.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/Sim2OS/selftest/main.cpp	(revision 81)
@@ -0,0 +1,92 @@
+#include <iostream>
+#include "../include/Sim2OS.h"
+
+using namespace std;
+using namespace environment;
+using namespace environment::sim2os;
+
+#ifdef SYSTEMC
+int sc_main (int argc, char * argv[])
+#else
+int    main (int argc, char * argv[])
+#endif
+{
+  cout << "<main> Begin" << endl;
+
+  SOCLIB_SEGMENT_TABLE * segtable = new SOCLIB_SEGMENT_TABLE;
+  segtable->setMSBNumber    (8);
+  segtable->setDefaultTarget(0,0);
+  
+  //shared data segment
+
+  const int TEXT_BASE          = 0x1000;
+  const int DATA_CACHED_BASE   = 0x2000;
+  const int DATA_UNCACHED_BASE = 0x3000;
+  const int STACK_BASE         = 0x4000;
+  const int TTY_BASE           = 0x5000;
+  const int SIM2OS_BASE        = 0x6000;
+  const int RAMLOCK_BASE       = 0x7000;
+  
+  const int TEXT_SIZE          = 0x100;
+  const int DATA_CACHED_SIZE   = 0x100;
+  const int DATA_UNCACHED_SIZE = 0x100;
+  const int STACK_SIZE         = 0x100;
+  const int TTY_SIZE           = 0x100;
+  const int SIM2OS_SIZE        = 0x100;
+  const int RAMLOCK_SIZE       = 0x100;
+
+  // Add a segment   :name        , address of base    , size               , global index , local index, uncache
+  segtable->addSegment("text"      , TEXT_BASE          , TEXT_SIZE          , 0            ,0           , false);
+  segtable->addSegment("data"      , DATA_CACHED_BASE   , DATA_CACHED_SIZE   , 0            ,0           , false);
+  segtable->addSegment("data_unc"  , DATA_UNCACHED_BASE , DATA_UNCACHED_SIZE , 0            ,0           , true );
+  segtable->addSegment("stack"     , STACK_BASE         , STACK_SIZE         , 0            ,0           , false);
+  segtable->addSegment("tty"       , TTY_BASE           , TTY_SIZE           , 0            ,0           , true );
+  segtable->addSegment("sim2os"    , SIM2OS_BASE        , SIM2OS_SIZE        , 0            ,0           , true );
+  segtable->addSegment("ramlock"   , RAMLOCK_BASE       , RAMLOCK_SIZE       , 0            ,0           , true );
+
+  segtable->print();
+
+  Parameters * param = new Parameters (segtable);
+  
+  Sim2OS * my_sim2os = new Sim2OS ("my_sim2os",param);
+
+  cout << *my_sim2os << endl;
+
+  my_sim2os->transition();
+  my_sim2os->transition();
+  my_sim2os->transition();
+  my_sim2os->transition();
+  my_sim2os->transition();
+  my_sim2os->transition();
+  my_sim2os->transition();
+  my_sim2os->transition(); // cycle 8
+
+  my_sim2os->parameter(1,(void*)  21071981);
+  my_sim2os->parameter(2,(void*)0xdeadbeef);
+  my_sim2os->parameter(0,(void*)5); // SERVICE_CLOCK
+
+  cout << *my_sim2os << endl;
+  my_sim2os->execute();
+  cout << *my_sim2os << endl;
+
+//   char * pathname = "toto.txt";
+//   int    flags    = O_CREAT;
+//   mode_t mode     = 0777;
+
+//   my_sim2os->parameter(1,(void*)pathname);
+//   my_sim2os->parameter(2,(void*)flags   );
+//   my_sim2os->parameter(3,(void*)mode    );
+//   my_sim2os->parameter(0,(void*)0       );
+
+//   cout << *my_sim2os << endl;
+//   my_sim2os->execute();
+//   cout << *my_sim2os << endl;
+
+  delete my_sim2os;
+  delete param;
+  delete segtable;
+
+  cout << "<main> End" << endl;
+
+  return EXIT_SUCCESS;
+}
Index: trunk/IPs/systemC/Environment/Sim2OS/src/Service_conversion.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Sim2OS/src/Service_conversion.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/Sim2OS/src/Service_conversion.cpp	(revision 81)
@@ -0,0 +1,28 @@
+#include "../include/Service_conversion.h"
+
+namespace environment {
+namespace sim2os {
+
+  int service2int (service_t num_service)
+  {
+    return static_cast<int>(num_service);
+  }
+  
+  service_t int2service (int val)
+  {
+    switch (val)
+      {
+      case SERVICE_OPEN          : return SERVICE_OPEN ;
+      case SERVICE_CLOSE         : return SERVICE_CLOSE;
+      case SERVICE_READ          : return SERVICE_READ ;
+      case SERVICE_WRITE         : return SERVICE_WRITE;
+      case SERVICE_TIME          : return SERVICE_TIME ;
+      case SERVICE_CLOCK         : return SERVICE_CLOCK;
+      case SERVICE_LSEEK         : return SERVICE_LSEEK;
+      case SERVICE_UNIMPLEMENTED : return SERVICE_UNIMPLEMENTED;
+      default                    : return SERVICE_UNDEFINED;
+      }//end switch
+  }
+
+};
+};
Index: trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS.cpp	(revision 81)
@@ -0,0 +1,22 @@
+#include "../include/Sim2OS.h"
+
+namespace environment {
+namespace sim2os {
+
+  Sim2OS::Sim2OS (std::string  name,
+		  Parameters * param)
+  {
+    this->name        = name;
+    this->param       = param;
+    this->num_service = SERVICE_UNDEFINED;
+    this->result      = (void *)-1;
+    this->error       =          1;
+    this->nb_cycle    =          0;
+  }
+  
+  Sim2OS::~Sim2OS (void)
+  {
+  }
+
+};
+};
Index: trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_convert_address.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_convert_address.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_convert_address.cpp	(revision 81)
@@ -0,0 +1,23 @@
+#include "../include/Sim2OS.h"
+
+namespace environment {
+namespace sim2os {
+
+  /*
+   * convert a address in the simulator on a address in OS
+   */
+  void * Sim2OS::convert_address (void * address)
+  {
+    void * result = param->segment_table->getAddrAlloc((uint32_t)address);
+    
+    if (result == NULL)
+      {
+	std::cerr << "<" << name << "> address don't match : " << std::hex << (uint32_t)(address) << std::dec << std::endl;
+	exit(0);
+      }
+    
+    return result;
+  }
+
+};
+};
Index: trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_execute.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_execute.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_execute.cpp	(revision 81)
@@ -0,0 +1,72 @@
+#include "../include/Sim2OS.h"
+
+namespace environment {
+namespace sim2os {
+
+    void * Sim2OS::execute (service_t num)
+    {
+      num_service = num;
+      
+      return execute();
+    }
+  
+    /*
+     * execute the service with all
+     * the list of arg must be finish by "NULL"
+     * also the list can't have a NULL as param
+     */
+    void * Sim2OS::execute (service_t num, void * arg, ...)
+    {
+      num_service = num;
+      
+      va_list ap;
+      va_start (ap,arg);
+      uint32_t it = 1;
+      while (arg != NULL)
+	{
+	  arguments[it] = arg;  
+	  it ++;
+	  arg = va_arg(ap,void *);
+	}
+  
+      va_end(ap);
+      return execute();
+    }
+
+    /*
+     * execute the service without argument
+     */
+    void * Sim2OS::execute ()
+    {
+      result = NULL;
+      
+      switch (num_service)
+	{
+	case SERVICE_OPEN          : {result = service_open     (); break;}
+	case SERVICE_CLOSE         : {result = service_close    (); break;}
+	case SERVICE_READ          : {result = service_read     (); break;}
+	case SERVICE_WRITE         : {result = service_write    (); break;}
+	case SERVICE_TIME          : {result = service_time     (); break;}
+	case SERVICE_CLOCK         : {result = service_clock    (); break;}
+	case SERVICE_LSEEK         : {result = service_lseek    (); break;}
+	case SERVICE_UNIMPLEMENTED :
+	  {
+	    std::cerr << "<" << name << "> service Unimplemented : " << num_service << std::endl;
+	    break;
+	  }
+
+	case SERVICE_UNDEFINED     :
+	default                    :
+	  {
+	    std::cerr << "<" << name << "> service Undefine      : " << num_service << std::endl;
+	    break;
+	  }
+	}//end switch
+
+      // Erase all elt;
+      num_service = SERVICE_UNDEFINED;
+      arguments.erase(arguments.begin(),arguments.end());
+      return result;
+    };
+};
+};
Index: trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_have_all_arguments.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_have_all_arguments.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_have_all_arguments.cpp	(revision 81)
@@ -0,0 +1,30 @@
+#include "../include/Sim2OS.h"
+
+namespace environment {
+namespace sim2os {
+
+    /*
+     * Test if all arguments is here
+     * (don't test the coherencies of this)
+     */
+    bool Sim2OS::have_all_arguments (uint32_t nb_val)
+    {
+      //   while ((nb_val > 0) &&
+      // 	 (arguments.find(nb_val) != arguments.end()))
+      //     nb_val --;
+      
+      uint32_t val = nb_val;
+      while (nb_val > 0)
+	if (arguments.find(nb_val) != arguments.end())
+	  nb_val --;
+	else
+	  {
+	    std::cerr << "argument[" << nb_val << "] on " << val << ", is not find." << std::endl;
+	    break;
+	  }
+
+      return (nb_val == 0);
+    };
+
+};
+};
Index: trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_parameter.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_parameter.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_parameter.cpp	(revision 81)
@@ -0,0 +1,21 @@
+#include "../include/Sim2OS.h"
+
+namespace environment {
+namespace sim2os {
+
+    /*
+     * Add a new parameter
+     * if num_reg == 0, it's the number of service
+     * else             it's a arguments
+     */
+    void Sim2OS ::parameter (uint32_t num_reg,
+			     void       * val)
+    {
+      if (num_reg == 0)
+	num_service = int2service((int)(val));
+      else
+	arguments[num_reg] = val;
+    };
+
+};
+};
Index: trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_print.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_print.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_print.cpp	(revision 81)
@@ -0,0 +1,19 @@
+#include "../include/Sim2OS.h"
+
+namespace environment {
+namespace sim2os {
+
+  std::ostream& operator<< (std::ostream& output, Sim2OS &x)
+  {
+    output << "<" << x.name << ">" << std::endl;
+    output << " * num_service : " << x.num_service << std::endl;
+    
+    for (std::map<uint32_t,void *>::iterator it = x.arguments.begin();
+	 it != x.arguments.end();
+	 it ++)
+      output << "[" << it->first << "] : " << it->second << std::endl;
+    return output;
+  }
+
+};
+};
Index: trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_reset.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_reset.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_reset.cpp	(revision 81)
@@ -0,0 +1,11 @@
+#include "../include/Sim2OS.h"
+
+namespace environment {
+namespace sim2os {
+
+  void Sim2OS::reset (void)
+    {
+    }
+
+};
+};
Index: trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_service_clock.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_service_clock.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_service_clock.cpp	(revision 81)
@@ -0,0 +1,25 @@
+#include "../include/Sim2OS.h"
+
+namespace environment {
+namespace sim2os {
+
+  void * Sim2OS::service_clock (void)
+  {
+    if (have_all_arguments(0) == false)
+      {
+	std::cerr << "<" << name << "> Usage : clock_t clock();" << std::endl;
+	return NULL;
+      }
+    
+    void * result = (void *) nb_cycle;
+    error         = 0;
+    
+    std::cout << "\n\t***** service : clock         *****" << std::endl;
+    std::cout << "\tresult    : " << (unsigned int) result << std::endl;
+    std::cout << "\terrno     : " << (unsigned int) error  << std::endl;
+    
+    return      result;
+  }
+
+};
+};
Index: trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_service_close.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_service_close.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_service_close.cpp	(revision 81)
@@ -0,0 +1,27 @@
+#include "../include/Sim2OS.h"
+
+namespace environment {
+namespace sim2os {
+
+  void * Sim2OS::service_close (void)
+  {
+    if (have_all_arguments(1) == false)
+      {
+	std::cerr << "<" << name << "> Usage : int close(int fd);" << std::endl;
+	return NULL;
+      }
+    
+    int    fd     = (int)    arguments[1];
+    void * result = (void *) close(fd);
+    error         = errno;
+    
+    std::cout << "\n\t***** service : close         *****" << std::endl;
+    std::cout << "\tfd        : " << (unsigned int) fd     << std::endl;
+    std::cout << "\tresult    : " << (unsigned int) result << std::endl;
+    std::cout << "\terrno     : " << (unsigned int) error  << std::endl;
+    
+    return result;
+  }
+
+};
+};
Index: trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_service_lseek.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_service_lseek.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_service_lseek.cpp	(revision 81)
@@ -0,0 +1,33 @@
+#include "../include/Sim2OS.h"
+
+namespace environment {
+namespace sim2os {
+
+  void * Sim2OS::service_lseek (void)
+  {
+    if (have_all_arguments(3) == false)
+      {
+	std::cerr << "<" << name << "> Usage : off_t lseek(int fildes, off_t offset, int whence);" << std::endl;
+	return NULL;
+      }
+    
+    int    flides   = (int)    arguments[1];
+    off_t  offset   = (off_t)  arguments[2];
+    int    whence   = (int)    arguments[3];
+    void * result   = (void *) lseek(flides,offset,whence);
+    error           = errno;
+    
+    // No swap -> because no access memory
+    
+    std::cout << "\n\t***** service : lseek         *****"        << std::endl;
+    std::cout << "\tflides    : " << (unsigned int) flides << std::endl;
+    std::cout << "\toffset    : " << (unsigned int) offset << std::endl;
+    std::cout << "\twhence    : " << (unsigned int) whence << std::endl;
+    std::cout << "\tresult    : " << (unsigned int) result << std::endl;
+    std::cout << "\terrno     : " << (unsigned int) error  << std::endl;
+    
+    return      result;
+  }
+
+};
+};
Index: trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_service_open.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_service_open.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_service_open.cpp	(revision 81)
@@ -0,0 +1,35 @@
+#include "../include/Sim2OS.h"
+
+namespace environment {
+namespace sim2os {
+
+  void * Sim2OS::service_open (void)
+  {
+    if (have_all_arguments(3) == false)
+      {
+	std::cerr << "<" << name << "> Usage : int open(const char *pathname, int flags, mode_t mode);" << std::endl;
+	return NULL;
+      }
+    
+    const char *pathname = (const char *) convert_address(arguments[1]);
+    int         flags    = (int)          arguments[2];
+    mode_t      mode     = (mode_t)       arguments[3];
+    void *      result   = (void *)       open(pathname,flags,mode);
+    error                = errno;
+    
+    std::cout << "\n\t***** service : open          *****"               << std::endl;
+    std::cout << "\tpathname  : " <<                            pathname << std::endl;
+    std::cout << "\tflags /8  : " << std::oct << (unsigned int) flags    << std::endl;
+    std::cout << "\tflags /10 : " << std::dec << (unsigned int) flags    << std::endl;
+    std::cout << "\tflags /16 : " << std::hex << (unsigned int) flags    << std::endl;
+    std::cout << "\tmode  /8  : " << std::oct << (unsigned int) mode     << std::endl;
+    std::cout << "\tmode  /10 : " << std::dec << (unsigned int) mode     << std::endl;
+    std::cout << "\tmode  /16 : " << std::hex << (unsigned int) mode     << std::endl;
+    std::cout << "\tresult    : " << std::dec << (unsigned int) result   << std::endl;
+    std::cout << "\terrno     : " <<             (unsigned int) error    << std::endl;
+    
+    return      result;
+  }
+
+};
+};
Index: trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_service_read.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_service_read.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_service_read.cpp	(revision 81)
@@ -0,0 +1,33 @@
+#include "../include/Sim2OS.h"
+
+namespace environment {
+namespace sim2os {
+
+  void * Sim2OS::service_read (void)
+  {
+    if (have_all_arguments(3) == false)
+      {
+	std::cerr << "<" << name << "> Usage : ssize_t read(int fd, void *buf, size_t count);" << std::endl;
+	return NULL;
+      }
+    
+    int     fd       = (int)     arguments[1];
+    void *  buf      = (void *)  convert_address(arguments[2]);
+    ssize_t count    = (ssize_t) arguments[3];
+    void *  result   = (void *)  read(fd,buf,count);
+    
+    std::cout << "\n\t***** service : read          *****"        << std::endl;
+    std::cout << "\tfd        : " <<             (unsigned int) fd     << std::endl;
+    std::cout << "\tbuf       : " << std::hex << (unsigned int) buf    << std::endl;
+  //std::cout << "\tbuf       : " << std::dec << (char *)       buf    << std::endl;
+    std::cout << "\tcount     : " << std::dec << (unsigned int) count  << std::endl;
+    std::cout << "\tresult    : " <<             (unsigned int) result << std::endl;
+    std::cout << "\terrno     : " <<             (unsigned int) error  << std::endl;
+    
+    error = errno;
+    
+    return result;
+  }
+
+};
+};
Index: trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_service_time.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_service_time.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_service_time.cpp	(revision 81)
@@ -0,0 +1,30 @@
+#include "../include/Sim2OS.h"
+
+namespace environment {
+namespace sim2os {
+
+  void * Sim2OS::service_time (void)
+  {
+    if (have_all_arguments(1) == false)
+      {
+	std::cerr << "<" << name << "> Usage : time_t time(time_t * t);" << std::endl;
+	return NULL;
+      }
+    
+    time_t *t      = (time_t *)     convert_address(arguments[1]);
+    void *  result = (void *)       time(t);
+    error          = errno;
+    
+    std::cout << "\n\t***** service : time          *****" << std::endl;
+    std::cout << "\tt         : " << std::hex << (unsigned int) t                                      << std::endl;
+    std::cout << "\tresult    : " << std::dec << (unsigned int) result << " - " << ctime((time_t *) t) << std::endl;
+    std::cout << "\terrno     : " <<             (unsigned int) error                                  << std::endl;
+    
+    // Must swap, because it's a pointer
+    t = (time_t *)endianness::swapBytes((char *)t,sizeof(time_t),sizeof(time_t));
+    
+    return result;
+  }
+
+};
+};
Index: trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_service_write.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_service_write.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_service_write.cpp	(revision 81)
@@ -0,0 +1,34 @@
+#include "../include/Sim2OS.h"
+
+namespace environment {
+namespace sim2os {
+
+  void * Sim2OS::service_write (void)
+  {
+    if (have_all_arguments(3) == false)
+      {
+	std::cerr << "<" << name << "> Usage : ssize_t write(int fd, void *buf, size_t count);" << std::endl;
+	return NULL;
+      }
+  
+    int         fd       = (int)          arguments[1];
+    const void *buf      = (const void *) convert_address(arguments[2]);
+    ssize_t     count    = (ssize_t)      arguments[3];
+    void *      result   = (void *)       write(fd,buf,count);
+    error                = errno;
+    
+    // No swap -> because it's a char
+    
+    std::cout << "\n\t***** service : write         *****"        << std::endl;
+    std::cout << "\tfd        : " <<             (unsigned int) fd     << std::endl;
+    std::cout << "\tbuf       : " << std::hex << (unsigned int) buf    << std::endl;
+  //std::cout << "\tbuf       : " << std::dec << (char *)       buf    << std::endl;
+    std::cout << "\tcount     : " << std::dec << (unsigned int) count  << std::endl;
+    std::cout << "\tresult    : " <<             (unsigned int) result << std::endl;
+    std::cout << "\terrno     : " <<             (unsigned int) error  << std::endl;
+    
+    return      result;
+  }
+
+};
+};
Index: trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_transition.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_transition.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_transition.cpp	(revision 81)
@@ -0,0 +1,12 @@
+#include "../include/Sim2OS.h"
+
+namespace environment {
+namespace sim2os {
+
+  void Sim2OS::transition (void)
+  {
+    nb_cycle ++;
+  }
+
+};
+};
Index: trunk/IPs/systemC/Environment/TTY/Makefile
===================================================================
--- trunk/IPs/systemC/Environment/TTY/Makefile	(revision 81)
+++ trunk/IPs/systemC/Environment/TTY/Makefile	(revision 81)
@@ -0,0 +1,21 @@
+#-----[ Directory ]----------------------------------------
+
+#-----[ Variable ]-----------------------------------------
+
+#OBJECTS_DEPS			=
+
+#-----[ Rules ]--------------------------------------------
+
+all				:
+				@\
+				$(MAKE) all_environment;
+
+clean				:
+				@\
+				$(MAKE)  environment_clean;\
+				$(RM) tty_*;
+
+help				:
+				@$(MAKE) environment_help
+
+include                         ../Makefile.Environment
Index: trunk/IPs/systemC/Environment/TTY/include/TTY.h
===================================================================
--- trunk/IPs/systemC/Environment/TTY/include/TTY.h	(revision 81)
+++ trunk/IPs/systemC/Environment/TTY/include/TTY.h	(revision 81)
@@ -0,0 +1,30 @@
+#ifndef ENVIRONMENT_TTY_H
+#define ENVIRONMENT_TTY_H
+
+#include "TTY_Parameters.h"
+#include "xTTY.h"
+// #include <fcntl.h>
+// #include <unistd.h>
+#include <signal.h>
+
+namespace environment {
+namespace tty {
+
+  class TTY
+  {
+  private : std::string  name;
+  private : Parameters * param;
+  private : xTTY       * xtty;
+
+  public  :  TTY (std::string  name,
+		  Parameters * param);
+  public  : ~TTY (void);
+
+  public  : void reset (void);
+  public  : bool write (uint32_t num_tty, char data);
+  public  : friend std::ostream& operator<< (std::ostream& output, TTY & x);
+  };
+
+};
+};
+#endif
Index: trunk/IPs/systemC/Environment/TTY/include/TTY_Parameters.h
===================================================================
--- trunk/IPs/systemC/Environment/TTY/include/TTY_Parameters.h	(revision 81)
+++ trunk/IPs/systemC/Environment/TTY/include/TTY_Parameters.h	(revision 81)
@@ -0,0 +1,27 @@
+#ifndef ENVIRONMENT_TTY_PARAMETERS_H
+#define ENVIRONMENT_TTY_PARAMETERS_H
+
+#include <iostream>
+
+namespace environment {
+namespace tty {
+
+  class Parameters
+  {
+  public : uint32_t      nb_tty;
+  public : std::string * name_tty;
+  public : bool          with_xtty;
+
+  public : Parameters (uint32_t      nb_tty,
+		       std::string * name_tty,
+		       bool          with_xtty)
+    {
+      this->nb_tty    = nb_tty;
+      this->name_tty  = name_tty;
+      this->with_xtty = with_xtty;
+    }
+  };
+
+};
+};
+#endif
Index: trunk/IPs/systemC/Environment/TTY/include/xTTY.h
===================================================================
--- trunk/IPs/systemC/Environment/TTY/include/xTTY.h	(revision 81)
+++ trunk/IPs/systemC/Environment/TTY/include/xTTY.h	(revision 81)
@@ -0,0 +1,21 @@
+#ifndef ENVIRONMENT_XTTY_H
+#define ENVIRONMENT_XTTY_H
+
+#include <sys/types.h>
+
+namespace environment {
+namespace tty {
+
+  typedef struct canal {int CanalPipe[2];} canal ;
+
+  class xTTY
+  {
+  public : FILE * log_file;
+  public : pid_t  pid;
+  public : int    pipe_output;
+  };
+
+
+};
+};
+#endif
Index: trunk/IPs/systemC/Environment/TTY/selftest/main.cpp
===================================================================
--- trunk/IPs/systemC/Environment/TTY/selftest/main.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/TTY/selftest/main.cpp	(revision 81)
@@ -0,0 +1,59 @@
+#include "../include/TTY.h"
+#include <iostream>
+
+using namespace std;
+using namespace environment;
+using namespace environment::tty;
+
+#ifdef SYSTEMC
+int sc_main (int argc, char * argv[])
+#else
+int    main (int argc, char * argv[])
+#endif
+{
+  cout << "<main> Begin" << endl;
+
+  uint32_t nb_tty = 4;
+  string * name_tty = new string [nb_tty];
+
+  name_tty [0] = "tty_0";
+  name_tty [1] = "tty_1";
+  name_tty [2] = "tty_2";
+  name_tty [3] = "tty_3";
+
+  Parameters * param = new Parameters (nb_tty,
+				       name_tty,
+				       true);
+
+  TTY * tty = new TTY ("my_tty", param);
+  tty->reset();
+
+  cout << *tty << endl;
+  
+  char * message_0 =  "Ici Londre : Adeline aime la saucisse de Frankort.\nJe repete : Adeline aime la saucisse de Frankort"  ;
+  char * message_1 =  "Ici Londre : Maurice a garer le camion de bernard dans la cour.\nJe repete Maurice a garer le camion de bernard dans la cour";
+  char * message_2 =  "Ici Londre : Londre est la ville qui diffuse des messages a la con.\nJe repete : Londre est la ville qui diffuse des messages a la con";
+  char * message_3 =  "Ici Londre : Non, le debarquement n'aura pas lieu le 6 juin 1944 en Normandie, et je ne me repete pas";
+
+  char * message [nb_tty];
+  message[0] = message_0;
+  message[1] = message_1;
+  message[2] = message_2;
+  message[3] = message_3;
+
+  for (uint32_t j = 0; j < nb_tty ; j ++)
+    {
+      for (uint32_t i = 0; i < strlen(message[j]); i++)
+	tty->write(j,message[j][i]);
+    }
+
+  cout << "<main> Press <Enter> to stop the test" << endl;
+  getchar();
+
+  delete    tty;
+  delete    param;
+  delete [] name_tty;
+  cout << "<main> End" << endl;
+  
+  return EXIT_SUCCESS;
+}
Index: trunk/IPs/systemC/Environment/TTY/src/TTY.cpp
===================================================================
--- trunk/IPs/systemC/Environment/TTY/src/TTY.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/TTY/src/TTY.cpp	(revision 81)
@@ -0,0 +1,74 @@
+#include "../include/TTY.h"
+
+namespace environment {
+namespace tty {
+
+  TTY::TTY (std::string  name,
+	    Parameters * param)
+  {
+    this->name  = name;
+    this->param = param;
+
+    xtty = new xTTY [param->nb_tty];
+
+    
+    for (uint32_t i=0; i<param->nb_tty; i++)
+      {
+	// ***** Create a log_file *****
+	xtty [i].log_file = fopen(param->name_tty[i].c_str(),"w");
+
+	if (xtty [i].log_file == NULL)
+	  {
+	    // Error
+	    std::cerr << "<Tty> Can't open the file : \"" << param->name_tty[i] << "\"" << std::endl;
+	    exit(1);
+	  }
+
+	if (param->with_xtty == true)
+	  {
+	    // ***** TTY and pipe init *****
+	    canal canal_output;
+	    
+	    if (pipe (canal_output.CanalPipe) != 0)
+	      {
+		std::cerr << "<Tty> Error in pipe creation" << std::endl;
+		exit(1);
+	      }
+	      
+	    if ((xtty[i].pid = fork()) == 0)
+	      {
+		// Childen -> transform in a xtty
+		close(0); // s
+		dup (canal_output.CanalPipe [0]);
+		close(1);
+		execlp("xtty","xtty", param->name_tty [i].c_str() ,NULL); // devient un tty
+		
+		std::cerr << "<Tty> Error in the creation of tty" << std::endl
+			  << "Test if environment's variable $PATH is set with ${MORPHEO_IPS}/Environment/TTY/xtty" << std::endl;
+		exit (1);
+	      }
+	    else
+	      {
+		// father
+		xtty[i].pipe_output = canal_output.CanalPipe [1];
+	      }
+	  }
+      }//end for
+  }
+
+  TTY::~TTY (void)
+  {
+    // Kill all tty
+    for (unsigned int i=0; i<param->nb_tty; i++)
+      {
+	if (param->with_xtty == true)
+	  if (xtty[i].pid)
+	    kill(xtty[i].pid,SIGTERM);
+	fclose(xtty[i].log_file);
+      }
+
+    delete [] xtty;
+  }
+
+};
+};
Index: trunk/IPs/systemC/Environment/TTY/src/TTY_print.cpp
===================================================================
--- trunk/IPs/systemC/Environment/TTY/src/TTY_print.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/TTY/src/TTY_print.cpp	(revision 81)
@@ -0,0 +1,18 @@
+#include "../include/TTY.h"
+
+namespace environment {
+namespace tty {
+
+  std::ostream& operator<< (std::ostream& output, TTY & x)
+  {
+    output << "<" << x.name << ">" << std::endl
+	   << " * nb_tty : " << x.param->nb_tty << std::endl;
+    
+    for (uint32_t i=0; i<x.param->nb_tty; i++)
+      output << "   * tty ["<< i << "] : " << x.param->name_tty[i] << std::endl;
+
+    return output;
+  }
+
+};
+};
Index: trunk/IPs/systemC/Environment/TTY/src/TTY_reset.cpp
===================================================================
--- trunk/IPs/systemC/Environment/TTY/src/TTY_reset.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/TTY/src/TTY_reset.cpp	(revision 81)
@@ -0,0 +1,11 @@
+#include "../include/TTY.h"
+
+namespace environment {
+namespace tty {
+  
+  void TTY::reset (void)
+  {
+  }
+
+};
+};
Index: trunk/IPs/systemC/Environment/TTY/src/TTY_write.cpp
===================================================================
--- trunk/IPs/systemC/Environment/TTY/src/TTY_write.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/TTY/src/TTY_write.cpp	(revision 81)
@@ -0,0 +1,20 @@
+#include "../include/TTY.h"
+
+namespace environment {
+namespace tty {
+
+  bool TTY::write (uint32_t num_tty, char data)
+  {
+    if (num_tty >= param->nb_tty)
+      return false;
+
+    if (param->with_xtty == true)
+      ::write (xtty[num_tty].pipe_output, &data, 1);
+    
+    fputc (data, xtty[num_tty].log_file);
+
+    return true;
+  }
+
+};
+};
Index: trunk/IPs/systemC/Environment/TTY/xtty/xtty.cc
===================================================================
--- trunk/IPs/systemC/Environment/TTY/xtty/xtty.cc	(revision 81)
+++ trunk/IPs/systemC/Environment/TTY/xtty/xtty.cc	(revision 81)
@@ -0,0 +1,468 @@
+/*
+ * $Log: xtty.cc,v $
+ * Revision 1.2  2005/09/26 10:45:31  wahid
+ * X11 application name changed
+ *
+ * Revision 1.1.1.1  2005/01/27 13:42:45  wahid
+ * First project import
+ * Wahid
+ *
+ * Revision 1.1  2002/03/19 15:03:22  boris
+ * Vcitty model addition
+ *
+ * Revision 1.1.1.1  2002/02/28 12:58:33  disydent
+ * Creation of Disydent CVS Tree
+ *
+ * Revision 1.1.1.1  2001/11/19 16:55:32  pwet
+ * Changing the CVS tree structure of disydent
+ *
+ * Revision 1.1.1.1  2001/07/24 13:31:45  pwet
+ * cvs tree of part of disydent
+ *
+ * Revision 1.1.1.1  2001/07/19 14:32:25  pwet
+ * New cvs tree
+ *
+ * Revision 1.3  2000/11/14 14:04:02  pwet
+ * Added an argument to main in tty.c and an argument in the call to xtty in
+ * pitty.c in order for the tty name to reflect the name of the file used
+ * to in the netlist.
+ *
+ * Revision 1.2  1998/09/16 16:11:32  pwet
+ * passage a cvs
+ *
+ * Revision 1.1  1998/09/01 09:49:14  pwet
+ * Initial revision
+ *
+ * Revision 1.1  1998/07/16 18:03:59  pwet
+ * Initial revision
+ *
+ * Authors: Frédéric Pétrot and Denis Hommais 
+ */
+
+//#ident "$Id$"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <X11/Xlib.h>
+#include <signal.h>
+#include "xtty.h"
+
+#include <X11/Xutil.h>
+#include <X11/Xos.h>
+
+
+#ifdef __STDC__
+static void ttySetGraphics(Colormap cmap, char *fname, xtty *tty)
+#else
+static void ttySetGraphics(cmap, fname, tty)
+Colormap cmap;
+char *fname;
+xtty *tty;
+#endif
+{
+XColor def, fit;
+register int i;
+static char *colorName[2] = {"Black", "Green"};
+int  colors[2];
+XGCValues vGC;
+Font         font;
+XFontStruct *qfst;
+
+
+   XFreeColormap(tty->display, cmap);
+
+   if ((qfst = XLoadQueryFont(tty->display, fname)) == NULL) {
+         fprintf(stderr, "Font %s not available from X11 database.\n", fname);
+         exit(-1);
+   }
+   tty->font_height  = qfst->ascent + qfst->descent;
+   tty->font_width   = qfst->max_bounds.rbearing - qfst->min_bounds.lbearing;
+   font = qfst->fid;
+   /* XFreeFontInfo(&fname, qfst, 1); */
+
+   for (i = 0; i < 2; i++) {
+      if (!XAllocNamedColor(tty->display, cmap, 
+               colorName[i], &def, &fit)) {
+         colorName[i]=strdup("white");
+         XAllocNamedColor(tty->display, cmap, colorName[i], &def, &fit);
+      }
+      colors[i] = def.pixel;
+   }
+
+   vGC.fill_style = FillSolid;
+   vGC.foreground = colors[1];
+   vGC.background = colors[0];
+   vGC.plane_mask = AllPlanes;
+   vGC.font = font;
+   tty->gc = XCreateGC(tty->display,
+                          RootWindow(tty->display,
+                                     DefaultScreen(tty->display)),
+                          (GCForeground | GCBackground | GCFillStyle | 
+                             GCPlaneMask | GCFont), &vGC);
+
+}
+
+#define OFFSET 3
+
+#ifdef __STDC__
+void RefreshXtty(xtty *tty)
+#else
+void RefreshXtty(tty)
+xtty *tty;
+#endif
+{
+int y;
+
+   for (y = 0; y < TTYHEIGHT; y++)
+      XDrawImageString(tty->display,
+                       tty->window,
+                       tty->gc,
+                       0,
+                       y * tty->font_height - OFFSET,
+                       &tty->video[y][0],
+                       TTYWIDTH);
+
+}
+
+#ifdef __STDC__
+static void UpdateXtty(xtty *tty, int refresh)
+#else
+static void UpdateXtty(tty, refresh)
+xtty *tty;
+int refresh;
+#endif
+{
+int x, y;
+
+   if (tty->xcurse == 0) {
+      x = TTYWIDTH - 1;
+      y = tty->ycurse - 1;
+   } else {
+      x = tty->xcurse - 1;
+      y = tty->ycurse;
+   }
+   if (refresh)
+      RefreshXtty(tty);
+   else
+      XDrawImageString(tty->display,
+                    tty->window,
+                    tty->gc,
+                    x * tty->font_width,
+                    y * tty->font_height - OFFSET,
+                    &tty->video[y][x], 1);
+}
+
+#undef OFFSET
+
+#ifdef __STDC__
+static int ManageXtty(xtty *tty, char c)
+#else
+static int ManageXtty(tty, c)
+xtty *tty;
+char c;
+#endif
+{
+int yy;
+int i;
+
+   switch (c) {
+      case 0x08:
+         if (tty->xcurse > 0) {
+            tty->video[tty->ycurse][--tty->xcurse] = ' ';
+            return 1;
+         } else
+            XBell(tty->display, 10);
+         break;
+
+      case 0x09:
+         for (i=0; i<8; i++) {
+            tty->video[tty->ycurse][tty->xcurse] = ' ';
+            tty->xcurse++;
+            if (tty->xcurse >= TTYWIDTH) {
+               tty->xcurse = 0;
+               tty->ycurse++;
+            }
+            if (tty->ycurse >= TTYHEIGHT) {
+               for (yy = 1; yy < TTYHEIGHT; yy++)
+                  memcpy(tty->video[yy - 1], tty->video[yy], TTYWIDTH);
+               memset(tty->video[yy - 1], ' ', TTYWIDTH);
+               tty->ycurse = yy - 1;
+               return 1;
+            }
+         }
+         break;
+
+      case 0x0A:
+      case 0x0D:
+         tty->xcurse = 0;
+         tty->ycurse++;
+         break;
+
+      default:
+         tty->video[tty->ycurse][tty->xcurse] = c;
+         tty->xcurse++;
+   }
+   if (tty->xcurse >= TTYWIDTH) {
+      tty->xcurse = 0;
+      tty->ycurse++;
+   }
+   if (tty->ycurse >= TTYHEIGHT) {
+      for (yy = 1; yy < TTYHEIGHT; yy++)
+         memcpy(tty->video[yy - 1], tty->video[yy], TTYWIDTH);
+      memset(tty->video[yy - 1], ' ', TTYWIDTH);
+      tty->ycurse = yy - 1;
+      return 1;
+   }
+   return 0;
+}
+
+#ifdef __STDC__
+static void EventXtty(xtty *tty, XEvent *event)
+#else
+static void EventXtty(tty, event)
+xtty *tty;
+XEvent *event;
+#endif
+{
+KeySym key;
+char c;
+
+   switch (event->type) { 
+      case Expose:
+         RefreshXtty(tty);
+         break;
+
+      case KeyPress:
+         XLookupString(&event->xkey, &c, 1, &key, NULL);
+
+         if ((key & 0x100) != 0
+             && key != XK_BackSpace
+             && key != XK_BackSpace
+             && key != XK_Tab
+             && key != XK_Linefeed
+             && key != XK_Return
+             && key != XK_Escape
+             && key != XK_Delete)
+		 
+		break ;
+	 
+	 if (tty->wptr == tty->rptr && (tty->keybuf[tty->wptr] & 0x100) == 0x100)
+            XBell(tty->display, 10);
+
+	 else {
+	    write( 1, &c, 1) ; 
+    	   // UpdateXtty(tty, ManageXtty(tty, c));
+	    tty->keybuf[tty->wptr++] = 0 << 8 | c; //1 << 8 | c;
+            tty->wptr %= 16;
+
+         }
+         break;
+
+      default :
+         return;
+   }
+}
+
+#ifdef __STDC__
+static Display *connect(Colormap *cmap)
+#else
+static Display *connect(cmap)
+Colormap *cmap;
+#endif
+{
+Display *display;
+
+   if ((display = XOpenDisplay(NULL)) == NULL) {
+      fputs("tty: cannot open X11 display\n", stderr);
+      exit(1);
+   }
+   *cmap = DefaultColormap(display, DefaultScreen(display));
+   return display;
+}
+
+#ifdef __STDC__
+static void DestroyXtty(xtty *tty)
+#else
+static void DestroyXtty(tty)
+xtty *tty;
+#endif
+{
+   XDestroyWindow(tty->display, tty->window);
+   XCloseDisplay(tty->display);
+}
+
+int main(int argc, char *argv[])
+{
+timeval timeout ;
+xtty *tty;
+char *title;
+XSizeHints shint;
+//XWMHints wmhint;
+XEvent event;
+Colormap Cmap;
+char c;
+int rs;
+
+//fd_set rfds, wfds;
+fd_set rfds;
+int xfd;
+
+   if (argc == 2)
+      title = argv[1];
+   else
+      title = "SoCLib TTY";
+
+   tty = (xtty *)malloc(sizeof(xtty));
+   memset(tty->video, ' ', TTYHEIGHT * TTYWIDTH);
+   
+   tty->xcurse = 0;
+   tty->ycurse = 1;
+   memset(tty->keybuf, 0, MAXCHAR * sizeof(short));
+   tty->rptr  = 0;
+   tty->wptr  = 0;
+
+   tty->display = connect(&Cmap);
+   ttySetGraphics(Cmap, FONT, tty);
+
+   shint.x = 100;
+   shint.y = 0;
+   shint.min_width = shint.max_width = shint.width = TTYWIDTH * tty->font_width;
+   shint.min_height = shint.max_height = shint.height
+                   = (TTYHEIGHT - 1) * tty->font_height;
+   
+   shint.flags = PSize | PMinSize | PMaxSize;
+
+   tty->window = XCreateSimpleWindow(
+                     tty->display,
+                     DefaultRootWindow(tty->display), 
+                     shint.x, shint.y, shint.width, shint.height, 5,
+                     WhitePixelOfScreen(DefaultScreenOfDisplay(tty->display)),
+                     BlackPixelOfScreen(DefaultScreenOfDisplay(tty->display)));
+
+   XSetStandardProperties(tty->display, tty->window,
+                          title, "Pouet",
+                          None, NULL, 0, &shint);
+
+   /*
+	if (XpmCreatePixmapFromData(tty->display, tty->window, afraid_xpm,
+					                &pixmap, &mask, NULL))
+                               */
+   XSelectInput(tty->display, tty->window,// ExposureMask);
+
+                KeyPressMask    | ExposureMask);
+
+   XMapRaised(tty->display, tty->window);
+
+   /*
+   for (i=0; i<15; i++)
+      memcpy(tty->video[i+4], pouet[i], 65);
+      */
+
+   xfd=ConnectionNumber(tty->display);
+   FD_ZERO(&rfds);
+   FD_SET(xfd, &rfds);
+   FD_SET(0, &rfds);
+
+   signal(SIGINT, SIG_IGN);
+
+
+
+
+   
+   XFlush(tty->display);
+   
+   while (1) {
+
+	   XFlush(tty->display);
+	
+	   FD_ZERO(&rfds);
+	   FD_SET(xfd, &rfds);
+   	   FD_SET(0, &rfds);
+
+	   timeout.tv_sec = 2 ;
+	   timeout.tv_usec = 0 ;
+  	   rs = select (xfd+1, &rfds, NULL, NULL, &timeout);
+	   
+	   if (rs !=0){
+		
+  		 if ( FD_ISSET(0, &rfds) == 1) {
+        		 read(0, &c, 1);
+        		 UpdateXtty(tty, ManageXtty(tty, c));
+		         RefreshXtty(tty);
+			}
+
+
+		 if (  FD_ISSET(xfd, &rfds) == 1)  {
+  	  		 XNextEvent(tty->display, &event);
+			 EventXtty (tty, &event) ;
+		         RefreshXtty(tty);
+			}
+		 
+	   	}
+
+   }
+
+
+//getchar();
+
+
+
+
+
+
+
+
+
+
+
+
+/*
+
+
+   while (1) {
+   FD_SET(xfd, &rfds);
+   FD_SET(0, &rfds);
+      XFlush(tty->display);
+      rs=select(xfd+1, &rfds, NULL, NULL, NULL);
+      if (FD_ISSET(0, &rfds)) {
+         memset(tty->video, ' ', TTYHEIGHT * TTYWIDTH);
+         RefreshXtty(tty);
+         read(0, &c, 1);
+         UpdateXtty(tty, ManageXtty(tty, c));
+         break;
+      } else {
+         while (XCheckWindowEvent(tty->display, tty->window,
+               ExposureMask, &event))
+            RefreshXtty(tty);
+      }
+   }
+
+
+   
+   
+   while (1) {
+   FD_SET(xfd, &rfds);
+   FD_SET(0, &rfds);
+      XFlush(tty->display);
+      rs=select(xfd+1, &rfds, NULL, NULL, NULL);
+      if (FD_ISSET(0, &rfds)) {
+         read(0, &c, 1);
+         UpdateXtty(tty, ManageXtty(tty, c));
+      } else {
+         while (XCheckWindowEvent(tty->display, tty->window,
+               ExposureMask, &event))
+            RefreshXtty(tty);
+      }
+   }
+
+
+*/
+
+   
+   exit(0);
+}
+
Index: trunk/IPs/systemC/Environment/TTY/xtty/xtty.h
===================================================================
--- trunk/IPs/systemC/Environment/TTY/xtty/xtty.h	(revision 81)
+++ trunk/IPs/systemC/Environment/TTY/xtty/xtty.h	(revision 81)
@@ -0,0 +1,64 @@
+/*
+ * $Log: xtty.h,v $
+ * Revision 1.1.1.1  2005/01/27 13:42:45  wahid
+ * First project import
+ * Wahid
+ *
+ * Revision 1.1  2002/03/19 15:03:22  boris
+ * Vcitty model addition
+ *
+ * Revision 1.1.1.1  2002/02/28 12:58:33  disydent
+ * Creation of Disydent CVS Tree
+ *
+ * Revision 1.1.1.1  2001/11/19 16:55:32  pwet
+ * Changing the CVS tree structure of disydent
+ *
+ * Revision 1.1.1.1  2001/07/24 13:31:45  pwet
+ * cvs tree of part of disydent
+ *
+ * Revision 1.1.1.1  2001/07/19 14:32:25  pwet
+ * New cvs tree
+ *
+ * Revision 1.2  1998/09/16 16:11:32  pwet
+ * passage a cvs
+ *
+ * Revision 1.1  1998/09/01 09:49:14  pwet
+ * Initial revision
+ *
+ * Revision 1.1  1998/07/16 18:04:12  pwet
+ * Initial revision
+ *
+ * Authors: Frédéric Pétrot and Denis Hommais 
+ */
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/keysym.h>
+
+#if 0
+#define FONT            "-misc-fixed-bold-r-normal--15-140-75-75-c-90-iso8859-1"
+#define TTYWIDTH        80
+#define TTYHEIGHT       40
+#define MAXCHAR         16
+#else
+#define FONT            "fixed"
+#define TTYWIDTH        80
+#define TTYHEIGHT       24
+#define MAXCHAR         16
+#endif
+
+typedef struct {
+   Display *display;
+   Window   window;
+   GC       gc;
+   int      font_height;
+   int      font_width;
+   short    xcurse;
+   short    ycurse;
+   char     video[TTYHEIGHT][TTYWIDTH];  /* video character memory */
+   short    rptr;
+   short    wptr;
+   FILE    *file;            /* redirection file if required */
+   short    keybuf[MAXCHAR];
+} xtty;
+
+
Index: trunk/IPs/systemC/Environment/include/Cache_Access.h
===================================================================
--- trunk/IPs/systemC/Environment/include/Cache_Access.h	(revision 81)
+++ trunk/IPs/systemC/Environment/include/Cache_Access.h	(revision 81)
@@ -0,0 +1,27 @@
+#ifndef ENVIRONMENT_CACHE_ACCESS_H
+#define ENVIRONMENT_CACHE_ACCESS_H
+
+#include "Types.h"
+
+namespace environment {
+
+  class Cache_Access
+  {
+  public : cache::type_req_cache_t      type      ;
+  public : cache::direction_req_cache_t direction ;
+  public : uint32_t                     nb_bytes  ;
+    
+  public : Cache_Access (cache::type_req_cache_t      type      ,
+			 cache::direction_req_cache_t direction ,
+			 uint32_t                     nb_bytes  )
+    {
+      this->type      = type     ;
+      this->direction = direction;
+      this->nb_bytes  = nb_bytes ;
+    };
+  };
+
+  Cache_Access ireq_type2cache_type (Ticache_type_t ireq_type, bool uncached);
+  Cache_Access dreq_type2cache_type (Tdcache_type_t dreq_type, bool uncached);
+};
+#endif
Index: trunk/IPs/systemC/Environment/include/Environment.h
===================================================================
--- trunk/IPs/systemC/Environment/include/Environment.h	(revision 81)
+++ trunk/IPs/systemC/Environment/include/Environment.h	(revision 81)
@@ -0,0 +1,154 @@
+#ifndef ENVIRONMENT_H
+#define ENVIRONMENT_H
+
+#include "../Cache/include/Cache.h"
+#include "../Data/include/Data.h"
+#include "../Endianness/include/Endianness.h"
+#include "../Queue/include/Sort_Queue.h"
+#include "../RamLock/include/RamLock.h"
+#include "../Sim2OS/include/Sim2OS.h"
+#include "../TTY/include/TTY.h"
+#include "../../processor/Morpheo/Common/include/Max.h"
+
+#include "Types.h"
+#include "Environment_Parameters.h"
+#include "Respons.h"
+#include "Cache_Access.h"
+
+#include <systemc.h>
+
+namespace environment {
+
+  typedef Respons<Ticache_context_t, Ticache_packet_t,Ticache_error_t> irsp_t;
+  typedef Respons<Tdcache_context_t, Tdcache_packet_t,Tdcache_error_t> drsp_t;
+
+  class Environment : public sc_module
+  {
+    // ===== [ Ports ]=======================================================
+  public : sc_in_clk                        * CLOCK                 ;
+  public : sc_in<bool>                      * NRESET                ;
+
+  public : sc_in <Tcontrol_t           >  *** ICACHE_REQ_VAL        ;
+  public : sc_out<Tcontrol_t           >  *** ICACHE_REQ_ACK        ;
+  public : sc_in <Ticache_context_t    >  *** ICACHE_REQ_CONTEXT_ID ;
+  public : sc_in <Ticache_packet_t     >  *** ICACHE_REQ_PACKET_ID  ;
+  public : sc_in <Ticache_address_t    >  *** ICACHE_REQ_ADDRESS    ;
+  public : sc_in <Ticache_type_t       >  *** ICACHE_REQ_TYPE       ;
+
+  public : sc_out<Tcontrol_t           >  *** ICACHE_RSP_VAL        ;
+  public : sc_in <Tcontrol_t           >  *** ICACHE_RSP_ACK        ;
+  public : sc_out<Ticache_context_t    >  *** ICACHE_RSP_CONTEXT_ID ;
+  public : sc_out<Ticache_packet_t     >  *** ICACHE_RSP_PACKET_ID  ;
+  public : sc_out<Ticache_instruction_t> **** ICACHE_RSP_INSTRUCTION;//[nb_instruction]
+  public : sc_out<Ticache_error_t      >  *** ICACHE_RSP_ERROR      ;
+
+  public : sc_in <Tcontrol_t           >  *** DCACHE_REQ_VAL        ;
+  public : sc_out<Tcontrol_t           >  *** DCACHE_REQ_ACK        ;
+  public : sc_in <Tdcache_context_t    >  *** DCACHE_REQ_CONTEXT_ID ;
+  public : sc_in <Tdcache_packet_t     >  *** DCACHE_REQ_PACKET_ID  ;
+  public : sc_in <Tdcache_address_t    >  *** DCACHE_REQ_ADDRESS    ;
+  public : sc_in <Tdcache_type_t       >  *** DCACHE_REQ_TYPE       ;
+  public : sc_in <Tdcache_data_t       >  *** DCACHE_REQ_WDATA      ;
+
+  public : sc_out<Tcontrol_t           >  *** DCACHE_RSP_VAL        ;
+  public : sc_in <Tcontrol_t           >  *** DCACHE_RSP_ACK        ;
+  public : sc_out<Tdcache_context_t    >  *** DCACHE_RSP_CONTEXT_ID ;
+  public : sc_out<Tdcache_packet_t     >  *** DCACHE_RSP_PACKET_ID  ;
+  public : sc_out<Tdcache_data_t       >  *** DCACHE_RSP_RDATA      ;
+  public : sc_out<Tdcache_error_t      >  *** DCACHE_RSP_ERROR      ;
+
+    // ===== [ Internal ]====================================================
+  public : Tcontrol_t                      ** icache_req_ack        ;
+  public : Tcontrol_t                      ** icache_rsp_val        ;
+  public : Tcontrol_t                      ** dcache_req_ack        ;
+  public : Tcontrol_t                      ** dcache_rsp_val        ;
+
+    // ===== [ Variables ]===================================================
+  private  : const sc_module_name name;
+  private  : Parameters         * param;
+
+  private: char **                read_iram;
+  private: char **                read_dram;
+  private: char *                 write_dram;
+
+    // ===== [ Components ]==================================================
+  private  : cache  ::Cache                * component_cache;
+  private  : tty    ::TTY                 ** component_tty;
+  private  : ramlock::RamLock             ** component_ramlock;
+  private  : sim2os ::Sim2OS               * component_sim2os;
+  private  : data   ::Data                 * component_data;
+  private  : queue  ::Sort_Queue<irsp_t*> ** component_buffer_irsp;
+  private  : queue  ::Sort_Queue<drsp_t*> ** component_buffer_drsp;
+
+    // ===== [ Methods ]=====================================================
+
+    SC_HAS_PROCESS (Environment);
+    
+  public   :  Environment (sc_module_name name, Parameters * param);
+  public   : ~Environment (void);
+
+  public   : bool   init       (std::string section, const char * filename, const char ** list_section);
+  public   : void   reset      (void);
+
+  public   : void   transition (void);
+  public   : void   genMoore   (void);
+
+  public   : friend std::ostream& operator<< (std::ostream& output, Environment &x);
+
+    
+  private  : 
+    template <class T>
+    void itoa  (T src, char *& dest, uint32_t size)
+    {
+      _cout(ENVIRONMENT,"<itoa> : size : %d, ",size);
+      _cout(ENVIRONMENT,"src : %.8x ",static_cast<uint32_t>(src));
+      _cout(ENVIRONMENT,"dest : ");
+
+      for (uint32_t i=0; i<size; i++)
+	{
+	  uint32_t j = i;
+	  dest [j] = (src & 0xFF);
+	  src >>= 8; // shift byte
+
+	  _cout(ENVIRONMENT,"%.2x",0xff&static_cast<uint32_t>(dest [j]));
+
+	}
+      _cout(ENVIRONMENT,".\n");
+    }
+    
+  private  : 
+    template <class T>
+    void atoi (char * src, T& dest, uint32_t size)
+    {
+      dest = 0;
+
+      _cout(ENVIRONMENT,"<atoi> : size : %d, ",size);
+      _cout(ENVIRONMENT,"src : ");
+
+      for (uint32_t i=0; i<size; i++)
+	{
+	  uint32_t j=(size)-(i)-1;
+	  dest <<= 8; // shift byte
+	  dest |= (static_cast<T>(src [j]) & 0xFF);
+
+	  _cout(ENVIRONMENT,"%.2x",0xff&static_cast<uint32_t>(src [j]));
+	}
+      _cout(ENVIRONMENT," dest : %.8x\n",static_cast<uint32_t>(dest));
+    }
+  };
+
+
+//   private: bool * context_stop;    // to determine which context have send the signal stop (a same thread can send many signal)
+//   private: uint3  nb_context_stop; // stop the simulation when all context have send the stop signal 
+
+//     //---------------------------------------------------------------------------------------------
+//     //-----[ stop ]--------------------------------------------------------------------------------
+//     //---------------------------------------------------------------------------------------------
+//   public : bool stop ()
+//     {
+//       return (nb_context_stop >= nb_context);
+//     }
+
+};
+
+#endif
Index: trunk/IPs/systemC/Environment/include/Environment_Parameters.h
===================================================================
--- trunk/IPs/systemC/Environment/include/Environment_Parameters.h	(revision 81)
+++ trunk/IPs/systemC/Environment/include/Environment_Parameters.h	(revision 81)
@@ -0,0 +1,237 @@
+#ifndef ENVIRONMENT_PARAMETERS_H
+#define ENVIRONMENT_PARAMETERS_H
+
+#include "../Cache/include/Cache_Parameters.h"
+#include "../Data/include/Data_Parameters.h"
+#include "../Queue/include/Parameters.h"
+#include "../TTY/include/TTY_Parameters.h"
+#include "../RamLock/include/RamLock_Parameters.h"
+#include "../Sim2OS/include/Sim2OS_Parameters.h"
+
+namespace environment {
+
+  class Parameters
+  {
+  public : uint32_t    nb_iport;
+  public : uint32_t    nb_dport;
+  public : uint32_t    nb_entity;
+  public : uint32_t  * icache_dedicated_nb_port;
+  public : uint32_t  * dcache_dedicated_nb_port;
+
+  public : uint32_t  * iaccess_nb_context    ;
+  public : uint32_t  * iaccess_nb_packet     ;
+  public : uint32_t  * iaccess_size_address  ;
+  public : uint32_t  * iaccess_nb_instruction;
+  public : uint32_t  * iaccess_size_instruction;
+
+  public : uint32_t  * daccess_nb_context    ;
+  public : uint32_t  * daccess_nb_packet     ;
+  public : uint32_t  * daccess_size_address  ;
+  public : uint32_t  * daccess_size_data     ;
+
+    // Parameters cache
+  public : cache::Parameters                     * param_cache;
+    // Parameters tty
+  public : uint32_t                                nb_component_tty;
+  public : uint32_t                              * tty_address;
+  public : tty::Parameters                      ** param_tty;
+    // Parameters ramlock
+  public : uint32_t                                nb_component_ramlock;
+  public : uint32_t                              * ramlock_address;
+  public : ramlock::Parameters                  ** param_ramlock;
+    // Parameters sim2OS
+  public : uint32_t                                sim2os_address;
+  public : uint32_t                                sim2os_size;
+  public : sim2os::Parameters                    * param_sim2os;
+    // Parameters data
+  public : data::Parameters                      * param_data;
+
+    // Parameters buffer_respons
+  public : queue::Parameters                    ** param_buffer_irsp;
+  public : queue::Parameters                    ** param_buffer_drsp;
+
+  public : Parameters (// General
+		       uint32_t    nb_cache_dedicated,
+		       
+		       uint32_t  * iaccess_nb_context,
+		       uint32_t  * iaccess_nb_instruction,
+		       uint32_t  * iaccess_nb_packet,
+		       uint32_t  * iaccess_size_address,
+		       uint32_t  * iaccess_size_instruction,
+
+		       uint32_t  * daccess_nb_context,
+		       uint32_t  * daccess_nb_packet,
+		       uint32_t  * daccess_size_address,
+		       uint32_t  * daccess_size_data,
+
+		       // buffer
+		       uint32_t  * buffer_irsp_size,
+		       uint32_t  * buffer_drsp_size,
+		       
+		       // Cache
+		       uint32_t  * icache_dedicated_nb_level     ,
+		       uint32_t  * icache_dedicated_nb_port      ,
+		       uint32_t ** icache_dedicated_nb_line      ,
+		       uint32_t ** icache_dedicated_size_line    ,
+		       uint32_t ** icache_dedicated_size_word    ,
+		       uint32_t ** icache_dedicated_associativity,
+		       uint32_t ** icache_dedicated_hit_latence  ,
+		       uint32_t ** icache_dedicated_miss_penality,
+		       uint32_t  * dcache_dedicated_nb_level     ,
+		       uint32_t  * dcache_dedicated_nb_port      ,
+		       uint32_t ** dcache_dedicated_nb_line      ,
+		       uint32_t ** dcache_dedicated_size_line    ,
+		       uint32_t ** dcache_dedicated_size_word    ,
+		       uint32_t ** dcache_dedicated_associativity,
+		       uint32_t ** dcache_dedicated_hit_latence  ,
+		       uint32_t ** dcache_dedicated_miss_penality,
+		       uint32_t    cache_shared_nb_level         ,
+// 		       uint32_t    cache_shared_nb_port          ,
+		       uint32_t  * cache_shared_nb_line          ,
+		       uint32_t  * cache_shared_size_line        ,
+		       uint32_t  * cache_shared_size_word        ,
+		       uint32_t  * cache_shared_associativity    ,
+		       uint32_t  * cache_shared_hit_latence      ,
+		       uint32_t  * cache_shared_miss_penality    ,
+
+		       // TTY
+		       uint32_t       nb_component_tty,
+		       uint32_t     * tty_address,
+		       uint32_t     * nb_tty,
+		       std::string ** name_tty,
+		       bool           with_xtty,
+
+		       // RAMLOCK
+		       uint32_t       nb_component_ramlock,
+		       uint32_t     * ramlock_address,
+		       uint32_t     * nb_lock,
+
+		       // SIM2OS
+		       uint32_t       sim2os_address,
+		       uint32_t       sim2os_size,
+		       SOCLIB_SEGMENT_TABLE * segment_table
+		       )
+    {
+      this->nb_entity                = nb_cache_dedicated;
+
+      this->icache_dedicated_nb_port = icache_dedicated_nb_port;
+      this->dcache_dedicated_nb_port = dcache_dedicated_nb_port;
+
+      this->iaccess_nb_context       = iaccess_nb_context      ;
+      this->iaccess_nb_instruction   = iaccess_nb_instruction  ;
+      this->iaccess_nb_packet        = iaccess_nb_packet       ;
+      this->iaccess_size_address     = iaccess_size_address    ;
+      this->iaccess_size_instruction = iaccess_size_instruction;
+      this->daccess_nb_context       = daccess_nb_context      ;
+      this->daccess_nb_packet        = daccess_nb_packet       ;
+      this->daccess_size_address     = daccess_size_address    ;
+      this->daccess_size_data        = daccess_size_data       ;
+
+      param_cache = new cache::Parameters
+	(nb_cache_dedicated            ,
+	 icache_dedicated_nb_level     ,
+	 icache_dedicated_nb_port      ,
+	 icache_dedicated_nb_line      ,
+	 icache_dedicated_size_line    ,
+	 icache_dedicated_size_word    ,
+	 icache_dedicated_associativity,
+	 icache_dedicated_hit_latence  ,
+	 icache_dedicated_miss_penality,
+	 dcache_dedicated_nb_level     ,
+	 dcache_dedicated_nb_port      ,
+	 dcache_dedicated_nb_line      ,
+	 dcache_dedicated_size_line    ,
+	 dcache_dedicated_size_word    ,
+	 dcache_dedicated_associativity,
+	 dcache_dedicated_hit_latence  ,
+	 dcache_dedicated_miss_penality,
+	 cache_shared_nb_level         ,
+// 	 cache_shared_nb_port          ,
+	 cache_shared_nb_line          ,
+	 cache_shared_size_line        ,
+	 cache_shared_size_word        ,
+	 cache_shared_associativity    ,
+	 cache_shared_hit_latence      ,
+	 cache_shared_miss_penality    
+	 );
+
+      nb_iport = 0;
+      nb_dport = 0;
+      for (uint32_t i=0; i<nb_cache_dedicated; i++)
+	{
+	  nb_iport += icache_dedicated_nb_port [i];
+	  nb_dport += dcache_dedicated_nb_port [i];
+	}
+
+      this->nb_component_tty = nb_component_tty;
+      this->tty_address      = tty_address;
+      
+      param_tty = new tty::Parameters * [nb_component_tty];
+      for (uint32_t i=0; i<nb_component_tty; i++)
+	{
+	  uint32_t tty_size = nb_tty [i] * 16; // 4 32bit-register by tty
+
+// 	  std::ostringstream str("");
+// 	  str << "tty_" << i;
+	  segment_table->addSegment("tty",tty_address[i],tty_size,0,0,true);
+
+	  param_tty [i] = new tty::Parameters (nb_tty    [i],
+					       name_tty  [i],
+					       with_xtty    );
+	}
+
+      this->nb_component_ramlock = nb_component_ramlock;
+      this->ramlock_address      = ramlock_address;
+      
+      param_ramlock = new ramlock::Parameters * [nb_component_ramlock];
+      for (uint32_t i=0; i<nb_component_ramlock; i++)
+	{
+	  uint32_t ramlock_size = nb_lock[i]; // registre 8 bits because it's min size access
+// 	  std::ostringstream str ("");
+// 	  str << "ramlock" << i;
+	  segment_table->addSegment("ramlock",ramlock_address[i],ramlock_size,0,0,true);
+
+	  param_ramlock [i] = new ramlock::Parameters (nb_lock [i]);
+	}
+
+      this->sim2os_address       = sim2os_address      ;
+      this->sim2os_size          = sim2os_size         ;
+
+      segment_table->addSegment("sim2os",sim2os_address,sim2os_size,0,0,true);
+      param_sim2os = new sim2os::Parameters (segment_table);
+
+      param_data   = new data::Parameters (16,0,0, segment_table);
+
+      param_buffer_irsp = new queue::Parameters * [nb_entity];
+      for (uint32_t i=0; i<nb_entity; i++)
+	param_buffer_irsp [i] = new queue::Parameters (buffer_irsp_size [i]);
+
+      param_buffer_drsp = new queue::Parameters * [nb_entity];
+      for (uint32_t i=0; i<nb_entity; i++)
+	param_buffer_drsp [i] = new queue::Parameters (buffer_drsp_size [i]);
+    }
+
+  public : ~Parameters (void)
+    {
+      for (uint32_t i=0; i<nb_entity; i++)
+	delete param_buffer_irsp [i];
+      delete [] param_buffer_irsp;
+
+      for (uint32_t i=0; i<nb_entity; i++)
+	delete param_buffer_drsp [i];
+      delete [] param_buffer_drsp;
+
+      delete param_data  ;
+      delete param_sim2os;
+      for (uint32_t i=0; i<nb_component_ramlock; i++)
+	delete param_ramlock [i];
+      delete [] param_ramlock;
+      for (uint32_t i=0; i<nb_component_tty; i++)
+	delete param_tty [i];
+      delete [] param_tty;
+      delete param_cache;
+    }
+  };
+
+};
+#endif
Index: trunk/IPs/systemC/Environment/include/Respons.h
===================================================================
--- trunk/IPs/systemC/Environment/include/Respons.h	(revision 81)
+++ trunk/IPs/systemC/Environment/include/Respons.h	(revision 81)
@@ -0,0 +1,78 @@
+#ifndef ENVIRONMENT_RESPONS_H
+#define ENVIRONMENT_RESPONS_H
+
+#include "Types.h"
+
+namespace environment {
+
+  template <class T1, class T2, class T3>
+  class Respons
+  {
+  public : T1       trdid  ;  // number of thread
+  public : T2       pktid  ;  // number of packet
+  public : uint32_t nb_word;
+  public : uint32_t size_word;
+  public : char **  data   ;
+  public : T3       error  ;
+    
+//   public : Respons ()
+//     {
+//       trdid     = 0;
+//       pktid     = 0;
+//       nb_word   = 0;
+//       size_word = 0;
+//       data      = NULL;
+//       error     = 0;
+//     };
+
+  public : Respons (T1       trdid    ,
+		    T2       pktid    ,
+		    uint32_t nb_word  ,
+		    uint32_t size_word,
+		    char **  data     ,
+		    T3       error 
+		   )
+    {
+      this->trdid     = trdid;
+      this->pktid     = pktid;
+      this->nb_word   = nb_word;
+      this->size_word = size_word;
+      this->data      = new char * [nb_word];
+      this->error     = error;
+
+      for (uint32_t i=0;i < nb_word; i++)
+	{
+	  this->data[i] = new char [size_word];
+	  memcpy(this->data[i],data[i],size_word);
+	}
+    };
+
+  public : ~Respons (void)
+    {
+      for (uint32_t i=0; i<nb_word; i++)
+	delete [] data [i];
+      delete [] data;
+    }
+
+  public : friend std::ostream& operator<< (std::ostream& output, Respons x)
+    {
+      output << x.trdid              << " " 
+	     << x.pktid              << " " 
+	     << x.error              << " ";
+      
+      output << std::hex;
+      
+      for (uint32_t i = 0; i < x.nb_word; i ++)
+	{
+	  for (uint32_t j = x.size_word; j > 0 ; j --)
+	    output << std::setw(2) << std::setfill('0') << (0xff & (static_cast<uint32_t>(x.data [i][j-1])));
+	  output << " - ";
+	} 
+      output << std::dec;
+      
+      return output;
+    }
+  };
+
+};
+#endif
Index: trunk/IPs/systemC/Environment/include/Types.h
===================================================================
--- trunk/IPs/systemC/Environment/include/Types.h	(revision 81)
+++ trunk/IPs/systemC/Environment/include/Types.h	(revision 81)
@@ -0,0 +1,27 @@
+#ifndef ENVIRONMENT_TYPES_H
+#define ENVIRONMENT_TYPES_H
+
+#include "../../processor/Morpheo/Behavioural/include/Types.h"
+#include "../../processor/Morpheo/Behavioural/include/Constants.h"
+#include "../Cache/include/Types.h"
+
+namespace environment 
+{
+  
+  typedef morpheo::behavioural::Tcontrol_t            Tcontrol_t           ;
+  
+  typedef morpheo::behavioural::Tcontext_t            Ticache_context_t    ;
+  typedef morpheo::behavioural::Tpacket_t             Ticache_packet_t     ;
+  typedef morpheo::behavioural::Ticache_address_t     Ticache_address_t    ;
+  typedef morpheo::behavioural::Ticache_type_t        Ticache_type_t       ;
+  typedef morpheo::behavioural::Ticache_instruction_t Ticache_instruction_t;
+  typedef morpheo::behavioural::Ticache_error_t       Ticache_error_t      ;
+
+  typedef morpheo::behavioural::Tcontext_t            Tdcache_context_t    ;
+  typedef morpheo::behavioural::Tpacket_t             Tdcache_packet_t     ;
+  typedef morpheo::behavioural::Tdcache_address_t     Tdcache_address_t    ;
+  typedef morpheo::behavioural::Tdcache_type_t        Tdcache_type_t       ;
+  typedef morpheo::behavioural::Tdcache_data_t        Tdcache_data_t       ;
+  typedef morpheo::behavioural::Tdcache_error_t       Tdcache_error_t      ;
+};
+#endif
Index: trunk/IPs/systemC/Environment/selftest/main.cpp
===================================================================
--- trunk/IPs/systemC/Environment/selftest/main.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/selftest/main.cpp	(revision 81)
@@ -0,0 +1,1265 @@
+#include <iostream>
+#include "../include/Environment.h"
+
+using namespace std;
+using namespace environment;
+
+#define _TEST_IMEMORY_ true
+#define _TEST_DMEMORY_ true
+#define _TEST_TTY_     true
+#define _TEST_RAMLOCK_ true
+#define _TEST_SIM2OS_  true 
+
+#define TEST(x,y)				\
+  {						\
+    cout << "Line " << __LINE__ << " : ";	\
+    if (x==y)					\
+      {						\
+	cout << "Test OK" << endl;		\
+      }						\
+    else					\
+      {						\
+	cout << "Test KO" << endl;		\
+	exit (EXIT_FAILURE);			\
+      }						\
+  } while (0)
+
+int sc_main (int argc, char * argv[])
+{
+  cout << "<main> Begin" << endl;
+
+  {
+    uint32_t    nb_entity = 2;
+    
+    uint32_t  * iaccess_nb_context    = new uint32_t [nb_entity];
+    uint32_t  * iaccess_nb_instruction= new uint32_t [nb_entity];
+    uint32_t  * iaccess_nb_packet     = new uint32_t [nb_entity];
+    uint32_t  * iaccess_size_address  = new uint32_t [nb_entity];
+    uint32_t  * iaccess_size_data     = new uint32_t [nb_entity];
+    
+    uint32_t  * daccess_nb_context    = new uint32_t [nb_entity];
+    uint32_t  * daccess_nb_packet     = new uint32_t [nb_entity];
+    uint32_t  * daccess_size_address  = new uint32_t [nb_entity];
+    uint32_t  * daccess_size_data     = new uint32_t [nb_entity];
+
+    uint32_t  * buffer_irsp_size      = new uint32_t [nb_entity];
+    uint32_t  * buffer_drsp_size      = new uint32_t [nb_entity];
+
+    for (uint32_t i=0; i<nb_entity; i++)
+      {
+	iaccess_nb_context     [i] = 4;
+	iaccess_nb_instruction [i] = 4;
+	iaccess_nb_packet      [i] = 4;
+	iaccess_size_address   [i] = 32;
+	iaccess_size_data      [i] = 32;
+
+	daccess_nb_context     [i] =  4;
+	daccess_nb_packet      [i] =  4;
+	daccess_size_address   [i] = 32;
+	daccess_size_data      [i] = 32;
+
+	buffer_irsp_size       [i] = 8;
+	buffer_drsp_size       [i] = 8;
+      }
+    
+    uint32_t * cache_shared_nb_line       = new uint32_t [1];
+    uint32_t * cache_shared_size_line     = new uint32_t [1];
+    uint32_t * cache_shared_size_word     = new uint32_t [1];
+    uint32_t * cache_shared_associativity = new uint32_t [1];
+    uint32_t * cache_shared_hit_latence   = new uint32_t [1];
+    uint32_t * cache_shared_miss_penality = new uint32_t [1];
+
+    cache_shared_nb_line       [0] = 8 ;
+    cache_shared_size_line     [0] = 8 ;
+    cache_shared_size_word     [0] = 4 ;
+    cache_shared_associativity [0] = 4 ;
+    cache_shared_hit_latence   [0] = 2 ;
+    cache_shared_miss_penality [0] = 5 ;
+
+    uint32_t  * icache_nb_level      = new uint32_t   [nb_entity];
+    uint32_t  * icache_nb_port       = new uint32_t   [nb_entity];
+    uint32_t ** icache_nb_line       = new uint32_t * [nb_entity];
+    uint32_t ** icache_size_line     = new uint32_t * [nb_entity];
+    uint32_t ** icache_size_word     = new uint32_t * [nb_entity];
+    uint32_t ** icache_associativity = new uint32_t * [nb_entity];
+    uint32_t ** icache_hit_latence   = new uint32_t * [nb_entity];
+    uint32_t ** icache_miss_penality = new uint32_t * [nb_entity];
+
+    for (uint32_t i=0; i<nb_entity; i++)
+      {
+	icache_nb_level      [i]    = 1;
+	icache_nb_port       [i]    = 2;
+	icache_nb_line       [i]    = new uint32_t [1];
+	icache_size_line     [i]    = new uint32_t [1];
+	icache_size_word     [i]    = new uint32_t [1];
+	icache_associativity [i]    = new uint32_t [1];
+	icache_hit_latence   [i]    = new uint32_t [1];
+	icache_miss_penality [i]    = new uint32_t [1];
+	
+	icache_nb_line       [i][0] = 8;
+	icache_size_line     [i][0] = 8;
+	icache_size_word     [i][0] = 4;
+	icache_associativity [i][0] = 1;
+	icache_hit_latence   [i][0] = 1;
+	icache_miss_penality [i][0] = 3;
+      }
+
+    uint32_t  * dcache_nb_level      = new uint32_t   [nb_entity];
+    uint32_t  * dcache_nb_port       = new uint32_t   [nb_entity];
+    uint32_t ** dcache_nb_line       = new uint32_t * [nb_entity];
+    uint32_t ** dcache_size_line     = new uint32_t * [nb_entity];
+    uint32_t ** dcache_size_word     = new uint32_t * [nb_entity];
+    uint32_t ** dcache_associativity = new uint32_t * [nb_entity];
+    uint32_t ** dcache_hit_latence   = new uint32_t * [nb_entity];
+    uint32_t ** dcache_miss_penality = new uint32_t * [nb_entity];
+
+    for (uint32_t i=0; i<nb_entity; i++)
+      {
+	dcache_nb_level      [i]    = 1;
+	dcache_nb_port       [i]    = 2;
+	dcache_nb_line       [i]    = new uint32_t [1];
+	dcache_size_line     [i]    = new uint32_t [1];
+	dcache_size_word     [i]    = new uint32_t [1];
+	dcache_associativity [i]    = new uint32_t [1];
+	dcache_hit_latence   [i]    = new uint32_t [1];
+	dcache_miss_penality [i]    = new uint32_t [1];
+	
+	dcache_nb_line       [i][0] = 8;
+	dcache_size_line     [i][0] = 8;
+	dcache_size_word     [i][0] = 4;
+	dcache_associativity [i][0] = 1;
+	dcache_hit_latence   [i][0] = 1;
+	dcache_miss_penality [i][0] = 3;
+      }
+
+    uint32_t   nb_component_tty = 1;
+    uint32_t * tty_address = new uint32_t [nb_component_tty];
+    uint32_t * nb_tty      = new uint32_t [nb_component_tty];
+    tty_address [0] = 0xa0000000;
+    nb_tty      [0] = 4;
+    string  ** name_tty    = new string * [nb_component_tty];
+    name_tty [0]    = new string [nb_tty[0]];
+    name_tty [0][0] = "tty_0_0";
+    name_tty [0][1] = "tty_0_1";
+    name_tty [0][2] = "tty_0_2";
+    name_tty [0][3] = "tty_0_3";
+
+    uint32_t   nb_component_ramlock = 1;
+    uint32_t * ramlock_address = new uint32_t [nb_component_ramlock];
+    uint32_t * nb_lock         = new uint32_t [nb_component_ramlock];
+    ramlock_address [0] = 0xb0000000;
+    nb_lock         [0] = 10;
+
+    uint32_t sim2os_address = 0xc0000000;
+    uint32_t sim2os_size    = 0x00001000;
+    SOCLIB_SEGMENT_TABLE * segtable = new SOCLIB_SEGMENT_TABLE;
+    segtable->setMSBNumber    (8);
+    segtable->setDefaultTarget(0,0);
+    
+    //shared data segment
+    const int TEXT_BASE          = 0x00000000;
+    const int DATA_CACHED_BASE   = 0x10000000;
+    const int DATA_UNCACHED_BASE = 0x40000000;
+    
+    const int TEXT_SIZE          = 0x4000;
+    const int DATA_CACHED_SIZE   = 0x4000;
+    const int DATA_UNCACHED_SIZE = 0x4000;
+    
+    // Add a segment    ,name      ,address of base   ,size              ,global index,local index,uncache
+    segtable->addSegment("text"    ,TEXT_BASE         ,TEXT_SIZE         ,0           ,0          ,false);
+    segtable->addSegment("data"    ,DATA_CACHED_BASE  ,DATA_CACHED_SIZE  ,0           ,0          ,false);
+    segtable->addSegment("data_unc",DATA_UNCACHED_BASE,DATA_UNCACHED_SIZE,0           ,0          ,true );
+
+
+    Parameters * param = new Parameters
+      (nb_entity,
+       
+       iaccess_nb_context,
+       iaccess_nb_instruction,
+       iaccess_nb_packet,
+       iaccess_size_address,
+       iaccess_size_data,
+       
+       daccess_nb_context,
+       daccess_nb_packet,
+       daccess_size_address,
+       daccess_size_data,
+
+       buffer_irsp_size,
+       buffer_drsp_size,
+       
+       icache_nb_level     ,
+       icache_nb_port      ,
+       icache_nb_line      ,
+       icache_size_line    ,
+       icache_size_word    ,
+       icache_associativity,
+       icache_hit_latence  ,
+       icache_miss_penality,
+       dcache_nb_level     ,
+       dcache_nb_port      ,
+       dcache_nb_line      ,
+       dcache_size_line    ,
+       dcache_size_word    ,
+       dcache_associativity,
+       dcache_hit_latence  ,
+       dcache_miss_penality,
+       1                             ,
+//        cache_shared_nb_port          ,
+       cache_shared_nb_line          ,
+       cache_shared_size_line        ,
+       cache_shared_size_word        ,
+       cache_shared_associativity    ,
+       cache_shared_hit_latence      ,
+       cache_shared_miss_penality    ,
+       
+       nb_component_tty,
+       tty_address,
+       nb_tty,
+       name_tty,
+       false,
+       
+       nb_component_ramlock,
+       ramlock_address,
+       nb_lock,
+       
+       sim2os_address,
+       sim2os_size,
+       segtable
+       );
+
+    segtable->print();
+
+    Environment * env = new Environment ("environment",param);
+
+    const char * filename = "Data/selftest/data/soft.x";
+    const char * sections_text  []  = {".text",NULL}; 
+    const char * sections_data  []  = {".data",".rodata",".bss",".sdata",".sbss", NULL}; 
+
+    env->init("text"   , filename, sections_text);
+    env->init("data"   , filename, sections_data);
+
+//     cout << "<main> Press <Enter> to stop the test" << endl;
+//     getchar();
+
+    //==============================================================================
+    //===== [ DECLARATION ]=========================================================
+    //==============================================================================
+
+    sc_clock                           * CLOCK                 = new sc_clock  ("clock", 1.0, 0.5);
+    sc_signal<bool>                    * NRESET                = new sc_signal<bool> ("NRESET");
+
+    sc_signal<Tcontrol_t           >  *** ICACHE_REQ_VAL        = new sc_signal<Tcontrol_t           >  ** [nb_entity];
+    sc_signal<Tcontrol_t           >  *** ICACHE_REQ_ACK        = new sc_signal<Tcontrol_t           >  ** [nb_entity];
+    sc_signal<Ticache_context_t    >  *** ICACHE_REQ_CONTEXT_ID = new sc_signal<Ticache_context_t    >  ** [nb_entity];
+    sc_signal<Ticache_packet_t     >  *** ICACHE_REQ_PACKET_ID  = new sc_signal<Ticache_packet_t     >  ** [nb_entity];
+    sc_signal<Ticache_address_t    >  *** ICACHE_REQ_ADDRESS    = new sc_signal<Ticache_address_t    >  ** [nb_entity];
+    sc_signal<Ticache_type_t       >  *** ICACHE_REQ_TYPE       = new sc_signal<Ticache_type_t       >  ** [nb_entity];
+
+    sc_signal<Tcontrol_t           >  *** ICACHE_RSP_VAL        = new sc_signal<Tcontrol_t           >  ** [nb_entity];
+    sc_signal<Tcontrol_t           >  *** ICACHE_RSP_ACK        = new sc_signal<Tcontrol_t           >  ** [nb_entity];
+    sc_signal<Ticache_context_t    >  *** ICACHE_RSP_CONTEXT_ID = new sc_signal<Ticache_context_t    >  ** [nb_entity];
+    sc_signal<Ticache_packet_t     >  *** ICACHE_RSP_PACKET_ID  = new sc_signal<Ticache_packet_t     >  ** [nb_entity];
+    sc_signal<Ticache_instruction_t> **** ICACHE_RSP_INSTRUCTION= new sc_signal<Ticache_instruction_t> *** [nb_entity];//[nb_instruction]
+    sc_signal<Ticache_error_t      >  *** ICACHE_RSP_ERROR      = new sc_signal<Ticache_error_t      >  ** [nb_entity];
+
+    sc_signal<Tcontrol_t           >  *** DCACHE_REQ_VAL        = new sc_signal<Tcontrol_t           >  ** [nb_entity];
+    sc_signal<Tcontrol_t           >  *** DCACHE_REQ_ACK        = new sc_signal<Tcontrol_t           >  ** [nb_entity];
+    sc_signal<Tdcache_context_t    >  *** DCACHE_REQ_CONTEXT_ID = new sc_signal<Tdcache_context_t    >  ** [nb_entity];
+    sc_signal<Tdcache_packet_t     >  *** DCACHE_REQ_PACKET_ID  = new sc_signal<Tdcache_packet_t     >  ** [nb_entity];
+    sc_signal<Tdcache_address_t    >  *** DCACHE_REQ_ADDRESS    = new sc_signal<Tdcache_address_t    >  ** [nb_entity];
+    sc_signal<Tdcache_type_t       >  *** DCACHE_REQ_TYPE       = new sc_signal<Tdcache_type_t       >  ** [nb_entity];
+    sc_signal<Tdcache_data_t       >  *** DCACHE_REQ_WDATA      = new sc_signal<Tdcache_data_t       >  ** [nb_entity];
+
+    sc_signal<Tcontrol_t           >  *** DCACHE_RSP_VAL        = new sc_signal<Tcontrol_t           >  ** [nb_entity];
+    sc_signal<Tcontrol_t           >  *** DCACHE_RSP_ACK        = new sc_signal<Tcontrol_t           >  ** [nb_entity];
+    sc_signal<Tdcache_context_t    >  *** DCACHE_RSP_CONTEXT_ID = new sc_signal<Tdcache_context_t    >  ** [nb_entity];
+    sc_signal<Tdcache_packet_t     >  *** DCACHE_RSP_PACKET_ID  = new sc_signal<Tdcache_packet_t     >  ** [nb_entity];
+    sc_signal<Tdcache_data_t       >  *** DCACHE_RSP_RDATA      = new sc_signal<Tdcache_data_t       >  ** [nb_entity];
+    sc_signal<Tdcache_error_t      >  *** DCACHE_RSP_ERROR      = new sc_signal<Tdcache_error_t      >  ** [nb_entity];
+
+    for (uint32_t i=0; i<nb_entity; i++)
+      {
+	ICACHE_REQ_VAL        [i] = new sc_signal<Tcontrol_t           >  * [icache_nb_port[i]];
+	ICACHE_REQ_ACK        [i] = new sc_signal<Tcontrol_t           >  * [icache_nb_port[i]];
+	ICACHE_REQ_CONTEXT_ID [i] = new sc_signal<Ticache_context_t    >  * [icache_nb_port[i]];
+	ICACHE_REQ_PACKET_ID  [i] = new sc_signal<Ticache_packet_t     >  * [icache_nb_port[i]];
+	ICACHE_REQ_ADDRESS    [i] = new sc_signal<Ticache_address_t    >  * [icache_nb_port[i]];
+	ICACHE_REQ_TYPE       [i] = new sc_signal<Ticache_type_t       >  * [icache_nb_port[i]];
+
+	ICACHE_RSP_VAL        [i] = new sc_signal<Tcontrol_t           >  * [icache_nb_port[i]];
+	ICACHE_RSP_ACK        [i] = new sc_signal<Tcontrol_t           >  * [icache_nb_port[i]];
+	ICACHE_RSP_CONTEXT_ID [i] = new sc_signal<Ticache_context_t    >  * [icache_nb_port[i]];
+	ICACHE_RSP_PACKET_ID  [i] = new sc_signal<Ticache_packet_t     >  * [icache_nb_port[i]];
+	ICACHE_RSP_INSTRUCTION[i] = new sc_signal<Ticache_instruction_t> ** [icache_nb_port[i]];//[nb_instruction]
+	ICACHE_RSP_ERROR      [i] = new sc_signal<Ticache_error_t      >  * [icache_nb_port[i]];
+	
+	for (uint32_t j=0; j<icache_nb_port[i]; j++)
+	  {
+	    ICACHE_REQ_VAL         [i][j] = new sc_signal<Tcontrol_t           > ("");
+	    ICACHE_REQ_ACK         [i][j] = new sc_signal<Tcontrol_t           > ("");
+	    ICACHE_REQ_CONTEXT_ID  [i][j] = new sc_signal<Ticache_context_t    > ("");
+	    ICACHE_REQ_PACKET_ID   [i][j] = new sc_signal<Ticache_packet_t     > ("");
+	    ICACHE_REQ_ADDRESS     [i][j] = new sc_signal<Ticache_address_t    > ("");
+	    ICACHE_REQ_TYPE        [i][j] = new sc_signal<Ticache_type_t       > ("");
+	    
+	    ICACHE_RSP_VAL         [i][j] = new sc_signal<Tcontrol_t           > ("");
+	    ICACHE_RSP_ACK         [i][j] = new sc_signal<Tcontrol_t           > ("");
+	    ICACHE_RSP_CONTEXT_ID  [i][j] = new sc_signal<Ticache_context_t    > ("");
+	    ICACHE_RSP_PACKET_ID   [i][j] = new sc_signal<Ticache_packet_t     > ("");
+	    ICACHE_RSP_ERROR       [i][j] = new sc_signal<Ticache_error_t      > ("");
+	    
+	    ICACHE_RSP_INSTRUCTION [i][j] = new sc_signal<Ticache_instruction_t> * [iaccess_nb_instruction[i]];
+	    
+	    for (uint32_t k=0; k<iaccess_nb_instruction[i]; k++)
+	      ICACHE_RSP_INSTRUCTION [i][j][k] = new sc_signal<Ticache_instruction_t> ("");
+
+	  }
+	
+	DCACHE_REQ_VAL        [i] = new sc_signal<Tcontrol_t           >  * [dcache_nb_port[i]];
+	DCACHE_REQ_ACK        [i] = new sc_signal<Tcontrol_t           >  * [dcache_nb_port[i]];
+	DCACHE_REQ_CONTEXT_ID [i] = new sc_signal<Tdcache_context_t    >  * [dcache_nb_port[i]];
+	DCACHE_REQ_PACKET_ID  [i] = new sc_signal<Tdcache_packet_t     >  * [dcache_nb_port[i]];
+	DCACHE_REQ_ADDRESS    [i] = new sc_signal<Tdcache_address_t    >  * [dcache_nb_port[i]];
+	DCACHE_REQ_TYPE       [i] = new sc_signal<Tdcache_type_t       >  * [dcache_nb_port[i]];
+	DCACHE_REQ_WDATA      [i] = new sc_signal<Tdcache_data_t       >  * [dcache_nb_port[i]];
+
+	DCACHE_RSP_VAL        [i] = new sc_signal<Tcontrol_t           >  * [dcache_nb_port[i]];
+	DCACHE_RSP_ACK        [i] = new sc_signal<Tcontrol_t           >  * [dcache_nb_port[i]];
+	DCACHE_RSP_CONTEXT_ID [i] = new sc_signal<Tdcache_context_t    >  * [dcache_nb_port[i]];
+	DCACHE_RSP_PACKET_ID  [i] = new sc_signal<Tdcache_packet_t     >  * [dcache_nb_port[i]];
+	DCACHE_RSP_RDATA      [i] = new sc_signal<Tdcache_data_t       >  * [dcache_nb_port[i]];
+	DCACHE_RSP_ERROR      [i] = new sc_signal<Tdcache_error_t      >  * [dcache_nb_port[i]];
+	
+	for (uint32_t j=0; j<dcache_nb_port[i]; j++)
+	  {
+	    DCACHE_REQ_VAL        [i][j] = new sc_signal<Tcontrol_t           > ("");
+	    DCACHE_REQ_ACK        [i][j] = new sc_signal<Tcontrol_t           > ("");
+	    DCACHE_REQ_CONTEXT_ID [i][j] = new sc_signal<Tdcache_context_t    > ("");
+	    DCACHE_REQ_PACKET_ID  [i][j] = new sc_signal<Tdcache_packet_t     > ("");
+	    DCACHE_REQ_ADDRESS    [i][j] = new sc_signal<Tdcache_address_t    > ("");
+	    DCACHE_REQ_TYPE       [i][j] = new sc_signal<Tdcache_type_t       > ("");
+	    DCACHE_REQ_WDATA      [i][j] = new sc_signal<Tdcache_data_t       > ("");
+	    
+	    DCACHE_RSP_VAL        [i][j] = new sc_signal<Tcontrol_t           > ("");
+	    DCACHE_RSP_ACK        [i][j] = new sc_signal<Tcontrol_t           > ("");
+	    DCACHE_RSP_CONTEXT_ID [i][j] = new sc_signal<Tdcache_context_t    > ("");
+	    DCACHE_RSP_PACKET_ID  [i][j] = new sc_signal<Tdcache_packet_t     > ("");
+	    DCACHE_RSP_RDATA      [i][j] = new sc_signal<Tdcache_data_t       > ("");
+	    DCACHE_RSP_ERROR      [i][j] = new sc_signal<Tdcache_error_t      > ("");
+	  }
+      }
+    
+    //==============================================================================
+    //===== [ INSTANCE ]============================================================
+    //==============================================================================
+
+    // instance
+    (*(env->CLOCK )) (*(CLOCK ));
+    (*(env->NRESET)) (*(NRESET));
+
+    for (uint32_t i=0; i<nb_entity; i++)
+      {
+	for (uint32_t j=0; j<icache_nb_port[i]; j++)
+	  {
+	    (*(env->ICACHE_REQ_VAL         [i][j])) (*(ICACHE_REQ_VAL         [i][j]));
+	    (*(env->ICACHE_REQ_ACK         [i][j])) (*(ICACHE_REQ_ACK         [i][j]));
+	    (*(env->ICACHE_REQ_CONTEXT_ID  [i][j])) (*(ICACHE_REQ_CONTEXT_ID  [i][j]));
+	    (*(env->ICACHE_REQ_PACKET_ID   [i][j])) (*(ICACHE_REQ_PACKET_ID   [i][j]));
+	    (*(env->ICACHE_REQ_ADDRESS     [i][j])) (*(ICACHE_REQ_ADDRESS     [i][j]));
+	    (*(env->ICACHE_REQ_TYPE        [i][j])) (*(ICACHE_REQ_TYPE        [i][j]));
+
+	    (*(env->ICACHE_RSP_VAL         [i][j])) (*(ICACHE_RSP_VAL         [i][j]));
+	    (*(env->ICACHE_RSP_ACK         [i][j])) (*(ICACHE_RSP_ACK         [i][j]));
+	    (*(env->ICACHE_RSP_CONTEXT_ID  [i][j])) (*(ICACHE_RSP_CONTEXT_ID  [i][j]));
+	    (*(env->ICACHE_RSP_PACKET_ID   [i][j])) (*(ICACHE_RSP_PACKET_ID   [i][j]));
+	    (*(env->ICACHE_RSP_ERROR       [i][j])) (*(ICACHE_RSP_ERROR       [i][j]));
+	    
+	    for (uint32_t k=0; k<iaccess_nb_instruction[i]; k++)
+	      (*(env->ICACHE_RSP_INSTRUCTION [i][j][k])) (*(ICACHE_RSP_INSTRUCTION [i][j][k]));
+
+	  }
+	
+	for (uint32_t j=0; j<dcache_nb_port[i]; j++)
+	  {
+	    (*(env->DCACHE_REQ_VAL        [i][j])) (*(DCACHE_REQ_VAL        [i][j]));
+	    (*(env->DCACHE_REQ_ACK        [i][j])) (*(DCACHE_REQ_ACK        [i][j]));
+	    (*(env->DCACHE_REQ_CONTEXT_ID [i][j])) (*(DCACHE_REQ_CONTEXT_ID [i][j]));
+	    (*(env->DCACHE_REQ_PACKET_ID  [i][j])) (*(DCACHE_REQ_PACKET_ID  [i][j]));
+	    (*(env->DCACHE_REQ_ADDRESS    [i][j])) (*(DCACHE_REQ_ADDRESS    [i][j]));
+	    (*(env->DCACHE_REQ_TYPE       [i][j])) (*(DCACHE_REQ_TYPE       [i][j]));
+	    (*(env->DCACHE_REQ_WDATA      [i][j])) (*(DCACHE_REQ_WDATA      [i][j]));
+
+	    (*(env->DCACHE_RSP_VAL        [i][j])) (*(DCACHE_RSP_VAL        [i][j]));
+	    (*(env->DCACHE_RSP_ACK        [i][j])) (*(DCACHE_RSP_ACK        [i][j]));
+	    (*(env->DCACHE_RSP_CONTEXT_ID [i][j])) (*(DCACHE_RSP_CONTEXT_ID [i][j]));
+	    (*(env->DCACHE_RSP_PACKET_ID  [i][j])) (*(DCACHE_RSP_PACKET_ID  [i][j]));
+	    (*(env->DCACHE_RSP_RDATA      [i][j])) (*(DCACHE_RSP_RDATA      [i][j]));
+	    (*(env->DCACHE_RSP_ERROR      [i][j])) (*(DCACHE_RSP_ERROR      [i][j]));
+	  }
+      }
+
+    //==============================================================================
+    //===== [ INIT ]================================================================
+    //==============================================================================
+
+    const uint32_t seed = 0;
+//  const uint32_t seed = static_cast<uint32_t>(time(NULL));
+    srand(seed);
+
+    sc_start(0);
+    // reset
+    NRESET->write(0);
+    sc_start(5);
+    NRESET->write(1);
+    sc_start(1);
+
+//     cout << *env << endl;
+
+    //==============================================================================
+    //===== [ ICACHE ]==============================================================
+    //==============================================================================
+
+    if (_TEST_IMEMORY_)
+      {
+	cout << "Test : ICACHE" << endl;
+	// Test no respons
+	
+	for (uint32_t i = 0; i < param->nb_entity; i++)
+	  for (uint32_t j=0; j<param->icache_dedicated_nb_port [i]; j++)
+	    {
+	      TEST(ICACHE_RSP_VAL [i][j]->read(), 0);
+	      ICACHE_RSP_ACK [i][j]->write(0);
+	    }
+	
+	for (uint32_t i = 0; i < param->nb_entity; i++)
+	  for (uint32_t j=0; j<param->dcache_dedicated_nb_port [i]; j++)
+	    {
+	      TEST(DCACHE_RSP_VAL [i][j]->read(), 0);
+	      DCACHE_RSP_ACK [i][j]->write(0);
+	    }
+	
+	const int32_t percent_transaction_icache_req = 75;
+	const int32_t percent_transaction_icache_rsp = 75;
+	
+	uint32_t packet_req = 0;
+	uint32_t packet_rsp = 0;
+	
+	Ticache_address_t addr_max = 0xf0;
+	
+	do
+	  {
+	    Ticache_packet_t packet_req_next = packet_req;
+	    
+	    Ticache_address_t addr = (packet_req_next << 2);
+	    for (uint32_t i=0; i<param->nb_entity; i++)
+	      for (uint32_t j=0; j<param->icache_dedicated_nb_port [i]; j++)
+		{
+		  ICACHE_REQ_VAL        [i][j]->write((addr < addr_max) and ((rand()%100)<percent_transaction_icache_req));
+		  ICACHE_REQ_CONTEXT_ID [i][j]->write(0);
+		  ICACHE_REQ_ADDRESS    [i][j]->write(addr);
+		  ICACHE_REQ_PACKET_ID  [i][j]->write(addr>>2);
+		  ICACHE_REQ_TYPE       [i][j]->write(ICACHE_TYPE_LOAD);
+		  
+		  packet_req_next++;
+		  addr += (param->iaccess_nb_instruction[i]<<2);
+		}
+	    
+	    for (uint32_t i=0; i<param->nb_entity; i++)
+	      for (uint32_t j=0; j<param->icache_dedicated_nb_port [i]; j++)
+		{
+		  ICACHE_RSP_ACK        [i][j]->write((rand()%100)<percent_transaction_icache_rsp) ;
+		}
+	    
+	    sc_start(1);
+	    
+	    for (uint32_t i=0; i<param->nb_entity; i++)
+	      for (uint32_t j=0; j<param->icache_dedicated_nb_port [i]; j++)
+		{
+		  cout << "ICACHE_REQ_VALACK (" << ICACHE_REQ_VAL [i][j]->read() << "," << ICACHE_REQ_ACK [i][j]->read() << ")" << endl;
+		  if (ICACHE_REQ_VAL [i][j]->read() and
+		      ICACHE_REQ_ACK [i][j]->read())
+		    {
+		      cout << "packet_req : " << packet_req << endl;
+		      packet_req ++;
+		    }
+		}
+	    
+	    for (uint32_t i=0; i<param->nb_entity; i++)
+	      for (uint32_t j=0; j<param->icache_dedicated_nb_port [i]; j++)
+		{
+		  cout << "ICACHE_RSP_VALACK (" << ICACHE_RSP_VAL [i][j]->read() << "," << ICACHE_RSP_ACK [i][j]->read() << ")" << endl;
+		  if (ICACHE_RSP_VAL [i][j]->read() and
+		      ICACHE_RSP_ACK [i][j]->read())
+		    {
+		      cout << "packet_rsp : " << packet_rsp << endl;
+		      packet_rsp ++;
+		      
+		      TEST(ICACHE_RSP_ERROR     [i][j]->read(),ICACHE_ERROR_NONE);
+		      TEST(ICACHE_RSP_CONTEXT_ID[i][j]->read(),0);
+		      
+		      Ticache_packet_t packet = ICACHE_RSP_PACKET_ID [i][j]->read();
+		      
+		      for (unsigned int k=0; k<param->iaccess_nb_instruction[i]; k++)
+			{
+			  Ticache_instruction_t inst = ICACHE_RSP_INSTRUCTION[i][j][k]->read();
+			  cout << "instruction [" << k << "] : " << std::hex << inst << std::dec << endl;
+			  
+			  TEST((inst>>16) , 0x1500); // copdop nop
+			  TEST((inst&0xffff) , ((0xffff ^ (packet+k))+1)); // packet in CA2
+			}
+		      
+		    }
+		}
+	    
+	  } while (((packet_req<<2)< addr_max) or
+		   ((packet_rsp<<2)< addr_max));
+	
+	for (uint32_t i=0; i<param->nb_entity; i++)
+	  {
+	    for (uint32_t j=0; j<param->icache_dedicated_nb_port [i]; j++)
+	      ICACHE_REQ_VAL [i][j]->write(0);
+	    for (uint32_t j=0; j<param->icache_dedicated_nb_port [i]; j++)
+	      ICACHE_RSP_ACK [i][j]->write(1);
+	  }
+	
+	sc_start(50);
+
+	for (uint32_t i=0; i<param->nb_entity; i++)
+	  for (uint32_t j=0; j<param->icache_dedicated_nb_port [i]; j++)
+	    ICACHE_RSP_ACK [i][j]->write(0);
+	
+	cout << "Test : icache - bus error" << endl;
+
+	// 1) in not valid segment
+	ICACHE_REQ_VAL        [0][0]->write(1);
+	ICACHE_REQ_CONTEXT_ID [0][0]->write(0);
+	ICACHE_REQ_ADDRESS    [0][0]->write(0xe0000000);
+	ICACHE_REQ_PACKET_ID  [0][0]->write(21);
+	ICACHE_REQ_TYPE       [0][0]->write(ICACHE_TYPE_LOAD);
+	ICACHE_RSP_ACK        [0][0]->write(1);
+	do
+	  {
+	    sc_start(1);
+	  } while (ICACHE_REQ_ACK [0][0]->read() == 0);
+	ICACHE_REQ_VAL        [0][0]->write(0);
+
+	sc_start (9);
+	TEST(ICACHE_RSP_VAL [0][0]->read(), 0);
+	sc_start (1);
+	TEST(ICACHE_RSP_VAL [0][0]->read(), 1);
+	TEST(ICACHE_RSP_CONTEXT_ID  [0][0]   ->read(), 0);
+	TEST(ICACHE_RSP_PACKET_ID   [0][0]   ->read(), 21);
+	TEST(ICACHE_RSP_INSTRUCTION [0][0][0]->read(), 0xe0000000);
+	TEST(ICACHE_RSP_ERROR       [0][0]   ->read(), ICACHE_ERROR_BUS_ERROR);
+	sc_start (1);
+	TEST(ICACHE_RSP_VAL [0][0]->read(), 0);
+
+	sc_start (10);
+	
+	// 2) in     valid segment but not memory
+	ICACHE_REQ_VAL        [0][0]->write(1);
+	ICACHE_REQ_CONTEXT_ID [0][0]->write(0);
+	ICACHE_REQ_ADDRESS    [0][0]->write(0xa0000000);
+	ICACHE_REQ_PACKET_ID  [0][0]->write(21);
+	ICACHE_REQ_TYPE       [0][0]->write(ICACHE_TYPE_LOAD);
+	ICACHE_RSP_ACK        [0][0]->write(1);
+	do
+	  {
+	    sc_start(1);
+	  } while (ICACHE_REQ_ACK [0][0]->read() == 0);
+	ICACHE_REQ_VAL        [0][0]->write(0);
+
+	sc_start (9);
+	TEST(ICACHE_RSP_VAL [0][0]->read(), 0);
+	sc_start (1);
+	TEST(ICACHE_RSP_VAL [0][0]->read(), 1);
+	TEST(ICACHE_RSP_CONTEXT_ID  [0][0]   ->read(), 0);
+	TEST(ICACHE_RSP_PACKET_ID   [0][0]   ->read(), 21);
+	TEST(ICACHE_RSP_INSTRUCTION [0][0][0]->read(), 0xa0000000);
+	TEST(ICACHE_RSP_ERROR       [0][0]   ->read(), ICACHE_ERROR_BUS_ERROR);
+	sc_start (1);
+	TEST(ICACHE_RSP_VAL [0][0]->read(), 0);
+	ICACHE_RSP_ACK        [0][0]->write(0);
+      }
+
+    //==============================================================================
+    //===== [ TTY ]=================================================================
+    //==============================================================================
+    if (_TEST_TTY_)
+      {
+	cout << "Test : TTY" << endl;
+	
+	for (uint32_t i=0; i<param->nb_entity; i++)
+	  for (uint32_t j=0; j<param->icache_dedicated_nb_port [i]; j++)
+	    {
+	      DCACHE_REQ_VAL        [i][j]->write(1);
+	      DCACHE_REQ_CONTEXT_ID [i][j]->write(0);
+	      DCACHE_REQ_PACKET_ID  [i][j]->write(0);
+	      DCACHE_REQ_ADDRESS    [i][j]->write(tty_address[0]+(2<<2));
+	      DCACHE_REQ_TYPE       [i][j]->write(DCACHE_TYPE_STORE_32);
+	      DCACHE_REQ_WDATA      [i][j]->write(0xdeadbeef);
+	    }
+	
+	sc_start(1);
+	for (uint32_t i=0; i<param->nb_entity; i++)
+	  for (uint32_t j=0; j<param->icache_dedicated_nb_port [i]; j++)
+	    DCACHE_REQ_VAL        [i][j]->write(0);
+
+	DCACHE_REQ_VAL        [0][0]->write(1);
+	DCACHE_REQ_TYPE       [0][0]->write(DCACHE_TYPE_STORE_8);
+	DCACHE_REQ_ADDRESS    [0][0]->write(tty_address[0]);
+	
+	char msg1 [] = "kane is back\n";
+	
+	for (uint32_t i=0; i<strlen(msg1); i++)
+	  do
+	    {
+	      DCACHE_REQ_WDATA      [0][0]->write(msg1[i]);
+	      sc_start(1);
+	    } while (not DCACHE_REQ_ACK [0][0]->read());
+	
+	
+	DCACHE_REQ_ADDRESS    [0][0]->write(tty_address[0]+(2<<4));
+	char msg2 [] = "La Technologie au service de la paix\nEt au nom de kane !!!!!!!!!";
+	
+	for (uint32_t i=0; i<strlen(msg2); i++)
+	  do
+	    {
+	      DCACHE_REQ_WDATA      [0][0]->write(msg2[i]);
+	      sc_start(1);
+	    } while (not DCACHE_REQ_ACK [0][0]->read());
+	
+	DCACHE_REQ_VAL        [0][0]->write(0);
+	
+	cout << "Test : TTY - bus error" << endl;
+	
+	// 1) bad access : load
+	DCACHE_REQ_VAL        [0][0]->write(1);
+	DCACHE_REQ_CONTEXT_ID [0][0]->write(0);
+	DCACHE_REQ_ADDRESS    [0][0]->write(0xa0000000);
+	DCACHE_REQ_PACKET_ID  [0][0]->write(21);
+	DCACHE_REQ_TYPE       [0][0]->write(DCACHE_TYPE_LOAD_32);
+	DCACHE_REQ_WDATA      [0][0]->write(0xdeadbeef);
+	DCACHE_RSP_ACK        [0][0]->write(1);
+	do
+	  {
+	    sc_start(1);
+	  } while (DCACHE_REQ_ACK [0][0]->read() == 0);
+	DCACHE_REQ_VAL        [0][0]->write(0);
+
+	sc_start (9);
+	TEST(DCACHE_RSP_VAL [0][0]->read(), 0);
+	sc_start (1);
+	TEST(DCACHE_RSP_VAL [0][0]->read(), 1);
+	TEST(DCACHE_RSP_CONTEXT_ID  [0][0]->read(), 0);
+	TEST(DCACHE_RSP_PACKET_ID   [0][0]->read(), 21);
+	TEST(DCACHE_RSP_RDATA       [0][0]->read(), 0xa0000000);
+	TEST(DCACHE_RSP_ERROR       [0][0]->read(), DCACHE_ERROR_BUS_ERROR);
+	sc_start (1);
+	TEST(DCACHE_RSP_VAL [0][0]->read(), 0);
+	DCACHE_RSP_ACK      [0][0]->write(0);
+	
+	// 2) bad register
+	DCACHE_REQ_VAL        [0][0]->write(1);
+	DCACHE_REQ_CONTEXT_ID [0][0]->write(0);
+	DCACHE_REQ_ADDRESS    [0][0]->write(0xa000000c);
+	DCACHE_REQ_PACKET_ID  [0][0]->write(21);
+	DCACHE_REQ_TYPE       [0][0]->write(DCACHE_TYPE_STORE_8);
+	DCACHE_REQ_WDATA      [0][0]->write(0xdeadbeef);
+	DCACHE_RSP_ACK        [0][0]->write(1);
+	do
+	  {
+	    sc_start(1);
+	  } while (DCACHE_REQ_ACK [0][0]->read() == 0);
+	DCACHE_REQ_VAL        [0][0]->write(0);
+
+	sc_start (9);
+	TEST(DCACHE_RSP_VAL [0][0]->read(), 0);
+	sc_start (1);
+	TEST(DCACHE_RSP_VAL [0][0]->read(), 1);
+	TEST(DCACHE_RSP_CONTEXT_ID  [0][0]->read(), 0);
+	TEST(DCACHE_RSP_PACKET_ID   [0][0]->read(), 21);
+	TEST(DCACHE_RSP_RDATA       [0][0]->read(), 0xa000000c);
+	TEST(DCACHE_RSP_ERROR       [0][0]->read(), DCACHE_ERROR_BUS_ERROR);
+	sc_start (1);
+	TEST(DCACHE_RSP_VAL [0][0]->read(), 0);
+	DCACHE_RSP_ACK      [0][0]->write(0);
+
+
+	// 3) bad tty number
+	DCACHE_REQ_VAL        [0][0]->write(1);
+	DCACHE_REQ_CONTEXT_ID [0][0]->write(0);
+	DCACHE_REQ_ADDRESS    [0][0]->write(0xa0000040);
+	DCACHE_REQ_PACKET_ID  [0][0]->write(21);
+	DCACHE_REQ_TYPE       [0][0]->write(DCACHE_TYPE_STORE_8);
+	DCACHE_REQ_WDATA      [0][0]->write(0xdeadbeef);
+	DCACHE_RSP_ACK        [0][0]->write(1);
+	do
+	  {
+	    sc_start(1);
+	  } while (DCACHE_REQ_ACK [0][0]->read() == 0);
+	DCACHE_REQ_VAL        [0][0]->write(0);
+
+	sc_start (9);
+	TEST(DCACHE_RSP_VAL [0][0]->read(), 0);
+	sc_start (1);
+	TEST(DCACHE_RSP_VAL [0][0]->read(), 1);
+	TEST(DCACHE_RSP_CONTEXT_ID  [0][0]->read(), 0);
+	TEST(DCACHE_RSP_PACKET_ID   [0][0]->read(), 21);
+	TEST(DCACHE_RSP_RDATA       [0][0]->read(), 0xa0000040);
+	TEST(DCACHE_RSP_ERROR       [0][0]->read(), DCACHE_ERROR_BUS_ERROR);
+	sc_start (1);
+	TEST(DCACHE_RSP_VAL [0][0]->read(), 0);
+	DCACHE_RSP_ACK      [0][0]->write(0);
+      }
+
+    //==============================================================================
+    //===== [ RAMLOCK ]=============================================================
+    //==============================================================================
+    if (_TEST_RAMLOCK_)
+      {
+	cout << "Test : RAMLOCK" << endl;
+
+	// Test if lock : no
+	DCACHE_REQ_VAL        [0][0]->write(1);
+	DCACHE_REQ_CONTEXT_ID [0][0]->write(0);
+	DCACHE_REQ_PACKET_ID  [0][0]->write(21);
+	DCACHE_REQ_ADDRESS    [0][0]->write(0xb0000003);
+	DCACHE_REQ_TYPE       [0][0]->write(DCACHE_TYPE_LOAD_8);
+	DCACHE_REQ_WDATA      [0][0]->write(0xdeadbeef);
+	DCACHE_RSP_ACK        [0][0]->write(1);
+	// Wait ack
+	do
+	  {
+	    sc_start(1);
+	  } while (DCACHE_REQ_ACK [0][0]->read() == 0);
+	DCACHE_REQ_VAL        [0][0]->write(0);
+
+	sc_start (9);
+	TEST(DCACHE_RSP_VAL [0][0]->read(), 0);
+	sc_start (1);
+	TEST(DCACHE_RSP_VAL [0][0]->read(), 1);
+	TEST(DCACHE_RSP_CONTEXT_ID  [0][0]->read(), 0);
+	TEST(DCACHE_RSP_PACKET_ID   [0][0]->read(), 21);
+	TEST(DCACHE_RSP_RDATA       [0][0]->read(), 0x00000000);
+	TEST(DCACHE_RSP_ERROR       [0][0]->read(), DCACHE_ERROR_NONE);
+	sc_start (1);
+	TEST(DCACHE_RSP_VAL [0][0]->read(), 0);
+	DCACHE_RSP_ACK      [0][0]->write(0);
+
+	// Test if lock : yes
+	DCACHE_REQ_VAL        [0][0]->write(1);
+	DCACHE_REQ_CONTEXT_ID [0][0]->write(0);
+	DCACHE_REQ_PACKET_ID  [0][0]->write(21);
+	DCACHE_REQ_ADDRESS    [0][0]->write(0xb0000003);
+	DCACHE_REQ_TYPE       [0][0]->write(DCACHE_TYPE_LOAD_8);
+	DCACHE_REQ_WDATA      [0][0]->write(0xdeadbeef);
+	DCACHE_RSP_ACK        [0][0]->write(1);
+	// Wait ack
+	do
+	  {
+	    sc_start(1);
+	  } while (DCACHE_REQ_ACK [0][0]->read() == 0);
+	DCACHE_REQ_VAL        [0][0]->write(0);
+
+	sc_start (9);
+	TEST(DCACHE_RSP_VAL [0][0]->read(), 0);
+	sc_start (1);
+	TEST(DCACHE_RSP_VAL [0][0]->read(), 1);
+	TEST(DCACHE_RSP_CONTEXT_ID  [0][0]->read(), 0);
+	TEST(DCACHE_RSP_PACKET_ID   [0][0]->read(), 21);
+	TEST(DCACHE_RSP_RDATA       [0][0]->read(), 0x00000001);
+	TEST(DCACHE_RSP_ERROR       [0][0]->read(), DCACHE_ERROR_NONE);
+	sc_start (1);
+	TEST(DCACHE_RSP_VAL [0][0]->read(), 0);
+	DCACHE_RSP_ACK      [0][0]->write(0);
+
+	// Test if lock : no
+	DCACHE_REQ_VAL        [0][0]->write(1);
+	DCACHE_REQ_CONTEXT_ID [0][0]->write(0);
+	DCACHE_REQ_PACKET_ID  [0][0]->write(21);
+	DCACHE_REQ_ADDRESS    [0][0]->write(0xb0000004);
+	DCACHE_REQ_TYPE       [0][0]->write(DCACHE_TYPE_LOAD_8);
+	DCACHE_REQ_WDATA      [0][0]->write(0xdeadbeef);
+	DCACHE_RSP_ACK        [0][0]->write(1);
+	// Wait ack
+	do
+	  {
+	    sc_start(1);
+	  } while (DCACHE_REQ_ACK [0][0]->read() == 0);
+	DCACHE_REQ_VAL        [0][0]->write(0);
+
+	sc_start (9);
+	TEST(DCACHE_RSP_VAL [0][0]->read(), 0);
+	sc_start (1);
+	TEST(DCACHE_RSP_VAL [0][0]->read(), 1);
+	TEST(DCACHE_RSP_CONTEXT_ID  [0][0]->read(), 0);
+	TEST(DCACHE_RSP_PACKET_ID   [0][0]->read(), 21);
+	TEST(DCACHE_RSP_RDATA       [0][0]->read(), 0x00000000);
+	TEST(DCACHE_RSP_ERROR       [0][0]->read(), DCACHE_ERROR_NONE);
+	sc_start (1);
+	TEST(DCACHE_RSP_VAL [0][0]->read(), 0);
+	DCACHE_RSP_ACK      [0][0]->write(0);
+
+	// Test if lock : yes
+	DCACHE_REQ_VAL        [0][0]->write(1);
+	DCACHE_REQ_CONTEXT_ID [0][0]->write(0);
+	DCACHE_REQ_PACKET_ID  [0][0]->write(21);
+	DCACHE_REQ_ADDRESS    [0][0]->write(0xb0000004);
+	DCACHE_REQ_TYPE       [0][0]->write(DCACHE_TYPE_LOAD_8);
+	DCACHE_REQ_WDATA      [0][0]->write(0xdeadbeef);
+	DCACHE_RSP_ACK        [0][0]->write(1);
+	// Wait ack
+	do
+	  {
+	    sc_start(1);
+	  } while (DCACHE_REQ_ACK [0][0]->read() == 0);
+	DCACHE_REQ_VAL        [0][0]->write(0);
+
+	sc_start (9);
+	TEST(DCACHE_RSP_VAL [0][0]->read(), 0);
+	sc_start (1);
+	TEST(DCACHE_RSP_VAL [0][0]->read(), 1);
+	TEST(DCACHE_RSP_CONTEXT_ID  [0][0]->read(), 0);
+	TEST(DCACHE_RSP_PACKET_ID   [0][0]->read(), 21);
+	TEST(DCACHE_RSP_RDATA       [0][0]->read(), 0x00000001);
+	TEST(DCACHE_RSP_ERROR       [0][0]->read(), DCACHE_ERROR_NONE);
+	sc_start (1);
+	TEST(DCACHE_RSP_VAL [0][0]->read(), 0);
+	DCACHE_RSP_ACK      [0][0]->write(0);
+
+
+	DCACHE_REQ_VAL        [0][0]->write(1);
+	DCACHE_REQ_CONTEXT_ID [0][0]->write(0);
+	DCACHE_REQ_PACKET_ID  [0][0]->write(21);
+	DCACHE_REQ_ADDRESS    [0][0]->write(0xb0000003);
+	DCACHE_REQ_TYPE       [0][0]->write(DCACHE_TYPE_STORE_8);
+	DCACHE_REQ_WDATA      [0][0]->write(0xdeadbeef);
+
+	sc_start (1);
+
+	// Test if lock : no
+	DCACHE_REQ_VAL        [0][0]->write(1);
+	DCACHE_REQ_CONTEXT_ID [0][0]->write(0);
+	DCACHE_REQ_PACKET_ID  [0][0]->write(21);
+	DCACHE_REQ_ADDRESS    [0][0]->write(0xb0000003);
+	DCACHE_REQ_TYPE       [0][0]->write(DCACHE_TYPE_LOAD_8);
+	DCACHE_REQ_WDATA      [0][0]->write(0xdeadbeef);
+	DCACHE_RSP_ACK        [0][0]->write(1);
+	// Wait ack
+	do
+	  {
+	    sc_start(1);
+	  } while (DCACHE_REQ_ACK [0][0]->read() == 0);
+	DCACHE_REQ_VAL        [0][0]->write(0);
+
+	sc_start (9);
+	TEST(DCACHE_RSP_VAL [0][0]->read(), 0);
+	sc_start (1);
+	TEST(DCACHE_RSP_VAL [0][0]->read(), 1);
+	TEST(DCACHE_RSP_CONTEXT_ID  [0][0]->read(), 0);
+	TEST(DCACHE_RSP_PACKET_ID   [0][0]->read(), 21);
+	TEST(DCACHE_RSP_RDATA       [0][0]->read(), 0x00000000);
+	TEST(DCACHE_RSP_ERROR       [0][0]->read(), DCACHE_ERROR_NONE);
+	sc_start (1);
+	TEST(DCACHE_RSP_VAL [0][0]->read(), 0);
+	DCACHE_RSP_ACK      [0][0]->write(0);
+
+	// Test if lock : yes
+	DCACHE_REQ_VAL        [0][0]->write(1);
+	DCACHE_REQ_CONTEXT_ID [0][0]->write(0);
+	DCACHE_REQ_PACKET_ID  [0][0]->write(21);
+	DCACHE_REQ_ADDRESS    [0][0]->write(0xb0000003);
+	DCACHE_REQ_TYPE       [0][0]->write(DCACHE_TYPE_LOAD_8);
+	DCACHE_REQ_WDATA      [0][0]->write(0xdeadbeef);
+	DCACHE_RSP_ACK        [0][0]->write(1);
+	// Wait ack
+	do
+	  {
+	    sc_start(1);
+	  } while (DCACHE_REQ_ACK [0][0]->read() == 0);
+	DCACHE_REQ_VAL        [0][0]->write(0);
+
+	sc_start (9);
+	TEST(DCACHE_RSP_VAL [0][0]->read(), 0);
+	sc_start (1);
+	TEST(DCACHE_RSP_VAL [0][0]->read(), 1);
+	TEST(DCACHE_RSP_CONTEXT_ID  [0][0]->read(), 0);
+	TEST(DCACHE_RSP_PACKET_ID   [0][0]->read(), 21);
+	TEST(DCACHE_RSP_RDATA       [0][0]->read(), 0x00000001);
+	TEST(DCACHE_RSP_ERROR       [0][0]->read(), DCACHE_ERROR_NONE);
+	sc_start (1);
+	TEST(DCACHE_RSP_VAL [0][0]->read(), 0);
+	DCACHE_RSP_ACK      [0][0]->write(0);
+
+
+	sc_start (5);
+	// Bus Error
+
+	// 1) size access
+	// Test if lock : yes
+	DCACHE_REQ_VAL        [0][0]->write(1);
+	DCACHE_REQ_CONTEXT_ID [0][0]->write(0);
+	DCACHE_REQ_PACKET_ID  [0][0]->write(21);
+	DCACHE_REQ_ADDRESS    [0][0]->write(0xb0000003);
+	DCACHE_REQ_TYPE       [0][0]->write(DCACHE_TYPE_LOAD_16);
+	DCACHE_REQ_WDATA      [0][0]->write(0xdeadbeef);
+	DCACHE_RSP_ACK        [0][0]->write(1);
+	// Wait ack
+	do
+	  {
+	    sc_start(1);
+	  } while (DCACHE_REQ_ACK [0][0]->read() == 0);
+	DCACHE_REQ_VAL        [0][0]->write(0);
+
+	sc_start (9);
+	TEST(DCACHE_RSP_VAL [0][0]->read(), 0);
+	sc_start (1);
+	TEST(DCACHE_RSP_VAL [0][0]->read(), 1);
+	TEST(DCACHE_RSP_CONTEXT_ID  [0][0]->read(), 0);
+	TEST(DCACHE_RSP_PACKET_ID   [0][0]->read(), 21);
+	TEST(DCACHE_RSP_RDATA       [0][0]->read(), 0xb0000003);
+	TEST(DCACHE_RSP_ERROR       [0][0]->read(), DCACHE_ERROR_BUS_ERROR);
+	sc_start (1);
+	TEST(DCACHE_RSP_VAL [0][0]->read(), 0);
+	DCACHE_RSP_ACK      [0][0]->write(0);
+
+      }
+
+    //==============================================================================
+    //===== [ MEMORY ]==============================================================
+    //==============================================================================
+    if (_TEST_DMEMORY_)
+      {
+	cout << "Test : MEMORY" << endl;
+
+	DCACHE_REQ_VAL        [0][0]->write(1);
+	DCACHE_REQ_CONTEXT_ID [0][0]->write(0);
+	DCACHE_REQ_PACKET_ID  [0][0]->write(21);
+	DCACHE_REQ_ADDRESS    [0][0]->write(0x10000100);
+	DCACHE_REQ_TYPE       [0][0]->write(DCACHE_TYPE_STORE_32);
+	DCACHE_REQ_WDATA      [0][0]->write(0xdeadbeef);
+	DCACHE_RSP_ACK        [0][0]->write(0);
+	// Wait ack
+	do
+	  {
+	    sc_start(1);
+	  } while (DCACHE_REQ_ACK [0][0]->read() == 0);
+	DCACHE_REQ_VAL        [0][0]->write(0);
+
+
+
+	DCACHE_REQ_VAL        [0][0]->write(1);
+	DCACHE_REQ_CONTEXT_ID [0][0]->write(0);
+	DCACHE_REQ_PACKET_ID  [0][0]->write(21);
+	DCACHE_REQ_ADDRESS    [0][0]->write(0x10000100);
+	DCACHE_REQ_TYPE       [0][0]->write(DCACHE_TYPE_LOAD_32);
+	DCACHE_REQ_WDATA      [0][0]->write(0x77777777);
+	DCACHE_RSP_ACK        [0][0]->write(1);
+	// Wait ack
+	do
+	  {
+	    sc_start(1);
+	  } while (DCACHE_REQ_ACK [0][0]->read() == 0);
+	DCACHE_REQ_VAL        [0][0]->write(0);
+
+	while (DCACHE_RSP_VAL [0][0]->read() == 0)
+	  sc_start (1);
+	
+	TEST(DCACHE_RSP_CONTEXT_ID  [0][0]->read(), 0);
+	TEST(DCACHE_RSP_PACKET_ID   [0][0]->read(), 21);
+	TEST(DCACHE_RSP_RDATA       [0][0]->read(), 0xdeadbeef);
+	TEST(DCACHE_RSP_ERROR       [0][0]->read(), DCACHE_ERROR_NONE);
+	sc_start (1);
+	TEST(DCACHE_RSP_VAL [0][0]->read(), 0);
+	DCACHE_RSP_ACK      [0][0]->write(0);
+
+
+
+	DCACHE_REQ_VAL        [0][0]->write(1);
+	DCACHE_REQ_CONTEXT_ID [0][0]->write(0);
+	DCACHE_REQ_PACKET_ID  [0][0]->write(21);
+	DCACHE_REQ_ADDRESS    [0][0]->write(0x10000100);
+	DCACHE_REQ_TYPE       [0][0]->write(DCACHE_TYPE_LOAD_16);
+	DCACHE_REQ_WDATA      [0][0]->write(0x77777777);
+	DCACHE_RSP_ACK        [0][0]->write(1);
+	// Wait ack
+	do
+	  {
+	    sc_start(1);
+	  } while (DCACHE_REQ_ACK [0][0]->read() == 0);
+	DCACHE_REQ_VAL        [0][0]->write(0);
+
+	while (DCACHE_RSP_VAL [0][0]->read() == 0)
+	  sc_start (1);
+	
+	TEST(DCACHE_RSP_CONTEXT_ID  [0][0]->read(), 0);
+	TEST(DCACHE_RSP_PACKET_ID   [0][0]->read(), 21);
+	TEST(DCACHE_RSP_RDATA       [0][0]->read(), 0xdeaddead);
+	TEST(DCACHE_RSP_ERROR       [0][0]->read(), DCACHE_ERROR_NONE);
+	sc_start (1);
+	TEST(DCACHE_RSP_VAL [0][0]->read(), 0);
+	DCACHE_RSP_ACK      [0][0]->write(0);
+
+	DCACHE_REQ_VAL        [0][0]->write(1);
+	DCACHE_REQ_CONTEXT_ID [0][0]->write(0);
+	DCACHE_REQ_PACKET_ID  [0][0]->write(21);
+	DCACHE_REQ_ADDRESS    [0][0]->write(0x10000102);
+	DCACHE_REQ_TYPE       [0][0]->write(DCACHE_TYPE_LOAD_16);
+	DCACHE_REQ_WDATA      [0][0]->write(0x77777777);
+	DCACHE_RSP_ACK        [0][0]->write(1);
+	// Wait ack
+	do
+	  {
+	    sc_start(1);
+	  } while (DCACHE_REQ_ACK [0][0]->read() == 0);
+	DCACHE_REQ_VAL        [0][0]->write(0);
+
+	while (DCACHE_RSP_VAL [0][0]->read() == 0)
+	  sc_start (1);
+	
+	TEST(DCACHE_RSP_CONTEXT_ID  [0][0]->read(), 0);
+	TEST(DCACHE_RSP_PACKET_ID   [0][0]->read(), 21);
+	TEST(DCACHE_RSP_RDATA       [0][0]->read(), 0xbeefbeef);
+	TEST(DCACHE_RSP_ERROR       [0][0]->read(), DCACHE_ERROR_NONE);
+	sc_start (1);
+	TEST(DCACHE_RSP_VAL [0][0]->read(), 0);
+	DCACHE_RSP_ACK      [0][0]->write(0);
+
+      }
+
+    //==============================================================================
+    //===== [ SIM2OS ]==============================================================
+    //==============================================================================
+    if (_TEST_SIM2OS_)
+      {
+	cout << "Test : SIM2OS" << endl;
+
+	DCACHE_REQ_VAL        [0][0]->write(1);
+	DCACHE_REQ_CONTEXT_ID [0][0]->write(0);
+	DCACHE_REQ_PACKET_ID  [0][0]->write(21);
+	DCACHE_REQ_ADDRESS    [0][0]->write(0xc0000000);
+	DCACHE_REQ_TYPE       [0][0]->write(DCACHE_TYPE_STORE_32);
+	DCACHE_REQ_WDATA      [0][0]->write(SERVICE_CLOCK);
+	DCACHE_RSP_ACK        [0][0]->write(0);
+	// Wait ack
+	do
+	  {
+	    sc_start(1);
+	  } while (DCACHE_REQ_ACK [0][0]->read() == 0);
+	DCACHE_REQ_VAL        [0][0]->write(0);
+
+
+
+	DCACHE_REQ_VAL        [0][0]->write(1);
+	DCACHE_REQ_CONTEXT_ID [0][0]->write(0);
+	DCACHE_REQ_PACKET_ID  [0][0]->write(21);
+	DCACHE_REQ_ADDRESS    [0][0]->write(0xc0000004);
+	DCACHE_REQ_TYPE       [0][0]->write(DCACHE_TYPE_LOAD_32);
+	DCACHE_REQ_WDATA      [0][0]->write(0x77777777);
+	DCACHE_RSP_ACK        [0][0]->write(1);
+	// Wait ack
+	do
+	  {
+	    sc_start(1);
+	  } while (DCACHE_REQ_ACK [0][0]->read() == 0);
+	DCACHE_REQ_VAL        [0][0]->write(0);
+
+	while (DCACHE_RSP_VAL [0][0]->read() == 0)
+	  sc_start (1);
+	
+	TEST(DCACHE_RSP_CONTEXT_ID  [0][0]->read(), 0);
+	TEST(DCACHE_RSP_PACKET_ID   [0][0]->read(), 21);
+	TEST(DCACHE_RSP_RDATA       [0][0]->read(), 354); // if all test is activate
+	TEST(DCACHE_RSP_ERROR       [0][0]->read(), DCACHE_ERROR_NONE);
+	sc_start (1);
+	TEST(DCACHE_RSP_VAL [0][0]->read(), 0);
+	DCACHE_RSP_ACK      [0][0]->write(0);
+
+	
+      }
+
+    //==============================================================================
+    //===== [ END TEST ]============================================================
+    //==============================================================================
+
+    cout << "<main> Press <Enter> to stop the test" << endl;
+    getchar();
+
+    delete CLOCK ;
+    delete NRESET;
+
+    for (uint32_t i=0; i<nb_entity; i++)
+      {
+	for (uint32_t j=0; j<icache_nb_port[i]; j++)
+	  {
+	    delete ICACHE_REQ_VAL         [i][j];
+	    delete ICACHE_REQ_ACK         [i][j];
+	    delete ICACHE_REQ_CONTEXT_ID  [i][j];
+	    delete ICACHE_REQ_PACKET_ID   [i][j];
+	    delete ICACHE_REQ_ADDRESS     [i][j];
+	    delete ICACHE_REQ_TYPE        [i][j];
+	    delete ICACHE_RSP_VAL         [i][j];
+	    delete ICACHE_RSP_ACK         [i][j];
+	    delete ICACHE_RSP_CONTEXT_ID  [i][j];
+	    delete ICACHE_RSP_PACKET_ID   [i][j];
+	    delete ICACHE_RSP_ERROR       [i][j];
+
+	    for (uint32_t k=0; k<iaccess_nb_instruction[i]; k++)
+	      delete ICACHE_RSP_INSTRUCTION [i][j][k];
+
+	    delete [] ICACHE_RSP_INSTRUCTION [i][j];
+	  }
+	delete [] ICACHE_REQ_VAL         [i];
+	delete [] ICACHE_REQ_ACK         [i];
+	delete [] ICACHE_REQ_CONTEXT_ID  [i];
+	delete [] ICACHE_REQ_PACKET_ID   [i];
+	delete [] ICACHE_REQ_ADDRESS     [i];
+	delete [] ICACHE_REQ_TYPE        [i];
+	delete [] ICACHE_RSP_VAL         [i];
+	delete [] ICACHE_RSP_ACK         [i];
+	delete [] ICACHE_RSP_CONTEXT_ID  [i];
+	delete [] ICACHE_RSP_PACKET_ID   [i];
+	delete [] ICACHE_RSP_ERROR       [i];
+	delete [] ICACHE_RSP_INSTRUCTION [i];
+      }
+    
+    delete [] ICACHE_REQ_VAL        ;
+    delete [] ICACHE_REQ_ACK        ;
+    delete [] ICACHE_REQ_CONTEXT_ID ;
+    delete [] ICACHE_REQ_PACKET_ID  ;
+    delete [] ICACHE_REQ_ADDRESS    ;
+    delete [] ICACHE_REQ_TYPE       ;
+    delete [] ICACHE_RSP_VAL        ;
+    delete [] ICACHE_RSP_ACK        ;
+    delete [] ICACHE_RSP_CONTEXT_ID ;
+    delete [] ICACHE_RSP_PACKET_ID  ;
+    delete [] ICACHE_RSP_INSTRUCTION;
+    delete [] ICACHE_RSP_ERROR      ;
+    
+    for (uint32_t i=0; i<nb_entity; i++)
+      {
+	for (uint32_t j=0; j<icache_nb_port[i]; j++)
+	  {
+	    delete DCACHE_REQ_VAL        [i][j];
+	    delete DCACHE_REQ_ACK        [i][j];
+	    delete DCACHE_REQ_CONTEXT_ID [i][j];
+	    delete DCACHE_REQ_PACKET_ID  [i][j];
+	    delete DCACHE_REQ_ADDRESS    [i][j];
+	    delete DCACHE_REQ_TYPE       [i][j];
+	    delete DCACHE_REQ_WDATA      [i][j];
+	    delete DCACHE_RSP_VAL        [i][j];
+	    delete DCACHE_RSP_ACK        [i][j];
+	    delete DCACHE_RSP_CONTEXT_ID [i][j];
+	    delete DCACHE_RSP_PACKET_ID  [i][j];
+	    delete DCACHE_RSP_RDATA      [i][j];
+	    delete DCACHE_RSP_ERROR      [i][j];
+	  }
+
+	delete [] DCACHE_REQ_VAL        [i];
+	delete [] DCACHE_REQ_ACK        [i];
+	delete [] DCACHE_REQ_CONTEXT_ID [i];
+	delete [] DCACHE_REQ_PACKET_ID  [i];
+	delete [] DCACHE_REQ_ADDRESS    [i];
+	delete [] DCACHE_REQ_TYPE       [i];
+	delete [] DCACHE_REQ_WDATA      [i];
+	delete [] DCACHE_RSP_VAL        [i];
+	delete [] DCACHE_RSP_ACK        [i];
+	delete [] DCACHE_RSP_CONTEXT_ID [i];
+	delete [] DCACHE_RSP_PACKET_ID  [i];
+	delete [] DCACHE_RSP_RDATA      [i];
+	delete [] DCACHE_RSP_ERROR      [i];
+      }
+
+    delete [] DCACHE_REQ_VAL        ;
+    delete [] DCACHE_REQ_ACK        ;
+    delete [] DCACHE_REQ_CONTEXT_ID ;
+    delete [] DCACHE_REQ_PACKET_ID  ;
+    delete [] DCACHE_REQ_ADDRESS    ;
+    delete [] DCACHE_REQ_TYPE       ;
+    delete [] DCACHE_REQ_WDATA      ;
+    delete [] DCACHE_RSP_VAL        ;
+    delete [] DCACHE_RSP_ACK        ;
+    delete [] DCACHE_RSP_CONTEXT_ID ;
+    delete [] DCACHE_RSP_PACKET_ID  ;
+    delete [] DCACHE_RSP_RDATA      ;
+    delete [] DCACHE_RSP_ERROR      ;
+    
+    delete    env;
+
+    delete    param;
+    delete    segtable;
+
+    delete [] ramlock_address;
+    delete [] nb_lock;
+  
+    delete [] name_tty [0];
+    delete [] name_tty;
+    delete [] tty_address;
+    delete [] nb_tty;
+
+    delete [] cache_shared_nb_line      ;
+    delete [] cache_shared_size_line    ;
+    delete [] cache_shared_size_word    ;
+    delete [] cache_shared_associativity;
+    delete [] cache_shared_hit_latence  ;
+    delete [] cache_shared_miss_penality;
+    delete [] icache_nb_level      ;
+    delete [] icache_nb_port       ;
+    delete [] icache_nb_line       [0];
+    delete [] icache_size_line     [0];
+    delete [] icache_size_word     [0];
+    delete [] icache_associativity [0];
+    delete [] icache_hit_latence   [0];
+    delete [] icache_miss_penality [0];
+    delete [] icache_nb_line       [1];
+    delete [] icache_size_line     [1];
+    delete [] icache_size_word     [1];
+    delete [] icache_associativity [1];
+    delete [] icache_hit_latence   [1];
+    delete [] icache_miss_penality [1];
+    delete [] icache_nb_line       ;
+    delete [] icache_size_line     ;
+    delete [] icache_size_word     ;
+    delete [] icache_associativity ;
+    delete [] icache_hit_latence   ;
+    delete [] icache_miss_penality ;
+    delete [] dcache_nb_level      ;
+    delete [] dcache_nb_port       ;
+    delete [] dcache_nb_line       [0];
+    delete [] dcache_size_line     [0];
+    delete [] dcache_size_word     [0];
+    delete [] dcache_associativity [0];
+    delete [] dcache_hit_latence   [0];
+    delete [] dcache_miss_penality [0];
+    delete [] dcache_nb_line       [1];
+    delete [] dcache_size_line     [1];
+    delete [] dcache_size_word     [1];
+    delete [] dcache_associativity [1];
+    delete [] dcache_hit_latence   [1];
+    delete [] dcache_miss_penality [1];
+    delete [] dcache_nb_line       ;
+    delete [] dcache_size_line     ;
+    delete [] dcache_size_word     ;
+    delete [] dcache_associativity ;
+    delete [] dcache_hit_latence   ;
+    delete [] dcache_miss_penality ;
+
+    delete [] iaccess_nb_context    ;
+    delete [] iaccess_nb_instruction;
+    delete [] iaccess_nb_packet     ;
+    delete [] iaccess_size_address  ;
+    delete [] iaccess_size_data     ;
+    delete [] daccess_nb_context    ;
+    delete [] daccess_nb_packet     ;
+    delete [] daccess_size_address  ;
+    delete [] daccess_size_data     ;
+
+    delete [] buffer_irsp_size;
+    delete [] buffer_drsp_size;    
+  }
+  cout << "<main> End" << endl;
+  
+  return EXIT_SUCCESS;
+}
Index: trunk/IPs/systemC/Environment/src/Cache_Access_dreq_type2cache_type.cpp
===================================================================
--- trunk/IPs/systemC/Environment/src/Cache_Access_dreq_type2cache_type.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/src/Cache_Access_dreq_type2cache_type.cpp	(revision 81)
@@ -0,0 +1,32 @@
+#include "../include/Cache_Access.h"
+
+namespace environment {
+
+  Cache_Access dreq_type2cache_type (morpheo::behavioural::Tdcache_type_t dreq_type, bool uncached)
+  {
+    cache::type_req_cache_t      type     ;
+    cache::direction_req_cache_t direction;
+    uint32_t nb_bytes = 0;
+    switch (dreq_type)
+      {
+      case DCACHE_TYPE_LOAD_8     : direction=cache::READ ; type=((uncached==true)?cache::UNCACHED:cache::CACHED); nb_bytes = 1; break; 
+      case DCACHE_TYPE_LOAD_16    : direction=cache::READ ; type=((uncached==true)?cache::UNCACHED:cache::CACHED); nb_bytes = 2; break; 
+      case DCACHE_TYPE_LOAD_32    : direction=cache::READ ; type=((uncached==true)?cache::UNCACHED:cache::CACHED); nb_bytes = 4; break; 
+      case DCACHE_TYPE_LOAD_64    : direction=cache::READ ; type=((uncached==true)?cache::UNCACHED:cache::CACHED); nb_bytes = 8; break; 
+      case DCACHE_TYPE_INVALIDATE : direction=cache::NONE ; type=cache::INVALIDATE                        ; nb_bytes = 1; break;
+      case DCACHE_TYPE_FLUSH      : direction=cache::NONE ; type=cache::FLUSH                             ; nb_bytes = 1; break;
+      case DCACHE_TYPE_PREFETCH   : direction=cache::NONE ; type=cache::INVALIDATE                        ; nb_bytes = 1; break;
+//    case DCACHE_TYPE_STORE_8_ACK: direction=cache::WRITE; type=((uncached==true)?cache::UNCACHED:cache::CACHED); nb_bytes = 1; break;
+      case DCACHE_TYPE_STORE_8    : direction=cache::WRITE; type=((uncached==true)?cache::UNCACHED:cache::CACHED); nb_bytes = 1; break;
+      case DCACHE_TYPE_STORE_16   : direction=cache::WRITE; type=((uncached==true)?cache::UNCACHED:cache::CACHED); nb_bytes = 2; break;
+      case DCACHE_TYPE_STORE_32   : direction=cache::WRITE; type=((uncached==true)?cache::UNCACHED:cache::CACHED); nb_bytes = 4; break;
+      case DCACHE_TYPE_STORE_64   : direction=cache::WRITE; type=((uncached==true)?cache::UNCACHED:cache::CACHED); nb_bytes = 8; break;
+      case DCACHE_TYPE_LOCK            :
+      case DCACHE_TYPE_SYNCHRONIZATION :
+      default : {std::cerr << "<ireq_type2cache_type> Unkown type (" << dreq_type << ")" << std::endl; exit(1);}
+      }
+    
+    return Cache_Access (type,direction,nb_bytes);
+  };
+
+};
Index: trunk/IPs/systemC/Environment/src/Cache_Access_ireq_type2cache_type.cpp
===================================================================
--- trunk/IPs/systemC/Environment/src/Cache_Access_ireq_type2cache_type.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/src/Cache_Access_ireq_type2cache_type.cpp	(revision 81)
@@ -0,0 +1,22 @@
+#include "../include/Cache_Access.h"
+
+namespace environment {
+
+  Cache_Access ireq_type2cache_type (morpheo::behavioural::Ticache_type_t ireq_type, bool uncached)
+  {
+    cache::type_req_cache_t      type     ;
+    cache::direction_req_cache_t direction;
+    
+    switch (ireq_type)
+      {
+      case ICACHE_TYPE_LOAD       : {direction=cache::READ ; type=cache::CACHED    ; break;}
+      case ICACHE_TYPE_INVALIDATE : {direction=cache::NONE ; type=cache::INVALIDATE; break;}
+      case ICACHE_TYPE_PREFETCH   : {direction=cache::NONE ; type=cache::PREFETCH  ; break;}
+      case ICACHE_TYPE_LOCK       :
+      default : {std::cerr << "<ireq_type2cache_type> Unkown type (" << ireq_type << ")" << std::endl; exit(1);}
+      }
+    
+    return Cache_Access (type,direction, 4); // instruction = 32 bits = 4 bytes
+  }
+
+};
Index: trunk/IPs/systemC/Environment/src/Environment.cpp
===================================================================
--- trunk/IPs/systemC/Environment/src/Environment.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/src/Environment.cpp	(revision 81)
@@ -0,0 +1,363 @@
+#include "../include/Environment.h"
+
+namespace environment {
+
+  Environment::Environment (sc_module_name name, Parameters * param) :
+    name (name)
+  {
+    this->param = param;
+
+    component_cache       = new cache::Cache     ("cache", param->param_cache);
+
+    component_tty         = new tty::TTY * [param->nb_component_tty];
+    for (uint32_t i=0; i<param->nb_component_tty; i++)
+    component_tty     [i] = new tty::TTY         ("tty_"+i    ,param->param_tty     [i]);
+    
+    component_ramlock     = new ramlock::RamLock * [param->nb_component_ramlock];
+    for (uint32_t i=0; i<param->nb_component_ramlock; i++)
+    component_ramlock [i] = new ramlock::RamLock ("ramlock_"+i,param->param_ramlock [i]);
+
+    component_sim2os      = new sim2os::Sim2OS   ("sim2os" ,param->param_sim2os );
+    component_data        = new data::Data       ("data"   ,param->param_data   );
+
+    component_buffer_irsp = new queue::Sort_Queue<irsp_t*> * [param->nb_entity];
+    component_buffer_drsp = new queue::Sort_Queue<drsp_t*> * [param->nb_entity];
+
+    for (uint32_t i=0; i<param->nb_component_tty; i++)
+      {
+	uint32_t tty_size = param->param_tty[i]->nb_tty * 16;
+
+	data::Entity entity = component_data->entity(param->tty_address[i], tty_size);
+	if (entity.present == false)
+	  {
+	    std::cerr << "<Environnement::Environnement> The tty [" << i << "] have not a segment in the segment table" << std::endl;
+	    exit (1);
+	  }
+	entity.segment->define_target(data::TYPE_TARGET_TTY,i);
+      } 
+
+    for (uint32_t i=0; i<param->nb_component_ramlock; i++)
+      {
+	uint32_t ramlock_size = param->param_ramlock[i]->_size;
+	data::Entity entity = component_data->entity(param->ramlock_address[i], ramlock_size);
+	if (entity.present == false)
+	  {
+	    std::cerr << "<Environnement::Environnement> The ramlock [" << i << "] have not a segment in the segment table" << std::endl;
+	    exit (1);
+	  }
+	entity.segment->define_target(data::TYPE_TARGET_RAMLOCK,i);
+      } 
+
+      {
+	data::Entity entity = component_data->entity(param->sim2os_address, param->sim2os_size);
+	if (entity.present == false)
+	  {
+	    std::cerr << "<Environnement::Environnement> The sim2os  have not a segment in the segment table" << std::endl;
+	    exit (1);
+	  }
+	entity.segment->define_target(data::TYPE_TARGET_SIM2OS,0);
+      } 
+
+
+
+
+    for (uint32_t i=0; i<param->nb_entity; i++)
+      {
+	component_buffer_irsp [i] = new queue::Sort_Queue<irsp_t*> ("buffer_irsp_"+i,param->param_buffer_irsp [i]);
+	component_buffer_drsp [i] = new queue::Sort_Queue<drsp_t*> ("buffer_drsp_"+i,param->param_buffer_drsp [i]);
+      }
+
+    uint32_t max_nb_instruction   = morpheo::max<uint32_t>(param->iaccess_nb_instruction  ,param->nb_entity);
+    uint32_t max_instruction_size = morpheo::max<uint32_t>(param->iaccess_size_instruction,param->nb_entity);
+    uint32_t max_data_size        = morpheo::max<uint32_t>(param->daccess_size_data       ,param->nb_entity);
+    
+    read_iram  = new char * [max_nb_instruction];
+    for (uint32_t i=0; i<max_nb_instruction; i++)
+      read_iram [i] = new char [max_instruction_size];
+
+    read_dram    = new char * [1];
+    read_dram[0] = new char [max_data_size/8];
+    write_dram   = new char [max_data_size/8];
+
+    // Port 
+    CLOCK                 = new sc_in_clk   ("CLOCK ");
+    NRESET                = new sc_in<bool> ("NRESET");
+
+    ICACHE_REQ_VAL        = new sc_in <Tcontrol_t           >  ** [param->nb_entity];
+    ICACHE_REQ_ACK        = new sc_out<Tcontrol_t           >  ** [param->nb_entity];
+    ICACHE_REQ_CONTEXT_ID = new sc_in <Ticache_context_t    >  ** [param->nb_entity];
+    ICACHE_REQ_PACKET_ID  = new sc_in <Ticache_packet_t     >  ** [param->nb_entity];
+    ICACHE_REQ_ADDRESS    = new sc_in <Ticache_address_t    >  ** [param->nb_entity];
+    ICACHE_REQ_TYPE       = new sc_in <Ticache_type_t       >  ** [param->nb_entity];
+
+    ICACHE_RSP_VAL        = new sc_out<Tcontrol_t           >  ** [param->nb_entity];
+    ICACHE_RSP_ACK        = new sc_in <Tcontrol_t           >  ** [param->nb_entity];
+    ICACHE_RSP_CONTEXT_ID = new sc_out<Ticache_context_t    >  ** [param->nb_entity];
+    ICACHE_RSP_PACKET_ID  = new sc_out<Ticache_packet_t     >  ** [param->nb_entity];
+
+    ICACHE_RSP_INSTRUCTION= new sc_out<Ticache_instruction_t> *** [param->nb_entity];//[nb_instruction]
+    ICACHE_RSP_ERROR      = new sc_out<Ticache_error_t      >  ** [param->nb_entity];
+
+    DCACHE_REQ_VAL        = new sc_in <Tcontrol_t           >  ** [param->nb_entity];
+    DCACHE_REQ_ACK        = new sc_out<Tcontrol_t           >  ** [param->nb_entity];
+    DCACHE_REQ_CONTEXT_ID = new sc_in <Tdcache_context_t    >  ** [param->nb_entity];
+    DCACHE_REQ_PACKET_ID  = new sc_in <Tdcache_packet_t     >  ** [param->nb_entity];
+    DCACHE_REQ_ADDRESS    = new sc_in <Tdcache_address_t    >  ** [param->nb_entity];
+    DCACHE_REQ_TYPE       = new sc_in <Tdcache_type_t       >  ** [param->nb_entity];
+    DCACHE_REQ_WDATA      = new sc_in <Tdcache_data_t       >  ** [param->nb_entity];
+
+    DCACHE_RSP_VAL        = new sc_out<Tcontrol_t           >  ** [param->nb_entity];
+    DCACHE_RSP_ACK        = new sc_in <Tcontrol_t           >  ** [param->nb_entity];
+    DCACHE_RSP_CONTEXT_ID = new sc_out<Tdcache_context_t    >  ** [param->nb_entity];
+    DCACHE_RSP_PACKET_ID  = new sc_out<Tdcache_packet_t     >  ** [param->nb_entity];
+    DCACHE_RSP_RDATA      = new sc_out<Tdcache_data_t       >  ** [param->nb_entity];
+    DCACHE_RSP_ERROR      = new sc_out<Tdcache_error_t      >  ** [param->nb_entity];
+
+    for (uint32_t i=0; i<param->nb_entity; i++)
+      {
+	ICACHE_REQ_VAL        [i] = new sc_in <Tcontrol_t           >  * [param->icache_dedicated_nb_port[i]];
+	ICACHE_REQ_ACK        [i] = new sc_out<Tcontrol_t           >  * [param->icache_dedicated_nb_port[i]];
+	ICACHE_REQ_CONTEXT_ID [i] = new sc_in <Ticache_context_t    >  * [param->icache_dedicated_nb_port[i]];
+	ICACHE_REQ_PACKET_ID  [i] = new sc_in <Ticache_packet_t     >  * [param->icache_dedicated_nb_port[i]];
+	ICACHE_REQ_ADDRESS    [i] = new sc_in <Ticache_address_t    >  * [param->icache_dedicated_nb_port[i]];
+	ICACHE_REQ_TYPE       [i] = new sc_in <Ticache_type_t       >  * [param->icache_dedicated_nb_port[i]];
+
+	ICACHE_RSP_VAL        [i] = new sc_out<Tcontrol_t           >  * [param->icache_dedicated_nb_port[i]];
+	ICACHE_RSP_ACK        [i] = new sc_in <Tcontrol_t           >  * [param->icache_dedicated_nb_port[i]];
+	ICACHE_RSP_CONTEXT_ID [i] = new sc_out<Ticache_context_t    >  * [param->icache_dedicated_nb_port[i]];
+	ICACHE_RSP_PACKET_ID  [i] = new sc_out<Ticache_packet_t     >  * [param->icache_dedicated_nb_port[i]];
+	ICACHE_RSP_INSTRUCTION[i] = new sc_out<Ticache_instruction_t> ** [param->icache_dedicated_nb_port[i]];//[nb_instruction]
+	ICACHE_RSP_ERROR      [i] = new sc_out<Ticache_error_t      >  * [param->icache_dedicated_nb_port[i]];
+	
+	for (uint32_t j=0; j<param->icache_dedicated_nb_port[i]; j++)
+	  {
+	    ICACHE_REQ_VAL         [i][j] = new sc_in <Tcontrol_t           > ("");
+	    ICACHE_REQ_ACK         [i][j] = new sc_out<Tcontrol_t           > ("");
+	    ICACHE_REQ_CONTEXT_ID  [i][j] = new sc_in <Ticache_context_t    > ("");
+	    ICACHE_REQ_PACKET_ID   [i][j] = new sc_in <Ticache_packet_t     > ("");
+	    ICACHE_REQ_ADDRESS     [i][j] = new sc_in <Ticache_address_t    > ("");
+	    ICACHE_REQ_TYPE        [i][j] = new sc_in <Ticache_type_t       > ("");
+	    
+	    ICACHE_RSP_VAL         [i][j] = new sc_out<Tcontrol_t           > ("");
+	    ICACHE_RSP_ACK         [i][j] = new sc_in <Tcontrol_t           > ("");
+	    ICACHE_RSP_CONTEXT_ID  [i][j] = new sc_out<Ticache_context_t    > ("");
+	    ICACHE_RSP_PACKET_ID   [i][j] = new sc_out<Ticache_packet_t     > ("");
+	    ICACHE_RSP_ERROR       [i][j] = new sc_out<Ticache_error_t      > ("");
+	    
+	    ICACHE_RSP_INSTRUCTION [i][j] = new sc_out<Ticache_instruction_t> * [param->iaccess_nb_instruction[i]];
+	    
+	    for (uint32_t k=0; k<param->iaccess_nb_instruction[i]; k++)
+	      ICACHE_RSP_INSTRUCTION [i][j][k] = new sc_out<Ticache_instruction_t> ("");
+	  }
+	
+	DCACHE_REQ_VAL        [i] = new sc_in <Tcontrol_t           >  * [param->dcache_dedicated_nb_port[i]];
+	DCACHE_REQ_ACK        [i] = new sc_out<Tcontrol_t           >  * [param->dcache_dedicated_nb_port[i]];
+	DCACHE_REQ_CONTEXT_ID [i] = new sc_in <Tdcache_context_t    >  * [param->dcache_dedicated_nb_port[i]];
+	DCACHE_REQ_PACKET_ID  [i] = new sc_in <Tdcache_packet_t     >  * [param->dcache_dedicated_nb_port[i]];
+	DCACHE_REQ_ADDRESS    [i] = new sc_in <Tdcache_address_t    >  * [param->dcache_dedicated_nb_port[i]];
+	DCACHE_REQ_TYPE       [i] = new sc_in <Tdcache_type_t       >  * [param->dcache_dedicated_nb_port[i]];
+	DCACHE_REQ_WDATA      [i] = new sc_in <Tdcache_data_t       >  * [param->dcache_dedicated_nb_port[i]];
+
+	DCACHE_RSP_VAL        [i] = new sc_out<Tcontrol_t           >  * [param->dcache_dedicated_nb_port[i]];
+	DCACHE_RSP_ACK        [i] = new sc_in <Tcontrol_t           >  * [param->dcache_dedicated_nb_port[i]];
+	DCACHE_RSP_CONTEXT_ID [i] = new sc_out<Tdcache_context_t    >  * [param->dcache_dedicated_nb_port[i]];
+	DCACHE_RSP_PACKET_ID  [i] = new sc_out<Tdcache_packet_t     >  * [param->dcache_dedicated_nb_port[i]];
+	DCACHE_RSP_RDATA      [i] = new sc_out<Tdcache_data_t       >  * [param->dcache_dedicated_nb_port[i]];
+	DCACHE_RSP_ERROR      [i] = new sc_out<Tdcache_error_t      >  * [param->dcache_dedicated_nb_port[i]];
+	
+	for (uint32_t j=0; j<param->dcache_dedicated_nb_port[i]; j++)
+	  {
+	    DCACHE_REQ_VAL        [i][j] = new sc_in <Tcontrol_t           > ("");
+	    DCACHE_REQ_ACK        [i][j] = new sc_out<Tcontrol_t           > ("");
+	    DCACHE_REQ_CONTEXT_ID [i][j] = new sc_in <Tdcache_context_t    > ("");
+	    DCACHE_REQ_PACKET_ID  [i][j] = new sc_in <Tdcache_packet_t     > ("");
+	    DCACHE_REQ_ADDRESS    [i][j] = new sc_in <Tdcache_address_t    > ("");
+	    DCACHE_REQ_TYPE       [i][j] = new sc_in <Tdcache_type_t       > ("");
+	    DCACHE_REQ_WDATA      [i][j] = new sc_in <Tdcache_data_t       > ("");
+	    
+	    DCACHE_RSP_VAL        [i][j] = new sc_out<Tcontrol_t           > ("");
+	    DCACHE_RSP_ACK        [i][j] = new sc_in <Tcontrol_t           > ("");
+	    DCACHE_RSP_CONTEXT_ID [i][j] = new sc_out<Tdcache_context_t    > ("");
+	    DCACHE_RSP_PACKET_ID  [i][j] = new sc_out<Tdcache_packet_t     > ("");
+	    DCACHE_RSP_RDATA      [i][j] = new sc_out<Tdcache_data_t       > ("");
+	    DCACHE_RSP_ERROR      [i][j] = new sc_out<Tdcache_error_t      > ("");
+	  }
+      }
+
+    icache_req_ack = new Tcontrol_t * [param->nb_entity];
+    icache_rsp_val = new Tcontrol_t * [param->nb_entity];
+    dcache_req_ack = new Tcontrol_t * [param->nb_entity];
+    dcache_rsp_val = new Tcontrol_t * [param->nb_entity];
+
+    for (uint32_t i=0; i<param->nb_entity; i++)
+      {
+	icache_req_ack [i] = new Tcontrol_t [param->icache_dedicated_nb_port[i]];
+	icache_rsp_val [i] = new Tcontrol_t [param->icache_dedicated_nb_port[i]];
+	dcache_req_ack [i] = new Tcontrol_t [param->dcache_dedicated_nb_port[i]];
+	dcache_rsp_val [i] = new Tcontrol_t [param->dcache_dedicated_nb_port[i]];
+      }
+    // *****[ Definition of method ]*****
+    SC_METHOD (transition);
+    dont_initialize ();
+    sensitive << (*(CLOCK)).pos();
+    
+    SC_METHOD (genMoore);
+    dont_initialize ();
+    sensitive << (*(CLOCK)).neg();
+  }
+
+  Environment::~Environment (void)
+  {
+    for (uint32_t i=0; i<param->nb_entity; i++)
+      {
+	delete [] icache_req_ack [i];
+	delete [] icache_rsp_val [i];
+	delete [] dcache_req_ack [i];
+	delete [] dcache_rsp_val [i];
+      }
+
+    delete [] icache_req_ack;
+    delete [] icache_rsp_val;
+    delete [] dcache_req_ack;
+    delete [] dcache_rsp_val;
+
+    delete CLOCK ;
+    delete NRESET;
+    
+    for (uint32_t i=0; i<param->nb_entity; i++)
+      {
+	for (uint32_t j=0; j<param->icache_dedicated_nb_port[i]; j++)
+	  {
+	    delete ICACHE_REQ_VAL         [i][j];
+	    delete ICACHE_REQ_ACK         [i][j];
+	    delete ICACHE_REQ_CONTEXT_ID  [i][j];
+	    delete ICACHE_REQ_PACKET_ID   [i][j];
+	    delete ICACHE_REQ_ADDRESS     [i][j];
+	    delete ICACHE_REQ_TYPE        [i][j];
+	    delete ICACHE_RSP_VAL         [i][j];
+	    delete ICACHE_RSP_ACK         [i][j];
+	    delete ICACHE_RSP_CONTEXT_ID  [i][j];
+	    delete ICACHE_RSP_PACKET_ID   [i][j];
+	    delete ICACHE_RSP_ERROR       [i][j];
+
+	    for (uint32_t k=0; k<param->iaccess_nb_instruction[i]; k++)
+	      delete ICACHE_RSP_INSTRUCTION [i][j][k];
+
+	    delete [] ICACHE_RSP_INSTRUCTION [i][j];
+	  }
+	delete [] ICACHE_REQ_VAL         [i];
+	delete [] ICACHE_REQ_ACK         [i];
+	delete [] ICACHE_REQ_CONTEXT_ID  [i];
+	delete [] ICACHE_REQ_PACKET_ID   [i];
+	delete [] ICACHE_REQ_ADDRESS     [i];
+	delete [] ICACHE_REQ_TYPE        [i];
+	delete [] ICACHE_RSP_VAL         [i];
+	delete [] ICACHE_RSP_ACK         [i];
+	delete [] ICACHE_RSP_CONTEXT_ID  [i];
+	delete [] ICACHE_RSP_PACKET_ID   [i];
+	delete [] ICACHE_RSP_ERROR       [i];
+	delete [] ICACHE_RSP_INSTRUCTION [i];
+      }
+    
+    delete [] ICACHE_REQ_VAL        ;
+    delete [] ICACHE_REQ_ACK        ;
+    delete [] ICACHE_REQ_CONTEXT_ID ;
+    delete [] ICACHE_REQ_PACKET_ID  ;
+    delete [] ICACHE_REQ_ADDRESS    ;
+    delete [] ICACHE_REQ_TYPE       ;
+    delete [] ICACHE_RSP_VAL        ;
+    delete [] ICACHE_RSP_ACK        ;
+    delete [] ICACHE_RSP_CONTEXT_ID ;
+    delete [] ICACHE_RSP_PACKET_ID  ;
+    delete [] ICACHE_RSP_INSTRUCTION;
+    delete [] ICACHE_RSP_ERROR      ;
+    
+    for (uint32_t i=0; i<param->nb_entity; i++)
+      {
+	for (uint32_t j=0; j<param->icache_dedicated_nb_port[i]; j++)
+	  {
+	    delete DCACHE_REQ_VAL        [i][j];
+	    delete DCACHE_REQ_ACK        [i][j];
+	    delete DCACHE_REQ_CONTEXT_ID [i][j];
+	    delete DCACHE_REQ_PACKET_ID  [i][j];
+	    delete DCACHE_REQ_ADDRESS    [i][j];
+	    delete DCACHE_REQ_TYPE       [i][j];
+	    delete DCACHE_REQ_WDATA      [i][j];
+	    delete DCACHE_RSP_VAL        [i][j];
+	    delete DCACHE_RSP_ACK        [i][j];
+	    delete DCACHE_RSP_CONTEXT_ID [i][j];
+	    delete DCACHE_RSP_PACKET_ID  [i][j];
+	    delete DCACHE_RSP_RDATA      [i][j];
+	    delete DCACHE_RSP_ERROR      [i][j];
+	  }
+
+	delete [] DCACHE_REQ_VAL        [i];
+	delete [] DCACHE_REQ_ACK        [i];
+	delete [] DCACHE_REQ_CONTEXT_ID [i];
+	delete [] DCACHE_REQ_PACKET_ID  [i];
+	delete [] DCACHE_REQ_ADDRESS    [i];
+	delete [] DCACHE_REQ_TYPE       [i];
+	delete [] DCACHE_REQ_WDATA      [i];
+	delete [] DCACHE_RSP_VAL        [i];
+	delete [] DCACHE_RSP_ACK        [i];
+	delete [] DCACHE_RSP_CONTEXT_ID [i];
+	delete [] DCACHE_RSP_PACKET_ID  [i];
+	delete [] DCACHE_RSP_RDATA      [i];
+	delete [] DCACHE_RSP_ERROR      [i];
+      }
+
+    delete [] DCACHE_REQ_VAL        ;
+    delete [] DCACHE_REQ_ACK        ;
+    delete [] DCACHE_REQ_CONTEXT_ID ;
+    delete [] DCACHE_REQ_PACKET_ID  ;
+    delete [] DCACHE_REQ_ADDRESS    ;
+    delete [] DCACHE_REQ_TYPE       ;
+    delete [] DCACHE_REQ_WDATA      ;
+    delete [] DCACHE_RSP_VAL        ;
+    delete [] DCACHE_RSP_ACK        ;
+    delete [] DCACHE_RSP_CONTEXT_ID ;
+    delete [] DCACHE_RSP_PACKET_ID  ;
+    delete [] DCACHE_RSP_RDATA      ;
+    delete [] DCACHE_RSP_ERROR      ;
+
+    delete [] write_dram;
+    delete [] read_dram [0];
+    delete [] read_dram;
+
+    uint32_t max_nb_instruction   = morpheo::max<uint32_t>(param->iaccess_nb_instruction,param->nb_entity);
+    for (uint32_t i=0; i<max_nb_instruction; i++)
+      delete [] read_iram [i];
+    delete [] read_iram;
+
+    for (uint32_t i=0; i<param->nb_entity; i++)
+      {
+	while (not component_buffer_irsp [i]->empty())
+	  {
+	    delete component_buffer_irsp [i]->read(0)._data;
+	    component_buffer_irsp [i]->pop();
+	  }
+	while (not component_buffer_drsp [i]->empty())
+	  {
+	    delete component_buffer_drsp [i]->read(0)._data;
+	    component_buffer_drsp [i]->pop();
+	  }
+
+	delete component_buffer_irsp [i];
+	delete component_buffer_drsp [i];
+      }
+    delete [] component_buffer_irsp;
+    delete [] component_buffer_drsp;
+
+    delete    component_data;
+    delete    component_sim2os;
+    for (uint32_t i=0; i<param->nb_component_ramlock; i++)
+    delete    component_ramlock [i];
+    delete [] component_ramlock;
+    for (uint32_t i=0; i<param->nb_component_tty; i++)
+    delete    component_tty [i];
+    delete [] component_tty;
+    delete    component_cache;
+
+  }
+
+};
Index: trunk/IPs/systemC/Environment/src/Environment_genMoore.cpp
===================================================================
--- trunk/IPs/systemC/Environment/src/Environment_genMoore.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/src/Environment_genMoore.cpp	(revision 81)
@@ -0,0 +1,119 @@
+#include "../include/Environment.h"
+
+namespace environment {
+
+  void Environment::genMoore (void)
+  {
+    //Scan all entity and for each entity scan all port
+    for (uint32_t i = 0; i < param->nb_entity; i++)
+      {
+	//=============================================================================
+	//===== [ ICACHE ]=============================================================
+	//=============================================================================
+	
+	//-----------------------------------------------------------------------------
+	//----- [ Request ]------------------------------------------------------------
+	//-----------------------------------------------------------------------------
+	{
+	  uint32_t nb_slot_free = component_buffer_irsp [i]->nb_slot_free ();
+	  for (uint32_t j=0; j<param->icache_dedicated_nb_port [i]; j ++)
+	    {
+	      icache_req_ack [i][j] = (j < nb_slot_free);
+	      ICACHE_REQ_ACK [i][j]->write (icache_req_ack [i][j]);
+	    }
+	}
+
+	//-----------------------------------------------------------------------------
+	//----- [ Respons ]------------------------------------------------------------
+	//-----------------------------------------------------------------------------
+	{
+	  for (uint32_t j = 0; j < param->icache_dedicated_nb_port [i]; j ++)
+      	    {
+	      // Test the number of element in the respons's buffer
+      	      if (j >= component_buffer_irsp [i]->nb_slot_use())
+      		{
+		  icache_rsp_val [i][j] = 0; // No respons
+      		}
+      	      else
+      		{
+		  queue::slot_t<irsp_t*> slot = component_buffer_irsp [i]->read(j);
+		  
+		  bool val = (slot._delay == 0);
+
+		  icache_rsp_val [i][j] = (val); // respons if have a result
+
+		  if (val)
+		    {
+		      ICACHE_RSP_CONTEXT_ID [i][j]->write(slot._data->trdid); // TODO : test if exist
+		      ICACHE_RSP_PACKET_ID  [i][j]->write(slot._data->pktid); // TODO : test if exist
+		      ICACHE_RSP_ERROR      [i][j]->write(slot._data->error);
+		      
+		      for (uint32_t k = 0; k < param->iaccess_nb_instruction[i]; k ++)
+			{
+			  Ticache_instruction_t data = 0;
+			  
+			  atoi (slot._data->data[k], data, param->iaccess_size_instruction[i]/8);
+			  
+			  ICACHE_RSP_INSTRUCTION [i][j][k]->write(data);
+			}
+		    }
+		}
+
+	      ICACHE_RSP_VAL [i][j]->write (icache_rsp_val [i][j]);
+      	    }
+	}
+	
+	//=============================================================================
+	//===== [ DCACHE ]=============================================================
+	//=============================================================================
+	
+	//-----------------------------------------------------------------------------
+	//----- [ Request ]------------------------------------------------------------
+	//-----------------------------------------------------------------------------
+	{
+	  uint32_t nb_slot_free = component_buffer_drsp [i]->nb_slot_free ();
+	  for (uint32_t j = 0; j < param->dcache_dedicated_nb_port [i]; j ++)
+	    {
+	      dcache_req_ack [i][j] = (j < nb_slot_free);
+	      DCACHE_REQ_ACK [i][j]->write (dcache_req_ack [i][j]);
+	    }
+	}
+	
+	//-----------------------------------------------------------------------------
+	//----- [ Respons ]------------------------------------------------------------
+	//-----------------------------------------------------------------------------
+	{
+	  for (uint32_t j = 0; j < param->dcache_dedicated_nb_port [i]; j ++)
+      	    {
+	      // Test the number of element in the respons's buffer
+      	      if (j >= component_buffer_drsp [i]->nb_slot_use())
+      		{
+		  dcache_rsp_val [i][j] = 0; // No respons
+      		}
+      	      else
+      		{
+		  queue::slot_t<drsp_t*> slot = component_buffer_drsp [i]->read(j);
+
+		  bool val = (slot._delay == 0); // respons if have a result
+		  
+		  dcache_rsp_val [i][j] = (val); // respons if have a result
+
+		  if (val)
+		    {
+		      DCACHE_RSP_CONTEXT_ID [i][j]->write(slot._data->trdid); // TODO : test if exist
+		      DCACHE_RSP_PACKET_ID  [i][j]->write(slot._data->pktid); // TODO : test if exist
+		      DCACHE_RSP_ERROR      [i][j]->write(slot._data->error);
+		      
+		      Tdcache_data_t data = 0;
+		      atoi (slot._data->data[0], data, param->daccess_size_data[i]/8);
+		      
+		      DCACHE_RSP_RDATA       [i][j]->write(data);
+		    }
+		}
+	      DCACHE_RSP_VAL [i][j]->write (dcache_rsp_val [i][j]);
+      	    }
+	}
+      }
+  }
+
+};
Index: trunk/IPs/systemC/Environment/src/Environment_init.cpp
===================================================================
--- trunk/IPs/systemC/Environment/src/Environment_init.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/src/Environment_init.cpp	(revision 81)
@@ -0,0 +1,10 @@
+#include "../include/Environment.h"
+
+namespace environment {
+
+  bool Environment::init (std::string section, const char * filename, const char ** list_section)
+  {
+    return component_data->init(section, filename, list_section);
+  }
+
+};
Index: trunk/IPs/systemC/Environment/src/Environment_print.cpp
===================================================================
--- trunk/IPs/systemC/Environment/src/Environment_print.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/src/Environment_print.cpp	(revision 81)
@@ -0,0 +1,56 @@
+#include "../include/Environment.h"
+
+namespace environment {
+
+  std::ostream& operator<< (std::ostream& output, Environment &x)
+  {
+    output << "<" << x.name << ">" << std::endl
+	   << " * nb_iport : " << x.param->nb_iport << std::endl
+	   << " * nb_dport : " << x.param->nb_dport << std::endl
+      ;
+
+    for (uint32_t i=0; i<x.param->nb_entity; i++)
+      output << " * iaccess_nb_context       ["<<i<<"] : " << x.param->iaccess_nb_context     [i] << std::endl
+	     << " * iaccess_nb_instruction   ["<<i<<"] : " << x.param->iaccess_nb_instruction [i] << std::endl
+	     << " * iaccess_nb_packet        ["<<i<<"] : " << x.param->iaccess_nb_packet      [i] << std::endl
+	     << " * iaccess_size_address     ["<<i<<"] : " << x.param->iaccess_size_address   [i] << std::endl
+	     << " * iaccess_size_instruction ["<<i<<"] : " << x.param->iaccess_size_instruction [i] << std::endl
+	;
+
+    for (uint32_t i=0; i<x.param->nb_entity; i++)
+      output << " * daccess_nb_context       ["<<i<<"] : " << x.param->daccess_nb_context     [i] << std::endl
+	     << " * daccess_nb_packet        ["<<i<<"] : " << x.param->daccess_nb_packet      [i] << std::endl
+	     << " * daccess_size_address     ["<<i<<"] : " << x.param->daccess_size_address   [i] << std::endl
+	     << " * daccess_size_data        ["<<i<<"] : " << x.param->daccess_size_data      [i] << std::endl
+	;
+
+      output << "  -----[ component_data ]-----------------------------------" << std::endl;
+      output << *x.component_data << std::endl;
+	    
+      output << "  -----[ component_cache ]----------------------------------" << std::endl;
+      output << *x.component_cache;
+
+      output << "  -----[ component_buffer_irsp ]----------------------------" << std::endl;
+      for (uint32_t i = 0; i < x.param->nb_entity; i++)
+	output << *x.component_buffer_irsp [i];
+      
+      output << "  -----[ component_buffer_drsp ]----------------------------" << std::endl;
+      for (uint32_t i = 0; i < x.param->nb_entity; i++)
+	output << *x.component_buffer_drsp [i];
+
+      output << "  -----[ component_ramlock ]--------------------------------" << std::endl;
+      output << "  * nb_component_ramlock : " << x.param->nb_component_ramlock << std::endl;
+      for (uint32_t it = 0; it < x.param->nb_component_ramlock; it++)
+      	output << *x.component_ramlock [it];      
+      
+      output << "  -----[ component_tty ]------------------------------------" << std::endl;
+      output << "  * nb_component_tty     : " << x.param->nb_component_tty     << std::endl;
+      for (uint32_t it = 0; it < x.param->nb_component_tty    ; it++)
+      	output << *x.component_tty     [it];
+      
+      output << *x.component_sim2os;
+      
+      return output;
+
+  }
+};
Index: trunk/IPs/systemC/Environment/src/Environment_reset.cpp
===================================================================
--- trunk/IPs/systemC/Environment/src/Environment_reset.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/src/Environment_reset.cpp	(revision 81)
@@ -0,0 +1,21 @@
+#include "../include/Environment.h"
+
+namespace environment {
+
+  void Environment::reset(void)
+  {
+    component_cache -> reset();
+    for (uint32_t i = 0; i < param->nb_component_tty    ; i++)
+      component_tty     [i]   ->reset();
+    for (uint32_t i = 0; i < param->nb_component_ramlock; i++)
+      component_ramlock [i]   ->reset();
+    component_sim2os -> reset();
+    component_data -> reset();
+    for (uint32_t i = 0; i < param->nb_entity; i++)
+      {
+	component_buffer_irsp [i] ->reset();
+	component_buffer_drsp [i] ->reset();
+      }
+  }
+
+};
Index: trunk/IPs/systemC/Environment/src/Environment_transition.cpp
===================================================================
--- trunk/IPs/systemC/Environment/src/Environment_transition.cpp	(revision 81)
+++ trunk/IPs/systemC/Environment/src/Environment_transition.cpp	(revision 81)
@@ -0,0 +1,804 @@
+#include "../include/Environment.h"
+
+namespace environment {
+
+  void Environment::transition (void)
+  {
+    if (NRESET->read() == 0)
+      {
+	reset ();
+      }
+    else
+      {
+	//=============================================================================
+	//===== [ ICACHE - RESPONS ]===================================================
+	//=============================================================================
+	for (uint32_t i = 0; i < param->nb_entity; i++)
+	  for (int32_t j=param->icache_dedicated_nb_port [i]-1; j>=0; j--)
+	    if (icache_rsp_val [i][j] and ICACHE_RSP_ACK [i][j]->read())
+	      {
+		delete component_buffer_irsp [i]->read(j)._data;
+		component_buffer_irsp [i]->pop(j);
+	      }
+	//=============================================================================
+	//===== [ DCACHE - RESPONS ]===================================================
+	//=============================================================================
+	for (uint32_t i = 0; i < param->nb_entity; i++)
+	  for (int32_t j=param->dcache_dedicated_nb_port [i]-1; j>=0; j--)
+	    if (dcache_rsp_val [i][j] and DCACHE_RSP_ACK [i][j]->read())
+	      {
+		delete component_buffer_drsp [i]->read(j)._data;
+		component_buffer_drsp [i]->pop(j);
+	      }
+
+	//=============================================================================
+	//===== [ ICACHE - RESPONS ]===================================================
+	//=============================================================================
+	for (uint32_t i=0; i<param->nb_entity; i++)
+	  for (uint32_t j=0; j <param->icache_dedicated_nb_port [i]; j++)
+	    if (ICACHE_REQ_VAL [i][j]->read() and icache_req_ack [i][j])
+	      {
+		_cout(ENVIRONMENT, "ICACHE_REQ [%d] : Transaction accepted\n",i);
+
+		Ticache_context_t context   = ICACHE_REQ_CONTEXT_ID [i][j]->read();// TODO : test presence
+		Ticache_packet_t  packet    = ICACHE_REQ_PACKET_ID  [i][j]->read();// TODO : test presence
+		Ticache_address_t address   = ICACHE_REQ_ADDRESS    [i][j]->read();
+		Ticache_type_t    type      = ICACHE_REQ_TYPE       [i][j]->read();
+		uint32_t          size      = param->iaccess_size_address [i]/8;
+
+		_cout(ENVIRONMENT," * information\n");
+		_cout(ENVIRONMENT,"   * context : %d\n" ,static_cast<uint32_t>(context));
+		_cout(ENVIRONMENT,"   * packet  : %d\n" ,static_cast<uint32_t>(packet ));
+		_cout(ENVIRONMENT,"   * address : %.x\n",static_cast<uint32_t>(address));
+		_cout(ENVIRONMENT,"   * type    : %d\n" ,static_cast<uint32_t>(type   ));
+		_cout(ENVIRONMENT,"   * size    : %d\n" ,static_cast<uint32_t>(size   ));
+
+		// search the entity
+		data::Entity      entity    = component_data->entity(static_cast<uint32_t>(address),size);
+		
+		bool              uncached ;
+		bool              bus_error;
+		bool              must_read         = (type == ICACHE_TYPE_LOAD);
+		bool              must_ack          = (type == ICACHE_TYPE_LOAD);
+		bool              must_ack_on_error = (type == ICACHE_TYPE_LOAD);
+
+		// Test the type of the address : if != MEMORY -> error
+		if ((entity.present == true) and 
+		    (entity.segment->getType() == data::TYPE_TARGET_MEMORY))
+		  {
+		    _cout(ENVIRONMENT, " * OK !\n");
+		    bus_error = false;
+		    uncached  = entity.segment->getUncached();
+		    
+		    if (must_read == true) // Test if must read the ram
+		      {
+			_cout(ENVIRONMENT, "   * must read\n");
+			// Read all instruction
+			for (unsigned int k=0; k<param->iaccess_nb_instruction[i]; k++)
+			  {
+			    uint32_t addr = address+k*(size);
+			    _cout(ENVIRONMENT, "   * addr : %.8x\n",addr);
+
+			    bus_error |= !component_data->read(addr,size,read_iram[k]);
+
+			    // Swap if endienness is different
+			    if (endianness::isSameEndianness(context) == false) 
+			      read_iram[k] = endianness::swapBytes(read_iram[k],size,size);
+			  }
+		      }
+		  }
+		else
+		  {
+		    _cout(ENVIRONMENT, " * KO !\n");
+		    _cout(ENVIRONMENT, "   * present : %d\n",entity.present);
+		    if (entity.present)
+		    _cout(ENVIRONMENT, "   * type    : %d must be data::TYPE_TARGET_MEMORY (%d)\n",entity.segment->getType(), data::TYPE_TARGET_MEMORY);
+		      
+		    // entity is not present, or is present but is not a memory : have a bus error
+		    bus_error = true;
+		    uncached  = true;
+		  }
+
+		Cache_Access cache_type = ireq_type2cache_type (type,uncached);
+		uint32_t latence = component_cache->latence(cache::INSTRUCTION_CACHE,
+							    i,
+							    j,
+							    address,
+							    context,
+							    cache_type.type,
+							    cache_type.direction);
+		
+		_cout(ENVIRONMENT, "   * latence : %d\n",latence);
+		
+		// If is a respons -> compute the latence and push in the write_buffer
+		if (must_ack or (must_ack_on_error and bus_error))
+		  {
+		    _cout(ENVIRONMENT, " * must ack\n");
+		    
+		    if (bus_error == true)
+		      {
+			std::cout << "Icache : have a bus error" << std::endl
+				  << "  * entity     : " << i << std::endl
+				  << "  * port       : " << j << std::endl
+				  << std::hex
+				  << "  * req_addr   : " << address << std::endl
+				  << std::dec
+				  << "  * req_trdid  : " << context << std::endl
+				  << "  * req_pktid  : " << packet  << std::endl;
+
+			// Write in instruction [0] the bad address (only 32bit ....)
+			itoa<Ticache_address_t>(address,read_iram[0],param->iaccess_size_instruction[i]/8);
+		      }
+			    
+		    // Simplification : the size of a line is a multiple of size_iword (no test)
+		    _cout(ENVIRONMENT, "   * push in buffer_irsp[%d]\n",i);
+
+		    irsp_t * rsp = new irsp_t(context,
+					      packet,
+					      param->iaccess_nb_instruction[i],
+					      size,
+					      read_iram,
+					      (bus_error==true)?ICACHE_ERROR_BUS_ERROR:ICACHE_ERROR_NONE);
+		    component_buffer_irsp [i]->push(latence,rsp);
+		  }
+
+		_cout(ENVIRONMENT, " * End request\n");
+	      }
+
+	//=============================================================================
+	//===== [ DCACHE - REQUEST ]===================================================
+	//=============================================================================
+	for (uint32_t i=0; i<param->nb_entity; i++)
+	  for (uint32_t j=0; j <param->dcache_dedicated_nb_port [i]; j++)
+	    if (DCACHE_REQ_VAL [i][j]->read() and dcache_req_ack [i][j])
+	      {
+		_cout(ENVIRONMENT, "DCACHE_REQ [%d] : Transaction accepted\n",i);
+
+		Tdcache_context_t context   = DCACHE_REQ_CONTEXT_ID [i][j]->read();// TODO : test presence
+		Tdcache_packet_t  packet    = DCACHE_REQ_PACKET_ID  [i][j]->read();// TODO : test presence
+		Tdcache_address_t address   = DCACHE_REQ_ADDRESS    [i][j]->read();
+		Tdcache_data_t    wdata     = DCACHE_REQ_WDATA      [i][j]->read();
+		Tdcache_type_t    type      = DCACHE_REQ_TYPE       [i][j]->read();
+		uint32_t          size      = param->daccess_size_data [i]/8;
+
+// 		_cout(ENVIRONMENT," * information\n");
+// 		_cout(ENVIRONMENT,"   * context : %d\n" ,static_cast<uint32_t>(context));
+// 		_cout(ENVIRONMENT,"   * packet  : %d\n" ,static_cast<uint32_t>(packet ));
+// 		_cout(ENVIRONMENT,"   * address : %.x\n",static_cast<uint32_t>(address));
+// 		_cout(ENVIRONMENT,"   * type    : %d\n" ,static_cast<uint32_t>(type   ));
+// 		_cout(ENVIRONMENT,"   * size    : %d\n" ,static_cast<uint32_t>(size   ));
+
+		// search the entity
+		data::Entity      entity    = component_data->entity(static_cast<uint32_t>(address),size);
+
+		std::cout << entity << std::endl;
+
+		bool              uncached  = false;
+		bool              bus_error = false;
+
+		uint32_t          nb_bytes  = size;
+		bool              must_read ;
+		bool              must_write;
+		bool              must_ack  ;
+		bool              must_ack_on_error;
+		
+		switch (type)
+		  {
+		  case DCACHE_TYPE_LOAD_8          :{nb_bytes=1; must_read=true ; must_write=false; must_ack=true ; must_ack_on_error=true ; break;}
+		  case DCACHE_TYPE_LOAD_16         :{nb_bytes=2; must_read=true ; must_write=false; must_ack=true ; must_ack_on_error=true ; break;}
+		  case DCACHE_TYPE_LOAD_32         :{nb_bytes=4; must_read=true ; must_write=false; must_ack=true ; must_ack_on_error=true ; break;}
+		  case DCACHE_TYPE_LOAD_64         :{nb_bytes=8; must_read=true ; must_write=false; must_ack=true ; must_ack_on_error=true ; break;}
+		  case DCACHE_TYPE_LOCK            :{            must_read=false; must_write=false; must_ack=false; must_ack_on_error=false; break;}
+		  case DCACHE_TYPE_INVALIDATE      :{            must_read=false; must_write=false; must_ack=false; must_ack_on_error=false; break;}
+		  case DCACHE_TYPE_PREFETCH        :{            must_read=false; must_write=false; must_ack=false; must_ack_on_error=false; break;}
+		  case DCACHE_TYPE_FLUSH           :{            must_read=false; must_write=false; must_ack=false; must_ack_on_error=false; break;}
+		  case DCACHE_TYPE_SYNCHRONIZATION :{            must_read=false; must_write=false; must_ack=true ; must_ack_on_error=false; break;}
+		  case DCACHE_TYPE_STORE_8         :{nb_bytes=1; must_read=false; must_write=true ; must_ack=false; must_ack_on_error=true ; break;}
+		  case DCACHE_TYPE_STORE_16        :{nb_bytes=2; must_read=false; must_write=true ; must_ack=false; must_ack_on_error=true ; break;}
+		  case DCACHE_TYPE_STORE_32        :{nb_bytes=4; must_read=false; must_write=true ; must_ack=false; must_ack_on_error=true ; break;}
+		  case DCACHE_TYPE_STORE_64        :{nb_bytes=8; must_read=false; must_write=true ; must_ack=false; must_ack_on_error=true ; break;}
+		  default                          :{            must_read=false; must_write=false; must_ack=false; must_ack_on_error=false; break;} 
+		  }
+		
+		// Test the type of the address
+		if (entity.present == true)
+		  {
+		    switch (entity.segment->getType())
+		      {
+			//**************************************************************
+			//*****[ TTY ]**************************************************
+			//**************************************************************
+		      case data::TYPE_TARGET_TTY     :
+			{
+			  // Can't read a tty, must write
+			  if (must_write == false)
+			    {
+			      bus_error = true;
+			      break;
+			    }
+
+			  uint32_t num_tty   = (address - entity.segment->getBase())>>4;
+			  uint32_t num_print = ((address>>2) & 0x3);
+			  _cout(ENVIRONMENT," * TYPE_TARGET_TTY : num_tty : %d, num_print : %d\n",num_tty, num_print);
+			  
+			  switch (num_print)
+			    {
+			    case 0 : // Write TTY
+			      {
+				uint32_t num_component_tty = entity.segment->getIndex();
+				char     char_write        = static_cast<char>(wdata&0xff);
+				bus_error |= !component_tty [num_component_tty]->write(num_tty,char_write);
+				break;
+			      }
+			    case 1 : // STOP
+			      {
+				printf("\n\t***** [ stop    ] Time : %.10d - Address : %.8x - Wdata[31:0] : %.2x%.2x%.2x%.2x         *****\n"
+				       ,static_cast<uint32_t>(sc_simulation_time())
+				       ,static_cast<uint32_t>(address		  )
+				       ,static_cast<uint32_t>((wdata>>24)&0xff)
+				       ,static_cast<uint32_t>((wdata>>16)&0xff)
+				       ,static_cast<uint32_t>((wdata>> 8)&0xff)
+				       ,static_cast<uint32_t>((wdata>> 0)&0xff)
+				       );
+			    
+// 				if (context_stop [context] == false)
+// 				  {
+// 				    context_stop [context] = true;
+// 				    nb_context_stop ++;
+				    
+// 				    if (nb_context_stop >= nb_context)
+// 				      sc_stop();
+// 				  }
+
+				break;
+			      }
+			    case 2 : // PRINT
+			      {
+				printf("\n\t----- [ print   ] Time : %.10d - Address : %.8x - Wdata[31:0] : %.2x%.2x%.2x%.2x         -----\n"
+				       ,static_cast<uint32_t>(sc_simulation_time())
+				       ,static_cast<uint32_t>(address		  )
+				       ,static_cast<uint32_t>((wdata>>24)&0xff)
+				       ,static_cast<uint32_t>((wdata>>16)&0xff)
+				       ,static_cast<uint32_t>((wdata>> 8)&0xff)
+				       ,static_cast<uint32_t>((wdata>> 0)&0xff)
+				       );
+				
+				break;
+			      }
+			    default :
+			      {
+				printf("[address : %.8x] tty %d, reg %d don't exist\n",static_cast<uint32_t>(address),num_tty,num_print);
+				bus_error = true;
+			      }
+			    }
+			  break;
+			}
+
+			//**************************************************************
+			//*****[ MEMORY ]***********************************************
+			//**************************************************************
+		      case data::TYPE_TARGET_MEMORY  : 
+			{
+			  _cout(ENVIRONMENT,"MEMORY\n");
+			  _cout(ENVIRONMENT,"access : %x\n",address);
+
+			  if (must_read == true)
+			    {
+			      // Read
+			      _cout(ENVIRONMENT," * Read  (%d bytes)\n",size);
+			      bus_error |= !component_data->read(address,size,read_dram[0]); // always read a complete word
+
+			      _cout(ENVIRONMENT," * Rdata : ");
+			      for (uint32_t i=0; i<size; i++)
+				_cout(ENVIRONMENT,"%.2x",0xff&static_cast<uint32_t>(read_dram[0][i]));
+			      _cout(ENVIRONMENT,".\n");
+			      
+			      // Multiple copy
+			      for (unsigned int it_size_data = nb_bytes; it_size_data < size; it_size_data+=nb_bytes)
+				memcpy(&(read_dram[0][it_size_data]),&(read_dram[0][0]),nb_bytes);
+			      
+			      // Permutation if problem of endianness
+			      if (endianness::isSameEndianness(context) == false) 
+				read_dram[0] = endianness::swapBytes(read_dram[0] , size, nb_bytes);
+			    }
+			  
+			  if (must_write == true)
+			    {
+			      // Write
+			      _cout(ENVIRONMENT," * Write (%d bytes)\n",size);
+			      _cout(ENVIRONMENT," * Wdata : %x\n",wdata);
+			      itoa<Tdcache_data_t>(wdata,write_dram,nb_bytes);
+
+// 			      for (unsigned int it_nb_bytes = 0; it_nb_bytes < size; it_nb_bytes ++)
+// 				write_dram [it_nb_bytes] = wdata.range(8*(it_nb_bytes+1)-1,8*it_nb_bytes);
+			    }
+
+			  break;
+			}
+			//**************************************************************
+			//*****[ RAMLOCK ]**********************************************
+			//**************************************************************
+		      case data::TYPE_TARGET_RAMLOCK :
+			{
+			  // Access is on a byte, else error
+			  if (nb_bytes != 1)
+			    {
+			      bus_error = true;
+			      break;
+			    }
+
+			  uint32_t num_ramlock           = (address - entity.segment->getBase()); // Char access
+			  uint32_t num_component_ramlock = entity.segment->getIndex();
+
+			  // No test : because out of range
+
+// 			  bus_error |= !component_ramlock [num_component_ramlock]->test(num_ramlock);
+			  
+// 			  if (bus_error == true)
+// 			    break;
+
+			  memset (read_dram[0],0,size);
+			  
+			  if (must_read == true)
+			    read_dram [0][0] = static_cast<char>(component_ramlock [num_component_ramlock]->read (num_ramlock));
+			  if (must_write == true)
+			    read_dram [0][0] = static_cast<char>(component_ramlock [num_component_ramlock]->write(num_ramlock));
+			  
+			  break;
+			}
+
+			//**************************************************************
+			//*****[ SIM2OS ]***********************************************
+			//**************************************************************
+		      case data::TYPE_TARGET_SIM2OS  :
+			{
+			  // Mapping :
+			  // [0]  number of service - Wonly - A write in this register lunch the execution of service
+			  // [1]  result            - Ronly - Content the result of the service
+			  // [2]  error             - Ronly - Content the code of errno
+			  // [3+] argument          - Wonly - it's all argument to execute the service
+
+			  uint32_t num_reg = (address - entity.segment->getBase())>>2;
+			  
+			  switch (num_reg)
+			    {
+			    case 0  : // ---> number of service
+			      {
+				if (must_write == false)
+				  {
+				    std::cerr << "<Environment::transition> SIM2OS[0] is not accessible in Read" << std::endl;
+				    bus_error = true;
+				  }
+				else
+				  {
+				    _cout(ENVIRONMENT,"<sim2os> service     : %x\n",wdata);
+				    component_sim2os->execute(sim2os::int2service(static_cast<uint32_t>(wdata)));
+				  }
+				break;
+			      }
+			    case 1  : // ---> result
+			      { 
+				if (must_read == false)
+				  {
+				    std::cerr << "<Environment::transition> SIM2OS[1] is not accessible in Write" << std::endl;
+				    bus_error = true;
+				  }
+				else
+				  {
+				    // Decomposition en groupe octect
+				    Tdcache_data_t result = (Tdcache_data_t)(component_sim2os->result);
+				    _cout(ENVIRONMENT,"<sim2os> result      : %x\n",result);
+				    
+				    itoa<Tdcache_data_t>(result,read_dram[0],size);
+				  }
+				break;
+			      }
+			    case 2  : // ---> error
+			      {
+				if (must_read == false)
+				  {
+				    std::cerr << "<Environment::transition> SIM2OS[2] is not accessible in Write" << std::endl;
+				    bus_error = true;
+				  }
+				else
+				  {
+				    // Decomposition en groupe octect
+				    Tdcache_data_t error = (Tdcache_data_t)component_sim2os->error;
+				    _cout(ENVIRONMENT,"<sim2os> error       : %x\n",error);
+				    
+				    itoa<Tdcache_data_t>(error,read_dram[0],size);
+				  }
+				
+				break;
+			      }
+			    default : //---> argument
+				{ 
+				  if (must_write == false)
+				    {
+				      std::cerr << "<Environment::transition> SIM2OS[" << num_reg << "] is not accessible in Read" << std::endl;
+				      bus_error = true;
+				    }
+				  else
+				    {
+				      _cout(ENVIRONMENT,"<sim2os> argument[%d] : %x\n",num_reg-1,wdata);
+				      component_sim2os->parameter(num_reg-2,(void *)wdata);
+				    }
+				  break;
+				}
+			    }
+			  
+			  break;
+			}
+			
+		      default :
+			{
+			  std::cerr << "<Environment::transition> Dcache_req : Unknow type" << std::endl;
+			  exit(1);
+			  break;
+			}
+		      }
+		    uncached |= entity.segment->getUncached();
+		  }
+		else
+		  {
+		    // entity is not present, or is present but is not a memory : have a bus error
+		    bus_error = true;
+		    uncached  = true;
+		  }
+
+	      if ((must_write == true) and (bus_error == false))
+		{
+		  // Permutation if problem of endianness
+		  if (endianness::isSameEndianness(context) == false) 
+		    write_dram = endianness::swapBytes(write_dram, size, nb_bytes);
+
+		  bus_error |= !component_data->write(address, nb_bytes, write_dram); // take the good access
+		}
+
+	      // Acces at the cache !!!
+	      // Cache WRITE ALLOCATE (becauce compute latence always; )
+	      Cache_Access cache_type = dreq_type2cache_type (type,uncached);
+	      uint32_t latence = component_cache->latence(cache::DATA_CACHE,
+							  i,
+							  j,
+							  address,
+							  context,
+							  cache_type.type,
+							  cache_type.direction);
+	      
+	      // If is a respons -> compute the latence and push in the write_buffer
+	      if (must_ack or (must_ack_on_error and bus_error))
+		  {
+		    if (bus_error == true)
+		      {
+			std::cout << "Dcache : have a bus error" << std::endl
+				  << "  * entity     : " << i << std::endl
+				  << "  * port       : " << j << std::endl
+				  << std::hex
+				  << "  * req_addr   : 0x" << address << std::endl
+				  << std::dec
+				  << "  * req_trdid  : " << context << std::endl
+				  << "  * req_pktid  : " << packet  << std::endl;
+
+			// Write in data [0] the bad address (32bit or 64bits    )
+			itoa<Tdcache_data_t>(address,read_dram[0],param->daccess_size_data[i]/8);
+		      }
+		    
+		    // Simplification : the size of a line is a multiple of size_iword (no test)
+		    drsp_t * rsp = new drsp_t(context,
+					      packet,
+					      1,
+					      size,
+					      read_dram,
+					      (bus_error==true)?DCACHE_ERROR_BUS_ERROR:DCACHE_ERROR_NONE);
+		    component_buffer_drsp [i]->push(latence,rsp);
+		  }
+
+	      }
+	//=============================================================================
+	//===== [ OTHERS ]=============================================================
+	//=============================================================================
+
+	// Transition for each component
+	component_cache -> transition();
+	for (uint32_t i=0; i<param->nb_entity; i++)
+	  {
+	    component_buffer_irsp [i]->transition();
+	    component_buffer_drsp [i]->transition();
+	  }
+	component_sim2os->transition();
+      }
+  }
+
+// 	  // ******************
+// 	  // ***** DCACHE *****
+// 	  // ******************
+
+// 	  for (uint32_t j = 0; j < nb_dport [i]; j ++)
+// 	    {
+// 	      // Test if transaction
+// // 	      cout << "[" << i << "]"
+// // 		   << "[" << j   << "] "
+// // 		   << "dreq_val : " << DCACHE [i][j].REQ_VAL.read() << " "
+// // 		   << "dreq_ack : " << dreq_ack [i][j] << endl;
+
+// 	      if ( (DCACHE [i][j].REQ_VAL.read() && dreq_ack [i][j]) == false)
+// 		continue;
+	      
+// 	      entity_t             entity         = component_data->entity((uint32_t)DCACHE [i][j].REQ_ADDR.read(), SIZE_DDATA/8);
+
+// 	      bool                 uncached       = DCACHE [i][j].REQ_UNC.read();
+// 	      bool                 bus_error      = false;
+	      
+// 	      uint32_t             addr           = (uint32_t) DCACHE [i][j].REQ_ADDR.read();
+// 	      sc_uint<SIZE_DDATA>  wdata          = DCACHE[i][j].REQ_WDATA .read();
+// 	      sc_uint<3>           type           = DCACHE[i][j].REQ_TYPE  .read();
+// 	      uint32_t             nb_bytes       = access_nb_bytes(DCACHE[i][j].REQ_ACCESS.read());
+// 	      // A lot of flag
+// 	      bool                 must_read      = ((type == DTYPE_READ      ));
+// 	      bool                 must_write     = ((type == DTYPE_WRITE     ) ||
+// 						     (type == DTYPE_WRITE_ACK ) );
+// 	      bool                 must_ack       = ((type == DTYPE_READ      ) ||
+// 						     (type == DTYPE_WRITE_ACK ) );
+
+// 	      // Test the type of the address
+// 	      if (entity.present == true)
+// 		{
+// 		switch (entity.segment->getType())
+// 		  {
+// 		    // ACCESS AT A RAM
+// 		  case data::TYPE_TARGET_MEMORY  : 
+// 		    {
+// 		      if (must_read == true)
+// 			{
+// 			  // Read
+// 			  bus_error |= !component_data->read(addr         ,
+// 							    SIZE_DDATA/8 , // always read a complete word
+// 							    read_dram    );
+			  
+// 			  for (unsigned int it_size_data = nb_bytes; it_size_data < SIZE_DDATA/8; it_size_data+=nb_bytes)
+// 			    memcpy(&(read_dram[it_size_data]),&(read_dram[0]),nb_bytes);
+
+// 			  // Permutation if problem of endianness
+// 			  if (isSameEndianness((uint32_t)DCACHE[i][j].REQ_TRDID.read()) == false) 
+// 			    read_dram  = swapBytes(read_dram , SIZE_DDATA/8, nb_bytes);
+// 			}
+		      
+// 		      if (must_write == true)
+// 			{
+// 			  // Write
+// 			  for (unsigned int it_nb_bytes = 0; it_nb_bytes < SIZE_DDATA / 8; it_nb_bytes ++)
+// 			    write_dram [it_nb_bytes] = wdata.range(8*(it_nb_bytes+1)-1,8*it_nb_bytes);
+// 			}
+// 		      break;
+// 		    }
+// 		    //ACCESS AT THE TTY
+// 		  case TYPE_TTY     :
+// 		    {
+// 		      if (must_write == false)
+// 			{
+// 			  bus_error = true;
+// 			  break;
+// 			}
+// 		      uint32_t num_tty           = (addr - entity.segment->getBase())>>4;
+// 		      uint32_t num_print         = ((addr>>2) & 0x3);
+		      
+// 		      switch (num_print)
+// 			{
+// 			case 0 : // Write TTY
+// 			  {
+// 			    uint32_t num_component_tty = entity.segment->getIndex();
+// 			    char     char_write        = (char)wdata.range( 7, 0);
+// 			    bus_error |= !component_tty [num_component_tty]->write(num_tty,char_write);
+// 			    break;
+// 			  }
+// 			case 1 : // STOP
+// 			  {
+// 			    printf("\n\t***** [ stop    ] Time : %.10d - Address : %.8x - Wdata[31:0] : %.2x%.2x%.2x%.2x         *****\n"
+// 				   ,(unsigned int)sc_simulation_time()
+// 				   ,(unsigned int)addr
+// 				   ,(unsigned int)wdata.range(31,24)
+// 				   ,(unsigned int)wdata.range(23,16)
+// 				   ,(unsigned int)wdata.range(15, 8)
+// 				   ,(unsigned int)wdata.range( 7, 0)
+// 				   );
+
+// 			    uint32_t trdid = (uint32_t) DCACHE[i][j].REQ_TRDID.read();
+			    
+// 			    if (context_stop [trdid] == false)
+// 			      {
+// 				context_stop [trdid] = true;
+// 				nb_context_stop ++;
+
+// 				if (nb_context_stop >= nb_context)
+// 				  sc_stop();
+// 			      }
+
+// 			    break;
+// 			  }
+// 			case 2 : // PRINT
+// 			  {
+// 			    printf("\n\t----- [ print   ] Time : %.10d - Address : %.8x - Wdata[31:0] : %.2x%.2x%.2x%.2x         -----\n"
+// 				   ,(unsigned int)sc_simulation_time()
+// 				   ,(unsigned int)addr
+// 				   ,(unsigned int)wdata.range(31,24)
+// 				   ,(unsigned int)wdata.range(23,16)
+// 				   ,(unsigned int)wdata.range(15, 8)
+// 				   ,(unsigned int)wdata.range( 7, 0)
+// 				   );
+			    
+// 			    break;
+// 			  }
+// 			default :
+// 			  {
+// 			    printf("<%s> : [address : %.8x] tty %d, reg %d don't exist\n",NAME,(unsigned int)addr,num_tty,num_print);
+// 			    exit(1);
+// 			  }
+// 			}
+		      
+// 		      break;
+// 		    }
+// 		  case TYPE_RAMLOCK :
+// 		    {
+// 		      // Access is on a byte, else error
+// 		      if (nb_bytes != 1)
+// 			{
+// 			  bus_error = true;
+// 			  break;
+// 			}
+// 		      uint32_t num_ramlock           = (addr - entity.segment->getBase()); // Char access
+// 		      uint32_t num_component_ramlock = entity.segment->getIndex();
+// 		      bus_error |= !component_ramlock [num_component_ramlock]->test(num_ramlock);
+		      
+// 		      if (bus_error == true)
+// 			break;
+		      
+// 		      memset (read_dram,0,SIZE_DDATA/8);
+			
+// 		      if (must_read == true)
+// 			read_dram [0] = (char)component_ramlock [num_component_ramlock]->read (num_ramlock);
+// 		      if (must_write == true)
+// 			read_dram [0] = (char)component_ramlock [num_component_ramlock]->write(num_ramlock);
+
+// 		      /*
+// 		      printf("Access ramlock   ( %d )\n" ,(uint32_t)sc_simulation_time());
+// 		      printf(" * addr          : %.8x\n" ,(uint32_t)addr);
+// 		      printf(" * trdid         : %d\n"   ,(uint32_t)DCACHE[i][j].REQ_TRDID.read());
+// 		      printf(" * r/w           : %d/%d\n",must_read,must_write);
+// 		      printf(" * val           : %d\n"   ,(uint32_t)read_dram[0]);
+// 		      */
+// 		      break;
+// 		    }
+// 		  case TYPE_SIM2OS  :
+// 		    {
+// 		      // Mapping :
+// 		      // [0]  number of service - Wonly - A write in this register lunch the execution of service
+// 		      // [1]  result            - Ronly - Content the result of the service
+// 		      // [2]  error             - Ronly - Content the code of errno
+// 		      // [3+] argument          - Wonly - it's all argument to execute the service
+
+// 		      uint32_t num_reg = (addr - entity.segment->getBase())>>2;
+		      
+// 		      switch (num_reg)
+// 			{
+// 			case 0  : // ---> number of service
+// 			  {
+// 			    if (must_write == false)
+// 			      {
+// 				cerr << "<" << NAME << "> {ERROR} : SIM2OS[0] is not accessible in Read" << endl;
+// 				bus_error = true;
+// 			      }
+// 			    else
+// 			      {
+// 				printf("<sim2os> service     : %.8x\n",(uint32_t)wdata);
+// 				component_sim2os->execute(int2service((uint32_t)wdata));
+// 			      }
+// 			  break;
+// 			  }
+// 			case 1  : // ---> result
+// 			  { 
+// 			    if (must_read == false)
+// 			      {
+// 				cerr << "<" << NAME << "> {ERROR} : SIM2OS[1] is not accessible in Write" << endl;
+// 				bus_error = true;
+// 			      }
+// 			    else
+// 			      {
+// 				// Decomposition en groupe octect
+// 				uint32_t result = (uint32_t) component_sim2os->result;
+// 				printf("<sim2os> result      : %.8x (%d)\n",result,result);
+				
+// 				read_dram = itoa(result,read_dram,SIZE_DDATA/8);
+// 			      }
+// 			    break;
+// 			  }
+// 			case 2  : // ---> error
+// 			  {
+// 			    if (must_read == false)
+// 			      {
+// 				cerr << "<" << NAME << "> {ERROR} : SIM2OS[2] is not accessible in Write" << endl;
+// 				bus_error = true;
+// 			      }
+// 			    else
+// 			      {
+// 				// Decomposition en groupe octect
+// 				uint32_t error = (uint32_t) component_sim2os->error;
+// 				printf("<sim2os> error       : %.8x\n",error);
+// 				read_dram = itoa(error ,read_dram,SIZE_DDATA/8);
+// 			      }
+// 			    break;
+// 			  }
+// 			default : // ---> argument
+// 			  { 
+// 			    if (must_write == false)
+// 			      {
+// 				cerr << "<" << NAME << "> {ERROR} : SIM2OS[" << num_reg << "] is not accessible in Write" << endl;
+// 				bus_error = true;
+// 			      }
+// 			    else
+// 			      {
+// 				uint32_t data = (uint32_t)wdata;
+// 				printf("<sim2os> argument[%d] : %.8x\n",num_reg-1,data);
+// 				component_sim2os->parameter(num_reg-2,(void *)data);
+// 			      }
+// 			    break;
+// 			  }
+// 			}//end switch num_reg
+		      
+// 		      break;
+// 		    }
+// 		  default           :
+// 		    {
+// 		      // Have a bus error
+// 		      bus_error = true;
+// 		      break;
+// 		    }
+// 		  }// switch
+// 		uncached |= entity.segment->getUncached();
+// 		}
+// 	      else
+// 		uncached = true; // If segment don't exist : it's the system bus that determine if the segment exist
+
+
+// 	      if ((must_write == true) && (bus_error == false))
+// 		{
+// 		  // Permutation if problem of endianness
+// 		  if (isSameEndianness((uint32_t)DCACHE[i][j].REQ_TRDID.read()) == false) 
+// 		    write_dram = swapBytes(write_dram, SIZE_DDATA/8, nb_bytes);
+		  
+// 		  bus_error |= !component_data->write(addr                   ,
+// 						     nb_bytes, // take the good access
+// 						     write_dram             );
+// 		}
+	      
+
+// 	      // Acces at the cache !!!
+// 	      Cache_Access cache_type = dreq_type2cache_type (type, uncached);
+	      
+// 	      uint32_t latence = component_cache->latence(DATA_CACHE                                               ,
+// 							  i                                               ,
+// 							  j                                                 ,
+// 							  (uint32_t)DCACHE [i][j].REQ_ADDR .read() ,
+// 							  (uint32_t)DCACHE [i][j].REQ_TRDID.read() ,
+// 							  cache_type.type                                          ,
+// 							  cache_type.direction                                     );
+	      
+// 	      // If is a respons -> compute the latence and push in the write_buffer
+// 	      if ( must_ack == true)
+// 		{
+// 		  if (bus_error == true)
+// 		    cout << "Dcache : have a bus error" << endl;
+// 		  component_buffer_drsp [i]->push(latence,
+// 							   Entry((uint32_t)DCACHE [i][j].REQ_TRDID.read() ,
+// 								 (uint32_t)DCACHE [i][j].REQ_PKTID.read() ,
+// 								 1                                                        ,
+// 								 SIZE_DDATA/8                                             ,
+// 								 &read_dram                                               ,
+// 								 (bus_error==true)?ERR_BUS:ERR_NO                         )
+// 							   );			
+// 		}
+// 	    }// dnb_port
+// 	}//i
+      
+
+};
