Index: soft/giet_vm/applications/classif/main.c
===================================================================
--- soft/giet_vm/applications/classif/main.c	(revision 548)
+++ soft/giet_vm/applications/classif/main.c	(revision 549)
@@ -34,16 +34,16 @@
 //
 // Initialisation is done in three steps by the "load" & "store" tasks:
-// - Task "load" in cluster[0][0] initialises the heaps in all clusters. Other tasks
-//   are waiting on the global_sync synchronisation variable.
-// - Then task "load" in cluster[0][0] initialises the barrier between all "load"
-//   tasks, allocates NIC & CMA RX channel, and starts the NIC_CMA RX transfer.
-//   Other "load" tasks are waiting on the load_sync synchronisation variable.
-//   Task "store" in cluster[0][0] initialises the barrier between all "store" tasks,
-//   allocates NIC & CMA TX channels, and starts the NIC_CMA TX transfer.
-//   Other "store" tasks are waiting on the store_sync synchronisation variable.
-// - When this global initialisation is completed, the "load" task in all clusters
-//   allocates the working containers and the MWMR fifos descriptors from the
-//   user local heap. In each cluster, the "analyse" and "store" tasks are waiting
-//   the local initialisation completion on the local_sync[x][y] variables.
+// 1) Task "load" in cluster[0][0] initialises the heaps in all clusters. Other tasks
+//    are waiting on the global_sync synchronisation variable.
+// 2) Then task "load" in cluster[0][0] initialises the barrier between all "load"
+//    tasks, allocates NIC & CMA RX channel, and starts the NIC_CMA RX transfer.
+//    Other "load" tasks are waiting on the load_sync synchronisation variable.
+//    Task "store" in cluster[0][0] initialises the barrier between all "store" tasks,
+//    allocates NIC & CMA TX channels, and starts the NIC_CMA TX transfer.
+//    Other "store" tasks are waiting on the store_sync synchronisation variable.
+// 3) When this global initialisation is completed, the "load" task in all clusters
+//    allocates the working containers and the MWMR fifos descriptors from the
+//    user local heap. In each cluster, the "analyse" and "store" tasks are waiting
+//    the local initialisation completion on the local_sync[x][y] variables.
 //
 // When initialisation is completed, all tasks loop on containers:
@@ -82,6 +82,5 @@
 // The MWMR channels (descriptors and buffers), as well as the working containers 
 // used by the "analysis" tasks are distributed in clusters.
-// But the pointers on these distributed structures are shared arrays
-// stored in cluster[0][0].
+// But the pointers on these distributed structures are stored in cluster[0][0].
 ///////////////////////////////////////////////////////////////////////////////////////
 
@@ -143,20 +142,22 @@
     if ( (x==0) && (y==0) )
     {
-        giet_shr_printf("\n*** Task load on P[%d][%d][%d] starts at cycle %d\n"
+        giet_tty_alloc();
+
+        giet_tty_printf("\n*** Task load on P[%d][%d][%d] starts at cycle %d\n"
                         "  x_size = %d / y_size = %d / nprocs = %d\n",
                         x , y , l , giet_proctime() , x_size, y_size, nprocs );
 
-    unsigned int xid;  // x cluster coordinate index
-    unsigned int yid;  // y cluster coordinate index
-
-    for ( xid = 0 ; xid < x_size ; xid++ )
-      {
-	for ( yid = 0 ; yid < y_size ; yid++ )
-	  {
-	    heap_init( xid, yid );
-	  }
-      }
+        unsigned int xid;  // x cluster coordinate index
+        unsigned int yid;  // y cluster coordinate index
+
+        for ( xid = 0 ; xid < x_size ; xid++ )
+        {
+	        for ( yid = 0 ; yid < y_size ; yid++ )
+	        {
+	            heap_init( xid, yid );
+	        }
+        }
     
-	global_sync = 1;
+	    global_sync = 1;
 
         sqt_barrier_init( &rx_barrier, x_size , y_size , 1 );
@@ -213,5 +214,5 @@
     // load task[0][0] displays status
     if ( (x==0) && (y==0) )
-    giet_shr_printf("\n*** Task load on P[%d,%d,%d] enters main loop at cycle %d\n"
+    giet_tty_printf("\n*** Task load on P[%d,%d,%d] enters main loop at cycle %d\n"
                     "      nic_rx_channel = %d / nic_tx_channel = %d\n"
                     "      &mwmr_l2a  = %x / &data_l2a  = %x\n"
@@ -248,5 +249,5 @@
 
         if ( (x==0) && (y==0) )
-        giet_shr_printf("\n*** Task load on P[%d,%d,%d] get container %d at cycle %d"
+        giet_tty_printf("\n*** Task load on P[%d,%d,%d] get container %d at cycle %d"
                         " : %d packets / %d words\n",
                         x, y, l, count, giet_proctime(), npackets, nwords );
@@ -298,5 +299,7 @@
     if ( (x==0) && (y==0) )
     {
-        giet_shr_printf("\n*** Task store on P[%d][%d][%d] starts at cycle %d\n"
+        giet_tty_alloc();
+
+        giet_tty_printf("\n*** Task store on P[%d][%d][%d] starts at cycle %d\n"
                         "  x_size = %d / y_size = %d / nprocs = %d\n",
                         x , y , l , giet_proctime() , x_size, y_size, nprocs );
@@ -332,5 +335,5 @@
     // "store" task[0][0] displays status
     if ( (x==0) && (y==0) )
-    giet_shr_printf("\n*** Task store on P[%d,%d,%d] enters main loop at cycle %d\n"
+    giet_tty_printf("\n*** Task store on P[%d,%d,%d] enters main loop at cycle %d\n"
                     "      &mwmr_l2a  = %x\n"
                     "      &mwmr_a2s  = %x\n"
@@ -364,5 +367,5 @@
 
         if ( (x==0) && (y==0) )
-        giet_shr_printf("\n*** Task store on P[%d,%d,%d] get container %d at cycle %d"
+        giet_tty_printf("\n*** Task store on P[%d,%d,%d] get container %d at cycle %d"
                         " : %d packets / %d words\n",
                         x, y, l, count, giet_proctime(), npackets, nwords );
@@ -382,5 +385,5 @@
         giet_nic_tx_stop( nic_tx_channel );
 
-        giet_shr_printf("\n@@@@ Classification Results @@@\n"
+        giet_tty_printf("\n@@@@ Classification Results @@@\n"
                         " - TYPE 0 : %d packets\n"
                         " - TYPE 1 : %d packets\n"
@@ -436,5 +439,7 @@
     if ( (x==0) && (y==0) )
     {
-        giet_shr_printf("\n*** Task analyse on P[%d][%d][%d] starts at cycle %d\n"
+        giet_tty_alloc();
+
+        giet_tty_printf("\n*** Task analyse on P[%d][%d][%d] starts at cycle %d\n"
                         "  x_size = %d / y_size = %d / nprocs = %d\n",
                         x , y , l , giet_proctime() , x_size, y_size, nprocs );
@@ -459,5 +464,5 @@
     // "analyse" task[0][0] display status
     if ( (x==0) && (y==0) )
-    giet_shr_printf("\n*** Task analyse on P[%d,%d,%d] enters main loop at cycle %d\n"
+    giet_tty_printf("\n*** Task analyse on P[%d,%d,%d] enters main loop at cycle %d\n"
                     "       &mwmr_l2a = %x\n"
                     "       &mwmr_a2s = %x\n"
@@ -505,5 +510,5 @@
 
         if ( (x==0) && (y==0) )
-        giet_shr_printf("\n*** Task analyse on P[%d,%d,%d] get container at cycle %d"
+        giet_tty_printf("\n*** Task analyse on P[%d,%d,%d] get container at cycle %d"
                         " : %d packets / %d words\n",
 						x, y, l, giet_proctime(), npackets, nwords );
@@ -552,5 +557,5 @@
 #if VERBOSE_ANALYSE 
         if ( (x==0) && (y==0) )
-        giet_shr_printf("\n*** Task analyse on P[%d,%d,%d] completes at cycle %d\n"
+        giet_tty_printf("\n*** Task analyse on P[%d,%d,%d] completes at cycle %d\n"
                         "   - Packet 0 : plen = %d / dst_mac = %l / src_mac = %l\n"
                         "   - Packet 1 : plen = %d / dst_mac = %l / src_mac = %l\n"
@@ -577,5 +582,6 @@
             
         // pseudo-random delay
-        for( p = 0 ; p < (giet_rand()>>4) ; p++ ) asm volatile ("nop");
+        unsigned int delay = giet_rand()>>3;
+        for( p = 0 ; p < delay ; p++ ) asm volatile ("nop");
 
         // put the working container index to fifo_a2s
