Index: trunk/platforms/caba-vdspin-vci_synthetic_initiator/top.cpp
===================================================================
--- trunk/platforms/caba-vdspin-vci_synthetic_initiator/top.cpp	(revision 103)
+++ trunk/platforms/caba-vdspin-vci_synthetic_initiator/top.cpp	(revision 105)
@@ -11,5 +11,4 @@
 #include "alloc_elems.h"
 #include "vci_simple_ram.h"
-//#include "vci_multi_tty.h"
 #include "vci_local_ring_fast.h"
 #include "virtual_dspin_router.h"
@@ -29,4 +28,18 @@
 #define WEST		3
 #define LOCAL		4
+// VCI parameters
+#define cell_width      4
+#define plen_width      8
+#define address_width   32
+#define error_width     1
+#define clen_width      1
+#define rflag_width     1
+#define srcid_width     11
+#define pktid_width     4
+#define trdid_width     4
+#define wrplen_width    1
+// Adress of targets
+#define TARGET_ADDR	0x00000000
+#define TARGET_SIZE	0x400
 
 
@@ -41,22 +54,30 @@
 
 	// Define VCI parameters
-	typedef soclib::caba::VciParams<4,8,40,1,1,1,8,4,4,1> vci_param;
-
-	
-	soclib::common::Loader loader(NULL);
+	typedef soclib::caba::VciParams<cell_width,
+					plen_width,
+					address_width,
+					error_width,
+					clen_width,
+					rflag_width,
+					srcid_width,
+					pktid_width,
+					trdid_width,
+					wrplen_width> vci_param;
+
+	//soclib::common::Loader loader();
 	// Mapping table primary network
-	
-	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 ));
+	soclib::common::MappingTable maptab0(address_width, IntTab(srcid_width-1 ,1), IntTab(srcid_width-1 ,1), 0xFFC0000);
+	soclib::common::MappingTable maptab1(address_width, IntTab(srcid_width-1 ,1), IntTab(srcid_width-1 ,1), 0xFFC0000);
+	for(int i = 0 ; i < Y_MAX ; i++){
+		for(int j = 0 ; j < X_MAX ; j++){
+			std::ostringstream	str0;
+			std::ostringstream	str1;
+			str0 << "Target_c0_" << (i*X_MAX+j) ;
+			str1 << "Target_c1_" << (i*X_MAX+j) ;
+			maptab0.add(Segment(str0.str(), TARGET_ADDR + ((i*X_MAX+j) << (address_width-srcid_width+1)), TARGET_SIZE, IntTab((i*X_MAX+j),0), false));
+			maptab1.add(Segment(str1.str(), TARGET_ADDR + ((i*X_MAX+j) << (address_width-srcid_width+1)), TARGET_SIZE, IntTab((i*X_MAX+j),0), false));
+		}
+	}
+
 
 	std::cout << maptab0 << std::endl;
@@ -66,6 +87,6 @@
 	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", 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);
+	soclib::caba::VciSignals<vci_param> ** signal_vci_ini_synth_c0 = soclib::common::alloc_elems<soclib::caba::VciSignals<vci_param> >("signal_vci_ini_synth_c0", 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_c1", 2, N_CLUSTERS);
 	///////////////////////////////////////////////////////////////
 	// VDSPIN Signals : one level for in and out, one level for X length in the mesh, 
@@ -83,6 +104,11 @@
 	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_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);
+		std::cout << "Passe " << i << " pour instanciation ring" << std::endl;
+		std::ostringstream	str0;
+		std::ostringstream	str1;
+		str0 << "cluster_c0_" << i ;
+		str1 << "cluster_c1_" << i ;
+		new(&local_ring_c0[i]) soclib::caba::VciLocalRingFast<vci_param, WIDTH_CMD, WIDTH_RSP> (str0.str().c_str() ,maptab0, IntTab(i), 2, 18, 1, 1);
+		new(&local_ring_c1[i]) soclib::caba::VciLocalRingFast<vci_param, WIDTH_CMD, WIDTH_RSP> (str1.str().c_str() ,maptab1, IntTab(i), 2, 18, 1, 1);
 	}
 
@@ -94,7 +120,8 @@
 	  routers_cmd[i] = (soclib::caba::VirtualDspinRouter<WIDTH_CMD> * ) malloc(sizeof(soclib::caba::VirtualDspinRouter<WIDTH_CMD>) * X_MAX);
 	  routers_rsp[i] = (soclib::caba::VirtualDspinRouter<WIDTH_RSP> * ) malloc(sizeof(soclib::caba::VirtualDspinRouter<WIDTH_RSP>) * X_MAX);
-	  for(int j = 0; j < X_MAX; i++){
-	    new(&routers_cmd[i][j]) soclib::caba::VirtualDspinRouter<WIDTH_CMD> ("VDspinRouterCMD" + i + j, j, i, soclib::common::uint32_log2(X_MAX), soclib::common::uint32_log2(Y_MAX), 4, 4);
-	    new(&routers_rsp[i][j]) soclib::caba::VirtualDspinRouter<WIDTH_RSP> ("VDspinRouterRSP" + i + j, j, i, soclib::common::uint32_log2(X_MAX), soclib::common::uint32_log2(Y_MAX), 4, 4);
+	  for(int j = 0; j < X_MAX; j++){
+		  std::cout << "Passe " << i << j << " pour instanciation vdspin" << std::endl;
+		  new(&routers_cmd[i][j]) soclib::caba::VirtualDspinRouter<WIDTH_CMD> ("VDspinRouterCMD" + i + j, j, i, soclib::common::uint32_log2(X_MAX), soclib::common::uint32_log2(Y_MAX), 4, 4);
+		  new(&routers_rsp[i][j]) soclib::caba::VirtualDspinRouter<WIDTH_RSP> ("VDspinRouterRSP" + i + j, j, i, soclib::common::uint32_log2(X_MAX), soclib::common::uint32_log2(Y_MAX), 4, 4);
 	  }
 	}
@@ -110,6 +137,11 @@
 	for(int i = 0 ; i < Y_MAX; i++)
 		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);
+			std::cout << "Passe " << i << j << " pour instanciation synthetic_init" << std::endl;
+			std::ostringstream	str0;
+			std::ostringstream	str1;
+			str0 << "Initiator_c0_" << (i*X_MAX+j) ;
+			str1 << "Initiator_c1_" << (i*X_MAX+j) ;
+			new(&initiator_c0[X_MAX*i+j]) soclib::caba::VciSyntheticInitiator<vci_param> (str0.str().c_str() , maptab0, IntTab(i*X_MAX+j,0), 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> (str1.str().c_str() , maptab0, IntTab(i*X_MAX+j,0), 16, 0.5, 2, X_MAX, Y_MAX ); //, 0, 0, 0, 0, 0);
 		}
 
@@ -118,6 +150,11 @@
 	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);
+			std::cout << "Passe " << i << j << " pour instanciation Ram" << std::endl;
+			std::ostringstream	str0;
+			std::ostringstream	str1;
+			str0 << "Ram_c0_" << (i*X_MAX+j) ;
+			str1 << "Ram_c1_" << (i*X_MAX+j) ;
+			new(&ram_c0[X_MAX*i+j]) soclib::caba::VciSimpleRam<vci_param> (str0.str().c_str() , IntTab(i*X_MAX+j,0), maptab0, soclib::common::Loader(), 0);
+			new(&ram_c1[X_MAX*i+j]) soclib::caba::VciSimpleRam<vci_param> (str1.str().c_str() , IntTab(i*X_MAX+j,0), maptab1, soclib::common::Loader(), 0);
 		}
 
@@ -252,15 +289,4 @@
 	int ncycles;
 
-	if (argc == 2) {
-		ncycles = std::atoi(argv[1]);
-	} else {
-		std::cerr
-			<< std::endl
-			<< "The number of simulation cycles must "
-			   "be defined in the command line"
-			<< std::endl;
-		exit(1);
-	}
-
 	sc_start(sc_core::sc_time(0, SC_NS));
 	signal_resetn = false;
@@ -269,13 +295,8 @@
 	signal_resetn = true;
 
-	for (int i = 0; i < ncycles ; i+=100000) {
+	while(1) {
 		sc_start(sc_core::sc_time(100000, SC_NS));
-		
-	}
-
-        std::cout << "Hit ENTER to end simulation" << std::endl;
-        char buf[1];
-
-	std::cin.getline(buf,1);
+	}
+
 	return EXIT_SUCCESS;
 }
