Index: /trunk/platforms/tsar_generic_xbar/top.cpp
===================================================================
--- /trunk/platforms/tsar_generic_xbar/top.cpp	(revision 618)
+++ /trunk/platforms/tsar_generic_xbar/top.cpp	(revision 619)
@@ -123,5 +123,10 @@
 
 //  cluster index (computed from x,y coordinates)
-#define cluster(x,y)   (y + YMAX * x)
+#ifdef USE_ALMOS
+#  define cluster(x,y)   (y + x * Y_MAX)
+#else
+#  define cluster(x,y)   (y + (x << Y_WIDTH))
+#endif
+
 
 #define min(x, y) (x < y ? x : y)
@@ -173,6 +178,6 @@
 //////////////////////i/////////////////////////////////////
 
-#define XMAX                  CLUSTER_X
-#define YMAX                  CLUSTER_Y
+#define XMAX                  X_SIZE
+#define YMAX                  Y_SIZE
 
 #define XRAM_LATENCY          0
@@ -373,5 +378,5 @@
          if ((strcmp(argv[n], "-NCYCLES") == 0) && (n + 1 < argc))
          {
-            ncycles = atoi(argv[n + 1]);
+            ncycles = (uint64_t) strtol(argv[n + 1], NULL, 0);
          }
          else if ((strcmp(argv[n], "-SOFT") == 0) && (n + 1 < argc))
@@ -391,30 +396,49 @@
          {
             debug_ok = true;
-            debug_from = atoi(argv[n + 1]);
+            debug_from = (uint32_t) strtol(argv[n + 1], NULL, 0);
          }
          else if ((strcmp(argv[n], "-MEMCID") == 0) && (n + 1 < argc))
          {
-            debug_memc_id = atoi(argv[n + 1]);
-            assert((debug_memc_id < (XMAX * YMAX)) && 
+            debug_memc_id = (size_t) strtol(argv[n + 1], NULL, 0);
+
+#ifdef USE_ALMOS
+            assert((debug_memc_id < (XMAX * YMAX)) &&
                    "debug_memc_id larger than XMAX * YMAX" );
+#else
+            size_t x = debug_memc_id >> Y_WIDTH;
+            size_t y = debug_memc_id & ((1<<Y_WIDTH)-1);
+
+            assert( (x <= XMAX) and (y <= YMAX) &&
+                  "MEMCID parameter refers a not valid memory cache");
+#endif
          }
          else if ((strcmp(argv[n], "-PROCID") == 0) && (n + 1 < argc))
          {
-            debug_proc_id = atoi(argv[n + 1]);
+            debug_proc_id = (size_t) strtol(argv[n + 1], NULL, 0);
+
+#ifdef USE_ALMOS
             assert((debug_proc_id < (XMAX * YMAX * NB_PROCS_MAX)) && 
                    "debug_proc_id larger than XMAX * YMAX * NB_PROCS");
+#else
+            size_t cluster_xy = debug_proc_id / NB_PROCS_MAX ;
+            size_t x          = cluster_xy >> Y_WIDTH;
+            size_t y          = cluster_xy & ((1<<Y_WIDTH)-1);
+
+            assert( (x <= XMAX) and (y <= YMAX) &&
+                  "PROCID parameter refers a not valid processor");
+#endif
          }
          else if ((strcmp(argv[n], "-THREADS") == 0) && ((n + 1) < argc))
          {
-            threads_nr = atoi(argv[n + 1]);
+            threads_nr = (ssize_t) strtol(argv[n + 1], NULL, 0);
             threads_nr = (threads_nr < 1) ? 1 : threads_nr;
          }
          else if ((strcmp(argv[n], "-FROZEN") == 0) && (n + 1 < argc))
          {
-            frozen_cycles = atoi(argv[n + 1]);
+            frozen_cycles = (uint32_t) strtol(argv[n + 1], NULL, 0);
          }
          else if ((strcmp(argv[n], "-PERIOD") == 0) && (n + 1 < argc))
          {
-            debug_period = atoi(argv[n + 1]);
+            debug_period = (size_t) strtol(argv[n + 1], NULL, 0);
          }
          else
@@ -513,7 +537,5 @@
 #endif
 
-   // Define parameters depending on mesh size
-   size_t   x_width;
-   size_t   y_width;
+#ifdef USE_ALMOS
 
    if      (XMAX == 1) x_width = 0;
@@ -529,10 +551,20 @@
    else                y_width = 4;
 
-
-#ifdef USE_ALMOS
-   cluster_io_id = 0xbfc00000 >> (vci_address_width - x_width - y_width); // index of cluster containing IOs
 #else
-   cluster_io_id = 0;
-#endif
+
+   size_t x_width = X_WIDTH;
+   size_t y_width = Y_WIDTH;
+
+   assert( (X_WIDTH <= 4) and (Y_WIDTH <= 4) and
+           "Up to 256 clusters");
+
+   assert( (XMAX <= (1 << X_WIDTH)) and (YMAX <= (1 << Y_WIDTH)) and
+           "The X_WIDTH and Y_WIDTH parameter are insufficient");
+
+#endif
+
+
+   // index of cluster containing IOs
+   cluster_io_id = 0x00bfc00000ULL >> (vci_address_width - x_width - y_width);
 
    /////////////////////
Index: /trunk/platforms/tsar_generic_xbar/tsar_xbar_cluster/caba/source/src/tsar_xbar_cluster.cpp
===================================================================
--- /trunk/platforms/tsar_generic_xbar/tsar_xbar_cluster/caba/source/src/tsar_xbar_cluster.cpp	(revision 618)
+++ /trunk/platforms/tsar_generic_xbar/tsar_xbar_cluster/caba/source/src/tsar_xbar_cluster.cpp	(revision 619)
@@ -362,8 +362,8 @@
                      mtd,
                      nic_channels,
+                     mac,             // mac_4 address
+                     0xBABE,          // mac_2 address
                      nic_rx_name,
-                     nic_tx_name,
-                     mac,             // mac_4 address
-                     0xBABE );           // mac_2 address
+                     nic_tx_name);
 
         wt_mnic = new VciDspinTargetWrapper<vci_param_int,
