Index: trunk/platforms/caba-vdspin-vci_synthetic_initiator/platform_desc
===================================================================
--- trunk/platforms/caba-vdspin-vci_synthetic_initiator/platform_desc	(revision 99)
+++ trunk/platforms/caba-vdspin-vci_synthetic_initiator/platform_desc	(revision 103)
@@ -9,11 +9,13 @@
 		       ring_rsp_data_size = 33,
 		  ),
+		  Uses('caba:vci_simple_ram'),
 		  Uses('caba:virtual_dspin_router', flit_width = 40),
 		  Uses('caba:virtual_dspin_router', flit_width = 33),
+		  Uses('common:loader'),
 	        ],
 		  cell_size = 4,
 		  plen_size = 8,
-		  addr_size = 32,
-		  rerror_size = 2,
+		  addr_size = 40,
+		  rerror_size = 1,
 		  clen_size = 1,
 		  rflag_size = 1,
Index: trunk/platforms/caba-vdspin-vci_synthetic_initiator/top.cpp
===================================================================
--- trunk/platforms/caba-vdspin-vci_synthetic_initiator/top.cpp	(revision 99)
+++ trunk/platforms/caba-vdspin-vci_synthetic_initiator/top.cpp	(revision 103)
@@ -1,3 +1,4 @@
 
+#include <stdint.h>
 #include <systemc>
 #include <sys/time.h>
@@ -6,7 +7,8 @@
 #include <cstdarg>
 
+#include "arithmetics.h"
 #include "mapping_table.h"
 #include "alloc_elems.h"
-//#include "vci_simple_ram.h"
+#include "vci_simple_ram.h"
 //#include "vci_multi_tty.h"
 #include "vci_local_ring_fast.h"
@@ -39,22 +41,24 @@
 
 	// Define VCI parameters
-	typedef soclib::caba::VciParams<4,8,32,1,1,1,8,4,4,1> vci_param;
-
+	typedef soclib::caba::VciParams<4,8,40,1,1,1,8,4,4,1> vci_param;
+
+	
+	soclib::common::Loader loader(NULL);
 	// Mapping table primary network
-
-	soclib::common::MappingTable maptab(32, IntTab(2,10), IntTab(2,3), 0x00C00000);
-
-
-	maptab.add(Segment("mc_r0" , MC0_R_BASE , MC0_R_SIZE , IntTab(0,0), false, true, IntTab(0,0)));
-	maptab.add(Segment("mc_m0" , MC0_M_BASE , MC0_M_SIZE , IntTab(0,0), true ));
-	maptab.add(Segment("mc_r1" , MC1_R_BASE , MC1_R_SIZE , IntTab(1,0), false, true, IntTab(1,0)));
-	maptab.add(Segment("mc_m1" , MC1_M_BASE , MC1_M_SIZE , IntTab(1,0), true ));
-	maptab.add(Segment("mc_r2" , MC2_R_BASE , MC2_R_SIZE , IntTab(2,0), false, true, IntTab(2,0)));
-	maptab.add(Segment("mc_m2" , MC2_M_BASE , MC2_M_SIZE , IntTab(2,0), true ));
-	maptab.add(Segment("mc_r3" , MC3_R_BASE , MC3_R_SIZE , IntTab(3,0), false, true, IntTab(3,0)));
-	maptab.add(Segment("mc_m3" , MC3_M_BASE , MC3_M_SIZE , IntTab(3,0), true ));
-
-	std::cout << maptab << std::endl;
-
+	
+	soclib::common::MappingTable maptab0(40, IntTab(2,10), IntTab(2,3), 0x00C00000);
+	soclib::common::MappingTable maptab1(40, IntTab(2,10), IntTab(2,3), 0x00C00000);
+
+
+	//maptab0.add(Segment("mc_r0" , MC0_R_BASE , MC0_R_SIZE , IntTab(0,0), false, true, IntTab(0,0)));
+	//maptab0.add(Segment("mc_m0" , MC0_M_BASE , MC0_M_SIZE , IntTab(0,0), true ));
+	//maptab0.add(Segment("mc_r1" , MC1_R_BASE , MC1_R_SIZE , IntTab(1,0), false, true, IntTab(1,0)));
+	//maptab0.add(Segment("mc_m1" , MC1_M_BASE , MC1_M_SIZE , IntTab(1,0), true ));
+	//maptab0.add(Segment("mc_r2" , MC2_R_BASE , MC2_R_SIZE , IntTab(2,0), false, true, IntTab(2,0)));
+	//maptab0.add(Segment("mc_m2" , MC2_M_BASE , MC2_M_SIZE , IntTab(2,0), true ));
+	//maptab0.add(Segment("mc_r3" , MC3_R_BASE , MC3_R_SIZE , IntTab(3,0), false, true, IntTab(3,0)));
+	//maptab0.add(Segment("mc_m3" , MC3_M_BASE , MC3_M_SIZE , IntTab(3,0), true ));
+
+	std::cout << maptab0 << std::endl;
 	// Signals
 
@@ -62,14 +66,14 @@
 	sc_signal<bool> signal_resetn("resetn");
    
-	soclib::caba::VciSignals<vci_param> * signal_vci_ini_synth_c0 = soclib::common::alloc_elems<soclib::caba::VciSignals<vci_param> >("signal_vci_ini_synth", N_CLUSTERS);
-	soclib::caba::VciSignals<vci_param> * signal_vci_ini_synth_c1 = soclib::common::alloc_elems<soclib::caba::VciSignals<vci_param> >("signal_vci_ini_synth", N_CLUSTERS);
+	soclib::caba::VciSignals<vci_param> ** signal_vci_ini_synth_c0 = soclib::common::alloc_elems<soclib::caba::VciSignals<vci_param> >("signal_vci_ini_synth", 2, N_CLUSTERS);
+	soclib::caba::VciSignals<vci_param> ** signal_vci_ini_synth_c1 = soclib::common::alloc_elems<soclib::caba::VciSignals<vci_param> >("signal_vci_ini_synth", 2, N_CLUSTERS);
 	///////////////////////////////////////////////////////////////
 	// VDSPIN Signals : one level for in and out, one level for X length in the mesh, 
 	//                  one level for Y length in the mesh, last level for each port of the router
 	///////////////////////////////////////////////////////////////
-	soclib::caba::DspinSignals<WIDTH_CMD> **** dspin_signals_cmd_c0 = soclib::common::alloc_elems<solib::caba::DspinSignals<WIDTH_CMD> >("Dspin_cmd_signals_channel_0", 2, Y_MAX, X_MAX, 5 );
-	soclib::caba::DspinSignals<WIDTH_CMD> **** dspin_signals_cmd_c1 = soclib::common::alloc_elems<solib::caba::DspinSignals<WIDTH_CMD> >("Dspin_cmd_signals_channel_1", 2, Y_MAX, X_MAX, 5 );
-	soclib::caba::DspinSignals<WIDTH_RSP> **** dspin_signals_rsp_c0 = soclib::common::alloc_elems<solib::caba::DspinSignals<WIDTH_RSP> >("Dspin_rsp_signals_channel_0", 2, Y_MAX, X_MAX, 5 );
-	soclib::caba::DspinSignals<WIDTH_RSP> **** dspin_signals_rsp_c1 = soclib::common::alloc_elems<solib::caba::DspinSignals<WIDTH_RSP> >("Dspin_rsp_signals_channel_2", 2, Y_MAX, X_MAX, 5 );
+	soclib::caba::DspinSignals<WIDTH_CMD> **** dspin_signals_cmd_c0 = soclib::common::alloc_elems<soclib::caba::DspinSignals<WIDTH_CMD> >("Dspin_cmd_signals_channel_0", 2, Y_MAX, X_MAX, 5 );
+	soclib::caba::DspinSignals<WIDTH_CMD> **** dspin_signals_cmd_c1 = soclib::common::alloc_elems<soclib::caba::DspinSignals<WIDTH_CMD> >("Dspin_cmd_signals_channel_1", 2, Y_MAX, X_MAX, 5 );
+	soclib::caba::DspinSignals<WIDTH_RSP> **** dspin_signals_rsp_c0 = soclib::common::alloc_elems<soclib::caba::DspinSignals<WIDTH_RSP> >("Dspin_rsp_signals_channel_0", 2, Y_MAX, X_MAX, 5 );
+	soclib::caba::DspinSignals<WIDTH_RSP> **** dspin_signals_rsp_c1 = soclib::common::alloc_elems<soclib::caba::DspinSignals<WIDTH_RSP> >("Dspin_rsp_signals_channel_2", 2, Y_MAX, X_MAX, 5 );
 
 	//soclib::caba::VciSignals<vci_param> * signal_vci_tgt_proc  = soclib::common::alloc_elems<soclib::caba::VciSignals<vci_param> >("signal_vci_tgt_proc",  N_CLUSTERS);
@@ -77,11 +81,8 @@
 	// N_CLUSTERS ring.
 	soclib::caba::VciLocalRingFast<vci_param, WIDTH_CMD, WIDTH_RSP> * local_ring_c0 = (soclib::caba::VciLocalRingFast<vci_param, WIDTH_CMD, WIDTH_RSP> *) malloc(sizeof(soclib::caba::VciLocalRingFast<vci_param, WIDTH_CMD, WIDTH_RSP> ) * N_CLUSTERS) ;
-	for(int i = 0 ; i < N_CLUSTERS ; i++){                                                            // ringid, fifo, fifo, nb_init, nb_tgt
-		new(&local_ring_c0[i]) soclib::caba::VciLocalRingFast<vci_param, WIDTH_CMD, WIDTH_RSP> ("cluster_c0" + i,maptab, IntTab(i), 2, 18, 1, 1)
-	}
-
 	soclib::caba::VciLocalRingFast<vci_param, WIDTH_CMD, WIDTH_RSP> * local_ring_c1 = (soclib::caba::VciLocalRingFast<vci_param, WIDTH_CMD, WIDTH_RSP> *) malloc(sizeof(soclib::caba::VciLocalRingFast<vci_param, WIDTH_CMD, WIDTH_RSP> ) * N_CLUSTERS) ;
 	for(int i = 0 ; i < N_CLUSTERS ; i++){                                                            // ringid, fifo, fifo, nb_init, nb_tgt
-		new(&local_ring_c1[i]) soclib::caba::VciLocalRingFast<vci_param, WIDTH_CMD, WIDTH_RSP> ("cluster_c1" + i,maptab, IntTab(i), 2, 18, 1, 1)
+		new(&local_ring_c0[i]) soclib::caba::VciLocalRingFast<vci_param, WIDTH_CMD, WIDTH_RSP> ("cluster_c0" + i,maptab0, IntTab(i), 2, 18, 1, 1);
+		new(&local_ring_c1[i]) soclib::caba::VciLocalRingFast<vci_param, WIDTH_CMD, WIDTH_RSP> ("cluster_c1" + i,maptab1, IntTab(i), 2, 18, 1, 1);
 	}
 
@@ -106,12 +107,18 @@
 	// N_CLUSTERS VCI Synthetic Initiator (1 initiator per cluster/network)
 	soclib::caba::VciSyntheticInitiator<vci_param> * initiator_c0 = (soclib::caba::VciSyntheticInitiator<vci_param> *) malloc(sizeof(soclib::caba::VciSyntheticInitiator<vci_param> )* N_CLUSTERS);
-	for(int i = 0 ; i < Y_MAX; i++)
-		for(int j = 0 ; j < Y_MAX ; j++)
-			new(&initiator_c0[Y_MAX*i+j]) soclib::caba::VciSyntheticInitiator<vci_param> ("Initiator_c0" + (i*X_MAX+j), i*X_MAX+j, maptab, IntTab(i,j),16, 0.5, 2, X_MAX, Y_MAX);
-
 	soclib::caba::VciSyntheticInitiator<vci_param> * initiator_c1 = (soclib::caba::VciSyntheticInitiator<vci_param> *) malloc(sizeof(soclib::caba::VciSyntheticInitiator<vci_param> )* N_CLUSTERS);
 	for(int i = 0 ; i < Y_MAX; i++)
-		for(int j = 0 ; j < Y_MAX ; j++)
-			new(&initiator_c1[Y_MAX*i+j]) soclib::caba::VciSyntheticInitiator<vci_param> ("Initiator_c1" + (i*X_MAX+j), i*X_MAX+j, maptab, IntTab(i,j),16, 0.5, 2, X_MAX, Y_MAX);
+		for(int j = 0 ; j < X_MAX ; j++){
+			new(&initiator_c0[X_MAX*i+j]) soclib::caba::VciSyntheticInitiator<vci_param> ("Initiator_c0" + (i*X_MAX+j), maptab0, IntTab(i,j), 16, 0.5, 2, X_MAX, Y_MAX ); //, 0, 0, 0, 0, 0);
+			new(&initiator_c1[X_MAX*i+j]) soclib::caba::VciSyntheticInitiator<vci_param> ("Initiator_c1" + (i*X_MAX+j), maptab0, IntTab(i,j), 16, 0.5, 2, X_MAX, Y_MAX ); //, 0, 0, 0, 0, 0);
+		}
+
+	soclib::caba::VciSimpleRam<vci_param> * ram_c0 = (soclib::caba::VciSimpleRam<vci_param> *) malloc(sizeof(soclib::caba::VciSimpleRam<vci_param>) * N_CLUSTERS);
+	soclib::caba::VciSimpleRam<vci_param> * ram_c1 = (soclib::caba::VciSimpleRam<vci_param> *) malloc(sizeof(soclib::caba::VciSimpleRam<vci_param>) * N_CLUSTERS);
+	for(int i = 0 ; i < Y_MAX ; i++)
+		for(int j = 0 ; j < X_MAX ; j++){
+			new(&ram_c0[X_MAX*i+j]) soclib::caba::VciSimpleRam<vci_param> ("Ram_target_c0" + (i*X_MAX+j), IntTab(i,j), maptab0, loader, 0);
+			new(&ram_c1[X_MAX*i+j]) soclib::caba::VciSimpleRam<vci_param> ("Ram_target_c1" + (i*X_MAX+j), IntTab(i,j), maptab1, loader, 0);
+		}
 
 	///////////////////////////////////////////////////////////////
@@ -121,14 +128,22 @@
 	  local_ring_c0[i].p_clk(signal_clk);
 	  local_ring_c0[i].p_resetn(signal_resetn);
-	  local_ring_c0[i].p_to_initiator[0](signal_vci_ini_synt_c0h[i]);
+	  local_ring_c0[i].p_to_initiator[0](signal_vci_ini_synth_c0[0][i]);
+	  local_ring_c0[i].p_to_target[0](signal_vci_ini_synth_c0[1][i]);
 	  initiator_c0[i].p_clk(signal_clk);
 	  initiator_c0[i].p_resetn(signal_resetn);
-	  initiator_c0[i].p_vci(signal_vci_ini_synth_c0[i]);
+	  initiator_c0[i].p_vci(signal_vci_ini_synth_c0[0][i]);
+	  ram_c0[i].p_clk(signal_clk);
+	  ram_c0[i].p_resetn(signal_resetn);
+	  ram_c0[i].p_vci(signal_vci_ini_synth_c0[1][i]);
 	  local_ring_c1[i].p_clk(signal_clk);
 	  local_ring_c1[i].p_resetn(signal_resetn);
-	  local_ring_c1[i].p_to_initiator[0](signal_vci_ini_synth_c1[i]);
+	  local_ring_c1[i].p_to_initiator[0](signal_vci_ini_synth_c1[0][i]);
+	  local_ring_c1[i].p_to_target[0](signal_vci_ini_synth_c1[1][i]);
 	  initiator_c1[i].p_clk(signal_clk);
 	  initiator_c1[i].p_resetn(signal_resetn);
-	  initiator_c1[i].p_vci(signal_vci_ini_synth_c1[i]);
+	  initiator_c1[i].p_vci(signal_vci_ini_synth_c1[0][i]);
+	  ram_c1[i].p_clk(signal_clk);
+	  ram_c1[i].p_resetn(signal_resetn);
+	  ram_c1[i].p_vci(signal_vci_ini_synth_c1[1][i]);
 	}
 	
@@ -151,5 +166,5 @@
 	    local_ring_c1[i*X_MAX+j].p_gate_rsp_in( dspin_signals_rsp_c1[0][i][j][LOCAL]);
 	    local_ring_c1[i*X_MAX+j].p_gate_rsp_out(dspin_signals_rsp_c1[1][i][j][LOCAL] );
-	    for(k = 0; k < 5; k++){
+	    for(int k = 0; k < 5; k++){
 	      if(i == 0){
 	        if(j == 0){
