Index: trunk/platforms/tsar_generic_xbar/top.cpp
===================================================================
--- trunk/platforms/tsar_generic_xbar/top.cpp	(revision 465)
+++ trunk/platforms/tsar_generic_xbar/top.cpp	(revision 468)
@@ -151,5 +151,4 @@
 //////////////////////i/////////////////////////////////////
 
-
 #ifdef USE_ALMOS
 #include "almos/hard_config.h"
@@ -157,6 +156,6 @@
 #endif
 #ifdef USE_GIET
+#include "giet_vm/hard_config.h"
 #define PREFIX_OS "giet_vm/"
-#include "giet_vm/hard_config.h"
 #endif
 
@@ -190,5 +189,5 @@
 #ifdef USE_GIET
 #define BDEV_SECTOR_SIZE      512
-#define BDEV_IMAGE_NAME       "giet_vm/display/images.raw"
+#define BDEV_IMAGE_NAME       PREFIX_OS"display/images.raw"
 #endif
 #ifdef USE_ALMOS
@@ -196,5 +195,4 @@
 #define BDEV_IMAGE_NAME       PREFIX_OS"hdd-img.bin"
 #endif
-
 
 #define NIC_RX_NAME           PREFIX_OS"nic/rx_packets.txt"
@@ -212,10 +210,10 @@
 
 #ifdef USE_ALMOS
-#define soft_name PREFIX_OS"bootloader.bin",\
-                  PREFIX_OS"kernel-soclib.bin@0xbfc10000:D",\
-                  PREFIX_OS"arch-info.bib@0xBFC08000:D"
+#define soft_name       PREFIX_OS"bootloader.bin",\
+                        PREFIX_OS"kernel-soclib.bin@0xbfc10000:D",\
+                        PREFIX_OS"arch-info.bib@0xBFC08000:D"
 #endif
 #ifdef USE_GIET
-#define soft_pathname        PREFIX_OS"soft.elf"
+#define soft_pathname   PREFIX_OS"soft.elf"
 #endif
 
@@ -285,7 +283,7 @@
 
 #ifdef USE_GIET
-   char     soft_name[256]   = soft_pathname;          // pathname to binary code
-#endif
-   size_t   ncycles          = 1000000000;         // simulated cycles
+   char     soft_name[256]   = soft_pathname;      // pathname to binary code
+#endif
+   uint64_t ncycles          = 100000000000;       // simulated cycles
    char     disk_name[256]   = BDEV_IMAGE_NAME;    // pathname to the disk image
    char     nic_rx_name[256] = NIC_RX_NAME;        // pathname to the rx packets file
@@ -299,5 +297,5 @@
    uint32_t frozen_cycles    = MAX_FROZEN_CYCLES;  // monitoring frozen processor
    size_t   cluster_io_id    = 0;                  // index of cluster containing IOs
-   struct timeval t1,t2;
+   struct   timeval t1,t2;
    uint64_t ms1,ms2;
 
@@ -541,7 +539,7 @@
    // Horizontal inter-clusters DSPIN signals
    DspinSignals<dspin_cmd_width>*** signal_dspin_h_cmd_inc =
-      alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_h_cmd_inc", XMAX-1, YMAX, 2);
+      alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_h_cmd_inc", XMAX-1, YMAX, 3);
    DspinSignals<dspin_cmd_width>*** signal_dspin_h_cmd_dec =
-      alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_h_cmd_dec", XMAX-1, YMAX, 2);
+      alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_h_cmd_dec", XMAX-1, YMAX, 3);
    DspinSignals<dspin_rsp_width>*** signal_dspin_h_rsp_inc =
       alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_h_rsp_inc", XMAX-1, YMAX, 2);
@@ -551,7 +549,7 @@
    // Vertical inter-clusters DSPIN signals
    DspinSignals<dspin_cmd_width>*** signal_dspin_v_cmd_inc =
-      alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_v_cmd_inc", XMAX, YMAX-1, 2);
+      alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_v_cmd_inc", XMAX, YMAX-1, 3);
    DspinSignals<dspin_cmd_width>*** signal_dspin_v_cmd_dec =
-      alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_v_cmd_dec", XMAX, YMAX-1, 2);
+      alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_v_cmd_dec", XMAX, YMAX-1, 3);
    DspinSignals<dspin_rsp_width>*** signal_dspin_v_rsp_inc =
       alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_v_rsp_inc", XMAX, YMAX-1, 2);
@@ -561,11 +559,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", XMAX, YMAX, 2, 4);
+      alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_false_cmd_in" , XMAX, YMAX, 4, 3);
    DspinSignals<dspin_cmd_width>**** signal_dspin_false_cmd_out =
-      alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_false_cmd_out", XMAX, YMAX, 2, 4);
+      alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_false_cmd_out", XMAX, YMAX, 4, 3);
    DspinSignals<dspin_rsp_width>**** signal_dspin_false_rsp_in =
-      alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_false_rsp_in", XMAX, YMAX, 2, 4);
+      alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_false_rsp_in" , XMAX, YMAX, 4, 2);
    DspinSignals<dspin_rsp_width>**** signal_dspin_false_rsp_out =
-      alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_false_rsp_out", XMAX, YMAX, 2, 4);
+      alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_false_rsp_out", XMAX, YMAX, 4, 2);
 
 
@@ -680,9 +678,12 @@
       for (size_t x = 0; x < (XMAX-1); x++){
          for (size_t y = 0; y < YMAX; y++){
-            for (size_t k = 0; k < 2; k++){
+            for (size_t k = 0; k < 3; k++){
                clusters[x][y]->p_cmd_out[EAST][k]      (signal_dspin_h_cmd_inc[x][y][k]);
                clusters[x+1][y]->p_cmd_in[WEST][k]     (signal_dspin_h_cmd_inc[x][y][k]);
                clusters[x][y]->p_cmd_in[EAST][k]       (signal_dspin_h_cmd_dec[x][y][k]);
                clusters[x+1][y]->p_cmd_out[WEST][k]    (signal_dspin_h_cmd_dec[x][y][k]);
+            }
+
+            for (size_t k = 0; k < 2; k++){
                clusters[x][y]->p_rsp_out[EAST][k]      (signal_dspin_h_rsp_inc[x][y][k]);
                clusters[x+1][y]->p_rsp_in[WEST][k]     (signal_dspin_h_rsp_inc[x][y][k]);
@@ -699,9 +700,12 @@
       for (size_t y = 0; y < (YMAX-1); y++){
          for (size_t x = 0; x < XMAX; x++){
-            for (size_t k = 0; k < 2; k++){
+            for (size_t k = 0; k < 3; k++){
                clusters[x][y]->p_cmd_out[NORTH][k]     (signal_dspin_v_cmd_inc[x][y][k]);
                clusters[x][y+1]->p_cmd_in[SOUTH][k]    (signal_dspin_v_cmd_inc[x][y][k]);
                clusters[x][y]->p_cmd_in[NORTH][k]      (signal_dspin_v_cmd_dec[x][y][k]);
                clusters[x][y+1]->p_cmd_out[SOUTH][k]   (signal_dspin_v_cmd_dec[x][y][k]);
+            }
+
+            for (size_t k = 0; k < 2; k++){
                clusters[x][y]->p_rsp_out[NORTH][k]     (signal_dspin_v_rsp_inc[x][y][k]);
                clusters[x][y+1]->p_rsp_in[SOUTH][k]    (signal_dspin_v_rsp_inc[x][y][k]);
@@ -717,15 +721,18 @@
    for (size_t y = 0; y < YMAX; y++)
    {
+      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_out[WEST][k]       (signal_dspin_false_cmd_out[0][y][WEST][k]);
+         clusters[XMAX-1][y]->p_cmd_in[EAST][k]   (signal_dspin_false_cmd_in[XMAX-1][y][EAST][k]);
+         clusters[XMAX-1][y]->p_cmd_out[EAST][k]  (signal_dspin_false_cmd_out[XMAX-1][y][EAST][k]);
+      }
+
       for (size_t k = 0; k < 2; k++)
       {
-         clusters[0][y]->p_cmd_in[WEST][k]             (signal_dspin_false_cmd_in[0][y][k][WEST]);
-         clusters[0][y]->p_cmd_out[WEST][k]            (signal_dspin_false_cmd_out[0][y][k][WEST]);
-         clusters[0][y]->p_rsp_in[WEST][k]             (signal_dspin_false_rsp_in[0][y][k][WEST]);
-         clusters[0][y]->p_rsp_out[WEST][k]            (signal_dspin_false_rsp_out[0][y][k][WEST]);
-
-         clusters[XMAX-1][y]->p_cmd_in[EAST][k]   (signal_dspin_false_cmd_in[XMAX-1][y][k][EAST]);
-         clusters[XMAX-1][y]->p_cmd_out[EAST][k]  (signal_dspin_false_cmd_out[XMAX-1][y][k][EAST]);
-         clusters[XMAX-1][y]->p_rsp_in[EAST][k]   (signal_dspin_false_rsp_in[XMAX-1][y][k][EAST]);
-         clusters[XMAX-1][y]->p_rsp_out[EAST][k]  (signal_dspin_false_rsp_out[XMAX-1][y][k][EAST]);
+         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[XMAX-1][y]->p_rsp_in[EAST][k]   (signal_dspin_false_rsp_in[XMAX-1][y][EAST][k]);
+         clusters[XMAX-1][y]->p_rsp_out[EAST][k]  (signal_dspin_false_rsp_out[XMAX-1][y][EAST][k]);
       }
    }
@@ -734,15 +741,18 @@
    for (size_t x = 0; x < XMAX; x++)
    {
+      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][YMAX-1]->p_cmd_in[NORTH][k]  (signal_dspin_false_cmd_in[x][YMAX-1][NORTH][k]);
+         clusters[x][YMAX-1]->p_cmd_out[NORTH][k] (signal_dspin_false_cmd_out[x][YMAX-1][NORTH][k]);
+      }
+
       for (size_t k = 0; k < 2; k++)
       {
-         clusters[x][0]->p_cmd_in[SOUTH][k]            (signal_dspin_false_cmd_in[x][0][k][SOUTH]);
-         clusters[x][0]->p_cmd_out[SOUTH][k]           (signal_dspin_false_cmd_out[x][0][k][SOUTH]);
-         clusters[x][0]->p_rsp_in[SOUTH][k]            (signal_dspin_false_rsp_in[x][0][k][SOUTH]);
-         clusters[x][0]->p_rsp_out[SOUTH][k]           (signal_dspin_false_rsp_out[x][0][k][SOUTH]);
-
-         clusters[x][YMAX-1]->p_cmd_in[NORTH][k]  (signal_dspin_false_cmd_in[x][YMAX-1][k][NORTH]);
-         clusters[x][YMAX-1]->p_cmd_out[NORTH][k] (signal_dspin_false_cmd_out[x][YMAX-1][k][NORTH]);
-         clusters[x][YMAX-1]->p_rsp_in[NORTH][k]  (signal_dspin_false_rsp_in[x][YMAX-1][k][NORTH]);
-         clusters[x][YMAX-1]->p_rsp_out[NORTH][k] (signal_dspin_false_rsp_out[x][YMAX-1][k][NORTH]);
+         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][YMAX-1]->p_rsp_in[NORTH][k]  (signal_dspin_false_rsp_in[x][YMAX-1][NORTH][k]);
+         clusters[x][YMAX-1]->p_rsp_out[NORTH][k] (signal_dspin_false_rsp_out[x][YMAX-1][NORTH][k]);
       }
    }
@@ -761,15 +771,17 @@
    for (size_t x = 0; x < XMAX ; x++){
       for (size_t y = 0; y < YMAX ; y++){
-         for (size_t k = 0; k < 2; k++){
-            for (size_t a = 0; a < 4; a++){
-               signal_dspin_false_cmd_in [x][y][k][a].write = false;
-               signal_dspin_false_cmd_in [x][y][k][a].read  = true;
-               signal_dspin_false_cmd_out[x][y][k][a].write = false;
-               signal_dspin_false_cmd_out[x][y][k][a].read  = true;
-
-               signal_dspin_false_rsp_in [x][y][k][a].write = false;
-               signal_dspin_false_rsp_in [x][y][k][a].read  = true;
-               signal_dspin_false_rsp_out[x][y][k][a].write = false;
-               signal_dspin_false_rsp_out[x][y][k][a].read  = true;
+         for (size_t a = 0; a < 4; a++){
+            for (size_t k = 0; k < 3; k++){
+               signal_dspin_false_cmd_in [x][y][a][k].write = false;
+               signal_dspin_false_cmd_in [x][y][a][k].read  = true;
+               signal_dspin_false_cmd_out[x][y][a][k].write = false;
+               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;
+               signal_dspin_false_rsp_in [x][y][a][k].read  = true;
+               signal_dspin_false_rsp_out[x][y][a][k].write = false;
+               signal_dspin_false_rsp_out[x][y][a][k].read  = true;
             }
          }
@@ -786,5 +798,5 @@
    }
 
-   for (size_t n = 1; n < ncycles; n++)
+   for (uint64_t n = 1; n < ncycles; n++)
    {
       // Monitor a specific address for L1 & L2 caches
@@ -811,5 +823,4 @@
          }
       }
-
 
       if (debug_ok and (n > debug_from) and (n % debug_period == 0))
