Index: trunk/platforms/tsar_generic_xbar/top.cpp
===================================================================
--- trunk/platforms/tsar_generic_xbar/top.cpp	(revision 749)
+++ trunk/platforms/tsar_generic_xbar/top.cpp	(revision 752)
@@ -632,5 +632,5 @@
    {
       for (size_t y = 0; y < Y_SIZE ; y++)
-      { 
+      {
 
          sc_uint<vci_address_width> offset;
@@ -676,12 +676,11 @@
    // Mesh boundaries DSPIN signals
    DspinSignals<dspin_cmd_width>**** signal_dspin_false_cmd_in =
-      alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_false_cmd_in" , X_SIZE, Y_SIZE, 4, 3);
+         alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_false_cmd_in" , X_SIZE, Y_SIZE, 4, 3);
    DspinSignals<dspin_cmd_width>**** signal_dspin_false_cmd_out =
-      alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_false_cmd_out", X_SIZE, Y_SIZE, 4, 3);
+         alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_false_cmd_out", X_SIZE, Y_SIZE, 4, 3);
    DspinSignals<dspin_rsp_width>**** signal_dspin_false_rsp_in =
-      alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_false_rsp_in" , X_SIZE, Y_SIZE, 4, 2);
+         alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_false_rsp_in" , X_SIZE, Y_SIZE, 4, 2);
    DspinSignals<dspin_rsp_width>**** signal_dspin_false_rsp_out =
-      alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_false_rsp_out", X_SIZE, Y_SIZE, 4, 2);
-
+         alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_false_rsp_out", X_SIZE, Y_SIZE, 4, 2);
 
    ////////////////////////////
@@ -730,6 +729,6 @@
                 sc.str().c_str(),
                 NB_PROCS_MAX,
-                NB_TTY_CHANNELS,  
-                NB_DMA_CHANNELS, 
+                NB_TTY_CHANNELS,
+                NB_DMA_CHANNELS,
                 x,
                 y,
@@ -772,5 +771,5 @@
                 debug_from,
                 debug_ok and (cluster(x,y) == debug_memc_id),
-                debug_ok and (cluster(x,y) == debug_proc_id) 
+                debug_ok and (cluster(x,y) == debug_proc_id)
             );
 
@@ -815,5 +814,5 @@
       }
    }
-   std::cout << std::endl << "Horizontal connections established" << std::endl;   
+   std::cout << std::endl << "Horizontal connections established" << std::endl;
 
    // Inter Clusters vertical connections
@@ -844,16 +843,16 @@
       for (size_t k = 0; k < 3; k++)
       {
-         clusters[0][y]->p_cmd_in[WEST][k]        (signal_dspin_false_cmd_in[0][y][WEST][k]);
+         clusters[0][y]->p_cmd_in[WEST][k]        (signal_dspin_false_cmd_in [0][y][WEST][k]);
          clusters[0][y]->p_cmd_out[WEST][k]       (signal_dspin_false_cmd_out[0][y][WEST][k]);
-         clusters[X_SIZE-1][y]->p_cmd_in[EAST][k]   (signal_dspin_false_cmd_in[X_SIZE-1][y][EAST][k]);
-         clusters[X_SIZE-1][y]->p_cmd_out[EAST][k]  (signal_dspin_false_cmd_out[X_SIZE-1][y][EAST][k]);
+         clusters[X_SIZE-1][y]->p_cmd_in[EAST][k] (signal_dspin_false_cmd_in [X_SIZE-1][y][EAST][k]);
+         clusters[X_SIZE-1][y]->p_cmd_out[EAST][k](signal_dspin_false_cmd_out[X_SIZE-1][y][EAST][k]);
       }
 
       for (size_t k = 0; k < 2; k++)
       {
-         clusters[0][y]->p_rsp_in[WEST][k]        (signal_dspin_false_rsp_in[0][y][WEST][k]);
+         clusters[0][y]->p_rsp_in[WEST][k]        (signal_dspin_false_rsp_in [0][y][WEST][k]);
          clusters[0][y]->p_rsp_out[WEST][k]       (signal_dspin_false_rsp_out[0][y][WEST][k]);
-         clusters[X_SIZE-1][y]->p_rsp_in[EAST][k]   (signal_dspin_false_rsp_in[X_SIZE-1][y][EAST][k]);
-         clusters[X_SIZE-1][y]->p_rsp_out[EAST][k]  (signal_dspin_false_rsp_out[X_SIZE-1][y][EAST][k]);
+         clusters[X_SIZE-1][y]->p_rsp_in[EAST][k] (signal_dspin_false_rsp_in [X_SIZE-1][y][EAST][k]);
+         clusters[X_SIZE-1][y]->p_rsp_out[EAST][k](signal_dspin_false_rsp_out[X_SIZE-1][y][EAST][k]);
       }
    }
@@ -864,16 +863,16 @@
       for (size_t k = 0; k < 3; k++)
       {
-         clusters[x][0]->p_cmd_in[SOUTH][k]       (signal_dspin_false_cmd_in[x][0][SOUTH][k]);
-         clusters[x][0]->p_cmd_out[SOUTH][k]      (signal_dspin_false_cmd_out[x][0][SOUTH][k]);
-         clusters[x][Y_SIZE-1]->p_cmd_in[NORTH][k]  (signal_dspin_false_cmd_in[x][Y_SIZE-1][NORTH][k]);
-         clusters[x][Y_SIZE-1]->p_cmd_out[NORTH][k] (signal_dspin_false_cmd_out[x][Y_SIZE-1][NORTH][k]);
+         clusters[x][0]->p_cmd_in[SOUTH][k]        (signal_dspin_false_cmd_in [x][0][SOUTH][k]);
+         clusters[x][0]->p_cmd_out[SOUTH][k]       (signal_dspin_false_cmd_out[x][0][SOUTH][k]);
+         clusters[x][Y_SIZE-1]->p_cmd_in[NORTH][k] (signal_dspin_false_cmd_in [x][Y_SIZE-1][NORTH][k]);
+         clusters[x][Y_SIZE-1]->p_cmd_out[NORTH][k](signal_dspin_false_cmd_out[x][Y_SIZE-1][NORTH][k]);
       }
 
       for (size_t k = 0; k < 2; k++)
       {
-         clusters[x][0]->p_rsp_in[SOUTH][k]       (signal_dspin_false_rsp_in[x][0][SOUTH][k]);
-         clusters[x][0]->p_rsp_out[SOUTH][k]      (signal_dspin_false_rsp_out[x][0][SOUTH][k]);
-         clusters[x][Y_SIZE-1]->p_rsp_in[NORTH][k]  (signal_dspin_false_rsp_in[x][Y_SIZE-1][NORTH][k]);
-         clusters[x][Y_SIZE-1]->p_rsp_out[NORTH][k] (signal_dspin_false_rsp_out[x][Y_SIZE-1][NORTH][k]);
+         clusters[x][0]->p_rsp_in[SOUTH][k]        (signal_dspin_false_rsp_in [x][0][SOUTH][k]);
+         clusters[x][0]->p_rsp_out[SOUTH][k]       (signal_dspin_false_rsp_out[x][0][SOUTH][k]);
+         clusters[x][Y_SIZE-1]->p_rsp_in[NORTH][k] (signal_dspin_false_rsp_in [x][Y_SIZE-1][NORTH][k]);
+         clusters[x][Y_SIZE-1]->p_rsp_out[NORTH][k](signal_dspin_false_rsp_out[x][Y_SIZE-1][NORTH][k]);
       }
    }
@@ -899,5 +898,4 @@
                signal_dspin_false_cmd_out[x][y][a][k].read  = true;
             }
-
             for (size_t k = 0; k < 2; k++){
                signal_dspin_false_rsp_in [x][y][a][k].write = false;
@@ -913,4 +911,49 @@
    signal_resetn = true;
 
+#define SC_TRACE
+#ifdef SC_TRACE
+   sc_trace_file * tf = sc_create_vcd_trace_file("my_trace_file");
+
+   if (X_SIZE > 1){
+      for (size_t x = 0; x < (X_SIZE-1); x++){
+         for (size_t y = 0; y < Y_SIZE; y++){
+            for (size_t k = 0; k < 3; k++){
+               signal_dspin_h_cmd_inc[x][y][k].trace(tf, "dspin_h_cmd_inc");
+               signal_dspin_h_cmd_dec[x][y][k].trace(tf, "dspin_h_cmd_dec");
+            }
+
+            for (size_t k = 0; k < 2; k++){
+               signal_dspin_h_rsp_inc[x][y][k].trace(tf, "dspin_h_rsp_inc");
+               signal_dspin_h_rsp_dec[x][y][k].trace(tf, "dspin_h_rsp_dec");
+            }
+         }
+      }
+   }
+
+   if (Y_SIZE > 1) {
+      for (size_t y = 0; y < (Y_SIZE-1); y++){
+         for (size_t x = 0; x < X_SIZE; x++){
+            for (size_t k = 0; k < 3; k++){
+               signal_dspin_v_cmd_inc[x][y][k].trace(tf, "dspin_v_cmd_inc");
+               signal_dspin_v_cmd_dec[x][y][k].trace(tf, "dspin_v_cmd_dec");
+            }
+
+            for (size_t k = 0; k < 2; k++){
+               signal_dspin_v_rsp_inc[x][y][k].trace(tf, "dspin_v_rsp_inc");
+               signal_dspin_v_rsp_dec[x][y][k].trace(tf, "dspin_v_rsp_dec");
+            }
+         }
+      }
+   }
+
+   for (size_t x = 0; x < (X_SIZE); x++){
+      for (size_t y = 0; y < Y_SIZE; y++){
+         std::ostringstream signame;
+         signame << "cluster" << x << "_" << y;
+         clusters[x][y]->trace(tf, signame.str());
+      }
+   }
+#endif
+
    if (debug_ok) {
       #if USE_OPENMP
@@ -932,5 +975,5 @@
          {
 
-            if (gettimeofday(&t2, NULL) != 0) 
+            if (gettimeofday(&t2, NULL) != 0)
             {
                perror("gettimeofday");
@@ -942,5 +985,5 @@
             std::cerr << "platform clock frequency " << (double) 5000000 / (double) (ms2 - ms1) << "Khz" << std::endl;
 
-            if (gettimeofday(&t1, NULL) != 0) 
+            if (gettimeofday(&t1, NULL) != 0)
             {
                perror("gettimeofday");
@@ -966,10 +1009,10 @@
          }
 
-         if (debug_ok and (n > debug_from) and (n % debug_period == 0))
+         if ((n > debug_from) and (n % debug_period == 0))
          {
             std::cout << "****************** cycle " << std::dec << n ;
             std::cout << " ************************************************" << std::endl;
 
-            // trace proc[debug_proc_id] 
+            // trace proc[debug_proc_id]
             size_t l = debug_proc_id % NB_PROCS_MAX ;
             size_t y = (debug_proc_id / NB_PROCS_MAX) % Y_SIZE ;
@@ -992,5 +1035,5 @@
             //clusters[x][y]->signal_dspin_rsp_g2l_d.print_trace("[SIG]G2L RSP");
 
-            // trace memc[debug_memc_id] 
+            // trace memc[debug_memc_id]
             x = debug_memc_id / Y_SIZE;
             y = debug_memc_id % Y_SIZE;
