Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Component.h
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Component.h	(revision 69)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Component.h	(revision 71)
@@ -21,6 +21,4 @@
 #include "Common/include/Debug.h"
 #include "Behavioural/include/Usage.h"
-
-using namespace std;
 
 namespace morpheo              {
@@ -53,11 +51,11 @@
   public    :                       ~Component        ();
 
-  public    : Entity *              set_entity        (string        name   
-						       ,string        type  
+  public    : Entity *              set_entity        (std::string        name   
+						       ,std::string        type  
 #ifdef POSITION
 						       ,schema_t      schema
 #endif
 						       );
-  private   : string                get_entity        (void);
+  private   : std::string                get_entity        (void);
 
   public    : void                  set_component     (Component * component
@@ -71,8 +69,8 @@
 						       );
 
-  private   : string                get_component     (void);
+  private   : std::string                get_component     (void);
 
-  private   : Entity *              find_entity       (string name);
-//private   : Interface *           find_interface    (string   name  , 
+  private   : Entity *              find_entity       (std::string name);
+//private   : Interface *           find_interface    (std::string   name  , 
 //						       Entity * entity);
 
@@ -85,18 +83,18 @@
 						       Signal * signal_productor);
 
-  public    : void                  port_map          (string component_src ,
-						       string port_src      ,
-						       string component_dest,
-						       string port_dest    );
-  public    : void                  port_map          (string component_src ,
-						       string port_src      );
+  public    : void                  port_map          (std::string component_src ,
+						       std::string port_src      ,
+						       std::string component_dest,
+						       std::string port_dest    );
+  public    : void                  port_map          (std::string component_src ,
+						       std::string port_src      );
 
   public    : bool                  test_map          (void);
 
 #ifdef POSITION
-  public    : void                  interface_map     (string component_src ,
-						       string port_dest,
-						       string component_dest,
-						       string port_dest     );
+  public    : void                  interface_map     (std::string component_src ,
+						       std::string port_dest,
+						       std::string component_dest,
+						       std::string port_dest     );
 
   public    : XML                   toXML             (void);
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Configuration_Parameters.h
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Configuration_Parameters.h	(revision 69)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Configuration_Parameters.h	(revision 71)
@@ -15,5 +15,4 @@
 #include "Common/include/ErrorMorpheo.h"
 #include "Common/include/ToString.h"
-using namespace std;
 
 namespace morpheo     {
@@ -24,26 +23,26 @@
     // -----[ fields ]----------------------------------------------------
     // Constant
-  public   : const string    _name   ;
+  public   : const std::string    _name   ;
   public   : const uint32_t  _value  ;
   public   : const uint32_t  _min    ;
   public   : const uint32_t  _max    ;
-  public   : const string    _step   ;
+  public   : const std::string    _step   ;
   public   : const uint32_t  _default;
   public   : const uint32_t  _level  ;
-  public   : const string    _comment;
+  public   : const std::string    _comment;
 
     // -----[ methods ]---------------------------------------------------
-  public   :                 Configuration_Parameters  (string   name   ,
+  public   :                 Configuration_Parameters  (std::string   name   ,
 							uint32_t value  ,
 							uint32_t min    ,
 							uint32_t max    ,
-							string   step   ,
+							std::string   step   ,
 							uint32_t value_default,
 							uint32_t level  ,
-							string   comment);
+							std::string   comment);
   public   :                 ~Configuration_Parameters ();
 
     // methods to print and test parameters_configuration
-  public   : string          print                      (uint32_t depth);
+  public   : std::string          print                      (uint32_t depth);
   public   : friend ostream& operator<<                 (ostream& output_stream,
 							 morpheo::behavioural::Configuration_Parameters & x);
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Constants.h
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Constants.h	(revision 69)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Constants.h	(revision 71)
@@ -11,4 +11,5 @@
 
   //-------------------------------------------------------[ Memory ]-----
+#define OPERATION_MEMORY_LOAD                    0x0      // 000_0000
 #define OPERATION_MEMORY_LOAD_8_Z                0x0      // 000_0000
 #define OPERATION_MEMORY_LOAD_16_Z               0x20     // 010_0000
@@ -55,4 +56,10 @@
 	 (x == OPERATION_MEMORY_STORE_HEAD_KO))
 
+#define is_operation_memory_load_signed(x)      \
+        ((x == OPERATION_MEMORY_LOAD_8_S ) or	\
+	 (x == OPERATION_MEMORY_LOAD_16_S) or	\
+	 (x == OPERATION_MEMORY_LOAD_32_S) or	\
+	 (x == OPERATION_MEMORY_LOAD_64_S) )
+
 #define MEMORY_ACCESS_8                          0x0
 #define MEMORY_ACCESS_16                         0x1
@@ -60,8 +67,24 @@
 #define MEMORY_ACCESS_64                         0x3
 
+#define MEMORY_SIZE_8                            8 
+#define MEMORY_SIZE_16                           16
+#define MEMORY_SIZE_32                           32
+#define MEMORY_SIZE_64                           64
+
 #define MASK_MEMORY_ACCESS_8                     0x0
 #define MASK_MEMORY_ACCESS_16                    0x1
 #define MASK_MEMORY_ACCESS_32                    0x3
 #define MASK_MEMORY_ACCESS_64                    0x7
+
+#define memory_size(x)                                                           \
+	(((x==OPERATION_MEMORY_LOAD_16_Z)or					 \
+	   (x==OPERATION_MEMORY_LOAD_16_S)or					 \
+	   (x==OPERATION_MEMORY_STORE_16 ))?MEMORY_SIZE_16:			 \
+	  (((x==OPERATION_MEMORY_LOAD_32_Z)or					 \
+	    (x==OPERATION_MEMORY_LOAD_32_S)or					 \
+	    (x==OPERATION_MEMORY_STORE_32 ))?MEMORY_SIZE_32:			 \
+	   (((x==OPERATION_MEMORY_LOAD_64_Z)or					 \
+	     (x==OPERATION_MEMORY_LOAD_64_S)or					 \
+	     (x==OPERATION_MEMORY_STORE_64 ))?MEMORY_SIZE_64:MEMORY_SIZE_8)))
 
 #define memory_access(x)                                                         \
@@ -86,5 +109,4 @@
 	     (x==OPERATION_MEMORY_LOAD_64_S)or					 \
 	     (x==OPERATION_MEMORY_STORE_64 ))?MASK_MEMORY_ACCESS_64:MASK_MEMORY_ACCESS_8)))
-
     
   //====================================================[ Exception ]=====
@@ -131,23 +153,23 @@
 #define EXCEPTION_MEMORY_BUS_ERROR               0x4  // Access at a invalid physical address
 #define EXCEPTION_MEMORY_MISS_SPECULATION        0x5  // Load miss speculation
+#define EXCEPTION_MEMORY_LOAD_SPECULATIVE        0x6  // The load is speculative : write in register file, but don't commit
 
   //==================================================[ dcache_type ]=====
-#  define DCACHE_LOAD                    0x0      // 0000
-#  define DCACHE_LOCK                    0x1      // 0001
-#  define DCACHE_INVALIDATE              0x2      // 0010
-#  define DCACHE_PREFETCH                0x3      // 0011
-//#define DCACHE_                        0x4      // 0100
-//#define DCACHE_                        0x5      // 0101
-#  define DCACHE_FLUSH                   0x6      // 0110
-#  define DCACHE_SYNCHRONIZATION         0x7      // 0111
-
-#  define DCACHE_STORE_8                 0x8      // 1000
-#  define DCACHE_STORE_16                0x9      // 1001
-#  define DCACHE_STORE_32                0xa      // 1010
-#  define DCACHE_STORE_64                0xb      // 1011
-//#define DCACHE_                        0xc      // 1100
-//#define DCACHE_                        0xd      // 1101
-//#define DCACHE_                        0xe      // 1110
-//#define DCACHE_                        0xf      // 1111
+#  define DCACHE_LOAD                    0x0 // 0000
+#  define DCACHE_LOCK                    0x1 // 0001
+#  define DCACHE_INVALIDATE              0x2 // 0010
+#  define DCACHE_PREFETCH                0x3 // 0011
+//#define DCACHE_                        0x4 // 0100
+//#define DCACHE_                        0x5 // 0101
+#  define DCACHE_FLUSH                   0x6 // 0110
+#  define DCACHE_SYNCHRONIZATION         0x7 // 0111
+#  define DCACHE_STORE_8                 0x8 // 1000
+#  define DCACHE_STORE_16                0x9 // 1001
+#  define DCACHE_STORE_32                0xa // 1010
+#  define DCACHE_STORE_64                0xb // 1011
+//#define DCACHE_                        0xc // 1100
+//#define DCACHE_                        0xd // 1101
+//#define DCACHE_                        0xe // 1110
+//#define DCACHE_                        0xf // 1111
 
 
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Debug_component.h
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Debug_component.h	(revision 69)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Debug_component.h	(revision 71)
@@ -21,9 +21,9 @@
 #define         DEBUG_Multi_Execute_unit                          false
 #define           DEBUG_Execute_unit                              false
-#define             DEBUG_Load_store_unit                         false
+#define             DEBUG_Load_store_unit                         true 
 #define         DEBUG_Multi_Read_unit				  false
 #define           DEBUG_Read_unit				  false
 #define             DEBUG_Read_queue                              false
-#define             DEBUG_Reservation_station                     true 
+#define             DEBUG_Reservation_station                     false
 #define         DEBUG_Register_unit				  false
 #define           DEBUG_Register_unit_Glue			  false
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Entity.h
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Entity.h	(revision 69)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Entity.h	(revision 71)
@@ -20,6 +20,4 @@
 #include "Behavioural/include/Usage.h"
 
-using namespace std;
-
 namespace morpheo              {
 namespace behavioural          {
@@ -28,6 +26,6 @@
   {
     // -----[ fields ]----------------------------------------------------
-  private   : const string          _name         ;
-  private   : const string          _type         ;
+  private   : const std::string          _name         ;
+  private   : const std::string          _type         ;
 #ifdef POSITION
   private   : const schema_t        _schema       ;
@@ -38,5 +36,5 @@
 
 #ifdef POSITION
-  private   : string                _comment      ;
+  private   : std::string                _comment      ;
 
   private   :       bool            _is_map       ;
@@ -48,6 +46,6 @@
 
     // -----[ methods ]---------------------------------------------------
-  public    :                       Entity            ( string        name   
-						       ,string        type   
+  public    :                       Entity            ( std::string        name   
+						       ,std::string        type   
 #ifdef POSITION
 						       ,schema_t      schema 
@@ -58,17 +56,17 @@
   public    :                       ~Entity           ();
 
-  public    : string                get_name          (void);
-  public    : string                get_type          (void);
+  public    : std::string                get_name          (void);
+  public    : std::string                get_type          (void);
 
 #ifdef POSITION
-  public    : void                  set_comment       (string comment);
-  private   : string                get_comment       (void          );
+  public    : void                  set_comment       (std::string comment);
+  private   : std::string                get_comment       (void          );
 #endif
   public    : Interfaces *          set_interfaces    (void);
-  private   : string                get_interfaces    (void);
+  private   : std::string                get_interfaces    (void);
   public    : Interfaces *          get_interfaces_list(void);
 
-  public    : Interface  *          find_interface    (string name);
-  public    : Signal     *          find_signal       (string name);
+  public    : Interface  *          find_interface    (std::string name);
+  public    : Signal     *          find_signal       (std::string name);
   public    : bool                  find_signal       (Signal * signal);
 
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Environnement.h
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Environnement.h	(revision 69)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Environnement.h	(revision 71)
@@ -18,2 +18,6 @@
 #  define SYSTEMC_VHDL_COMPATIBILITY
 #endif
+
+#if (defined(DEBUG))
+#  define DEBUG_TEST
+#endif
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Interface.h
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Interface.h	(revision 69)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Interface.h	(revision 71)
@@ -28,6 +28,4 @@
 #include "Behavioural/include/Usage.h"
 
-using namespace std;
-
 namespace morpheo              {
 namespace behavioural          {
@@ -36,5 +34,5 @@
   {
     // -----[ fields ]----------------------------------------------------
-  protected : const string          _name         ;
+  protected : const std::string          _name         ;
 #ifdef POSITION
   protected : const direction_t     _direction    ;
@@ -44,5 +42,5 @@
 
 #ifdef POSITION
-  protected :       string          _comment      ;
+  protected :       std::string          _comment      ;
 #endif
 
@@ -60,5 +58,5 @@
     
     // -----[ methods ]---------------------------------------------------
-  public    :                       Interface            (string         name        
+  public    :                       Interface            (std::string         name        
 #ifdef POSITION
 							  ,direction_t    direction   
@@ -71,20 +69,20 @@
   public    :                       ~Interface           ();
 
-  public    : string                get_name             ();
-
-#ifdef POSITION
-  public    : void                  set_comment          (string comment);
-  protected : string                get_comment          (void          );
-#endif
-
-  protected : string                signal_name          (string      name_interface,
-							  string      name_signal   ,
+  public    : std::string                get_name             ();
+
+#ifdef POSITION
+  public    : void                  set_comment          (std::string comment);
+  protected : std::string                get_comment          (void          );
+#endif
+
+  protected : std::string                signal_name          (std::string      name_interface,
+							  std::string      name_signal   ,
 							  direction_t direction     );
 
-  public    : Signal *              find_signal          (string name);
+  public    : Signal *              find_signal          (std::string name);
   public    : bool                  find_signal          (Signal * signal);
 
-  protected : string                get_signal           (void);
-  public    : Signal *              set_signal           (string          name     ,
+  protected : std::string                get_signal           (void);
+  public    : Signal *              set_signal           (std::string          name     ,
 							  direction_t     direction,
 							  uint32_t        size     ,
@@ -93,5 +91,5 @@
 
 #ifdef SYSTEMC
-  public    : sc_in_clk *           set_signal_clk       (string          name     ,
+  public    : sc_in_clk *           set_signal_clk       (std::string          name     ,
 							  uint32_t        size     ,
 							  presence_port_t presence_port=CLOCK_VHDL_YES)
@@ -122,5 +120,5 @@
 
   public    : template <typename T>
-              sc_in <T> *           set_signal_in       (string          name     ,
+              sc_in <T> *           set_signal_in       (std::string          name     ,
 							 uint32_t        size     ,
 							 presence_port_t presence_port=PORT_VHDL_YES_TESTBENCH_YES)
@@ -151,5 +149,5 @@
 
   public    : template <typename T>
-              sc_out <T> *          set_signal_out      (string          name     ,
+              sc_out <T> *          set_signal_out      (std::string          name     ,
 							 uint32_t        size     ,
 							 presence_port_t presence_port=PORT_VHDL_YES_TESTBENCH_YES)
@@ -180,5 +178,5 @@
 
   public    : template <typename T>
-              sc_signal <T> *       set_signal_internal (string   name,
+              sc_signal <T> *       set_signal_internal (std::string   name,
 							 uint32_t size)
     {
@@ -209,5 +207,5 @@
 #  ifdef VHDL_TESTBENCH
   public    : void                  set_signal           (Vhdl * & vhdl);
-  public    : void                  get_signal           (list<string> * & list_signal);
+  public    : void                  get_signal           (list<std::string> * & list_signal);
 #  endif
 #endif
@@ -220,13 +218,13 @@
   public    : void                  testbench_cycle      (void);
   public    : void                  testbench_body       (Vhdl           * & vhdl          ,
-							  string             counter_name  ,
-							  string             reset_name    );
-  public    : string                testbench_test       (Vhdl           * & vhdl        ,
-							  string             counter_name,
-							  string             reset_name);
-  public    : string                testbench_test_ok    (Vhdl           * & vhdl        );
-  protected : string                testbench_test_name   (Vhdl           * & vhdl);
-  protected : string                testbench_test_ok_name(Vhdl           * & vhdl);
-  protected : string                testbench_test_transaction_name(Vhdl           * & vhdl);
+							  std::string             counter_name  ,
+							  std::string             reset_name    );
+  public    : std::string                testbench_test       (Vhdl           * & vhdl        ,
+							  std::string             counter_name,
+							  std::string             reset_name);
+  public    : std::string                testbench_test_ok    (Vhdl           * & vhdl        );
+  protected : std::string                testbench_test_name   (Vhdl           * & vhdl);
+  protected : std::string                testbench_test_ok_name(Vhdl           * & vhdl);
+  protected : std::string                testbench_test_transaction_name(Vhdl           * & vhdl);
 #endif
 
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Interfaces.h
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Interfaces.h	(revision 69)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Interfaces.h	(revision 71)
@@ -20,5 +20,4 @@
 #include "Behavioural/include/Usage.h"
 
-using namespace std;
 
 namespace morpheo              {
@@ -28,15 +27,15 @@
   {
     // -----[ fields ]----------------------------------------------------
-  private   : const string               _name;
+  private   : const std::string               _name;
   private   : const Tusage_t             _usage;
   private   : list<Interface_fifo*>    * _list_interface;
 
     // -----[ methods ]---------------------------------------------------
-  public    :                       Interfaces            (string name, 
+  public    :                       Interfaces            (std::string name, 
 							   Tusage_t usage=USE_ALL);
   public    :                       Interfaces            (const Interfaces & interfaces);
   public    :                       ~Interfaces           ();
 
-  public    : Interface_fifo *      set_interface         (string         name        
+  public    : Interface_fifo *      set_interface         (std::string         name        
 #ifdef POSITION
 							   ,direction_t    direction   
@@ -45,10 +44,10 @@
 							   );
 #ifdef POSITION
-  public    : Interface_fifo *      set_interface         (string         name        ,
+  public    : Interface_fifo *      set_interface         (std::string         name        ,
 							   direction_t    direction   ,
 							   localisation_t localisation,
-							   string         comment     );
+							   std::string         comment     );
 #endif
-  private   : string                get_interface         (void);
+  private   : std::string                get_interface         (void);
   public    :list<Interface_fifo*>* get_interface_list    (void);
 
@@ -56,5 +55,5 @@
   public    : void                  set_port              (Vhdl           * & vhdl          );
 #  ifdef VHDL_TESTBENCH
-  private   : void                  get_signal            (list<string>   * & list_signal   );
+  private   : void                  get_signal            (list<std::string>   * & list_signal   );
   private   : void                  set_signal            (Vhdl           * & vhdl          );
 #  endif
@@ -67,11 +66,11 @@
   private   : void                  testbench_generate_file (void);
   public    : void                  testbench             (void);
-  private   : string                testbench_body        (Vhdl           * & vhdl          ,
-							   string             counter_name  ,
-							   string             reset_name    );
+  private   : std::string                testbench_body        (Vhdl           * & vhdl          ,
+							   std::string             counter_name  ,
+							   std::string             reset_name    );
 #endif
 
-  public    : Interface_fifo  *     find_interface        (string name);
-  public    : Signal          *     find_signal           (string name);
+  public    : Interface_fifo  *     find_interface        (std::string name);
+  public    : Signal          *     find_signal           (std::string name);
   public    : bool                  find_signal           (Signal * signal);
 
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Parameters.h
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Parameters.h	(revision 69)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Parameters.h	(revision 71)
@@ -18,6 +18,4 @@
 #include "Common/include/Debug.h"
 
-using namespace std;
-
 namespace morpheo     {
 namespace behavioural {
@@ -37,6 +35,6 @@
 	
     // methods to print and test parameters
-  public   : virtual string   print                 (uint32_t depth) = 0;
-  public   : virtual string   msg_error             (void) = 0;
+  public   : virtual std::string   print                 (uint32_t depth) = 0;
+  public   : virtual std::string   msg_error             (void) = 0;
 
     // methods to generate configuration file
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Parameters_Statistics.h
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Parameters_Statistics.h	(revision 69)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Parameters_Statistics.h	(revision 71)
@@ -12,5 +12,4 @@
 #include "Common/include/Debug.h"
 #include <stdint.h>
-using namespace std;
 
 namespace morpheo              {
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Signal.h
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Signal.h	(revision 69)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Signal.h	(revision 71)
@@ -26,6 +26,4 @@
 #include "Common/include/ToString.h"
 #include "Common/include/Debug.h"
-
-using namespace std;
 
 namespace morpheo              {
@@ -53,5 +51,5 @@
 
     // -----[ fields ]----------------------------------------------------
-  private   : const string          _name          ;
+  private   : const std::string          _name          ;
   private   : const direction_t     _direction     ;
   private   : const presence_port_t _presence_port ;
@@ -68,9 +66,9 @@
 
 #ifdef VHDL_TESTBENCH
-  private   : list<string>        * _list_value    ;
+  private   : list<std::string>        * _list_value    ;
 #endif
 
     // -----[ methods ]---------------------------------------------------
-  public    :                   Signal          (string          name          ,
+  public    :                   Signal          (std::string          name          ,
 						 direction_t     direction     ,
 						 uint32_t        size          ,
@@ -79,5 +77,5 @@
   public    :                   ~Signal         ();
 
-  public    : string            get_name                (void);
+  public    : std::string            get_name                (void);
   public    : uint32_t          get_size                (void);
   public    : void              set_size                (uint32_t size);
@@ -184,10 +182,10 @@
 
   public    : void              set_signal      (Vhdl * & vhdl);
-  public    : void              get_name_vhdl   (list<string> * & list_signal);
+  public    : void              get_name_vhdl   (list<std::string> * & list_signal);
 
   public    : void              testbench        (void);
   public    : void              testbench_body   (Vhdl           * & vhdl          ,
-						  string             counter_name  ,
-						  string             reset_name    );
+						  std::string             counter_name  ,
+						  std::string             reset_name    );
   public    : void              testbench_test_ok(Vhdl           * & vhdl          );
 #  endif
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Stat.h
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Stat.h	(revision 71)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Stat.h	(revision 71)
@@ -0,0 +1,98 @@
+#ifdef STATISTICS
+#ifndef morpheo_behavioural_Stat_h
+#define morpheo_behavioural_Stat_h
+
+#include "Behavioural/include/Parameters_Statistics.h"
+#include "Behavioural/include/Stat_type.h"
+#include "Behavioural/include/Stat_binary_tree.h"
+#include "Behavioural/include/XML.h"
+#include "Common/include/ErrorMorpheo.h"
+#include "Common/include/Message.h"
+
+#ifdef SYSTEMC
+#include "systemc.h"
+#endif
+
+#include <stdint.h>
+#include <string>
+#include <map>
+#include <list>
+#include <iostream>
+
+namespace morpheo {
+  namespace behavioural {
+
+    typedef double cycle_t;
+  
+    typedef struct 
+    {
+      counter_type_t type;
+      counter_t *    counter;
+      std::string    name;
+      std::string    unit;
+      std::string    description;
+      std::list<counter_t> save_counter;
+    } var_t;
+  
+    typedef struct 
+    {
+      bool               each_cycle;
+      counter_t        * variable;
+      Stat_binary_tree * expression;
+    } expr_t;
+
+    class Stat
+    {
+      const std::string              _name_instance;
+      const std::string              _name_component;
+      const cycle_t                  _nb_cycle_before_begin;
+      const cycle_t                  _period;
+      const bool                     _save_periodic;
+      // Tableau des variables
+      std::map<std::string, var_t> * _list_operand;
+      // Liste chaîné des expressions
+      std::list<expr_t>            * _list_expr;
+
+      counter_t                    * _cycle;
+
+    public :                     Stat            (std::string name_instance,
+						  std::string name_component,
+						  Parameters_Statistics * param);
+
+    public :                     Stat            (std::string name_instance,
+						  std::string name_component,
+						  cycle_t nb_cycle_before_begin=0,
+						  cycle_t period=0);
+    public :                    ~Stat            (void);
+     
+    public  : counter_t *        create_variable (std::string varname);
+    public  : counter_t *        create_counter  (std::string varname,
+						  std::string unit,
+						  std::string description);
+    private : counter_t *        alloc_operand   (counter_type_t type,
+						  std::string varname,
+						  std::string unit,
+						  std::string description);
+    public  : void               create_expr     (std::string varname,
+						  std::string expr,
+						  bool each_cycle=true);
+
+    private : Stat_binary_tree * string2tree     (std::string expr);
+
+    public  : void               end_cycle       (void);
+    private : void               end_simulation  (void);
+    private : void               test_and_save   (bool force_save=false);
+    private : void               eval_exprs      (bool only_each_cycle=true);
+    private : void               eval_expr       (expr_t expr);
+      
+    private : bool               is_valid_var    (std::string expr);
+
+    private : void               generate_file   (void);
+
+    public  : std::string        print           (uint32_t depth=0);
+    };
+
+  };
+};
+#endif
+#endif
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Stat_binary_tree.h
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Stat_binary_tree.h	(revision 71)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Stat_binary_tree.h	(revision 71)
@@ -0,0 +1,62 @@
+#ifdef STATISTICS
+#ifndef morpheo_behavioural_Stat_binary_tree_h
+#define morpheo_behavioural_Stat_binary_tree_h
+
+#include "Behavioural/include/Stat_type.h"
+#include "Common/include/ErrorMorpheo.h"
+#include "Common/include/Message.h"
+#include <string>
+#include <map>
+#include <list>
+#include <iostream>
+
+namespace morpheo {
+namespace behavioural {
+
+  typedef enum {VARIABLE, CONSTANT, OPERATOR_UNARY, OPERATOR_BINARY} data_type_t;
+
+  typedef union 
+  {
+    counter_t   cst;
+    counter_t * var;
+    operator_t  op;
+  } data_t;
+
+class Stat_binary_tree
+  {
+    // arbre binaire
+    private : Stat_binary_tree * _root;
+    private : Stat_binary_tree * _left;
+    private : Stat_binary_tree * _right;
+    private : data_type_t        _data_type;
+    private : data_t             _data;
+    
+    /*     private :  Stat_binary_tree (data_type_t data_type, data_t data); */
+    public  :  Stat_binary_tree (counter_t   cst);
+    public  :  Stat_binary_tree (counter_t * var);
+    public  :  Stat_binary_tree (operator_t  op );
+  
+    public  : ~Stat_binary_tree (void);
+    
+    private : void               insert_tree (Stat_binary_tree * tree);
+    public  : Stat_binary_tree * insert_tree (counter_t   cst);
+    public  : Stat_binary_tree * insert_tree (counter_t * var);
+    public  : Stat_binary_tree * insert_tree (operator_t  op );
+
+    public  : Stat_binary_tree * goto_top_level (void);
+    public  : Stat_binary_tree * goto_next_root (void);
+
+    public  : bool      valid    (void);
+
+    public  : counter_t eval     (void);
+
+    private : counter_t val_tree (void);
+    private : counter_t val_leaf (void);
+    private : bool      is_leaf  (void);
+
+//     public  : friend std::ostream& operator<< (std::ostream&, const morpheo::Stat_binary_tree &);
+  };
+};
+};
+#endif
+#endif
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Stat_type.h
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Stat_type.h	(revision 71)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Stat_type.h	(revision 71)
@@ -0,0 +1,24 @@
+#ifdef STATISTICS
+#ifndef morpheo_behavioural_Stat_type_h
+#define morpheo_behavioural_Stat_type_h
+
+#include <string>
+#include <map>
+#include <utility>
+
+namespace morpheo {
+namespace behavioural {
+
+  typedef enum{TYPE_VARIABLE, TYPE_COUNTER} counter_type_t;
+
+  typedef double counter_t ;
+
+  typedef enum{add, sub, mul, div, inc, dec} operator_t;
+
+//typedef std::pair<operator_t, std::string> pair_operator_string_t;
+//typedef std::pair<std::string, operator_t> pair_string_operator_t;
+
+};
+};
+#endif
+#endif
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Statistics.h
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Statistics.h	(revision 69)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Statistics.h	(revision 71)
@@ -18,6 +18,4 @@
 #include "Common/include/Percent.h"
 
-using namespace std;
-
 namespace morpheo              {
 namespace behavioural          {
@@ -26,5 +24,5 @@
   {
     // -----[ fields ]----------------------------------------------------
-  protected : const string                  _name;
+  protected : const std::string                  _name;
   protected : const Parameters_Statistics * _parameters_statistics;
 
@@ -33,5 +31,5 @@
 
     // -----[ methods ]---------------------------------------------------
-  public    :                  Statistics          (string                  name                 ,
+  public    :                  Statistics          (std::string                  name                 ,
 						    Parameters_Statistics * parameters_statistics);
   public    : virtual          ~Statistics         ();
@@ -40,7 +38,7 @@
   protected : uint32_t         compute_cycle_end   (uint32_t num_statistics, uint32_t nb_cycle);
 
-  public    : virtual string   print_body          (uint32_t depth) = 0;
-  public    : virtual string   print               (uint32_t depth) = 0;
-  public    : void             generate_file       (string   stat );
+  public    : virtual std::string   print_body          (uint32_t depth) = 0;
+  public    : virtual std::string   print               (uint32_t depth) = 0;
+  public    : void             generate_file       (std::string   stat );
   public    : void             generate_file       (void);
 
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Vhdl.h
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Vhdl.h	(revision 69)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Vhdl.h	(revision 71)
@@ -20,129 +20,127 @@
 #include "Common/include/ErrorMorpheo.h"
 
-using namespace std;
+namespace morpheo              {
+  namespace behavioural          {
 
-namespace morpheo              {
-namespace behavioural          {
+    std::string std_logic        (uint32_t size);
+    std::string std_logic_conv   (uint32_t size, std::string   value);
+    std::string std_logic_conv   (uint32_t size, uint32_t value);
+    std::string std_logic_range  (uint32_t size, uint32_t max , uint32_t min  );
+    std::string std_logic_range  (uint32_t max , uint32_t min  );
+    std::string std_logic_range  (uint32_t size);
+    std::string std_logic_others (uint32_t size, uint32_t cst  );
 
-  string std_logic        (uint32_t size);
-  string std_logic_conv   (uint32_t size, string   value);
-  string std_logic_conv   (uint32_t size, uint32_t value);
-  string std_logic_range  (uint32_t size, uint32_t max , uint32_t min  );
-  string std_logic_range  (uint32_t max , uint32_t min  );
-  string std_logic_range  (uint32_t size);
-  string std_logic_others (uint32_t size, uint32_t cst  );
+    class Vhdl
+    {
+      // -----[ fields ]----------------------------------------------------
+    private   : const std::string     _name                         ;
 
-  class Vhdl
-  {
-    // -----[ fields ]----------------------------------------------------
-  private   : const string     _name                         ;
+    private   : std::list<std::string>     _list_library_work            ;
+    private   : std::list<std::string>     _list_signal                  ;
+    private   : std::list<std::string>     _list_type                    ;
+    private   : std::list<std::string>     _list_alias                   ;
+    private   : std::list<std::string>     _list_port                    ;
+    private   : std::list<std::string>     _list_body                    ;
 
-  private   : list<string>     _list_library_work            ;
-  private   : list<string>     _list_signal                  ;
-  private   : list<string>     _list_type                    ;
-  private   : list<string>     _list_alias                   ;
-  private   : list<string>     _list_port                    ;
-  private   : list<string>     _list_body                    ;
-    
-    // -----[ methods ]---------------------------------------------------
-  public    :                  Vhdl                        (string name);
-  public    :                  ~Vhdl                       ();
-						           
-  public    : void             generate_file               (void);
-  public    : void             generate_file               (bool generate_package,
-							    bool generate_model  );
+      // -----[ methods ]---------------------------------------------------
+    public    :                  Vhdl                        (std::string name);
+    public    :                  ~Vhdl                       ();
 
-  private   : void             generate_file_package       (void);
-  private   : void             generate_file_model         (void);
-  
-  private   : string           get_package                 (uint32_t    depth                 ,
-							    string      filename              ,
-							    string      package_name          ,
-							    string      entity_name           );
-  private   : string           get_model                   (uint32_t    depth                 ,
-							    string      filename              ,
-							    string      entity_name           ,
-							    string      architecture_name     );
-  private   : string           get_header                  (uint32_t    depth                 ,
-							    string      filename              );
-  private   : string           get_entity                  (uint32_t    depth                 ,
-							    string      name                  );
-  private   : string           get_architecture            (uint32_t    depth                 , 
-							    string      name                  ,
-							    string      entity_name           );
-  private   : string           get_component               (uint32_t    depth                 ,
-							    string      name                  );
+    public    : void             generate_file               (void);
+    public    : void             generate_file               (bool generate_package,
+							      bool generate_model  );
 
-  private   : string           get_port                    (uint32_t    depth                 );
-  public    : void             set_port                    (string      name                  ,
-							    direction_t direction             ,
-							    string      type                  );
-  public    : void             set_port                    (string      name                  ,
-							    direction_t direction             ,
-							    uint32_t    size                  );
-  private   : string           get_signal                  (uint32_t    depth                 );
-  public    : void             set_signal                  (string      name                  ,
-							    string      type                  );
-  public    : void             set_signal                  (string      name                  ,
-							    uint32_t    signal                );
-  public    : void             set_signal                  (string      name                  ,
-							    string      type                  ,
-							    string      init                  );
-  public    : void             set_signal                  (string      name                  ,
-							    uint32_t    size                  ,
-							    string      init                  );
-  public    : void             set_signal                  (string      name                  ,
-							    uint32_t    size                  ,
-							    uint32_t    init                  );
-  public    : void             set_constant                (string      name                  ,
-							    string      type                  ,
-							    string      init                  );
-  public    : void             set_constant                (string      name                  ,
-							    uint32_t    size                  ,
-							    string      init                  );
-  public    : void             set_constant                (string      name                  ,
-							    uint32_t    size                  ,
-							    uint32_t    init                  );
+    private   : void             generate_file_package       (void);
+    private   : void             generate_file_model         (void);
 
-  private   : string           get_type                    (uint32_t    depth                 );
-  public    : void             set_type                    (string      name                  ,
-							    string      type                  );
-  private   : string           get_alias                   (uint32_t    depth                 );
-  public    : void             set_alias                   (string      name1                 ,
-							    string      type1                 ,
-							    string      name2                 ,
-							    string      range2                );
-  public    : void             set_alias                   (string      name1                 ,
-							    uint32_t    size1                 ,
-							    string      name2                 ,
-							    string      range2                );
+    private   : std::string           get_package                 (uint32_t    depth                 ,
+								   std::string      filename              ,
+								   std::string      package_name          ,
+								   std::string      entity_name           );
+    private   : std::string           get_model                   (uint32_t    depth                 ,
+								   std::string      filename              ,
+								   std::string      entity_name           ,
+								   std::string      architecture_name     );
+    private   : std::string           get_header                  (uint32_t    depth                 ,
+								   std::string      filename              );
+    private   : std::string           get_entity                  (uint32_t    depth                 ,
+								   std::string      name                  );
+    private   : std::string           get_architecture            (uint32_t    depth                 , 
+								   std::string      name                  ,
+								   std::string      entity_name           );
+    private   : std::string           get_component               (uint32_t    depth                 ,
+								   std::string      name                  );
 
-  public    : string           get_list                    (list<string> liste                ,
-							    uint32_t     depth                ,
-							    string       separator            ,
-							    bool         last_separator       );
-  public    : void             set_list                    (list<string> & liste              ,
-							    string         text               );
+    private   : std::string           get_port                    (uint32_t    depth                 );
+    public    : void             set_port                    (std::string      name                  ,
+							      direction_t direction             ,
+							      std::string      type                  );
+    public    : void             set_port                    (std::string      name                  ,
+							      direction_t direction             ,
+							      uint32_t    size                  );
+    private   : std::string           get_signal                  (uint32_t    depth                 );
+    public    : void             set_signal                  (std::string      name                  ,
+							      std::string      type                  );
+    public    : void             set_signal                  (std::string      name                  ,
+							      uint32_t    signal                );
+    public    : void             set_signal                  (std::string      name                  ,
+							      std::string      type                  ,
+							      std::string      init                  );
+    public    : void             set_signal                  (std::string      name                  ,
+							      uint32_t    size                  ,
+							      std::string      init                  );
+    public    : void             set_signal                  (std::string      name                  ,
+							      uint32_t    size                  ,
+							      uint32_t    init                  );
+    public    : void             set_constant                (std::string      name                  ,
+							      std::string      type                  ,
+							      std::string      init                  );
+    public    : void             set_constant                (std::string      name                  ,
+							      uint32_t    size                  ,
+							      std::string      init                  );
+    public    : void             set_constant                (std::string      name                  ,
+							      uint32_t    size                  ,
+							      uint32_t    init                  );
 
-  private   : string           get_body                    (uint32_t       depth              );
-  public    : void             set_body                    (string         text               );
+    private   : std::string           get_type                    (uint32_t    depth                 );
+    public    : void             set_type                    (std::string      name                  ,
+							      std::string      type                  );
+    private   : std::string           get_alias                   (uint32_t    depth                 );
+    public    : void             set_alias                   (std::string      name1                 ,
+							      std::string      type1                 ,
+							      std::string      name2                 ,
+							      std::string      range2                );
+    public    : void             set_alias                   (std::string      name1                 ,
+							      uint32_t    size1                 ,
+							      std::string      name2                 ,
+							      std::string      range2                );
 
-  public    : void             set_body_component          (string         name_instance      ,
-							    string         name_component     ,
-							    list<string>   list_port_map      );
-  public    : void             set_body_component_port_map (list<string> & list_port_map      ,
-							    string         name_port          ,
-							    uint32_t       size_port          ,
-							    string         name_signal        ,
-							    uint32_t       size_signal        );
+    public    : std::string           get_list                    (std::list<std::string> liste                ,
+								   uint32_t     depth                ,
+								   std::string       separator            ,
+								   bool         last_separator       );
+    public    : void             set_list                    (std::list<std::string> & liste              ,
+							      std::string         text               );
 
-  private   : string           get_library_ieee            (uint32_t    depth                 );
-  private   : string           get_library_work            (uint32_t    depth                 );
-  public    : void             set_library_work            (string      package_name          );
+    private   : std::string           get_body                    (uint32_t       depth              );
+    public    : void             set_body                    (std::string         text               );
 
-  private   : string           direction_toString          (direction_t direction);
-  };
+    public    : void        set_body_component          (std::string         name_instance      ,
+							 std::string         name_component     ,
+							 std::list<std::string>   list_port_map      );
+    public    : void        set_body_component_port_map (std::list<std::string> & list_port_map      ,
+							 std::string         name_port          ,
+							 uint32_t       size_port          ,
+							 std::string         name_signal        ,
+							 uint32_t       size_signal        );
 
-}; // end namespace behavioural          
+    private   : std::string get_library_ieee            (uint32_t    depth                 );
+    private   : std::string get_library_work            (uint32_t    depth                 );
+    public    : void        set_library_work            (std::string      package_name          );
+
+    private   : std::string direction_toString          (direction_t direction);
+    };
+
+  }; // end namespace behavioural          
 }; // end namespace morpheo              
 
Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/include/XML.h
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/include/XML.h	(revision 69)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/include/XML.h	(revision 71)
@@ -16,6 +16,4 @@
 #include "Common/include/Debug.h"
 
-using namespace std;
-
 namespace morpheo     {
 namespace behavioural {
@@ -25,37 +23,37 @@
   {
     // -----[ fields ]----------------------------------------------------
-  private  : const string     _name              ;
-  private  : string           _filename_extension;
-  private  : string           _body              ;
-  private  : list<string>     _list_balise_name  ;
+  private  : const std::string     _name              ;
+  private  : std::string           _filename_extension;
+  private  : std::string           _body              ;
+  private  : std::list<std::string>     _list_balise_name  ;
 
     // -----[ methods ]---------------------------------------------------
-  public   :                  XML                 (string name);
+  public   :                  XML                 (std::string name);
   public   :                  ~XML                (void);
 	
-  public   : bool             balise_open         (string name); // no attribut
-  public   : bool             balise_open_begin   (string name);
+  public   : bool             balise_open         (std::string name); // no attribut
+  public   : bool             balise_open_begin   (std::string name);
   public   : bool             balise_open_end     (void);      
   public   : bool             balise_close        (void);      
-  public   : bool             singleton           (string name); // no attribut
-  public   : bool             singleton_begin     (string name);
+  public   : bool             singleton           (std::string name); // no attribut
+  public   : bool             singleton_begin     (std::string name);
   public   : bool             singleton_end       (void);
-  public   : bool             attribut            (string name, string value);
+  public   : bool             attribut            (std::string name, std::string value);
   public   : bool             insert_XML          (XML    xml );
 
-  public   : void             filename_extension  (string extension);
+  public   : void             filename_extension  (std::string extension);
   public   : void             generate_file       (void);
-  public   : void             generate_file       (string encoding);
-  public   : string           get_body            (void);
-  public   : string           get_body            (uint32_t depth);
+  public   : void             generate_file       (std::string encoding);
+  public   : std::string           get_body            (void);
+  public   : std::string           get_body            (uint32_t depth);
 
-  public   : bool             comment             (string text);
-  public   : bool             text                (string text);
+  public   : bool             comment             (std::string text);
+  public   : bool             text                (std::string text);
 					          
-  private  : string           indent              (uint32_t depth );
-  private  : string           indent              (void);
+  private  : std::string           indent              (uint32_t depth );
+  private  : std::string           indent              (void);
   private  : uint32_t         depth               (void);
 					          
-  private  : void             header              (string encoding);
+  private  : void             header              (std::string encoding);
   };
 }; // end namespace behavioural          
