Index: trunk/IPs/systemC/Environment/Cache/Makefile
===================================================================
--- trunk/IPs/systemC/Environment/Cache/Makefile	(revision 85)
+++ trunk/IPs/systemC/Environment/Cache/Makefile	(revision 88)
@@ -4,4 +4,6 @@
 
 #-----[ Variable ]-----------------------------------------
+
+ENTITY                         ?= Cache
 
 OBJECTS_DEPS			= $(patsubst $(DIR_QUEUE)/$(DIR_SRC)/%.cpp,$(DIR_QUEUE)/$(DIR_OBJ)/%.o,$(wildcard $(DIR_QUEUE)/$(DIR_SRC)/*.cpp))
@@ -19,4 +21,6 @@
 				$(MAKE)                          environment_clean;
 
+clean_all			: clean
+
 help				:
 				@$(MAKE) environment_help
Index: trunk/IPs/systemC/Environment/Common/include/Debug.h
===================================================================
--- trunk/IPs/systemC/Environment/Common/include/Debug.h	(revision 85)
+++ trunk/IPs/systemC/Environment/Common/include/Debug.h	(revision 88)
@@ -3,13 +3,13 @@
 
 #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
+#define DEBUG_CACHE       true
+#define DEBUG_DATA        true
+#define DEBUG_ENDIANNESS  true
+#define DEBUG_QUEUE       true
+#define DEBUG_RAMLOCK     true
+#define DEBUG_SIM2OS      true
+#define DEBUG_TTY         true
 
-#ifdef DEBUG
+// #ifdef DEBUG
 # define _cout(component, str...)					\
   do									\
@@ -19,11 +19,13 @@
 	  fprintf(stdout,str);						\
 	}								\
-    } while(0)
-#else
-# define _cout(component, str...)					\
-  do									\
-    {									\
-    } while(0)
-#endif
+    } 								        \
+  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 85)
+++ trunk/IPs/systemC/Environment/Data/Makefile	(revision 88)
@@ -4,4 +4,6 @@
 
 #-----[ Variable ]-----------------------------------------
+
+ENTITY                         ?= Data
 
 # OBJECTS_DEPS			= $(patsubst $(DIR_ENDIANNESS)/$(DIR_SRC)/%.cpp,$(DIR_ENDIANNESS)/$(DIR_OBJ)/%.o,$(wildcard $(DIR_ENDIANNESS)/$(DIR_SRC)/*.cpp))
@@ -21,4 +23,6 @@
 # 				$(MAKE) --directory=$(DIR_ENDIANNESS) clean; \
 
+clean_all			: clean
+
 help				:
 				@$(MAKE) environment_help
Index: trunk/IPs/systemC/Environment/Data/include/Segment.h
===================================================================
--- trunk/IPs/systemC/Environment/Data/include/Segment.h	(revision 85)
+++ trunk/IPs/systemC/Environment/Data/include/Segment.h	(revision 88)
@@ -39,4 +39,5 @@
   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 : std::string          print         (uint32_t depth);
   public : friend std::ostream& operator<<    (std::ostream& output, Segment & x);
   };
Index: trunk/IPs/systemC/Environment/Data/src/Segment_init.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Data/src/Segment_init.cpp	(revision 85)
+++ trunk/IPs/systemC/Environment/Data/src/Segment_init.cpp	(revision 88)
@@ -1,3 +1,4 @@
 #include "../include/Segment.h"
+#include "../../Common/include/Debug.h"
 
 namespace environment {
@@ -22,6 +23,31 @@
     
     memcpy(data, ptab, size);
-    
+
     free  (ptab);
+      
+
+//     {
+//       _cout(DATA,"Segment Init\n");
+//       _cout(DATA," * size : %d\n",size);
+//       _cout(DATA," * size : %d\n",this->size);
+//       _cout(DATA,"%s\n",print(0).c_str());
+      
+//       uint32_t addr = base;
+//       uint32_t step1 = 4;
+//       uint32_t step2 = step1*8;
+
+//       for (int32_t i=0; i<size; ++i)
+//         {
+//           if ((i%step1) == 0)
+//             _cout(DATA," ");
+//           if ((i%step2) ==0)
+//             {
+//               _cout(DATA,"\n%.8x : ",addr);
+//               addr += step2;
+//             }
+//           _cout(DATA,"%.2x",0xff&static_cast<uint32_t>(data[i]));
+//         }
+//       _cout(DATA,"\n");
+//     }
     
     return true;
Index: trunk/IPs/systemC/Environment/Data/src/Segment_print.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Data/src/Segment_print.cpp	(revision 85)
+++ trunk/IPs/systemC/Environment/Data/src/Segment_print.cpp	(revision 88)
@@ -1,16 +1,28 @@
 #include "../include/Segment.h"
+#include <sstream>
 
 namespace environment {
 namespace data {
+
+  std::string Segment::print(uint32_t depth)
+  {
+    std::ostringstream out("");
+    std::string tab = std::string(depth,'\t');
+
+
+    out << tab << "Segment \"" << name << "\""     << std::endl
+        << std::hex
+        << tab << "  * base     : " << std::setw(8) << std::setfill('0') << base << std::endl
+        << tab << "  * size     : " << std::setw(8) << std::setfill('0') << size << std::endl
+        << std::dec
+        << tab << "  * uncached : " << uncached    << std::endl
+        << tab << "  * type     : " << type;
+
+    return out.str();
+  }
   
   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;
+    output << x.print(0);
 	
     return output;
Index: trunk/IPs/systemC/Environment/Endianness/Makefile
===================================================================
--- trunk/IPs/systemC/Environment/Endianness/Makefile	(revision 85)
+++ trunk/IPs/systemC/Environment/Endianness/Makefile	(revision 88)
@@ -2,4 +2,6 @@
 
 #-----[ Variable ]-----------------------------------------
+
+ENTITY                         ?= Endianness
 
 #OBJECTS_DEPS			=
@@ -15,4 +17,6 @@
 				$(MAKE) environment_clean;
 
+clean_all			: clean
+
 help				:
 				@$(MAKE) environment_help
Index: trunk/IPs/systemC/Environment/Makefile
===================================================================
--- trunk/IPs/systemC/Environment/Makefile	(revision 85)
+++ trunk/IPs/systemC/Environment/Makefile	(revision 88)
@@ -1,13 +1,18 @@
 #-----[ Directory ]----------------------------------------
 
-DIR_CACHE			= Cache
-DIR_DATA			= Data
-DIR_ENDIANNESS			= Endianness
-DIR_QUEUE			= Queue
-DIR_RAMLOCK			= RamLock
-DIR_SIM2OS			= Sim2OS
-DIR_TTY   			= TTY
+DIR_LIB				= ./lib
+DIR_CACHE			= ./Cache
+DIR_DATA			= ./Data
+DIR_ENDIANNESS			= ./Endianness
+DIR_QUEUE			= ./Queue
+DIR_RAMLOCK			= ./RamLock
+DIR_SIM2OS			= ./Sim2OS
+DIR_TTY   			= ./TTY
 
 #-----[ Variable ]-----------------------------------------
+ENTITY                         ?=	Environment
+
+LIBRARY_NAME			= Environment
+LIBRARY_FILE			= $(DIR_LIB)/lib$(LIBRARY_NAME).a
 
 OBJECTS_DEPS			= 	$(patsubst $(DIR_CACHE)/$(DIR_SRC)/%.cpp,$(DIR_CACHE)/$(DIR_OBJ)/%.o,$(wildcard $(DIR_CACHE)/$(DIR_SRC)/*.cpp))			\
@@ -18,19 +23,64 @@
 					$(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))
+					$(patsubst $(DIR_TTY)/$(DIR_SRC)/%.cpp,$(DIR_TTY)/$(DIR_OBJ)/%.o,$(wildcard $(DIR_TTY)/$(DIR_SRC)/*.cpp))			
 
 
 #-----[ Rules ]--------------------------------------------
 
-all				:
+all				: a b c d e f g
 				@\
-				$(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;
+				$(MAKE) all_environment; \
+				$(MAKE) $(LIBRARY_FILE);
+
+a				:
+				@\
+				$(MAKE) --directory=$(DIR_CACHE)      all;
+
+b				:
+				@\
+				$(MAKE) --directory=$(DIR_DATA)       all;
+
+c				:
+				@\
+				$(MAKE) --directory=$(DIR_ENDIANNESS) all;
+
+d				:
+				@\
+				$(MAKE) --directory=$(DIR_QUEUE)      all;
+
+e				:
+				@\
+				$(MAKE) --directory=$(DIR_RAMLOCK)    all;
+
+f				:
+				@\
+				$(MAKE) --directory=$(DIR_SIM2OS)     all;
+
+g				:
+				@\
+				$(MAKE) --directory=$(DIR_TTY)        all;
+
+
+$(LIBRARY_FILE)			: $(OBJECTS_DEPS) $(OBJECTS) $(DIR_LIB)
+				@\
+				$(ECHO) "Archive            : $@";\
+				$(AR)  -r $@ $(OBJECTS_DEPS) $(OBJECTS);\
+				$(RANLIB) $@;
+
+$(DIR_LIB)			:
+				@\
+				$(ECHO) "Create directory   : $@";\
+				$(MKDIR) $@;
+
+exe_all				:
+				@\
+				$(MAKE) --directory=$(DIR_CACHE)      exe; \
+				$(MAKE) --directory=$(DIR_DATA)       exe; \
+				$(MAKE) --directory=$(DIR_ENDIANNESS) exe; \
+				$(MAKE) --directory=$(DIR_QUEUE)      exe; \
+				$(MAKE) --directory=$(DIR_RAMLOCK)    exe; \
+				$(MAKE) --directory=$(DIR_SIM2OS)     exe; \
+				$(MAKE) --directory=$(DIR_TTY)        exe; \
+				$(MAKE) exe; \
 
 clean				:
@@ -46,4 +96,7 @@
 				$(RM) tty_*;
 
+clean_all			: clean
+				@\
+				$(RM) $(DIR_LIB);
 
 help				:
Index: trunk/IPs/systemC/Environment/Makefile.Environment
===================================================================
--- trunk/IPs/systemC/Environment/Makefile.Environment	(revision 85)
+++ trunk/IPs/systemC/Environment/Makefile.Environment	(revision 88)
@@ -1,11 +1,18 @@
-include                         $(MORPHEO_TOPLEVEL)/Makefile.tools
-include                         $(MORPHEO_TOPLEVEL)/IPs/systemC/processor/Morpheo/Behavioural/Makefile.flags 
+ifeq ($(origin MORPHEO_TOPLEVEL), undefined)
+	$(error "variable MORPHEO_TOPLEVEL is undefined");
+else
+	include $(MORPHEO_TOPLEVEL)/Makefile.tools
+	include $(MORPHEO_TOPLEVEL)/Makefile.flags
+endif
 
 #-----[ Directory ]----------------------------------------
-DIR_TST                         = selftest
-DIR_INC				= include
-DIR_SRC				= src
-DIR_OBJ				= obj
-DIR_BIN				= bin
+ENTITY                         ?=	Environment
+
+DIR_TMP				=	$(MORPHEO_TMP)/$(ENTITY)
+DIR_TST                         = 	./selftest
+DIR_INC				= 	./include
+DIR_SRC				= 	./src
+DIR_OBJ				= 	./obj
+DIR_BIN				= 	$(DIR_TMP)/bin
 
 #-----[ Compilation ]--------------------------------------
@@ -16,6 +23,7 @@
 LIBDIR 				= $(SYSTEMC_LIBDIR_$(SIMULATOR))
 
-LIBNAME  			= $(SYSTEMC_LIBNAME_$(SIMULATOR)) 	\
-				  -lbfd
+LIBNAME  			= -lbfd                                 \
+                                  -liberty                              \
+                                  $(SYSTEMC_LIBNAME_$(SIMULATOR)) 
 
 FLAGS				= $(SYSTEMC_CFLAGS_$(SIMULATOR))
@@ -26,6 +34,4 @@
 
 #-----[ Variable ]-----------------------------------------
-
-ENTITY				= `$(BASENAME) $$PWD`
 
 OBJECTS				= $(patsubst $(DIR_SRC)/%.cpp,$(DIR_OBJ)/%.o,$(wildcard $(DIR_SRC)/*.cpp)) \
@@ -42,4 +48,9 @@
 #-----[ Rules ]--------------------------------------------
 
+vpath	%.h	$(DIR_INC)
+vpath	%.c	$(DIR_SRC)
+vpath	%.cpp	$(DIR_SRC):$(DIR_TST)
+vpath	%.o	$(DIR_OBJ)
+
 .PRECIOUS			: $(DIR_OBJ)/%.o $(DIR_BIN)/%.x
 
@@ -48,18 +59,13 @@
 				$(ECHO) "-------------------| $(ENTITY)"
 
-$(DIR_OBJ)/%.o			: $(DIR_SRC)/%.cpp $(HEADERS)
+$(DIR_OBJ)/%.o			: %.cpp $(HEADERS)
 				@\
 				$(ECHO) "Compilation        : $*";\
 				$(CXX) $(MORPHEO_CXX_FLAGS) -c -o $@ $<;
 
-$(DIR_OBJ)/%.o			: $(DIR_SRC)/%.c $(HEADERS)
+$(DIR_OBJ)/%.o			: %.c $(HEADERS)
 				@\
 				$(ECHO) "Compilation        : $*";\
 				$(CC)  $(MORPHEO_CC_FLAGS)  -c -o $@ $<;
-
-$(DIR_OBJ)/%.o			: $(DIR_TST)/%.cpp $(HEADERS)
-				@\
-				$(ECHO) "Compilation        : $*";\
-				$(CXX) $(MORPHEO_CXX_FLAGS) -c -o $@ $<;
 
 $(DIR_BIN)/%.x			: $(OBJECTS_DEPS) $(OBJECTS) $(OBJECTS_BIN)
@@ -79,12 +85,13 @@
 
 
-exe				: all
+exe				: all $(DIR_BIN)
 				@\
-				export SYSTEMC=$(SYSTEMC_$(SIMULATOR)) ; $(EXEC_PREFIX) ./$(EXE) $(SYSTEMC_EXEC_PARAMS_$(SIMULATOR))
+				$(MAKE) $(EXE); \
+				export SYSTEMC=$(SYSTEMC_$(SIMULATOR)) ; $(EXEC_PREFIX) $(EXE) $(SYSTEMC_EXEC_PARAMS_$(SIMULATOR))
 
 
-all_environment			: test_env $(DIR_OBJ) $(DIR_BIN)
+all_environment			: test_env $(DIR_OBJ)
 				@\
-				$(MAKE) $(EXE)
+				$(MAKE) $(OBJECTS_DEPS) $(OBJECTS) $(OBJECTS_BIN)
 
 environment_clean		:
@@ -104,5 +111,6 @@
 				$(ECHO) " -----[ Environment ]------------------------------";\
 				$(ECHO) "";\
-				$(ECHO) " * test_env             : test if environnment's variable is set";\
-				$(ECHO) " * all_environment    : generate object";\
+				$(ECHO) " * exe             : execute testbench";\
+				$(ECHO) " * test_env        : test if environnment's variable is set";\
+				$(ECHO) " * all_environment : generate object";\
 				$(ECHO) "";
Index: trunk/IPs/systemC/Environment/Makefile.deps
===================================================================
--- trunk/IPs/systemC/Environment/Makefile.deps	(revision 88)
+++ trunk/IPs/systemC/Environment/Makefile.deps	(revision 88)
@@ -0,0 +1,19 @@
+# 
+# $Id$
+# 
+
+#-----[ Test ]---------------------------------------------
+
+# Test Environment variables
+ifeq ($(origin MORPHEO_TOPLEVEL), undefined)
+        $(error "variable MORPHEO_TOPLEVEL is undefined");
+else
+        include $(MORPHEO_TOPLEVEL)/Makefile.tools
+endif
+
+#-----[ Variables ]----------------------------------------
+
+ENVIRONMENT_DIR			=	$(MORPHEO_TOPLEVEL)/IPs/systemC/Environment
+ENVIRONMENT_INCDIR		=	-I$(ENVIRONMENT_DIR)/include
+ENVIRONMENT_LIBDIR		=	-L$(ENVIRONMENT_DIR)/lib
+ENVIRONMENT_LIBNAME		=	-lEnvironment -lbfd -liberty 
Index: trunk/IPs/systemC/Environment/Queue/Makefile
===================================================================
--- trunk/IPs/systemC/Environment/Queue/Makefile	(revision 85)
+++ trunk/IPs/systemC/Environment/Queue/Makefile	(revision 88)
@@ -1,2 +1,6 @@
+#-----[ Variables ]----------------------------------------
+
+ENTITY                         ?= Queue
+
 #-----[ Rules ]--------------------------------------------
 
@@ -7,4 +11,6 @@
 				@$(MAKE) environment_clean
 
+clean_all			: clean
+
 help				:
 				@$(MAKE) environment_help
Index: trunk/IPs/systemC/Environment/RamLock/Makefile
===================================================================
--- trunk/IPs/systemC/Environment/RamLock/Makefile	(revision 85)
+++ trunk/IPs/systemC/Environment/RamLock/Makefile	(revision 88)
@@ -1,2 +1,6 @@
+#-----[ Variables ]----------------------------------------
+
+ENTITY                         ?= RamLock
+
 #-----[ Rules ]--------------------------------------------
 
@@ -7,4 +11,6 @@
 				@$(MAKE) environment_clean
 
+clean_all			: clean
+
 help				:
 				@$(MAKE) environment_help
Index: trunk/IPs/systemC/Environment/Sim2OS/Makefile
===================================================================
--- trunk/IPs/systemC/Environment/Sim2OS/Makefile	(revision 85)
+++ trunk/IPs/systemC/Environment/Sim2OS/Makefile	(revision 88)
@@ -4,4 +4,6 @@
 
 #-----[ Variable ]-----------------------------------------
+
+ENTITY                         ?= Sim2OS
 
 OBJECTS_DEPS			= $(patsubst $(DIR_ENDIANNESS)/$(DIR_SRC)/%.cpp,$(DIR_ENDIANNESS)/$(DIR_OBJ)/%.o,$(wildcard $(DIR_ENDIANNESS)/$(DIR_SRC)/*.cpp))
@@ -19,4 +21,6 @@
 				$(MAKE) environment_clean
 
+clean_all			: clean
+
 help				:
 				@$(MAKE) environment_help
Index: trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_convert_address.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_convert_address.cpp	(revision 85)
+++ trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_convert_address.cpp	(revision 88)
@@ -9,9 +9,9 @@
   void * Sim2OS::convert_address (void * address)
   {
-    void * result = param->segment_table->getAddrAlloc((uint32_t)address);
+    void * result = param->segment_table->getAddrAlloc(static_cast<uint32_t>(reinterpret_cast<uint64_t>(address)));
     
     if (result == NULL)
       {
-	std::cerr << "<" << name << "> address don't match : " << std::hex << (uint32_t)(address) << std::dec << std::endl;
+	std::cerr << "<" << name << "> address don't match : " << std::hex << static_cast<uint32_t>(reinterpret_cast<uint64_t>(address)) << std::dec << std::endl;
 	exit(0);
       }
Index: trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_parameter.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_parameter.cpp	(revision 85)
+++ trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_parameter.cpp	(revision 88)
@@ -13,5 +13,5 @@
     {
       if (num_reg == 0)
-	num_service = int2service((int)(val));
+	num_service = int2service(static_cast<int32_t>(reinterpret_cast<int64_t>(val)));
       else
 	arguments[num_reg] = val;
Index: trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_service_clock.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_service_clock.cpp	(revision 85)
+++ trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_service_clock.cpp	(revision 88)
@@ -16,6 +16,6 @@
     
     std::cout << "\n\t***** service : clock         *****" << std::endl;
-    std::cout << "\tresult    : " << (unsigned int) result << std::endl;
-    std::cout << "\terrno     : " << (unsigned int) error  << std::endl;
+    std::cout << "\tresult    : " << static_cast<int32_t>(reinterpret_cast<int64_t>(result)) << std::endl;
+    std::cout << "\terrno     : " << 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 85)
+++ trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_service_close.cpp	(revision 88)
@@ -12,5 +12,5 @@
       }
     
-    int    fd     = (int)    arguments[1];
+    int    fd     = static_cast<int>(reinterpret_cast<int64_t>(arguments[1]));
     void * result = (void *) close(fd);
     error         = errno;
@@ -18,5 +18,5 @@
     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 << "\tresult    : " << static_cast<int32_t>(reinterpret_cast<int64_t>(result)) << std::endl;
     std::cout << "\terrno     : " << (unsigned int) error  << std::endl;
     
Index: trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_service_lseek.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_service_lseek.cpp	(revision 85)
+++ trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_service_lseek.cpp	(revision 88)
@@ -12,7 +12,7 @@
       }
     
-    int    flides   = (int)    arguments[1];
-    off_t  offset   = (off_t)  arguments[2];
-    int    whence   = (int)    arguments[3];
+    int    flides   = static_cast<int  >(reinterpret_cast<int64_t>(arguments[1]));
+    off_t  offset   = static_cast<off_t>(reinterpret_cast<int64_t>(arguments[2]));
+    int    whence   = static_cast<int  >(reinterpret_cast<int64_t>(arguments[3]));
     void * result   = (void *) lseek(flides,offset,whence);
     error           = errno;
@@ -24,5 +24,5 @@
     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 << "\tresult    : " << static_cast<int32_t>(reinterpret_cast<int64_t>(result)) << std::endl;
     std::cout << "\terrno     : " << (unsigned int) error  << std::endl;
     
Index: trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_service_open.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_service_open.cpp	(revision 85)
+++ trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_service_open.cpp	(revision 88)
@@ -13,6 +13,6 @@
     
     const char *pathname = (const char *) convert_address(arguments[1]);
-    int         flags    = (int)          arguments[2];
-    mode_t      mode     = (mode_t)       arguments[3];
+    int         flags    = static_cast<int   >(reinterpret_cast<int64_t>(arguments[2]));
+    mode_t      mode     = static_cast<mode_t>(reinterpret_cast<int64_t>(arguments[3]));
     void *      result   = (void *)       open(pathname,flags,mode);
     error                = errno;
@@ -26,5 +26,5 @@
     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 << "\tresult    : " << static_cast<int32_t>(reinterpret_cast<int64_t>(result)) << std::endl;
     std::cout << "\terrno     : " <<             (unsigned int) error    << std::endl;
     
Index: trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_service_read.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_service_read.cpp	(revision 85)
+++ trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_service_read.cpp	(revision 88)
@@ -12,5 +12,5 @@
       }
     
-    int     fd       = (int)     arguments[1];
+    int     fd       = static_cast<int>(reinterpret_cast<int64_t>(arguments[1]));
     void *  buf      = (void *)  convert_address(arguments[2]);
     ssize_t count    = (ssize_t) arguments[3];
@@ -19,8 +19,8 @@
     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::hex << static_cast<int32_t>(reinterpret_cast<int64_t>(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 << "\tresult    : " << static_cast<int32_t>(reinterpret_cast<int64_t>(result)) << std::endl;
     std::cout << "\terrno     : " <<             (unsigned int) error  << std::endl;
     
Index: trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_service_time.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_service_time.cpp	(revision 85)
+++ trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_service_time.cpp	(revision 88)
@@ -17,6 +17,6 @@
     
     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 << "\tt         : " << std::hex << static_cast<int32_t>(reinterpret_cast<int64_t>(t))                                      << std::endl;
+    std::cout << "\tresult    : " << std::dec << static_cast<int32_t>(reinterpret_cast<int64_t>(result)) << " - " << ctime((time_t *) t) << std::endl;
     std::cout << "\terrno     : " <<             (unsigned int) error                                  << std::endl;
     
Index: trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_service_write.cpp
===================================================================
--- trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_service_write.cpp	(revision 85)
+++ trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_service_write.cpp	(revision 88)
@@ -12,5 +12,5 @@
       }
   
-    int         fd       = (int)          arguments[1];
+    int         fd       = static_cast<int>(reinterpret_cast<int64_t>(arguments[1]));
     const void *buf      = (const void *) convert_address(arguments[2]);
     ssize_t     count    = (ssize_t)      arguments[3];
@@ -22,8 +22,8 @@
     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::hex << static_cast<int32_t>(reinterpret_cast<int64_t>(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 << "\tresult    : " << static_cast<int32_t>(reinterpret_cast<int64_t>(result)) << std::endl;
     std::cout << "\terrno     : " <<             (unsigned int) error  << std::endl;
     
Index: trunk/IPs/systemC/Environment/TTY/Makefile
===================================================================
--- trunk/IPs/systemC/Environment/TTY/Makefile	(revision 85)
+++ trunk/IPs/systemC/Environment/TTY/Makefile	(revision 88)
@@ -2,4 +2,6 @@
 
 #-----[ Variable ]-----------------------------------------
+
+ENTITY                         ?= TTY
 
 #OBJECTS_DEPS			=
@@ -16,4 +18,6 @@
 				$(RM) tty_*;
 
+clean_all			: clean
+
 help				:
 				@$(MAKE) environment_help
Index: trunk/IPs/systemC/Environment/include/Cache_Access.h
===================================================================
--- trunk/IPs/systemC/Environment/include/Cache_Access.h	(revision 85)
+++ trunk/IPs/systemC/Environment/include/Cache_Access.h	(revision 88)
@@ -22,6 +22,6 @@
   };
 
-  Cache_Access ireq_type2cache_type (Ticache_type_t ireq_type, bool uncached);
-  Cache_Access dreq_type2cache_type (Tdcache_type_t dreq_type, bool uncached);
+  Cache_Access ireq_type2cache_type (morpheo::Ticache_type_t ireq_type, bool uncached);
+  Cache_Access dreq_type2cache_type (morpheo::Tdcache_type_t dreq_type, bool uncached);
 };
 #endif
Index: trunk/IPs/systemC/Environment/include/Environment.h
===================================================================
--- trunk/IPs/systemC/Environment/include/Environment.h	(revision 85)
+++ trunk/IPs/systemC/Environment/include/Environment.h	(revision 88)
@@ -20,6 +20,6 @@
 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;
+  typedef Respons<morpheo::Ticache_context_t, morpheo::Ticache_packet_t,morpheo::Ticache_error_t> irsp_t;
+  typedef Respons<morpheo::Tdcache_context_t, morpheo::Tdcache_packet_t,morpheo::Tdcache_error_t> drsp_t;
 
   class Environment : public sc_module
@@ -29,38 +29,38 @@
   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_in <morpheo::Tcontrol_t           >  *** ICACHE_REQ_VAL        ;//[nb_entity][icache_dedicated_nb_port]
+  public : sc_out<morpheo::Tcontrol_t           >  *** ICACHE_REQ_ACK        ;//[nb_entity][icache_dedicated_nb_port]
+  public : sc_in <morpheo::Ticache_context_t    >  *** ICACHE_REQ_CONTEXT_ID ;//[nb_entity][icache_dedicated_nb_port]
+  public : sc_in <morpheo::Ticache_packet_t     >  *** ICACHE_REQ_PACKET_ID  ;//[nb_entity][icache_dedicated_nb_port]
+  public : sc_in <morpheo::Ticache_address_t    >  *** ICACHE_REQ_ADDRESS    ;//[nb_entity][icache_dedicated_nb_port]
+  public : sc_in <morpheo::Ticache_type_t       >  *** ICACHE_REQ_TYPE       ;//[nb_entity][icache_dedicated_nb_port]
 
-  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_out<morpheo::Tcontrol_t           >  *** ICACHE_RSP_VAL        ;//[nb_entity][icache_dedicated_nb_port]
+  public : sc_in <morpheo::Tcontrol_t           >  *** ICACHE_RSP_ACK        ;//[nb_entity][icache_dedicated_nb_port]
+  public : sc_out<morpheo::Ticache_context_t    >  *** ICACHE_RSP_CONTEXT_ID ;//[nb_entity][icache_dedicated_nb_port]
+  public : sc_out<morpheo::Ticache_packet_t     >  *** ICACHE_RSP_PACKET_ID  ;//[nb_entity][icache_dedicated_nb_port]
+  public : sc_out<morpheo::Ticache_instruction_t> **** ICACHE_RSP_INSTRUCTION;//[nb_entity][icache_dedicated_nb_port][iaccess_nb_instruction]
+  public : sc_out<morpheo::Ticache_error_t      >  *** ICACHE_RSP_ERROR      ;//[nb_entity][icache_dedicated_nb_port]
 
-  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_in <morpheo::Tcontrol_t           >  *** DCACHE_REQ_VAL        ;//[nb_entity][dcache_dedicated_nb_port]
+  public : sc_out<morpheo::Tcontrol_t           >  *** DCACHE_REQ_ACK        ;//[nb_entity][dcache_dedicated_nb_port]
+  public : sc_in <morpheo::Tdcache_context_t    >  *** DCACHE_REQ_CONTEXT_ID ;//[nb_entity][dcache_dedicated_nb_port]
+  public : sc_in <morpheo::Tdcache_packet_t     >  *** DCACHE_REQ_PACKET_ID  ;//[nb_entity][dcache_dedicated_nb_port]
+  public : sc_in <morpheo::Tdcache_address_t    >  *** DCACHE_REQ_ADDRESS    ;//[nb_entity][dcache_dedicated_nb_port]
+  public : sc_in <morpheo::Tdcache_type_t       >  *** DCACHE_REQ_TYPE       ;//[nb_entity][dcache_dedicated_nb_port]
+  public : sc_in <morpheo::Tdcache_data_t       >  *** DCACHE_REQ_WDATA      ;//[nb_entity][dcache_dedicated_nb_port]
 
-  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      ;
+  public : sc_out<morpheo::Tcontrol_t           >  *** DCACHE_RSP_VAL        ;//[nb_entity][dcache_dedicated_nb_port]
+  public : sc_in <morpheo::Tcontrol_t           >  *** DCACHE_RSP_ACK        ;//[nb_entity][dcache_dedicated_nb_port]
+  public : sc_out<morpheo::Tdcache_context_t    >  *** DCACHE_RSP_CONTEXT_ID ;//[nb_entity][dcache_dedicated_nb_port]
+  public : sc_out<morpheo::Tdcache_packet_t     >  *** DCACHE_RSP_PACKET_ID  ;//[nb_entity][dcache_dedicated_nb_port]
+  public : sc_out<morpheo::Tdcache_data_t       >  *** DCACHE_RSP_RDATA      ;//[nb_entity][dcache_dedicated_nb_port]
+  public : sc_out<morpheo::Tdcache_error_t      >  *** DCACHE_RSP_ERROR      ;//[nb_entity][dcache_dedicated_nb_port]
 
     // ===== [ 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        ;
+  public : morpheo::Tcontrol_t                      ** icache_req_ack        ;
+  public : morpheo::Tcontrol_t                      ** icache_rsp_val        ;
+  public : morpheo::Tcontrol_t                      ** dcache_req_ack        ;
+  public : morpheo::Tcontrol_t                      ** dcache_rsp_val        ;
 
     // ===== [ Variables ]===================================================
@@ -68,7 +68,11 @@
   private  : Parameters         * param;
 
-  private: char **                read_iram;
-  private: char **                read_dram;
-  private: char *                 write_dram;
+  private  : char              ** read_iram;
+  private  : char              ** read_dram;
+  private  : char               * write_dram;
+
+  private  : bool               * context_stop;    // to determine which context have send the signal stop (a same thread can send many signal)
+  private  : uint32_t             nb_context_stop; // stop the simulation when all context have send the stop signal 
+
 
     // ===== [ Components ]==================================================
@@ -88,9 +92,11 @@
   public   : ~Environment (void);
 
-  public   : bool   init       (std::string section, const char * filename, const char ** list_section);
-  public   : void   reset      (void);
+  public   : bool   init           (std::string section, const char * filename, const char ** list_section);
+  public   : void   reset          (void);
+  public   : void   stop           (uint32_t num_context);
+  public   : bool   simulation_end (void);
 
-  public   : void   transition (void);
-  public   : void   genMoore   (void);
+  public   : void   transition     (void);
+  public   : void   genMoore       (void);
 
   public   : friend std::ostream& operator<< (std::ostream& output, Environment &x);
@@ -137,17 +143,4 @@
     }
   };
-
-
-//   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);
-//     }
-
 };
 
Index: trunk/IPs/systemC/Environment/include/Environment_Parameters.h
===================================================================
--- trunk/IPs/systemC/Environment/include/Environment_Parameters.h	(revision 85)
+++ trunk/IPs/systemC/Environment/include/Environment_Parameters.h	(revision 88)
@@ -8,4 +8,5 @@
 #include "../RamLock/include/RamLock_Parameters.h"
 #include "../Sim2OS/include/Sim2OS_Parameters.h"
+#include "../../processor/Morpheo/Common/include/ToString.h"
 
 namespace environment {
@@ -13,41 +14,41 @@
   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     ;
+  public : uint32_t                nb_iport                ;
+  public : uint32_t                nb_dport                ;
+  public : uint32_t                nb_entity               ;
+  public : uint32_t              * icache_dedicated_nb_port; //[nb_entity]
+  public : uint32_t              * dcache_dedicated_nb_port; //[nb_entity]
+                               
+  public : uint32_t              * iaccess_nb_context      ; //[nb_entity]
+  public : uint32_t              * iaccess_nb_packet       ; //[nb_entity]
+  public : uint32_t              * iaccess_size_address    ; //[nb_entity]
+  public : uint32_t              * iaccess_nb_instruction  ; //[nb_entity]
+  public : uint32_t              * iaccess_size_instruction; //[nb_entity]
+                               
+  public : uint32_t              * daccess_nb_context      ; //[nb_entity]
+  public : uint32_t              * daccess_nb_packet       ; //[nb_entity]
+  public : uint32_t              * daccess_size_address    ; //[nb_entity]
+  public : uint32_t              * daccess_size_data       ; //[nb_entity]
 
     // Parameters cache
-  public : cache::Parameters                     * param_cache;
+  public : cache::Parameters     * param_cache             ;
     // Parameters tty
-  public : uint32_t                                nb_component_tty;
-  public : uint32_t                              * tty_address;
-  public : tty::Parameters                      ** param_tty;
+  public : uint32_t                nb_component_tty        ;
+  public : uint32_t              * tty_address             ; //[nb_component_tty]
+  public : tty::Parameters      ** param_tty               ; //[nb_component_tty]
     // Parameters ramlock
-  public : uint32_t                                nb_component_ramlock;
-  public : uint32_t                              * ramlock_address;
-  public : ramlock::Parameters                  ** param_ramlock;
+  public : uint32_t                nb_component_ramlock    ;
+  public : uint32_t              * ramlock_address         ; //[nb_component_ramlock]
+  public : ramlock::Parameters  ** param_ramlock           ; //[nb_component_ramlock]
     // Parameters sim2OS
-  public : uint32_t                                sim2os_address;
-  public : uint32_t                                sim2os_size;
-  public : sim2os::Parameters                    * param_sim2os;
+  public : uint32_t                sim2os_address          ;
+  public : uint32_t                sim2os_size             ;
+  public : sim2os::Parameters    * param_sim2os            ;
     // Parameters data
-  public : data::Parameters                      * param_data;
+  public : data::Parameters      * param_data              ;
 
     // Parameters buffer_respons
-  public : queue::Parameters                    ** param_buffer_irsp;
-  public : queue::Parameters                    ** param_buffer_drsp;
+  public : queue::Parameters    ** param_buffer_irsp       ; //[nb_entity]
+  public : queue::Parameters    ** param_buffer_drsp       ; //[nb_entity]
 
   public : Parameters (// General
@@ -232,4 +233,76 @@
       delete param_cache;
     }
+
+  public : std::string print (uint32_t depth)
+    {
+      std::string tab = std::string(depth,'\t');
+      std::string str = "";
+
+      str+=tab+"nb_entity                    : "+morpheo::toString(nb_entity)+"\n";
+      str+=tab+"nb_iport                     : "+morpheo::toString(nb_iport )+"\n";
+      str+=tab+"nb_dport                     : "+morpheo::toString(nb_dport )+"\n";
+      for (uint32_t i=0; i<nb_entity; ++i)
+        {
+      str+=tab+"ENTITY ["+morpheo::toString(i)+"]\n";
+      str+=tab+"  * icache_dedicated_nb_port : "+morpheo::toString(icache_dedicated_nb_port[i])+"\n";
+      str+=tab+"  * dcache_dedicated_nb_port : "+morpheo::toString(dcache_dedicated_nb_port[i])+"\n";
+      str+=tab+"  * iaccess_nb_context       : "+morpheo::toString(iaccess_nb_context      [i])+"\n";
+      str+=tab+"  * iaccess_nb_packet        : "+morpheo::toString(iaccess_nb_packet       [i])+"\n";
+      str+=tab+"  * iaccess_size_address     : "+morpheo::toString(iaccess_size_address    [i])+"\n";
+      str+=tab+"  * iaccess_nb_instruction   : "+morpheo::toString(iaccess_nb_instruction  [i])+"\n";
+      str+=tab+"  * iaccess_size_instruction : "+morpheo::toString(iaccess_size_instruction[i])+"\n";
+      str+=tab+"  * daccess_nb_context       : "+morpheo::toString(daccess_nb_context      [i])+"\n";
+      str+=tab+"  * daccess_nb_packet        : "+morpheo::toString(daccess_nb_packet       [i])+"\n";
+      str+=tab+"  * daccess_size_address     : "+morpheo::toString(daccess_size_address    [i])+"\n";
+      str+=tab+"  * daccess_size_data        : "+morpheo::toString(daccess_size_data       [i])+"\n";
+        }
+
+      str+=tab+"CACHE\n";
+      str+=param_cache->print(depth+1);
+
+//       str+=tab+"nb_component_tty             : "+morpheo::toString(nb_component_tty           )+"\n";
+//       for (uint32_t i=0; i<nb_component_tty; ++i)
+//         {
+//       str+=tab+"TTY ["+morpheo::toString(i)+"]\n";
+//       str+=tab+"  * tty_address              : "+morpheo::toString(tty_address             [i])+"\n";
+//       str+=param_tty->print(depth+1);
+//         }      
+
+//       str+=tab+"nb_component_ramlock         : "+morpheo::toString(nb_component_ramlock       )+"\n";
+//       for (uint32_t i=0; i<nb_component_ramlock; ++i)
+//         {
+//       str+=tab+"RAMLOCK ["+morpheo::toString(i)+"]\n";
+//       str+=tab+"  * ramlock_address          : "+morpheo::toString(ramlock_address         [i])+"\n";
+//       str+=param_ramlock->print(depth+1);
+//         }      
+
+//       str+=tab+"SIM2OS\n";
+//       str+=tab+"sim2os_address               : "+morpheo::toString(sim2os_address)+"\n";
+//       str+=tab+"sim2os_size                  : "+morpheo::toString(sim2os_size   )+"\n";
+//       str+=param_sim2os->print(depth+1);
+
+//       str+=tab+"DATA\n";
+//       str+=param_data->print(depth+1);
+
+//       for (uint32_t i=0; i<nb_entity; ++i)
+//         {
+//       str+=tab+"BUFFER_IRSP ["+morpheo::toString(i)+"]\n";
+//       str+=param_buffer_irsp[i]_data->print(depth+1);
+//         }
+
+//       for (uint32_t i=0; i<nb_entity; ++i)
+//         {
+//       str+=tab+"BUFFER_DRSP ["+morpheo::toString(i)+"]\n";
+//       str+=param_buffer_drsp[i]_data->print(depth+1);
+//         }
+
+      return str;
+    }
+
+//   public : friend std::ostream& operator<< (std::ostream& output, const Parameters &x)
+//     {
+//       x.print(0);
+//       return output;
+//     }
   };
 
Index: trunk/IPs/systemC/Environment/include/Types.h
===================================================================
--- trunk/IPs/systemC/Environment/include/Types.h	(revision 85)
+++ trunk/IPs/systemC/Environment/include/Types.h	(revision 88)
@@ -2,5 +2,5 @@
 #define ENVIRONMENT_TYPES_H
 
-#include "../../processor/Morpheo/Behavioural/include/Types.h"
+#include "../../processor/Morpheo/TopLevel/include/Types.h"
 #include "../../processor/Morpheo/Behavioural/include/Constants.h"
 #include "../Cache/include/Types.h"
@@ -9,19 +9,20 @@
 {
   
-  typedef morpheo::behavioural::Tcontrol_t            Tcontrol_t           ;
+//   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            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      ;
+//   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 85)
+++ trunk/IPs/systemC/Environment/selftest/main.cpp	(revision 88)
@@ -4,4 +4,5 @@
 using namespace std;
 using namespace environment;
+using namespace morpheo;
 
 #define _TEST_IMEMORY_ true
@@ -206,5 +207,5 @@
        dcache_miss_penality,
        1                             ,
-//        cache_shared_nb_port          ,
+//     cache_shared_nb_port          ,
        cache_shared_nb_line          ,
        cache_shared_size_line        ,
@@ -218,5 +219,5 @@
        nb_tty,
        name_tty,
-       false,
+       false, // don't execute xtty
        
        nb_component_ramlock,
@@ -458,5 +459,5 @@
 		  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_ADDRESS    [i][j]->write(addr>>2);
 		  ICACHE_REQ_PACKET_ID  [i][j]->write(addr>>2);
 		  ICACHE_REQ_TYPE       [i][j]->write(ICACHE_TYPE_LOAD);
@@ -535,5 +536,5 @@
 	ICACHE_REQ_VAL        [0][0]->write(1);
 	ICACHE_REQ_CONTEXT_ID [0][0]->write(0);
-	ICACHE_REQ_ADDRESS    [0][0]->write(0xe0000000);
+	ICACHE_REQ_ADDRESS    [0][0]->write(0xe0000000>>2);
 	ICACHE_REQ_PACKET_ID  [0][0]->write(21);
 	ICACHE_REQ_TYPE       [0][0]->write(ICACHE_TYPE_LOAD);
@@ -561,5 +562,5 @@
 	ICACHE_REQ_VAL        [0][0]->write(1);
 	ICACHE_REQ_CONTEXT_ID [0][0]->write(0);
-	ICACHE_REQ_ADDRESS    [0][0]->write(0xa0000000);
+	ICACHE_REQ_ADDRESS    [0][0]->write(0xa0000000>>2);
 	ICACHE_REQ_PACKET_ID  [0][0]->write(21);
 	ICACHE_REQ_TYPE       [0][0]->write(ICACHE_TYPE_LOAD);
Index: trunk/IPs/systemC/Environment/src/Environment.cpp
===================================================================
--- trunk/IPs/systemC/Environment/src/Environment.cpp	(revision 85)
+++ trunk/IPs/systemC/Environment/src/Environment.cpp	(revision 88)
@@ -1,3 +1,5 @@
 #include "../include/Environment.h"
+
+using namespace morpheo;
 
 namespace environment {
@@ -60,6 +62,4 @@
 
 
-
-
     for (uint32_t i=0; i<param->nb_entity; i++)
       {
@@ -79,4 +79,8 @@
     read_dram[0] = new char [max_data_size/8];
     write_dram   = new char [max_data_size/8];
+    context_stop = new bool [param->nb_entity];
+    for (uint32_t i=0; i<param->nb_entity; ++i)
+      context_stop [i] = false;
+    nb_context_stop = 0;
 
     // Port 
Index: trunk/IPs/systemC/Environment/src/Environment_genMoore.cpp
===================================================================
--- trunk/IPs/systemC/Environment/src/Environment_genMoore.cpp	(revision 85)
+++ trunk/IPs/systemC/Environment/src/Environment_genMoore.cpp	(revision 88)
@@ -1,3 +1,5 @@
 #include "../include/Environment.h"
+
+using namespace morpheo;
 
 namespace environment {
Index: trunk/IPs/systemC/Environment/src/Environment_simulation_end.cpp
===================================================================
--- trunk/IPs/systemC/Environment/src/Environment_simulation_end.cpp	(revision 88)
+++ trunk/IPs/systemC/Environment/src/Environment_simulation_end.cpp	(revision 88)
@@ -0,0 +1,10 @@
+#include "../include/Environment.h"
+
+namespace environment {
+
+  bool Environment::simulation_end(void)
+  {
+    return (nb_context_stop >= param->nb_entity);
+  }
+
+};
Index: trunk/IPs/systemC/Environment/src/Environment_stop.cpp
===================================================================
--- trunk/IPs/systemC/Environment/src/Environment_stop.cpp	(revision 88)
+++ trunk/IPs/systemC/Environment/src/Environment_stop.cpp	(revision 88)
@@ -0,0 +1,17 @@
+#include "../include/Environment.h"
+
+namespace environment {
+
+  void Environment::stop(uint32_t num_context)
+  {
+    if (context_stop [num_context] == false)
+      {
+        context_stop [num_context] = true;
+        nb_context_stop ++;
+	
+        if (nb_context_stop >= param->nb_entity)
+          sc_stop();
+      }
+  }
+
+};
Index: trunk/IPs/systemC/Environment/src/Environment_transition.cpp
===================================================================
--- trunk/IPs/systemC/Environment/src/Environment_transition.cpp	(revision 85)
+++ trunk/IPs/systemC/Environment/src/Environment_transition.cpp	(revision 88)
@@ -1,3 +1,5 @@
 #include "../include/Environment.h"
+
+using namespace morpheo;
 
 namespace environment {
@@ -43,7 +45,7 @@
 		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_address_t address   = ICACHE_REQ_ADDRESS    [i][j]->read()<<2;
 		Ticache_type_t    type      = ICACHE_REQ_TYPE       [i][j]->read();
-		uint32_t          size      = param->iaccess_size_address [i]/8;
+		uint32_t          size      = (param->iaccess_size_address [i]+2)/8;
 
 		_cout(ENVIRONMENT," * information\n");
@@ -67,5 +69,5 @@
 		    (entity.segment->getType() == data::TYPE_TARGET_MEMORY))
 		  {
-		    _cout(ENVIRONMENT, " * OK !\n");
+		    _cout(ENVIRONMENT," * OK !\n");
 		    bus_error = false;
 		    uncached  = entity.segment->getUncached();
@@ -73,10 +75,10 @@
 		    if (must_read == true) // Test if must read the ram
 		      {
-			_cout(ENVIRONMENT, "   * must read\n");
+			_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);
+                            _cout(ENVIRONMENT,"   * addr    : %.8x\n",addr);
 
 			    bus_error |= !component_data->read(addr,size,read_iram[k]);
@@ -84,5 +86,12 @@
 			    // Swap if endienness is different
 			    if (endianness::isSameEndianness(context) == false) 
-			      read_iram[k] = endianness::swapBytes(read_iram[k],size,size);
+                              {
+                                read_iram[k] = endianness::swapBytes(read_iram[k],size,size);
+                              }
+
+                            _cout(ENVIRONMENT,"   * inst    :");
+                            for (int32_t cpt=(param->iaccess_size_instruction[context]/8)-1; cpt>=0; --cpt)
+                              _cout(ENVIRONMENT, "%.2x",0xff&static_cast<uint32_t>(read_iram[k][cpt]));
+                            _cout(ENVIRONMENT, "\n");
 			  }
 		      }
@@ -241,14 +250,7 @@
 				       ,static_cast<uint32_t>((wdata>> 0)&0xff)
 				       );
+
+                                stop (context);
 			    
-// 				if (context_stop [context] == false)
-// 				  {
-// 				    context_stop [context] = true;
-// 				    nb_context_stop ++;
-				    
-// 				    if (nb_context_stop >= nb_context)
-// 				      sc_stop();
-// 				  }
-
 				break;
 			      }
@@ -387,5 +389,5 @@
 				  {
 				    // Decomposition en groupe octect
-				    Tdcache_data_t result = (Tdcache_data_t)(component_sim2os->result);
+				    Tdcache_data_t result = static_cast<Tdcache_data_t>(reinterpret_cast<uint64_t>(component_sim2os->result));
 				    _cout(ENVIRONMENT,"<sim2os> result      : %x\n",result);
 				    
@@ -494,5 +496,4 @@
 		    component_buffer_drsp [i]->push(latence,rsp);
 		  }
-
 	      }
 	//=============================================================================
