Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Allocation.h
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Allocation.h	(revision 139)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Allocation.h	(revision 145)
@@ -14,17 +14,21 @@
 // =====[ ALLOCATION / DELETE of ARRAY ]=================================
 // ======================================================================
-#define ALLOC0(var,type)                        \
+#define ALLOC0_COND(var,type,cond)              \
   do                                            \
     {                                           \
-      var = new type;                           \
-    } while (0)
-
-#define ALLOC1(var,type,s1)                     \
+      if (cond)                                 \
+        var = new type;                         \
+    } while (0)
+
+
+#define ALLOC1_COND(var,type,s1,cond)           \
   do                                            \
     {                                           \
-      var = new type [s1];                      \
-    } while (0)
-
-#define ALLOC2(var,type,s1,s2)                   \
+      if (cond)                                 \
+        var = new type [s1];                    \
+    } while (0)
+
+
+#define ALLOC2_COND(var,type,s1,s2,cond)         \
   do                                             \
     {                                            \
@@ -32,9 +36,10 @@
       for (uint32_t it1=0; it1<s1; ++it1)        \
         {                                        \
-          var [it1] = new type [s2];             \
+          if (cond)                              \
+            var [it1] = new type [s2];           \
         }                                        \
     } while (0)
 
-#define ALLOC3(var,type,s1,s2,s3)                \
+#define ALLOC3_COND(var,type,s1,s2,s3,cond)      \
   do                                             \
     {                                            \
@@ -45,50 +50,62 @@
           for (uint32_t it2=0; it2<s2; ++it2)    \
             {                                    \
-              var [it1][it2] = new type [s3];    \
+              if (cond)                          \
+                var [it1][it2] = new type [s3];  \
             }                                    \
         }                                        \
     } while (0)
 
-#define ALLOC4(var,type,s1,s2,s3,s4)                    \
-  do                                                    \
-    {                                                   \
-      var = new type *** [s1];                          \
-      for (uint32_t it1=0; it1<s1; ++it1)               \
-        {                                               \
-          var [it1] = new type ** [s2];                 \
-          for (uint32_t it2=0; it2<s2; ++it2)           \
-            {                                           \
-              var [it1][it2] = new type * [s3];         \
-              for (uint32_t it3=0; it3<s3; ++it3)       \
-                {                                       \
-                  var [it1][it2][it3] = new type [s4];  \
-                }                                       \
-            }                                           \
-        }                                               \
-    } while (0)
-
-#define DELETE0(var)                            \
+#define ALLOC4_COND(var,type,s1,s2,s3,s4,cond)                  \
+  do                                                            \
+    {                                                           \
+      var = new type *** [s1];                                  \
+      for (uint32_t it1=0; it1<s1; ++it1)                       \
+        {                                                       \
+          var [it1] = new type ** [s2];                         \
+          for (uint32_t it2=0; it2<s2; ++it2)                   \
+            {                                                   \
+              var [it1][it2] = new type * [s3];                 \
+              for (uint32_t it3=0; it3<s3; ++it3)               \
+                {                                               \
+                  if (cond)                                     \
+                    var [it1][it2][it3] = new type [s4];        \
+                }                                               \
+            }                                                   \
+        }                                                       \
+    } while (0)
+
+#define ALLOC0(var,type)             ALLOC0_COND(var,type,true)
+#define ALLOC1(var,type,s1)          ALLOC1_COND(var,type,s1,true)
+#define ALLOC2(var,type,s1,s2)       ALLOC2_COND(var,type,s1,s2,true)
+#define ALLOC3(var,type,s1,s2,s3)    ALLOC3_COND(var,type,s1,s2,s3,true)
+#define ALLOC4(var,type,s1,s2,s3,s4) ALLOC4_COND(var,type,s1,s2,s3,s4,true)
+
+
+#define DELETE0_COND(var,cond)                  \
   do                                            \
     {                                           \
-      delete var;                               \
-    } while (0)
-
-#define DELETE1(var,s1)                         \
+      if (cond)                                 \
+        delete var;                             \
+    } while (0)
+
+#define DELETE1_COND(var,s1,cond)               \
   do                                            \
     {                                           \
-      delete [] var;                            \
-    } while (0)
-
-#define DELETE2(var,s1,s2)                      \
+      if (cond)                                 \
+        delete [] var;                          \
+    } while (0)
+
+#define DELETE2_COND(var,s1,s2,cond)            \
   do                                            \
     {                                            \
       for (uint32_t it1=0; it1<s1; ++it1)        \
         {                                        \
-          delete [] var [it1];                   \
+          if (cond)                              \
+            delete [] var [it1];                 \
         }                                        \
       delete [] var;                             \
     } while (0)
 
-#define DELETE3(var,s1,s2,s3)                    \
+#define DELETE3_COND(var,s1,s2,s3,cond)          \
   do                                             \
     {                                            \
@@ -97,5 +114,6 @@
           for (uint32_t it2=0; it2<s2; ++it2)    \
             {                                    \
-              delete [] var [it1][it2];          \
+              if (cond)                          \
+                delete [] var [it1][it2];        \
             }                                    \
           delete [] var [it1];                   \
@@ -104,5 +122,5 @@
     } while (0)
 
-#define DELETE4(var,s1,s2,s3,s4)                        \
+#define DELETE4_COND(var,s1,s2,s3,s4,cond)              \
   do                                                    \
     {                                                   \
@@ -113,5 +131,6 @@
               for (uint32_t it3=0; it3<s3; ++it3)       \
                 {                                       \
-                  delete [] var [it1][it2][it3];        \
+                  if (cond)                             \
+                    delete [] var [it1][it2][it3];      \
                 }                                       \
               delete [] var [it1][it2];                 \
@@ -121,4 +140,10 @@
       delete [] var;                                    \
     } while (0)
+
+#define DELETE0(var)             DELETE1_COND(var,true)
+#define DELETE1(var,s1)          DELETE1_COND(var,s1,true)
+#define DELETE2(var,s1,s2)       DELETE2_COND(var,s1,s2,true)
+#define DELETE3(var,s1,s2,s3)    DELETE3_COND(var,s1,s2,s3,true)
+#define DELETE4(var,s1,s2,s3,s4) DELETE4_COND(var,s1,s2,s3,s4,true)
 
 // ======================================================================
