Index: soft/giet_vm/transpose/main.c
===================================================================
--- soft/giet_vm/transpose/main.c	(revision 295)
+++ soft/giet_vm/transpose/main.c	(revision 307)
@@ -9,5 +9,5 @@
 //
 // - The image size NN must be a power of 2.
-// - The number of clusters containing processors (X_SIZE*Y_SIZE-1) must be a power of 2.
+// - The number of clusters containing processors must be a power of 2.
 // - The number of processors per cluster (NB_PROCS_MAX) must be a power of 2.
 // - The image size NN must be larger or equal to the total number of processor.
@@ -26,5 +26,4 @@
 #define FILE_PATHNAME       "misc/images.raw"   // file pathname on disk
 
-#define VERBOSE_OK          0                   // display a detailed log on TTY  when non zero
 #define INSTRUMENTATION_OK  0                   // display statistcs on TTY when non zero
 
@@ -48,15 +47,4 @@
 unsigned char*  buf_out[32];
 
-// array of heap names 
-// one heap per cluster
-char*        heap_name[32] = { "trsp_heap_0" , "trsp_heap_1" , "trsp_heap_2" , "trsp_heap_3" ,
-                               "trsp_heap_4" , "trsp_heap_5" , "trsp_heap_6" , "trsp_heap_7" ,
-                               "trsp_heap_8" , "trsp_heap_9" , "trsp_heap_10", "trsp_heap_11",
-                               "trsp_heap_12", "trsp_heap_13", "trsp_heap_14", "trsp_heap_15",
-                               "trsp_heap_16", "trsp_heap_17", "trsp_heap_18", "trsp_heap_19",
-                               "trsp_heap_20", "trsp_heap_21", "trsp_heap_22", "trsp_heap_23",
-                               "trsp_heap_24", "trsp_heap_25", "trsp_heap_26", "trsp_heap_27",
-                               "trsp_heap_28", "trsp_heap_29", "trsp_heap_30", "trsp_heap_31" };
-
 // checksum variables 
 unsigned check_line_before[NN];
@@ -76,28 +64,22 @@
 {
 
-    int          file;                                          // file descriptor for images
-    unsigned int l;                                             // line index for loops
-    unsigned int p;                                             // pixel index for loops
-    unsigned int proc_id     = giet_procid();                   // processor id
-    unsigned int nclusters   = X_SIZE*(Y_SIZE-1);               // number of clusters with procs
-    unsigned int lpid        = proc_id % NB_PROCS_MAX;          // local processor id
-    unsigned int cluster_xy  = proc_id / NB_PROCS_MAX;          // cluster index (8 bits format)
-    unsigned int x           = cluster_xy >> Y_WIDTH;           // x coordinate
-    unsigned int y           = cluster_xy & ((1<<Y_WIDTH)-1);   // y coordinate
-    unsigned int ntasks      = nclusters * NB_PROCS_MAX;        // number of tasks
-    unsigned int npixels     = NN * NN;                         // number of pixel per image
-    unsigned int nblocks     = npixels / 512;                   // number of blocks per image
-    unsigned int image       = 0;
- 
-    // cluster_id is a "continuous" index from (0 to nclusters-1) 
-    // for a cluster with coordinates (x,y)
-    unsigned int cluster_id  = (x * (Y_SIZE-1)) + y;               
-
-    // task_id is a "continuous" index (from 0 to ntasks-1
-    // for the the task running on processor[x,y,lpid]
-    unsigned int task_id = (cluster_id * NB_PROCS_MAX) + lpid;
-
-    giet_shr_printf("\n*** Proc [%d,%d,%d] enters main() at cycle %d ***\n", 
-                    x, y, lpid, giet_proctime() );
+    int          file;                                             // file descriptor for images
+    unsigned int l;                                                // line index for loops
+    unsigned int p;                                                // pixel index for loops
+
+    unsigned int proc_id     = giet_procid();                      // processor id
+    unsigned int lpid        = proc_id % NB_PROCS_MAX;             // local processor id
+    unsigned int cluster_xy  = proc_id / NB_PROCS_MAX;             // cluster index (8 bits format)
+    unsigned int x           = cluster_xy >> Y_WIDTH;              // x coordinate
+    unsigned int y           = cluster_xy & ((1<<Y_WIDTH)-1);      // y coordinate
+
+    unsigned int npixels     = NN * NN;                            // number of pixel per image
+    unsigned int nblocks     = npixels / 512;                      // number of blocks per image
+    unsigned int image       = 0;                                  // image counter
+
+    unsigned int nclusters   = X_SIZE * Y_SIZE;                    // number of clusters with procs
+    unsigned int cluster_id  = (x * Y_SIZE) + y;                   // "continuous" cluster index   
+    unsigned int ntasks      = nclusters * NB_PROCS_MAX;           // number of tasks
+    unsigned int task_id     = (cluster_id * NB_PROCS_MAX) +lpid;  // "continuous" task index
 
     // processor [0,0,0] makes parameters checking and barriers initialization
@@ -126,4 +108,5 @@
         giet_shr_printf("\n*** Proc [%d,%d,%d] completes barrier init at cycle %d\n",
                         0, 0, 0, giet_proctime() );
+
         init_ok = 0;
     }
@@ -136,14 +119,14 @@
     // (one buf_in and one buf_out per cluster).
     // Each buffer contains (NN*NN / nclusters) bytes.
-    // They are allocated in the cluster heap by processor with (lpid == 0).
+    // They are allocated in the cluster[x,y] heap by processor[x,y,0]
     if ( lpid == 0 )
     {
-        unsigned int heap_base;
-        giet_vobj_get_vbase( "transpose",
-                             heap_name[cluster_id],
-                             &heap_base );
-
-        buf_in[cluster_id]  = (unsigned char*)heap_base;
-        buf_out[cluster_id] = (unsigned char*)(heap_base + NN*NN/nclusters);
+        // get heap vaddr in cluster[0,0]
+        unsigned int heap_base;         
+        giet_vobj_get_vbase( "transpose", "heap_0_0", &heap_base );
+ 
+        // allocate buffers in cluster[x,y]
+        buf_in[cluster_id]  = ((unsigned char*)heap_base) + (cluster_xy << 20);
+        buf_out[cluster_id] = buf_in[cluster_id] + NN*NN/nclusters;
 
         giet_shr_printf("\n*** Proc [%d,%d,%d] completes buffer allocation at cycle %d\n"
@@ -157,14 +140,14 @@
         file = giet_fat_open( "misc/images.raw", 0);
 
-        giet_assert( (file >= 0), 
-                     "[TRANSPOSE ERROR] cannot open file misc/images.raw");
-
-        giet_shr_printf("\n*** Proc [%d,%d,%d] completes _fat_open at cycle %d\n",
-                            x, y, 0, giet_proctime() ); 
+        if (file < 0)
+        { 
+            giet_shr_printf("[TRANSPOSE ERROR] Processor[%d,%d,%d]"
+                            " cannot open file misc/images.raw",
+                            x, y, lpid );
+            giet_exit(" open() failure");
+        }
     }
 
-    //////////////////////////////////////////////////
-    // all tasks wait buffer allocation completion
-    //////////////////////////////////////////////////
+    ///////////////////////////
     barrier_wait( &barrier_0 );
 
@@ -179,7 +162,4 @@
         if (lpid == 0)
         {
-            giet_shr_printf("\n*** Proc [%d,%d,%d] starts load for image %d at cycle %d\n",
-                           x, y, 0, image, giet_proctime() );
-
             giet_fat_read( file,
                            buf_in[cluster_id],
@@ -193,7 +173,5 @@
         LOAD_END[cluster_id][lpid] = giet_proctime();
 
-        //////////////////////////////////////////////////
-        // all tasks wait buf_in load completion 
-        //////////////////////////////////////////////////
+        ///////////////////////////
         barrier_wait( &barrier_1 );
 
@@ -203,6 +181,4 @@
         // (p,l) are the absolute pixel coordinates in the source image
 
-        giet_shr_printf("\n*** proc [%d,%d,%d] starts transpose for image %d at cycle %d\n", 
-                        x, y, lpid, image, giet_proctime());
 
         TRSP_START[cluster_id][lpid] = giet_proctime();
@@ -223,9 +199,4 @@
         for ( l = first ; l < last ; l++ )
         {
-
-#if VERBOSE_OK
-giet_shr_printf(" - Proc[%d,%d,%d] process line %d\n", x, y, lpid, l );
-#endif
-
             check_line_before[l] = 0;
          
@@ -248,12 +219,13 @@
         }
 
-        giet_shr_printf("\n*** proc [%d,%d,%d] completes transpose for image %d at cycle %d\n", 
-                        x, y, lpid, image, giet_proctime() );
-
+        if ( lpid == 0 )
+        {
+            giet_shr_printf("\n*** proc [%d,%d,0] completes transpose for image %d at cycle %d\n", 
+                        x, y, image, giet_proctime() );
+
+        }
         TRSP_END[cluster_id][lpid] = giet_proctime();
 
-        //////////////////////////////////////////////////
-        // all tasks wait transpose completion 
-        //////////////////////////////////////////////////
+        ///////////////////////////
         barrier_wait( &barrier_2 );
 
@@ -261,9 +233,6 @@
         // all processors contribute to display using memcpy...
 
-        if ( ( X_IO != 0) || (Y_IO != 0) )  // external frame buffer available
-        {
-            giet_shr_printf("\n*** proc [%d,%d,%d] starts display for image %d at cycle %d\n", 
-                            x, y, lpid, image, giet_proctime() );
-
+        if ( USE_FBF )  // external frame buffer available
+        {
             DISP_START[cluster_id][lpid] = giet_proctime();
 
@@ -274,12 +243,13 @@
                                 npt );
 
-            giet_shr_printf("\n*** Proc [%d,%d,%d] completes display for image %d at cycle %d\n",
-                            x, y, lpid, image, giet_proctime() );
+            if ( lpid == 0 )
+            {
+                giet_shr_printf("\n*** Proc [%d,%d,0] completes display for image %d at cycle %d\n",
+                                x, y, image, giet_proctime() );
+            }
 
             DISP_END[cluster_id][lpid] = giet_proctime();
 
-            //////////////////////////////////////////////////
-            // all tasks wait display completion 
-            //////////////////////////////////////////////////
+            ///////////////////////////
             barrier_wait( &barrier_3 );
         }
@@ -289,7 +259,4 @@
         if ( lpid == 0 )
         {
-            giet_shr_printf("\n*** Proc [%d,%d,%d] starts checks for image %d at cycle %d\n",
-                            x, y, lpid, image, giet_proctime() );
-
             unsigned int success = 1;
             unsigned int start   = cluster_id * nlc;
@@ -311,8 +278,4 @@
                 }
 
-#if VERBOSE_OK
-giet_shr_printf(" - l = %d / before = %d / after = %d \n",
-                l, check_line_before[l], check_line_after[l] );
-#endif
                 if ( check_line_before[l] != check_line_after[l] ) success = 0;
             }
