Index: trunk/platforms/tsar_generic_xbar/tsar_xbar_cluster/caba/source/include/tsar_xbar_cluster.h
===================================================================
--- trunk/platforms/tsar_generic_xbar/tsar_xbar_cluster/caba/source/include/tsar_xbar_cluster.h	(revision 885)
+++ trunk/platforms/tsar_generic_xbar/tsar_xbar_cluster/caba/source/include/tsar_xbar_cluster.h	(revision 1023)
@@ -190,4 +190,5 @@
                      size_t                             y_width,       // y field bits
                      size_t                             l_width,       // l field bits
+                     size_t                             p_width,
                      size_t                             tgtid_memc,
                      size_t                             tgtid_xicu,
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 885)
+++ trunk/platforms/tsar_generic_xbar/tsar_xbar_cluster/caba/source/src/tsar_xbar_cluster.cpp	(revision 1023)
@@ -50,4 +50,5 @@
          size_t                             y_width,
          size_t                             l_width,
+         size_t                             p_width,
          size_t                             tgtid_memc,
          size_t                             tgtid_xicu,
@@ -85,7 +86,5 @@
             : soclib::caba::BaseModule(insname),
             p_clk("clk"),
-            p_resetn("resetn")
-
-{
+            p_resetn("resetn") {
 
     n_procs = nb_procs;
@@ -114,6 +113,5 @@
     /////////////////////////////////////////////////////////////////////////////
 
-    for (size_t p = 0; p < nb_procs; p++)
-    {
+    for (size_t p = 0; p < nb_procs; p++) {
         std::ostringstream sproc;
         sproc << "proc_" << x_id << "_" << y_id << "_" << p;
@@ -123,7 +121,7 @@
                                          GdbServer<Mips32ElIss> >(
                       sproc.str().c_str(),
-                      cluster_id * nb_procs + p,      // GLOBAL PROC_ID
+                      (cluster_id << p_width) + p,    // GLOBAL PROC_ID
                       mtd,                            // Mapping Table
-                      IntTab(cluster_id,p),           // SRCID
+                      IntTab(cluster_id, p),          // SRCID
                       (cluster_id << l_width) + p,    // CC_GLOBAL_ID
                       8,                              // ITLB ways
@@ -205,6 +203,5 @@
     size_t nb_direct_initiators      = nb_procs + 1;
     size_t nb_direct_targets         = 3;
-    if (io)
-    {
+    if (io) {
         nb_direct_initiators         = nb_procs + 3;
         nb_direct_targets            = 10;
@@ -321,6 +318,5 @@
 
     // IO cluster components
-    if (io)
-    {
+    if (io) {
         /////////////////////////////////////////////
         brom = new VciSimpleRom<vci_param_int>(
@@ -371,6 +367,5 @@
         /////////////////////////////////////////////
         std::vector<std::string> vect_names;
-        for (size_t tid = 0; tid < nb_ttys; tid++)
-        {
+        for (size_t tid = 0; tid < nb_ttys; tid++) {
             std::ostringstream term_name;
             term_name <<  "term" << tid;
@@ -406,6 +401,5 @@
 
     // loop on N/S/E/W ports
-    for (size_t i = 0; i < 4; i++)
-    {
+    for (size_t i = 0; i < 4; i++) {
         router_cmd->p_out[i]               (this->p_cmd_out[i]);
         router_cmd->p_in[i]                (this->p_cmd_in[i]);
@@ -469,9 +463,9 @@
     xbar_d->p_to_initiator[nb_procs]         (signal_vci_ini_mdma);
 
-    for (size_t p = 0; p < nb_procs; p++)
+    for (size_t p = 0; p < nb_procs; p++) {
         xbar_d->p_to_initiator[p]            (signal_vci_ini_proc[p]);
-
-    if (io)
-    {
+    }
+
+    if (io) {
         xbar_d->p_to_target[tgtid_mtty]      (signal_vci_tgt_mtty);
         xbar_d->p_to_target[tgtid_brom]      (signal_vci_tgt_brom);
@@ -494,6 +488,7 @@
     xbar_m2p_c->p_global_in                      (signal_dspin_m2p_g2l_c);
     xbar_m2p_c->p_local_in[0]                    (signal_dspin_m2p_memc);
-    for (size_t p = 0; p < nb_procs; p++)
+    for (size_t p = 0; p < nb_procs; p++) {
         xbar_m2p_c->p_local_out[p]               (signal_dspin_m2p_proc[p]);
+    }
 
     std::cout << "  - M2P Coherence crossbar connected" << std::endl;
@@ -505,6 +500,7 @@
     xbar_clack_c->p_global_in                    (signal_dspin_clack_g2l_c);
     xbar_clack_c->p_local_in[0]                  (signal_dspin_clack_memc);
-    for (size_t p = 0; p < nb_procs; p++)
+    for (size_t p = 0; p < nb_procs; p++) {
         xbar_clack_c->p_local_out[p]             (signal_dspin_clack_proc[p]);
+    }
 
     std::cout << "  - Clack Coherence crossbar connected" << std::endl;
@@ -516,6 +512,7 @@
     xbar_p2m_c->p_global_in                      (signal_dspin_p2m_g2l_c);
     xbar_p2m_c->p_local_out[0]                   (signal_dspin_p2m_memc);
-    for (size_t p = 0; p < nb_procs; p++)
+    for (size_t p = 0; p < nb_procs; p++) {
         xbar_p2m_c->p_local_in[p]                (signal_dspin_p2m_proc[p]);
+    }
 
     std::cout << "  - P2M Coherence crossbar connected" << std::endl;
@@ -523,6 +520,5 @@
 
     //////////////////////////////////// Processors
-    for (size_t p = 0; p < nb_procs; p++)
-    {
+    for (size_t p = 0; p < nb_procs; p++) {
         proc[p]->p_clk                      (this->p_clk);
         proc[p]->p_resetn                   (this->p_resetn);
@@ -532,10 +528,9 @@
         proc[p]->p_dspin_clack              (signal_dspin_clack_proc[p]);
 
-        for ( size_t i = 0; i < irq_per_processor; i++)
-        {
+        for ( size_t i = 0; i < irq_per_processor; i++) {
             proc[p]->p_irq[i]               (signal_proc_it[p*irq_per_processor + i]);
         }
-        for ( size_t j = irq_per_processor; j < 6; j++) // 6 = number of irqs in the MIPS
-        {
+        for ( size_t j = irq_per_processor; j < 6; j++) {
+            // 6 = number of irqs in the MIPS
             proc[p]->p_irq[j]               (signal_false);
         }
@@ -549,12 +544,10 @@
     xicu->p_resetn                     (this->p_resetn);
     xicu->p_vci                        (signal_vci_tgt_xicu);
-    for (size_t p = 0; p < nb_procs * irq_per_processor; p++)
-    {
+    for (size_t p = 0; p < nb_procs * irq_per_processor; p++) {
         xicu->p_irq[p]                 (signal_proc_it[p]);
     }
-    for (size_t i = 0; i < 32; i++)
-    {
-        if (io) // I/O cluster
-        {
+    for (size_t i = 0; i < 32; i++) {
+        if (io) {
+            // I/O cluster
             if      (i < 8)                  xicu->p_hwi[i] (signal_false);
             else if (i < (8 + nb_dmas))      xicu->p_hwi[i] (signal_irq_mdma[i - 8]);
@@ -565,6 +558,6 @@
             else                             xicu->p_hwi[i] (signal_irq_bdev);
         }
-        else      // other clusters
-        {
+        else {
+            // other clusters
             if      (i < 8)                  xicu->p_hwi[i] (signal_false);
             else if (i < (8 + nb_dmas))      xicu->p_hwi[i] (signal_irq_mdma[i - 8]);
@@ -601,6 +594,7 @@
     mdma->p_vci_target                 (signal_vci_tgt_mdma);
     mdma->p_vci_initiator              (signal_vci_ini_mdma);
-    for (size_t i = 0; i < nb_dmas; i++)
+    for (size_t i = 0; i < nb_dmas; i++) {
         mdma->p_irq[i]                 (signal_irq_mdma[i]);
+    }
 
     std::cout << "  - MDMA connected" << std::endl;
@@ -608,6 +602,5 @@
     /////////////////////////////// Components in I/O cluster
 
-    if (io)
-    {
+    if (io) {
         // BDEV
         bdev->p_clk                    (this->p_clk);
@@ -630,6 +623,5 @@
         mnic->p_resetn                 (this->p_resetn);
         mnic->p_vci                    (signal_vci_tgt_mnic);
-        for (size_t i = 0; i < nic_channels; i++)
-        {
+        for (size_t i = 0; i < nic_channels; i++) {
             mnic->p_rx_irq[i]          (signal_irq_mnic_rx[i]);
             mnic->p_tx_irq[i]          (signal_irq_mnic_tx[i]);
@@ -643,6 +635,5 @@
         chbuf->p_vci_target             (signal_vci_tgt_chbuf);
         chbuf->p_vci_initiator          (signal_vci_ini_chbuf);
-        for (size_t i = 0; i < chbufdma_channels; i++)
-        {
+        for (size_t i = 0; i < chbufdma_channels; i++) {
             chbuf->p_irq[i]          (signal_irq_chbuf[i]);
         }
@@ -661,6 +652,5 @@
         mtty->p_resetn                 (this->p_resetn);
         mtty->p_vci                    (signal_vci_tgt_mtty);
-        for (size_t i = 0; i < nb_ttys; i++)
-        {
+        for (size_t i = 0; i < nb_ttys; i++) {
             mtty->p_irq[i]             (signal_irq_mtty[i]);
         }
@@ -703,6 +693,5 @@
     dealloc_elems<DspinOutput<dspin_cmd_width> >(p_cla_out, 4);
 
-    for (size_t p = 0; p < n_procs; p++)
-    {
+    for (size_t p = 0; p < n_procs; p++) {
         delete proc[p];
     }
@@ -720,6 +709,5 @@
     delete router_cmd;
     delete router_rsp;
-    if (brom != NULL)
-    {
+    if (brom != NULL) {
         delete brom;
         delete fbuf;
