Index: trunk/IPs/systemC/processor/Morpheo/Common/include/BitManipulation.h
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Common/include/BitManipulation.h	(revision 112)
+++ trunk/IPs/systemC/processor/Morpheo/Common/include/BitManipulation.h	(revision 113)
@@ -42,4 +42,10 @@
   };
 
+  template <typename T>
+  T gen_mask_not   (uint32_t size)
+  { 
+    return gen_mask_not<T>(size-1,0);
+  };
+
   //............................................................................
   // mask, mask_not ............................................................
Index: trunk/IPs/systemC/processor/Morpheo/Common/include/Debug.h
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Common/include/Debug.h	(revision 112)
+++ trunk/IPs/systemC/processor/Morpheo/Common/include/Debug.h	(revision 113)
@@ -24,4 +24,5 @@
  */
 
+#include "Common/include/Systemc.h"
 #include "Common/include/Message.h"
 #include "Common/include/FromString.h"
@@ -64,6 +65,6 @@
 #define debug_test_simulation_time                                      \
   (not debug_cycle_test or                                              \
-   ( (sc_simulation_time() >= debug_cycle_start) and                    \
-    ((sc_simulation_time() <= debug_cycle_stop) or                      \
+   ( (simulation_cycle() >= debug_cycle_start) and                    \
+    ((simulation_cycle() <= debug_cycle_stop) or                      \
       (debug_cycle_stop == -1))))
 #else
@@ -149,5 +150,5 @@
   do									\
     {									\
-      log_printf(TRACE,component,func,_("[%d] %s.%s"),static_cast<uint32_t>(sc_simulation_time()),name,func); \
+      log_printf(TRACE,component,func,_("[%d] %s.%s"),static_cast<uint32_t>(simulation_cycle()),name,func); \
     } while(0)
 
Index: trunk/IPs/systemC/processor/Morpheo/Common/include/Environment.h
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Common/include/Environment.h	(revision 112)
+++ trunk/IPs/systemC/processor/Morpheo/Common/include/Environment.h	(revision 113)
@@ -14,29 +14,33 @@
 
 #if (defined(STATISTICS) and not defined(SYSTEMC))
-#  error "To have the statistics, you must set flags SYSTEMC"
+# error "To have the statistics, you must set flags SYSTEMC"
 #endif
 
 #if (defined(INFORMATION) and not defined(STATISTICS))
-#  error "To have the information, you must set flags STATISTICS"
+# error "To have the information, you must set flags STATISTICS"
 #endif
 
 #if (defined(VHDL_TESTBENCH) and not defined(SYSTEMC))
-#  error "To have the vhdl's test bench, you must set flags SYSTEMC"
+# error "To have the vhdl's test bench, you must set flags SYSTEMC"
 #endif
 
 #if (defined(VHDL_TESTBENCH) and not defined(VHDL))
-#  error "To have the vhdl's test bench, you must set flags VHDL"
+# error "To have the vhdl's test bench, you must set flags VHDL"
 #endif
 
 #if (defined(VHDL_TESTBENCH_ASSERT) and not defined(VHDL_TESTBENCH))
-#  error "To have an assert in vhdl's test bench, you must set flags VHDL_TESTBENCH"
+# error "To have an assert in vhdl's test bench, you must set flags VHDL_TESTBENCH"
 #endif
 
 #if (defined(VHDL_TESTBENCH) and defined(SYSTEMC))
-#  define SYSTEMC_VHDL_COMPATIBILITY
+# define SYSTEMC_VHDL_COMPATIBILITY
 #endif
 
 #if (defined(DEBUG))
-#  define DEBUG_TEST
+# define DEBUG_TEST
+#endif
+
+#if defined(MTI_SYSTEMC) and defined(SYSTEMC) and defined(VHDL)
+# define MODELSIM_COSIMULATION
 #endif
 
Index: trunk/IPs/systemC/processor/Morpheo/Common/include/Message.h
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Common/include/Message.h	(revision 112)
+++ trunk/IPs/systemC/processor/Morpheo/Common/include/Message.h	(revision 113)
@@ -33,4 +33,5 @@
 #  define MSG_INFORMATION   _("[1;32m[INFORMATION][0m")
 #  define MSG_BREAKPOINT    _("[1;38m[   BREAK   ][0m")
+#  define MSG_VHDL          _("[1;34m[   VHDL    ][0m")
 #else
 #  define MSG_DEBUG         _("[   DEBUG   ]")
@@ -39,4 +40,5 @@
 #  define MSG_INFORMATION   _("[INFORMATION]")
 #  define MSG_BREAKPOINT    _("[   BREAK   ]")
+#  define MSG_VHDL          _("[   VHDL    ]")
 #endif
 
@@ -84,9 +86,10 @@
 
 #define msg(arg...)		fmsg(stdout,arg)
+#define err(arg...)             fmsgError(stderr,arg)
+
 #define msgDebug(arg...)	fmsgDebug(stdout,arg)
 #define msgError(arg...)	fmsgError(stdout,arg)
 #define msgWarning(arg...)	fmsgWarning(stdout,arg)
 #define msgInformation(arg...)	fmsgInformation(stdout,arg)
-#define err(arg...)             fmsgError(stderr,arg)
 
 }; // end namespace morpheo
Index: trunk/IPs/systemC/processor/Morpheo/Common/include/Systemc.h
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Common/include/Systemc.h	(revision 113)
+++ trunk/IPs/systemC/processor/Morpheo/Common/include/Systemc.h	(revision 113)
@@ -0,0 +1,48 @@
+#ifndef Morpheo_systemc_h
+#define Morpheo_systemc_h
+
+/*
+ * $Id$
+ *
+ * [ Description ]
+ * 
+ * Macro / function to test
+ */
+
+#ifdef SYSTEMC
+#include <systemc.h>
+
+namespace morpheo {
+
+  // Modelsim to sc_start
+#ifdef MTI_SYSTEMC
+# define TIME_PERIOD 10.
+#else
+# define TIME_PERIOD 1.
+#endif
+
+# ifndef TIME_UNIT_PREFIX
+#  ifdef MTI_SYSTEMC
+#   define TIME_UNIT_PREFIX
+#  else
+#   define TIME_UNIT_PREFIX sc_core::
+#  endif
+# endif
+# define TIME_UNIT TIME_UNIT_PREFIX SC_NS
+
+# define VHDL_TIME_PERIOD TIME_PERIOD
+# define VHDL_TIME_UNIT               "ns"
+// #endif
+
+#ifdef MTI_SYSTEMC
+# define simulation_run(x) do{ if (x>0) wait(TIME_PERIOD*x,TIME_UNIT); else for (int i=0; i<1000; ++i) wait(SC_ZERO_TIME); } while(0)
+#else
+# define simulation_run(x) do{ sc_start(x); } while(0)
+#endif
+
+#define simulation_cycle() sc_simulation_time()/TIME_PERIOD
+
+};
+#endif
+#endif
+
Index: trunk/IPs/systemC/processor/Morpheo/Common/include/Test.h
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Common/include/Test.h	(revision 112)
+++ trunk/IPs/systemC/processor/Morpheo/Common/include/Test.h	(revision 113)
@@ -16,5 +16,5 @@
 #include "Common/include/ErrorMorpheo.h"
 #include "Common/include/ToString.h"
-
+#include "Common/include/Systemc.h"
 namespace morpheo {
 
@@ -26,5 +26,5 @@
 inline void test_ko_error (void)
 {
-  std::string msg = "Test ko : error in test \""+morpheo::toString(num_test)+"\"";
+  std::string msg = morpheo::toString(_("Test ko : error in test \"%d\""),num_test);
   throw (morpheo::ErrorMorpheo (msg));
 }
@@ -33,15 +33,11 @@
 inline void test_ko (char * file, uint32_t line, T exp1, T exp2)
 {
-  fflush (stdout);
-  fflush (stderr);
-
-  std::cerr << "[" << num_test << "] : " << STR_KO
-       << "\tline " << line                      << std::endl
-       << " * Localisation"                      << std::endl
-       << "   - File : " << file                 << std::endl
-       << "   - Line : " << line                 << std::endl
-       << " * Expression is different"           << std::endl
-       << "   - exp1 : "+morpheo::toString(exp1) << std::endl
-       << "   - exp2 : "+morpheo::toString(exp2) << std::endl;
+  msgError(_("[%d] : %s\n"),num_test,STR_KO);
+  msgError(_(" * Localisation\n"));
+  msgError(_("   - File  : %s\n"),file);
+  msgError(_("   - Line  : %d\n"),line);
+  msgError(_(" * Expression is different\n"));
+  msgError(_("   - exp1  : %s\n"),morpheo::toString(exp1).c_str());
+  msgError(_("   - exp2  : %s\n"),morpheo::toString(exp2).c_str());
 
   test_ko_error ();
@@ -50,12 +46,8 @@
 inline void test_ko (char * file, uint32_t line)
 {
-  fflush (stdout);
-  fflush (stderr);
-
-  std::cerr << "[" << num_test << "] : " << STR_KO
-       << "\tline " << line                           << std::endl
-       << " * Localisation"                           << std::endl
-       << "   - File : " << file                      << std::endl
-       << "   - Line : " << line                      << std::endl;
+  msgError(_("[%d] : %s\n"),num_test,STR_KO);
+  msgError(_(" * Localisation\n"));
+  msgError(_("   - File  : %s\n"),file);
+  msgError(_("   - Line  : %d\n"),line);
   
   test_ko_error ();
@@ -64,8 +56,5 @@
 inline void test_ok ()
 {
-  fflush (stdout);
-  fflush (stderr);
-
-  msg (_("[%d] : %s\n"), num_test,STR_OK);
+  msgInformation (_("[%d] : %s\n"), num_test,STR_OK);
 
   num_test ++;
@@ -74,9 +63,6 @@
 inline void test_ok (char * file, uint32_t line)
 {
-  fflush (stdout);
-  fflush (stderr);
-
-  msg (_("[%d] : %s\n"), num_test,STR_OK);
-  msg (_("\tline %d\n"), line);
+  msgInformation (_("[%d] : %s (line %d)\n"), num_test,STR_OK,line);
+  msgInformation (_("   - Line  : %d\n"), line);
 
   num_test ++;
@@ -86,10 +72,7 @@
 inline void test_ok (char * file, uint32_t line, T exp)
 {
-  fflush (stdout);
-  fflush (stderr);
-
-  msg (_("[%d] : %s\n"), num_test, STR_OK);
-  msg (_("\tline %d\n"), line);
-  msg (_("\tvalue %s\n"), (morpheo::toString(exp)).c_str());
+  msgInformation (_("[%d] : %s\n"), num_test, STR_OK);
+  msgInformation (_("   - Line  : %d\n"), line);
+  msgInformation (_("   - Value : %s\n"), (morpheo::toString(exp)).c_str());
 
   num_test ++;
@@ -112,8 +95,7 @@
 #define LABEL(str...)							\
   {									\
-    msg (_("{%d} "),static_cast<uint32_t>(sc_simulation_time()));	\
-    msg (str);								\
-    msg (_("\n"));							\
-    fflush (stdout);                                                    \
+    msgInformation (_("{%.0f} "),simulation_cycle());                \
+    msg            (str);                                               \
+    msg            (_("\n"));                                           \
   } while(0)
 
@@ -122,13 +104,13 @@
 #endif
 
-#define SC_START(cycle_offset)						\
+#define SC_CYCLE(cycle_offset)						\
   do									\
     {									\
-      /*cout << "SC_START (begin)" << endl;*/				\
+      /*cout << "SC_CYCLE (begin)" << endl;*/				\
       									\
-      uint32_t cycle_current = static_cast<uint32_t>(sc_simulation_time()); \
+      double cycle_current = simulation_cycle();                        \
       if (cycle_offset != 0)						\
 	{								\
-	  cout << "##########[ cycle "<< cycle_current+cycle_offset << " ] (" << __LINE__ << ")" << endl; \
+	  msgInformation(_("##########[ cycle %.0f ] (%d)\n"),cycle_current+cycle_offset,__LINE__); \
 	}								\
       									\
@@ -138,10 +120,13 @@
 	}								\
       									\
-      sc_start(cycle_offset);						\
+      simulation_run(cycle_offset);                                     \
       									\
-      /*cout << "SC_START (end  )" << endl;*/				\
+      /*cout << "SC_CYCLE (end  )" << endl;*/				\
     } while(0)
 
-
+// old support
+#ifndef MTI_SYSTEMC
+# define SC_START(x) SC_CYCLE(x)
+#endif
 
 };
Index: trunk/IPs/systemC/processor/Morpheo/Common/include/Time.h
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Common/include/Time.h	(revision 112)
+++ trunk/IPs/systemC/processor/Morpheo/Common/include/Time.h	(revision 113)
@@ -9,4 +9,5 @@
 #include <iostream>
 #include <sys/time.h>
+#include "Common/include/Systemc.h"
 
 namespace morpheo {
@@ -28,5 +29,5 @@
   { 
 #ifdef SYSTEMC
-    nb_cycles_begin = sc_simulation_time();
+    nb_cycles_begin = simulation_cycle();
 #endif
     gettimeofday(&time_begin,NULL);
@@ -48,5 +49,5 @@
     if (x.systemc)
       {
-        double nb_cycles_end = sc_simulation_time();
+        double nb_cycles_end = simulation_cycle();
         double average       = static_cast<double>(nb_cycles_end-x.nb_cycles_begin+1) / static_cast<double>(time_end.tv_sec-x.time_begin.tv_sec+1);
         
