Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Debug_signal.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Debug_signal.cpp	(revision 137)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Debug_signal.cpp	(revision 138)
@@ -38,10 +38,10 @@
   void debug_signal::print (void)
   {
-    msg("List of access signal\n");
+    msgInformation("List of access signal\n");
     for (std::list<std::string>::iterator it = _signal_access.begin();
          it != _signal_access.end();
          ++ it)
       {
-        msg(" * %s\n",(*it).c_str());
+        msgInformation(" * %s\n",(*it).c_str());
       }
   }
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Interface.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Interface.cpp	(revision 137)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Interface.cpp	(revision 138)
@@ -77,5 +77,5 @@
         if ((_usage & USE_SYSTEMC) and 
             ((*it)->get_direction() == INTERNAL))
-          delete (*it)->get_sc_signal();
+          (*it)->dealloc();
         delete (*it);
       }
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Simulation.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Simulation.cpp	(revision 137)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Simulation.cpp	(revision 138)
@@ -18,4 +18,5 @@
   double              _simulation_nb_instruction;
   std::vector<double> _simulation_nb_instruction_commited;
+  stop_type_t         _simulation_stop_type;
   bool                _simulation_file_with_date;
   bool                _simulation_file_with_pid ;
@@ -23,9 +24,10 @@
   Model               _model;
 
-  void simulation_init (double nb_cycle,
-                        double debug_nb_cycle,
-                        double nb_instruction,
-                        bool   file_with_date,
-                        bool   file_with_pid )
+  void simulation_init (double      nb_cycle,
+                        double      debug_nb_cycle,
+                        double      nb_instruction,
+                        stop_type_t stop_type,
+                        bool        file_with_date,
+                        bool        file_with_pid )
   {
     if (not simulation_initialized)
@@ -44,4 +46,5 @@
         _simulation_nb_instruction          = nb_instruction;
 //      _simulation_nb_instruction_commited = new std::vector<double>;
+        _simulation_stop_type               = stop_type;
         _simulation_file_with_date          = file_with_date;
         _simulation_file_with_pid           = file_with_pid ;
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Simulation_test_end.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Simulation_test_end.cpp	(revision 137)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Simulation_test_end.cpp	(revision 138)
@@ -35,12 +35,37 @@
       {
         end_inst = true;
+        std::vector<double>::iterator it=_simulation_nb_instruction_commited.begin();
 
-        std::vector<double>::iterator it=_simulation_nb_instruction_commited.begin();
-        
-        // Scan all context and test if all can finish
-        while (end_inst and it!=_simulation_nb_instruction_commited.end())
+        switch (_simulation_stop_type)
           {
-            end_inst &= (_simulation_nb_instruction <= *it);
-            it ++;
+          case ALL_THREAD :
+            {
+              double sum_inst = 0;
+
+              // Scan all context and test if all can finish
+              while (it!=_simulation_nb_instruction_commited.end())
+                {
+                  sum_inst += *it;
+                  it ++;
+                }
+              
+              // Stop if sum of all instruction is higher of "simulation_nb_instruction"
+              end_inst &= (_simulation_nb_instruction <= sum_inst);
+
+              break;
+            }
+          case EACH_THREAD_AND_CONTINUE :
+          case EACH_THREAD_AND_STOP :
+            {
+              // Scan all context and test if all can finish
+              while (end_inst and it!=_simulation_nb_instruction_commited.end())
+                {
+
+                  // Stop if all thread have executed more that "simulation_nb_instruction" instructions.
+                  end_inst &= (_simulation_nb_instruction <= *it);
+                  it ++;
+                }
+              break;
+            }
           }
       }
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Stat.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Stat.cpp	(revision 137)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Stat.cpp	(revision 138)
@@ -14,13 +14,14 @@
     _save_periodic         (_period>0)
   {
+    _generate_file = true;
+
     _list_operand  = new std::map<std::string, var_t>;
     _list_expr     = new std::list<expr_t>;
     _list_stat     = new std::list<Stat *>;
+    _list_counters = new std::list<counters_t *>;
 
     _cycle         = create_variable("cycle");
 //  _cycle         = create_counter("cycle","","");
     *_cycle        = 0; // for the first period
-
-    _generate_file = true;
   }
 
@@ -35,13 +36,14 @@
     _save_periodic         (period>0)
   {
+    _generate_file = true;
+
     _list_operand  = new std::map<std::string, var_t>;
     _list_expr     = new std::list<expr_t>;
     _list_stat     = new std::list<Stat *>;
+    _list_counters = new std::list<counters_t *>;
 
     _cycle         = create_variable("cycle");
 //  _cycle         = create_counter("cycle","","");
     *_cycle        = 0; // for the first period
-
-    _generate_file = true;
   }
 
@@ -68,4 +70,14 @@
       }
     delete _list_expr;
+
+    // parcourir la liste et desallouer les arbres
+    for (std::list<counters_t*>::iterator i=_list_counters->begin();
+	 i!= _list_counters->end();
+	 ++i)
+      {
+	delete *i;
+      }
+    delete _list_counters;
+
     delete _list_stat;
   }
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Stat_create_counters.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Stat_create_counters.cpp	(revision 138)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Stat_create_counters.cpp	(revision 138)
@@ -0,0 +1,37 @@
+#ifdef STATISTICS
+#include "Behavioural/include/Stat.h"
+
+namespace morpheo {
+namespace behavioural {
+  counters_t * Stat::create_counters (std::string varname, 
+                                      uint32_t    nb_counter, 
+                                      std::string unit,
+                                      std::string description_counter,
+                                      std::string description_percent,
+                                      std::string description_average)
+  {
+    counters_t * counters = new counters_t (nb_counter);
+
+    _list_counters->push_back(counters);
+
+    std::string sum = "0";
+
+    for (uint32_t i=0; i<=nb_counter; ++i) // 0 and _nb_counter
+      {
+        std::string name=varname+"_"+toString(i);
+        
+        counters->set_counter(alloc_operand (TYPE_COUNTER, name, unit, toString(description_counter.c_str(),i)), i);
+
+        create_expr_percent("percent_"+name,name,"cycle",toString(description_percent.c_str(),i));
+
+        if (i!=0)
+          sum = "+ "+sum+" * "+toString(i)+" "+name; // "cycle"
+      }
+
+    create_expr_average_by_cycle("average_"+varname,sum,unit+" / cycle",description_average);
+
+    return counters;
+  }
+};
+};
+#endif
