Changeset 122 for trunk/modules


Ignore:
Timestamp:
Dec 23, 2010, 3:31:25 PM (13 years ago)
Author:
choichil
Message:

Synthetic Initiator before being change for multiple requests

Location:
trunk/modules/vci_synthetic_initator/caba/sources
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/modules/vci_synthetic_initator/caba/sources/include/vci_synthetic_initiator.h

    r115 r122  
    2626 *
    2727 * Maintainers: christophe.choichillon@lip6.fr
     28 */
     29 /*
     30     TODO : Adding the broadcast latency
    2831 */
    2932
     
    6467        VCI_BC_RECEIVE
    6568      };
    66       enum gen_fsm_state_e{
    67         A_IDLE,
    68         A_DATA
    69       };
     69//      enum gen_fsm_state_e{
     70//        A_IDLE,
     71//        A_DATA
     72//      };
    7073
    71       uint32_t     m_cpt_cycles;            // Counter of cycles
     74      uint64_t     m_cpt_cycles;            // Counter of cycles
    7275     
    7376
     
    132135      uint64_t                            m_start_latency1;         // Start time of sending packet wanted
    133136      uint64_t                            m_start_latency2;         // Start time of sending packet
    134 //      float                             m_rhos;                   // Effective Rho during the simulation
     137      uint64_t                            m_latency1;               // Average latency wanted
     138      uint64_t                            m_latency2;               // Average latency
    135139      size_t                              m_bc_nrsp;                // Expected number of responses for a broadcast command
    136140      addr_t                              m_address_to_send;        // Address to send the write command
    137141      uint32_t                            m_local_seed;
    138142
     143      uint64_t                            m_start_latency_bc;
     144      uint64_t                            m_latency_bc;
     145      uint64_t                            m_nb_bc;
     146
    139147      // Fifo transmitting date to the VCI FSM
    140148      GenericFifo<uint32_t>    m_date_fifo;
    141149
     150      //sc_signal<int>           r_cmd_fsm;
    142151      sc_signal<int>           r_vci_fsm;
     152
     153      sc_signal<int>           r_bc_rsp_fsm;
    143154       
    144155      sc_signal<size_t>        r_index;
  • trunk/modules/vci_synthetic_initator/caba/sources/src/vci_synthetic_initiator.cpp

    r115 r122  
    3232
    3333
    34 //#define DETERMINISM
     34#define DETERMINISTIC
    3535
    3636namespace soclib { namespace caba {
     
    140140  //////////////////////////////////
    141141  {
    142         std::cout << m_cpt_cycles << " cycles, " << m_npackets << " packets sent" << std::endl;
     142        std::cout << name() << " : "<< std::dec << m_cpt_cycles << " cycles, " << m_npackets << " packets sent" << std::endl;
     143        std::cout << ((double)m_latency1/(double)m_npackets) << " | " << ((double)m_latency2/(double)m_npackets) << std::endl;
     144        if(m_bc_period)
     145          std::cout << ((double)m_latency_bc/(double)m_nb_bc) << std::endl;
    143146  }
    144147
     
    150153    if ( ! p_resetn.read() ) {
    151154      // Initializing seed for random numbers generation
    152 #ifndef DETERMINISM
     155#ifndef DETERMINISTIC
    153156      srand(time(NULL));
    154157#endif
     
    160163      m_date_fifo.init();
    161164
     165      // Initializing the stats
     166      m_latency1 = 0 ;
     167      m_latency2 = 0 ;
    162168      // Activity counters
    163169      m_cpt_cycles              = 0;
    164170      m_npackets                = 0;
     171     
     172      m_start_latency_bc        = 0;
     173      m_latency_bc              = 0;
     174      m_nb_bc                   = 0;
    165175
    166176      r_broadcast_req           = false;
     
    172182    bool    date_fifo_get = false;
    173183
    174 //   if (m_cpt_cycles == 0) {
    175 //           m_rhos = 0.0 ;
    176 //   } else {
    177 //           m_rhos = static_cast<float>(m_npackets * m_length) / static_cast<float>(m_cpt_cycles) ;
    178 //   }
    179    
    180184
    181185
     
    193197            } else {
    194198              r_vci_fsm = VCI_SINGLE_SEND ;
    195 #ifdef DETERMINISM
     199#ifdef DETERMINISTIC
    196200              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));
    197201#else
     
    222226        {
    223227          if (p_vci.rspval.read()) {
    224             m_start_latency1 = m_date_fifo.read();
    225             m_start_latency2 = m_cpt_cycles;
     228            m_latency1 = m_latency1 + (m_cpt_cycles - m_start_latency1);
     229            m_latency2 = m_latency2 + (m_cpt_cycles - m_start_latency2);
    226230            m_npackets++;
    227231            date_fifo_get = true;
     
    236240          if (p_vci.cmdack.read()) {
    237241            m_bc_nrsp = (m_xmax - m_xmin) * (m_ymax - m_ymin) ;
     242            m_start_latency_bc = m_cpt_cycles;
    238243            r_vci_fsm = VCI_BC_RECEIVE;
    239244            break;
     
    247252              r_broadcast_req = false;
    248253              m_address_to_send = 0;
     254              date_fifo_get = true;
     255              m_latency_bc = m_latency_bc + (m_cpt_cycles - m_start_latency_bc);
     256              m_nb_bc++;
    249257              r_vci_fsm = VCI_IDLE ;
    250258            } else {
     
    259267
    260268    /////////////////// Filling fifo
    261     if( ( (uint64_t)(m_rho*m_cpt_cycles) >= (uint64_t)(m_length*m_npackets*1000)) ){
     269    if( ( (uint64_t)(m_rho*m_cpt_cycles) > (uint64_t)(m_length*m_npackets*1000)) ){
    262270      if (m_date_fifo.wok()){
    263271        date_fifo_put = true ;
Note: See TracChangeset for help on using the changeset viewer.