Index: trunk/modules/vci_synthetic_initator/caba/sources/src/vci_synthetic_initiator.cpp
===================================================================
--- trunk/modules/vci_synthetic_initator/caba/sources/src/vci_synthetic_initiator.cpp	(revision 125)
+++ trunk/modules/vci_synthetic_initator/caba/sources/src/vci_synthetic_initiator.cpp	(revision 126)
@@ -83,7 +83,24 @@
     m_ymax(ymax),
     m_date_fifo("m_date_fifo", depth),
-    m_local_seed(m_srcid),
-    r_cmd_fsm("r_cmd_fsm")
-    {
+    r_count           ("r_count"),             
+    r_npackets        ("r_npackets"),		
+    r_start_latency1  ("r_start_latency1"),  
+    r_start_latency2  ("r_start_latency2"),    
+    r_latency1        ("r_latency1"),		 
+    r_latency2        ("r_latency2"),		 
+    r_address_to_send ("r_address_to_send"), 	 
+    r_local_seed      ("r_local_seed"),
+    r_id_to_send      ("r_id_to_send"),
+    r_start_latency_bc("r_start_latency_bc"),
+    r_latency_bc      ("r_latency_bc"),
+    r_nb_bc           ("r_nb_bc"),
+    r_cmd_fsm("r_cmd_fsm"),
+    r_bc_rsp_fsm("r_bc_rsp_fsm"),
+    r_index("r_index"),
+    r_broadcast_req("r_broadcast_req"),
+    r_broadcast_rsp("r_broadcast_rsp"),
+    r_bc_nrsp("r_bc_nrsp")		    
+    //r_req_id("r_req_id")
+{
 
       r_req_id = new sc_signal<uint64_t>*[tab_size];
@@ -144,7 +161,7 @@
 		  << " : state_cmd_fsm = " << state_cmd_str[r_cmd_fsm] 
 		  << " : state_rsp_fsm = " << state_bc_rsp_str[r_bc_rsp_fsm] 
-		  << " Adresse to send : " << std::hex << m_address_to_send 
+		  << " Adresse to send : " << std::hex << r_address_to_send.read()
 		  << " Number of broadcast to receive : " << std::dec << r_bc_nrsp.read() 
-		  << " Number of packets sent : " << std::dec << m_npackets << " " << m_id_to_send << std::endl;
+		  << " Number of packets sent : " << std::dec << r_npackets.read() << " " << r_id_to_send.read() << std::endl;
 	for(int i = 0; i < (1<<vci_param::T) ; i++){
 	  std::cout << "ID : " << i << " " << (uint64_t)(r_req_id[i][0].read()) << " " << (uint64_t)(r_req_id[i][1].read()) << std::endl;
@@ -156,8 +173,8 @@
   //////////////////////////////////
   {
-  	std::cout << name() << " : "<< std::dec << m_cpt_cycles << " cycles, " << m_npackets << " packets sent" << std::endl;
-	std::cout << ((double)m_latency1/(double)m_npackets) << " | " << ((double)m_latency2/(double)m_npackets) << std::endl;
+  	std::cout << name() << " : "<< std::dec << m_cpt_cycles << " cycles, " << r_npackets.read() << " packets sent" << std::endl;
+	std::cout << ((double)r_latency1.read()/(double)r_npackets.read()) << " | " << ((double)r_latency2.read()/(double)r_npackets.read()) << std::endl;
 	if(m_bc_period)
-	  std::cout << ((double)m_latency_bc/(double)m_nb_bc) << std::endl;
+	  std::cout << ((double)r_latency_bc.read()/(double)r_nb_bc.read()) << std::endl;
   }
 
@@ -182,14 +199,13 @@
 
       // Initializing the stats
-      m_latency1 = 0 ;
-      m_latency2 = 0 ;
+      r_latency1 = 0 ;
+      r_latency2 = 0 ;
       // Activity counters
       m_cpt_cycles		= 0;
-      m_npackets		= 0;
       
-      m_start_latency_bc	= 0;
-      m_latency_bc		= 0;
-      m_nb_bc			= 0;
-      m_id_to_send		= -1;
+      r_start_latency_bc	= 0;
+      r_latency_bc		= 0;
+      r_nb_bc			= 0;
+      r_id_to_send		= -1;
 
       r_broadcast_req		= false;
@@ -198,4 +214,12 @@
 
       r_bc_nrsp			= 0;
+      r_count            	= 0;        
+      r_npackets         	= 0;	  
+      r_start_latency1   	= 0;        
+      r_start_latency2   	= 0;        
+      r_address_to_send  	= 0; 	  
+      r_local_seed       	= (uint32_t)m_srcid;
+
+      r_latency_bc       	= 0;
 
       for(int i = 0; i < tab_size; i++){
@@ -220,17 +244,15 @@
 	  if (m_date_fifo.rok()){
 	    if (r_broadcast_req.read() && !r_broadcast_rsp.read()){
-	      m_address_to_send = 0x3 | (0x7c1f << vci_param::N-20) ;
+	      r_address_to_send = 0x3 | (0x7c1f << vci_param::N-20) ;
 	      r_cmd_fsm = VCI_BC_SEND ;
 	    } else {
-	      m_id_to_send = -1;
+	      r_id_to_send = -1;
 	      for(int i = 0; i < tab_size; i++){
 	        if(r_req_id[i][0].read() == 0){
-		  m_id_to_send = i;
-		  //r_req_id[i][0] = m_date_fifo.read();
-		  //r_req_id[i][1] = m_cpt_cycles;
+		  r_id_to_send = i;
 		  break;
 		}
 	      }
-	      if(m_id_to_send == -1){
+	      if(r_id_to_send.read() == -1){
 	        r_cmd_fsm = VCI_IDLE ;
 		break;
@@ -239,9 +261,11 @@
 	      }
 #ifdef DETERMINISTIC
-	      m_address_to_send = destAdress(&m_local_seed) << (vci_param::N)-(soclib::common::uint32_log2((uint32_t)m_xmesh)+soclib::common::uint32_log2((uint32_t)m_ymesh));
+	      uint32_t m_local_seed = r_local_seed.read();
+	      r_address_to_send = destAdress(&m_local_seed) << (vci_param::N)-(soclib::common::uint32_log2((uint32_t)m_xmesh)+soclib::common::uint32_log2((uint32_t)m_ymesh));
+	      r_local_seed = m_local_seed;
 #else
-	      m_address_to_send = destAdress() << (vci_param::N)-(soclib::common::uint32_log2((uint32_t)m_xmesh)+soclib::common::uint32_log2((uint32_t)m_ymesh));
+	      r_address_to_send = destAdress() << (vci_param::N)-(soclib::common::uint32_log2((uint32_t)m_xmesh)+soclib::common::uint32_log2((uint32_t)m_ymesh));
 #endif
-	      m_count = 0;
+	      r_count = 0;
 	    }
 	  }
@@ -252,15 +276,14 @@
         {
 	  if (p_vci.cmdack.read()){
-	    if (m_count == m_length-1) {
-	      //r_req_id[m_id_to_send][0] = (uint64_t)(m_date_fifo.read());
-	      r_req_id[m_id_to_send][0] = m_date_fifo.read();
-	      r_req_id[m_id_to_send][1] = m_cpt_cycles;
+	    if (r_count.read() == m_length-1) {
+	      r_req_id[r_id_to_send.read()][0] = (uint64_t)(m_date_fifo.read());
+	      r_req_id[r_id_to_send.read()][1] = m_cpt_cycles;
 	      //std::cout << name () << " FIFO " << m_date_fifo.read() << std::endl;
 	      date_fifo_get = true;
-	      m_npackets++;
+	      r_npackets = r_npackets.read() + 1;
 	      r_cmd_fsm = VCI_IDLE ;
 	    } else {
 	      r_cmd_fsm = VCI_SINGLE_SEND ;
-	      m_count++;
+	      r_count = r_count.read() + 1;
 	    }
 	  }
@@ -272,5 +295,5 @@
 	  if (p_vci.rspval.read()) {
 	    r_bc_nrsp = (m_xmax - m_xmin) * (m_ymax - m_ymin) ;
-	    m_start_latency_bc = m_cpt_cycles;
+	    r_start_latency_bc = m_cpt_cycles;
 	    r_broadcast_rsp = true;
 	    date_fifo_get = true;
@@ -297,7 +320,7 @@
 	      r_broadcast_req = false;
 	      r_broadcast_rsp = false;
-	      m_address_to_send = 0;
-	      m_latency_bc = m_latency_bc + (m_cpt_cycles - m_start_latency_bc);
-	      m_nb_bc++;
+	      //r_address_to_send.read() = 0;
+	      r_latency_bc = r_latency_bc.read() + (m_cpt_cycles - r_start_latency_bc.read());
+	      r_nb_bc = r_nb_bc.read() + 1;
 	      r_bc_rsp_fsm = BC_RSP_IDLE ;
 	    } else {
@@ -312,7 +335,6 @@
     if(p_vci.rspval.read()){
       if((int)(p_vci.pktid.read()) == 0){
-	m_latency1 = m_latency1 + (m_cpt_cycles - r_req_id[(int)(p_vci.rtrdid.read())][0].read());
-	m_latency2 = m_latency2 + (m_cpt_cycles - r_req_id[(int)(p_vci.rtrdid.read())][1].read());
-	//m_npackets++;
+	r_latency1 = r_latency1.read() + (m_cpt_cycles - r_req_id[(int)(p_vci.rtrdid.read())][0].read());
+	r_latency2 = r_latency2.read() + (m_cpt_cycles - r_req_id[(int)(p_vci.rtrdid.read())][1].read());
         r_req_id[(int)(p_vci.rtrdid.read())][0] = 0;
         r_req_id[(int)(p_vci.rtrdid.read())][1] = 0;
@@ -322,5 +344,5 @@
 
     /////////////////// Filling fifo
-    if( ( (uint64_t)(m_rho*m_cpt_cycles) > (uint64_t)(m_length*m_npackets*1000)) ){
+    if( ( (uint64_t)(m_rho*m_cpt_cycles) > (uint64_t)(m_length*r_npackets.read()*1000)) ){
       if (m_date_fifo.wok()){
         date_fifo_put = true ;
@@ -387,9 +409,9 @@
         {
 	  p_vci.cmdval  = true;                 
-	  p_vci.address = (addr_t)(m_address_to_send + (m_count*4)); 
+	  p_vci.address = (addr_t)(r_address_to_send.read() + (r_count.read()*4)); 
 	  p_vci.plen    = m_length*4;                                         
 	  p_vci.wdata   = 0;                                       
-	  p_vci.trdid   = m_id_to_send;                  
-	  if (m_count == m_length - 1 ) {
+	  p_vci.trdid   = r_id_to_send.read();                  
+	  if (r_count.read() == m_length - 1 ) {
 	    p_vci.eop     = true;                                   
 	  } else {
@@ -402,5 +424,5 @@
         {
        	  p_vci.cmdval  = true;                 
-	  p_vci.address = (addr_t) m_address_to_send; 
+	  p_vci.address = (addr_t) r_address_to_send.read(); 
 	  p_vci.plen    = 4;                                         
 	  p_vci.wdata   = 0;                                       
