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 389)
+++ trunk/platforms/tsar_generic_xbar/tsar_xbar_cluster/caba/source/src/tsar_xbar_cluster.cpp	(revision 396)
@@ -15,6 +15,5 @@
 // - Each processor has a private dma channel (vci_multi_dma)
 // - It uses the vci_xicu interrupt controller
-// - The peripherals MTTY, BDEV, FBUF, MNIC and BROM are in the cluster 
-//   containing address 0xBFC00000.
+// - The peripherals MTTY, BDEV, FBUF, MNIC and BROM are in cluster (0,0)
 // - The Multi-TTY component controls up to 15 terminals. 
 // - Each Multi-DMA component controls up to 8 DMA channels.
@@ -26,17 +25,17 @@
 #include "../include/tsar_xbar_cluster.h"
 
-#define tmpl(x) template<\
-   typename iss_t,int cmd_width, int rsp_width> \
-   x TsarXbarCluster<\
-   iss_t, cmd_width, rsp_width\
-   >
 
 namespace soclib {
 namespace caba  {
 
-//////////////////////////////////////////////////////////////////////////
-//                 Constructor
-//////////////////////////////////////////////////////////////////////////
-tmpl(/**/)::TsarXbarCluster(
+////////////////////////////////////////////////////////////////////////////////////
+template<size_t dspin_cmd_width, 
+         size_t dspin_rsp_width,
+         typename vci_param_int,
+         typename vci_param_ext> TsarXbarCluster<dspin_cmd_width,
+                                                 dspin_rsp_width,
+                                                 vci_param_int,
+                                                 vci_param_ext>::TsarXbarCluster(
+////////////////////////////////////////////////////////////////////////////////////
          sc_module_name                     insname,
          size_t                             nb_procs,
@@ -86,19 +85,11 @@
 {
     // Vectors of ports definition
-
-    p_cmd_in        = alloc_elems<DspinInput<cmd_width> >("p_cmd_in", 2, 4);
-    p_cmd_out       = alloc_elems<DspinOutput<cmd_width> >("p_cmd_out", 2, 4);
-    p_rsp_in        = alloc_elems<DspinInput<rsp_width> >("p_rsp_in", 2, 4);
-    p_rsp_out       = alloc_elems<DspinOutput<rsp_width> >("p_rsp_out", 2, 4);
-
+    p_cmd_in        = alloc_elems<DspinInput<dspin_cmd_width> >("p_cmd_in", 2, 4);
+    p_cmd_out       = alloc_elems<DspinOutput<dspin_cmd_width> >("p_cmd_out", 2, 4);
+    p_rsp_in        = alloc_elems<DspinInput<dspin_rsp_width> >("p_rsp_in", 2, 4);
+    p_rsp_out       = alloc_elems<DspinOutput<dspin_rsp_width> >("p_rsp_out", 2, 4);
+
+    /////////////////////////////////////////////////////////////////////////////
     // Components definition 
-
-    // on direct network : local srcid[proc] in [0..nb_procs-1]
-    // on direct network : local srcid[mdma] = nb_procs
-    // on direct network : local srcid[bdev] = nb_procs + 1
-
-    // on coherence network : local srcid[proc] in [0...nb_procs-1]
-    // on coherence network : local srcid[memc] = nb_procs
-
     /////////////////////////////////////////////////////////////////////////////
     std::cout << "  - building proc_" << x_id << "_" << y_id << "-*" << std::endl;
@@ -107,6 +98,9 @@
     { 
         std::ostringstream sproc;
-        sproc << "proc_" << p;
-        proc[p] = new VciCcVCacheWrapper<vci_param_d, cmd_width, rsp_width, iss_t>(
+        sproc << "proc_" << x_id << "_" << y_id << "_" << p;
+        proc[p] = new VciCcVCacheWrapper<vci_param_int,
+                                         dspin_cmd_width,
+                                         dspin_rsp_width, 
+                                         GdbServer<Mips32ElIss> >(
                       sproc.str().c_str(),
                       cluster_id*nb_procs + p,        // GLOBAL PROC_ID
@@ -130,5 +124,7 @@
         std::ostringstream swip;
         swip << "wi_proc_" << x_id << "_" << y_id << p;
-        wi_proc[p] = new VciDspinInitiatorWrapper<vci_param_d,cmd_width,rsp_width>(
+        wi_proc[p] = new VciDspinInitiatorWrapper<vci_param_int,
+                                                  dspin_cmd_width,
+                                                  dspin_rsp_width>(
                      swip.str().c_str(),
                      x_width + y_width + l_width);
@@ -138,6 +134,11 @@
     std::cout << "  - building memc_" << x_id << "_" << y_id << std::endl;
 
-    memc = new VciMemCache<vci_param_d, vci_param_x, rsp_width, cmd_width>(
-                     "memc",
+    std::ostringstream smemc;
+    smemc << "memc_" << x_id << "_" << y_id;
+    memc = new VciMemCache<vci_param_int,
+                           vci_param_ext,
+                           dspin_rsp_width,
+                           dspin_cmd_width>(
+                     smemc.str().c_str(),
                      mtd,                                // Mapping Table direct space
                      mtx,                                // Mapping Table external space
@@ -153,5 +154,7 @@
                      memc_debug_ok );
 
-    wt_memc = new VciDspinTargetWrapper<vci_param_d,cmd_width,rsp_width>(
+    wt_memc = new VciDspinTargetWrapper<vci_param_int,
+                                        dspin_cmd_width,
+                                        dspin_rsp_width>(
                      "wt_memc",
                      x_width + y_width + l_width);
@@ -160,6 +163,8 @@
     std::cout << "  - building xram_" << x_id << "_" << y_id << std::endl;
 
-    xram = new VciSimpleRam<vci_param_x>(
-                     "xram",
+    std::ostringstream sxram;
+    sxram << "xram_" << x_id << "_" << y_id;
+    xram = new VciSimpleRam<vci_param_ext>(
+                     sxram.str().c_str(),
                      IntTab(cluster_id),
                      mtx,
@@ -170,6 +175,8 @@
     std::cout << "  - building xicu_" << x_id << "_" << y_id << std::endl;
 
-    xicu = new VciXicu<vci_param_d>(
-                     "xicu",
+    std::ostringstream sxicu;
+    sxicu << "xicu_" << x_id << "_" << y_id;
+    xicu = new VciXicu<vci_param_int>(
+                     sxicu.str().c_str(),
                      mtd,                               // mapping table
                      IntTab(cluster_id, tgtid_xicu),    // TGTID_D
@@ -179,5 +186,7 @@
                      nb_procs);                         // number of output IRQs
 
-    wt_xicu = new VciDspinTargetWrapper<vci_param_d,cmd_width,rsp_width>(
+    wt_xicu = new VciDspinTargetWrapper<vci_param_int,
+                                        dspin_cmd_width,
+                                        dspin_rsp_width>(
                      "wt_xicu",
                      x_width + y_width + l_width);
@@ -186,6 +195,8 @@
     std::cout << "  - building mdma_" << x_id << "_" << y_id << std::endl;
 
-    mdma = new VciMultiDma<vci_param_d>(
-                     "mdma",
+    std::ostringstream smdma;
+    smdma << "mdma_" << x_id << "_" << y_id;
+    mdma = new VciMultiDma<vci_param_int>(
+                     smdma.str().c_str(),
                      mtd,
                      IntTab(cluster_id, nb_procs),        // SRCID
@@ -194,9 +205,13 @@
                      nb_dmas);                            // number of IRQs
 
-    wt_mdma = new VciDspinTargetWrapper<vci_param_d,cmd_width,rsp_width>(
+    wt_mdma = new VciDspinTargetWrapper<vci_param_int,
+                                        dspin_cmd_width,
+                                        dspin_rsp_width>(
                      "wt_mdma",
                      x_width + y_width + l_width);
 
-    wi_mdma = new VciDspinInitiatorWrapper<vci_param_d,cmd_width,rsp_width>(
+    wi_mdma = new VciDspinInitiatorWrapper<vci_param_int,
+                                           dspin_cmd_width,
+                                           dspin_rsp_width>(
                      "wi_mdma",
                      x_width + y_width + l_width);
@@ -213,5 +228,5 @@
     }
 
-    xbar_cmd_d = new DspinLocalCrossbar<cmd_width>(
+    xbar_cmd_d = new DspinLocalCrossbar<dspin_cmd_width>(
                      "xbar_cmd_d",
                      mtd,                          // mapping table
@@ -227,5 +242,5 @@
     std::cout << "  - building xbar_rsp_d_" << x_id << "_" << y_id << std::endl;
 
-    xbar_rsp_d = new DspinLocalCrossbar<rsp_width>(
+    xbar_rsp_d = new DspinLocalCrossbar<dspin_rsp_width>(
                      "xbar_rsp_d",
                      mtd,                          // mapping table
@@ -241,5 +256,5 @@
     std::cout << "  - building xbar_m2p_c" << x_id << "_" << y_id << std::endl;
 
-    xbar_m2p_c = new DspinLocalCrossbar<cmd_width>(
+    xbar_m2p_c = new DspinLocalCrossbar<dspin_cmd_width>(
                      "xbar_m2p_c",
                      mtd,                          // mapping table
@@ -255,5 +270,5 @@
     std::cout << "  - building xbar_p2m_c_" << x_id << "_" << y_id << std::endl;
 
-    xbar_p2m_c = new DspinLocalCrossbar<rsp_width>(
+    xbar_p2m_c = new DspinLocalCrossbar<dspin_rsp_width>(
                      "xbar_p2m_c",
                      mtd,                          // mapping table
@@ -269,5 +284,5 @@
     std::cout << "  - building router_cmd_" << x_id << "_" << y_id << std::endl;
 
-    router_cmd = new VirtualDspinRouter<cmd_width>(
+    router_cmd = new VirtualDspinRouter<dspin_cmd_width>(
                      "router_cmd",
                      x_id,y_id,                    // coordinate in the mesh
@@ -278,5 +293,5 @@
     std::cout << "  - building router_rsp_" << x_id << "_" << y_id << std::endl;
 
-    router_rsp = new VirtualDspinRouter<rsp_width>(
+    router_rsp = new VirtualDspinRouter<dspin_rsp_width>(
                      "router_rsp",
                      x_id,y_id,                    // coordinates in mesh
@@ -290,11 +305,14 @@
         std::cout << "  - building brom" << std::endl;
 
-        brom = new VciSimpleRam<vci_param_d>(
-                        "brom",
-                        IntTab(cluster_id, tgtid_brom),
-                        mtd,
-                        loader);
-
-        wt_brom = new VciDspinTargetWrapper<vci_param_d,cmd_width,rsp_width>("wt_brom",
+        brom = new VciSimpleRam<vci_param_int>(
+                     "brom",
+                     IntTab(cluster_id, tgtid_brom),
+                     mtd,
+                     loader);
+
+        wt_brom = new VciDspinTargetWrapper<vci_param_int,
+                                            dspin_cmd_width,
+                                            dspin_rsp_width>(
+                     "wt_brom",
                      x_width + y_width + l_width);
 
@@ -302,11 +320,14 @@
         std::cout << "  - building fbuf" << std::endl;
 
-        fbuf = new VciFrameBuffer<vci_param_d>(
-                        "fbuf",
-                        IntTab(cluster_id, tgtid_fbuf),
-                        mtd,
-                        xfb, yfb); 
-
-        wt_fbuf = new VciDspinTargetWrapper<vci_param_d,cmd_width,rsp_width>("wt_fbuf",
+        fbuf = new VciFrameBuffer<vci_param_int>(
+                     "fbuf",
+                     IntTab(cluster_id, tgtid_fbuf),
+                     mtd,
+                     xfb, yfb); 
+
+        wt_fbuf = new VciDspinTargetWrapper<vci_param_int,
+                                            dspin_cmd_width,
+                                            dspin_rsp_width>(
+                     "wt_fbuf",
                      x_width + y_width + l_width);
 
@@ -314,16 +335,23 @@
         std::cout << "  - building bdev" << std::endl;
 
-        bdev = new VciBlockDeviceTsar<vci_param_d>(
-                        "bdev",
-                        mtd,
-                        IntTab(cluster_id, nb_procs+1),
-                        IntTab(cluster_id, tgtid_bdev),
-                        disk_name,
-                        block_size,
-                        64);            // burst size
-
-        wt_bdev = new VciDspinTargetWrapper<vci_param_d,cmd_width,rsp_width>("wt_bdev",
-                     x_width + y_width + l_width);
-        wi_bdev = new VciDspinInitiatorWrapper<vci_param_d,cmd_width,rsp_width>("wi_bdev",
+        bdev = new VciBlockDeviceTsar<vci_param_int>(
+                     "bdev",
+                     mtd,
+                     IntTab(cluster_id, nb_procs+1),
+                     IntTab(cluster_id, tgtid_bdev),
+                     disk_name,
+                     block_size,
+                     64);            // burst size
+
+        wt_bdev = new VciDspinTargetWrapper<vci_param_int,
+                                            dspin_cmd_width,
+                                            dspin_rsp_width>(
+                     "wt_bdev",
+                     x_width + y_width + l_width);
+
+        wi_bdev = new VciDspinInitiatorWrapper<vci_param_int,
+                                               dspin_cmd_width,
+                                               dspin_rsp_width>(
+                     "wi_bdev",
                      x_width + y_width + l_width);
 
@@ -331,15 +359,18 @@
         std::cout << "  - building mnic" << std::endl;
 
-        mnic = new VciMultiNic<vci_param_d>(
-                        "mnic",
-                        IntTab(cluster_id, tgtid_mnic),
-                        mtd,
-                        nic_channels,
-                        nic_rx_name,
-                        nic_tx_name,
-                        0,             // mac_4 address
-                        0 );           // mac_2 address
-
-        wt_mnic = new VciDspinTargetWrapper<vci_param_d,cmd_width,rsp_width>("wt_mnic",
+        mnic = new VciMultiNic<vci_param_int>(
+                     "mnic",
+                     IntTab(cluster_id, tgtid_mnic),
+                     mtd,
+                     nic_channels,
+                     nic_rx_name,
+                     nic_tx_name,
+                     0,             // mac_4 address
+                     0 );           // mac_2 address
+
+        wt_mnic = new VciDspinTargetWrapper<vci_param_int,
+                                            dspin_cmd_width,
+                                            dspin_rsp_width>(
+                     "wt_mnic",
                      x_width + y_width + l_width);
 
@@ -354,13 +385,15 @@
             vect_names.push_back(term_name.str().c_str());
         }
-        mtty = new VciMultiTty<vci_param_d>(
-                        "mtty",
-                        IntTab(cluster_id, tgtid_mtty),
-                        mtd, 
-                        vect_names);
-
-        wt_mtty = new VciDspinTargetWrapper<vci_param_d,cmd_width,rsp_width>("wt_mtty",
-                     x_width + y_width + l_width);
-
+        mtty = new VciMultiTty<vci_param_int>(
+                     "mtty",
+                     IntTab(cluster_id, tgtid_mtty),
+                     mtd, 
+                     vect_names);
+
+        wt_mtty = new VciDspinTargetWrapper<vci_param_int,
+                                            dspin_cmd_width,
+                                            dspin_rsp_width>(
+                     "wt_mtty",
+                     x_width + y_width + l_width);
     }
 
@@ -679,11 +712,5 @@
 } // end constructor
 
-///////////////////////////////////////////////////////////////////////////
-//    destructor
-///////////////////////////////////////////////////////////////////////////
-tmpl(/**/)::~TsarXbarCluster() {}
-}
-}
-
+}}
 
 // Local Variables:
