Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Constants.h
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Constants.h	(revision 88)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Constants.h	(revision 97)
@@ -16,4 +16,6 @@
   [0][19] - SPR_CID
 */
+
+#include "Common/include/ToString.h"
 
 namespace morpheo {
@@ -33,16 +35,19 @@
 
   //=========================================================[ Type ]=====
-#  define TYPE_ALU                                 0x0        // 00000 - unit multiple
-#  define TYPE_SHIFT                               0x1        // 00000 - unit multiple
-#  define TYPE_MOVE                                0x2        // 00000 - unit multiple
-#  define TYPE_TEST                                0x3        // 00000 - unit multiple
-#  define TYPE_MUL                                 0x4        // 00000 - unit multiple
-#  define TYPE_DIV                                 0x5        // 00000 - unit multiple, type optionnal
-#  define TYPE_EXTEND                              0x6        // 00000 - unit multiple, type optionnal
-#  define TYPE_FIND                                0x7        // 00000 - unit multiple, type optionnal
-#  define TYPE_SPECIAL                             0x8        // 00000 - unit uniq
-#  define TYPE_CUSTOM                              0x9        // 00000 - unit uniq    , type optionnal
-#  define TYPE_BRANCH                              0xa        // 00000 - unit multiple
-#  define TYPE_MEMORY                              0xb        // 00000 - unit uniq
+typedef enum
+  {
+    TYPE_ALU                               = 0x0,       // 00000 - unit multiple
+    TYPE_SHIFT                             = 0x1,       // 00000 - unit multiple
+    TYPE_MOVE                              = 0x2,       // 00000 - unit multiple
+    TYPE_TEST                              = 0x3,       // 00000 - unit multiple
+    TYPE_MUL                               = 0x4,       // 00000 - unit multiple
+    TYPE_DIV                               = 0x5,       // 00000 - unit multiple, type optionnal
+    TYPE_EXTEND                            = 0x6,       // 00000 - unit multiple, type optionnal
+    TYPE_FIND                              = 0x7,       // 00000 - unit multiple, type optionnal
+    TYPE_SPECIAL                           = 0x8,       // 00000 - unit uniq
+    TYPE_CUSTOM                            = 0x9,       // 00000 - unit uniq    , type optionnal
+    TYPE_BRANCH                            = 0xa,       // 00000 - unit multiple
+    TYPE_MEMORY                            = 0xb        // 00000 - unit uniq
+  } type_t;
 
 //#define NB_TYPE                                  11
@@ -610,13 +615,48 @@
 
 #  define SIZE_BRANCH_CONDITION                    4
-
-#  define BRANCH_CONDITION_NONE_WITHOUT_WRITE_STACK          0x0        // None condition (jump)
-#  define BRANCH_CONDITION_NONE_WITH_WRITE_STACK             0x8        // None condition (jump)
-#  define BRANCH_CONDITION_FLAG_UNSET                        0x2        // Branch if Flag is clear
-#  define BRANCH_CONDITION_FLAG_SET                          0x3        // Branch if Flag is set
-#  define BRANCH_CONDITION_READ_REGISTER_WITHOUT_WRITE_STACK 0x4        // Branch if a register is read
-#  define BRANCH_CONDITION_READ_REGISTER_WITH_WRITE_STACK    0xc        // Branch if a register is read
-#  define BRANCH_CONDITION_READ_STACK                        0xf        // Branch with pop  in stack pointer
-
+#  define MAX_BRANCH_CONDITION                     (1<<SIZE_BRANCH_CONDITION)
+  typedef enum
+    {
+      BRANCH_CONDITION_NONE_WITHOUT_WRITE_STACK          = 0x0,        // None condition (jump)
+      BRANCH_CONDITION_NONE_WITH_WRITE_STACK             = 0x8,        // None condition (jump)
+      BRANCH_CONDITION_FLAG_UNSET                        = 0x2,        // Branch if Flag is clear
+      BRANCH_CONDITION_FLAG_SET                          = 0x3,        // Branch if Flag is set
+      BRANCH_CONDITION_READ_REGISTER_WITHOUT_WRITE_STACK = 0x4,        // Branch if a register is read
+      BRANCH_CONDITION_READ_REGISTER_WITH_WRITE_STACK    = 0xc,        // Branch if a register is read
+      BRANCH_CONDITION_READ_STACK                        = 0xf         // Branch with pop  in stack pointer
+    } branch_condition_t;
+
+#  define is_branch_condition_valid(x)                           \
+  (( x == BRANCH_CONDITION_NONE_WITHOUT_WRITE_STACK         ) or \
+   ( x == BRANCH_CONDITION_NONE_WITH_WRITE_STACK            ) or \
+   ( x == BRANCH_CONDITION_FLAG_UNSET                       ) or \
+   ( x == BRANCH_CONDITION_FLAG_SET                         ) or \
+   ( x == BRANCH_CONDITION_READ_REGISTER_WITHOUT_WRITE_STACK) or \
+   ( x == BRANCH_CONDITION_READ_REGISTER_WITH_WRITE_STACK   ) or \
+   ( x == BRANCH_CONDITION_READ_STACK                       ))
+
+
+  /*
+enum
+  {
+    BRANCH_TYPE_SEQUENTIAL,
+    BRANCH_TYPE_JUMP,
+    BRANCH_TYPE_CONDITIONNAL,
+    BRANCH_TYPE_REGISTER,
+    BRANCH_TYPE_CALL,
+    BRANCH_TYPE_RETURN,
+    NB_BRANCH_TYPE
+  };
+
+#  define branch_condition_to_type(x)                                   \
+  (x == BRANCH_CONDITION_NONE_WITHOUT_WRITE_STACK         )?BRANCH_TYPE_JUMP: \
+  ((x == BRANCH_CONDITION_NONE_WITH_WRITE_STACK            )?BRANCH_TYPE_CALL: \
+   ((x == BRANCH_CONDITION_FLAG_UNSET                       )?BRANCH_TYPE_CONDITIONNAL: \
+    ((x == BRANCH_CONDITION_FLAG_SET                         )?BRANCH_TYPE_CONDITIONNAL: \
+     ((x == BRANCH_CONDITION_READ_REGISTER_WITHOUT_WRITE_STACK)?BRANCH_TYPE_REGISTER: \
+      ((x == BRANCH_CONDITION_READ_REGISTER_WITH_WRITE_STACK   )?BRANCH_TYPE_CALL: \
+       ((x == BRANCH_CONDITION_READ_STACK                       )?BRANCH_TYPE_RETURN:BRANCH_TYPE_SEQUENTIAL))))));
+  */
+  
   //--------------------------------------------------[ instruction ]-----
 #  define NB_INSTRUCTION                           213        // 92 ORBIS, 30 ORFPX (15 simple, 15 double), 91 ORVDX (38 on byte, 41 on half, 12 independant format)
@@ -991,4 +1031,40 @@
 
 }; // end namespace behavioural
+
+  template<> inline std::string toString<morpheo::behavioural::type_t>(const morpheo::behavioural::type_t& x)
+  {
+    switch (x)
+      {
+      case morpheo::behavioural::TYPE_ALU     : return "ALU"        ;
+      case morpheo::behavioural::TYPE_SHIFT   : return "SHIFT"      ;
+      case morpheo::behavioural::TYPE_MOVE    : return "MOVE"       ;
+      case morpheo::behavioural::TYPE_TEST    : return "TEST"       ;
+      case morpheo::behavioural::TYPE_MUL     : return "MUL"        ;
+      case morpheo::behavioural::TYPE_DIV     : return "DIV"        ;
+      case morpheo::behavioural::TYPE_EXTEND  : return "EXTEND"     ;
+      case morpheo::behavioural::TYPE_FIND    : return "FIND"       ;
+      case morpheo::behavioural::TYPE_SPECIAL : return "SPECIAL"    ;
+      case morpheo::behavioural::TYPE_CUSTOM  : return "CUSTOM"     ;
+      case morpheo::behavioural::TYPE_BRANCH  : return "BRANCH"     ;
+      case morpheo::behavioural::TYPE_MEMORY  : return "MEMORY"     ;
+      default : return "";
+      }
+  };
+
+  template<> inline std::string toString<morpheo::behavioural::branch_condition_t>(const morpheo::behavioural::branch_condition_t& x)
+  {
+    switch (x)
+      {
+      case morpheo::behavioural::BRANCH_CONDITION_NONE_WITHOUT_WRITE_STACK          : return "none_without_write_stack"         ;
+      case morpheo::behavioural::BRANCH_CONDITION_NONE_WITH_WRITE_STACK             : return "none_with_write_stack"            ;
+      case morpheo::behavioural::BRANCH_CONDITION_FLAG_UNSET                        : return "flag_unset"                       ;
+      case morpheo::behavioural::BRANCH_CONDITION_FLAG_SET                          : return "flag_set"                         ;
+      case morpheo::behavioural::BRANCH_CONDITION_READ_REGISTER_WITHOUT_WRITE_STACK : return "read_register_without_write_stack";
+      case morpheo::behavioural::BRANCH_CONDITION_READ_REGISTER_WITH_WRITE_STACK    : return "read_register_with_write_stack"   ;
+      case morpheo::behavioural::BRANCH_CONDITION_READ_STACK                        : return "read_stack"                       ;
+      default : return "";
+      }
+  };
+
 }; // end namespace morpheo              
 
