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 102)
+++ trunk/modules/vci_synthetic_initator/caba/sources/src/vci_synthetic_initiator.cpp	(revision 106)
@@ -29,4 +29,5 @@
 
 #include "../include/vci_synthetic_initiator.h"
+#include <iostream>
 
 
@@ -48,5 +49,6 @@
       const soclib::common::IntTab       &vci_index,
       const uint32_t length,    // Packet length (flit numbers)
-      const float  rho,       // Packets ratio on the network
+      const uint32_t rho,       // Packets ratio on the network
+    //  const float  rho,       // Packets ratio on the network
       const uint32_t depth,     // Fifo depth
       const uint32_t xmesh,	
@@ -66,5 +68,4 @@
 
     m_srcid( mt.indexForId(vci_index) ),
-    m_coord(vci_index[1]),
     //  FIFOs 
     m_length(length),
@@ -104,9 +105,5 @@
   ///////////////////////////////////
   {
-    size_t dest;
-    do{
-      dest = (size_t) (rand() % (m_xmesh * m_ymesh));
-    } while(dest == m_srcid);
-    return dest ;
+    return (size_t) (rand() % (m_xmesh * m_ymesh)) ;
   }
 
@@ -123,7 +120,31 @@
 //  }
 
+  
+  //////////////////////////////////
+  tmpl(void)::print_trace()
+  //////////////////////////////////
+  {
+  	const char* state_str[] = { "IDLE",
+				     "SINGLE_SEND",
+				     "SINGLE_RECEIVE",
+				     "BC_SEND",
+				     "BC_RECEIVE" };
+
+	std::cout << "Vci_Synthetic_Initiator " << name()
+		  << " : " << m_cpt_cycles << " cycles " 
+		  << " : state = " << state_str[r_vci_fsm] 
+		  << " Adresse to send : " << m_address_to_send << std::endl;
+  }
+
+  //////////////////////////////////
+  tmpl(void)::printStats()
+  //////////////////////////////////
+  {
+  	std::cout << m_cpt_cycles << " cycles, " << m_npackets << " packets sent" << std::endl;
+  }
+
   //////////////////////////////////
   tmpl(void)::transition()
-    //////////////////////////////////
+  //////////////////////////////////
   {
     //  RESET          
@@ -142,4 +163,6 @@
       m_npackets		= 0;
 
+      r_broadcast_req		= false;
+
       return;
     }
@@ -148,6 +171,16 @@
     bool    date_fifo_get = false;
 
+//   if (m_cpt_cycles == 0) {
+//           m_rhos = 0.0 ;
+//   } else {
+//           m_rhos = static_cast<float>(m_npackets * m_length) / static_cast<float>(m_cpt_cycles) ;
+//   }
+    
+
+
     switch ( r_vci_fsm.read() ) {
 
+  	std::cout << m_cpt_cycles << " cycles, " << m_npackets << " packets sent" << std::endl;
+      //printStats();
       //////////////////
       case VCI_IDLE:
@@ -155,8 +188,9 @@
 	  if (m_date_fifo.rok()){
 	    if (r_broadcast_req.read()){
+	      m_address_to_send = (((((((((m_xmin << 5) | m_xmax ) << 5 ) | m_ymin ) << 5 ) | m_ymax ) << 5 ) << vci_param::N-(4*5) ) | 0x3) | 0 ;
 	      r_vci_fsm = VCI_BC_SEND ;
 	    } else {
 	      r_vci_fsm = VCI_SINGLE_SEND ;
-	      r_address_to_send = destAdress();
+	      m_address_to_send = destAdress() << 32-10;
 	      m_count = 0;
 	    }
@@ -168,5 +202,4 @@
         {
 	  if (p_vci.cmdack.read()){
-	    m_count++;
 	    if (m_count == m_length-1) {
 	      m_start_latency1 = m_date_fifo.read();
@@ -175,4 +208,5 @@
 	    } else {
 	      r_vci_fsm = VCI_SINGLE_SEND ;
+	      m_count++;
 	    }
 	  }
@@ -187,4 +221,5 @@
 	    m_npackets++;
 	    date_fifo_get = true;
+	    m_address_to_send = 0;
 	    r_vci_fsm = VCI_IDLE ;
 	  }
@@ -194,10 +229,4 @@
       case VCI_BC_SEND:
         {
-	  r_address_to_send = (((((((((m_xmin << 5) & m_xmax ) << 5 ) & m_ymin ) << 5 ) & m_ymax ) << 5 ) << 17 ) & 0x3) | 0 ;
-	  //m_address_to_send.broadcast_address.xmin = m_xmin;
-	  //m_address_to_send.broadcast_address.xmax = m_xmax;
-	  //m_address_to_send.broadcast_address.ymin = m_ymin;
-	  //m_address_to_send.broadcast_address.ymax = m_ymax;
-	  //m_address_to_send.broadcast_address.bc   = 0x3;
 	  m_bc_nrsp = (m_xmax - m_xmin) * (m_ymax - m_ymin);
 	  r_vci_fsm = VCI_BC_SEND;
@@ -210,4 +239,5 @@
 	    if (m_bc_nrsp == 0) {
 	      r_broadcast_req = false;
+	      m_address_to_send = 0;
 	      r_vci_fsm = VCI_IDLE ;
 	    } else {
@@ -221,11 +251,13 @@
 
 
-/////////////////// Filling fifo
-    if( (m_rhos < m_rho) && (rand()/RAND_MAX) ){
+    /////////////////// Filling fifo
+    if( ( (uint64_t)(m_rho*m_cpt_cycles) >= (uint64_t)(m_length*m_npackets*1000)) ){
       if (m_date_fifo.wok()){
         date_fifo_put = true ;
       } 
-      if (!r_broadcast_req.read() && (m_cpt_cycles % m_bc_period)){
-        r_broadcast_req = true;
+      if (m_bc_period){
+	      if (!r_broadcast_req.read() && (m_cpt_cycles % m_bc_period)){
+		      r_broadcast_req = true;
+	      }
       }
     }
@@ -243,6 +275,4 @@
     }
    
-    m_rhos = (float) ((m_npackets * m_length) / m_cpt_cycles) ;
-
     m_cpt_cycles++;
 
@@ -287,5 +317,5 @@
         {
 	  p_vci.cmdval  = true;                 
-	  p_vci.address = (vci_addr_t)(r_address_to_send.read() + (m_count*4)); 
+	  p_vci.address = (addr_t)(m_address_to_send + (m_count*4)); 
 	  p_vci.plen    = m_length*4;                                         
 	  p_vci.wdata   = 0;                                       
@@ -315,5 +345,5 @@
         {
        	  p_vci.cmdval  = true;                 
-	  p_vci.address = (vci_addr_t) r_address_to_send.read(); 
+	  p_vci.address = (addr_t) m_address_to_send; 
 	  p_vci.plen    = 4;                                         
 	  p_vci.wdata   = 0;                                       
