Ignore:
Timestamp:
Oct 14, 2010, 2:58:27 PM (14 years ago)
Author:
choichil
Message:

Vci_Synthetic_Initiator correction of some bugs... some may still exist

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/modules/vci_synthetic_initator/caba/sources/src/vci_synthetic_initiator.cpp

    r102 r106  
    2929
    3030#include "../include/vci_synthetic_initiator.h"
     31#include <iostream>
    3132
    3233
     
    4849      const soclib::common::IntTab       &vci_index,
    4950      const uint32_t length,    // Packet length (flit numbers)
    50       const float  rho,       // Packets ratio on the network
     51      const uint32_t rho,       // Packets ratio on the network
     52    //  const float  rho,       // Packets ratio on the network
    5153      const uint32_t depth,     // Fifo depth
    5254      const uint32_t xmesh,     
     
    6668
    6769    m_srcid( mt.indexForId(vci_index) ),
    68     m_coord(vci_index[1]),
    6970    //  FIFOs
    7071    m_length(length),
     
    104105  ///////////////////////////////////
    105106  {
    106     size_t dest;
    107     do{
    108       dest = (size_t) (rand() % (m_xmesh * m_ymesh));
    109     } while(dest == m_srcid);
    110     return dest ;
     107    return (size_t) (rand() % (m_xmesh * m_ymesh)) ;
    111108  }
    112109
     
    123120//  }
    124121
     122 
     123  //////////////////////////////////
     124  tmpl(void)::print_trace()
     125  //////////////////////////////////
     126  {
     127        const char* state_str[] = { "IDLE",
     128                                     "SINGLE_SEND",
     129                                     "SINGLE_RECEIVE",
     130                                     "BC_SEND",
     131                                     "BC_RECEIVE" };
     132
     133        std::cout << "Vci_Synthetic_Initiator " << name()
     134                  << " : " << m_cpt_cycles << " cycles "
     135                  << " : state = " << state_str[r_vci_fsm]
     136                  << " Adresse to send : " << m_address_to_send << std::endl;
     137  }
     138
     139  //////////////////////////////////
     140  tmpl(void)::printStats()
     141  //////////////////////////////////
     142  {
     143        std::cout << m_cpt_cycles << " cycles, " << m_npackets << " packets sent" << std::endl;
     144  }
     145
    125146  //////////////////////////////////
    126147  tmpl(void)::transition()
    127     //////////////////////////////////
     148  //////////////////////////////////
    128149  {
    129150    //  RESET         
     
    142163      m_npackets                = 0;
    143164
     165      r_broadcast_req           = false;
     166
    144167      return;
    145168    }
     
    148171    bool    date_fifo_get = false;
    149172
     173//   if (m_cpt_cycles == 0) {
     174//           m_rhos = 0.0 ;
     175//   } else {
     176//           m_rhos = static_cast<float>(m_npackets * m_length) / static_cast<float>(m_cpt_cycles) ;
     177//   }
     178   
     179
     180
    150181    switch ( r_vci_fsm.read() ) {
    151182
     183        std::cout << m_cpt_cycles << " cycles, " << m_npackets << " packets sent" << std::endl;
     184      //printStats();
    152185      //////////////////
    153186      case VCI_IDLE:
     
    155188          if (m_date_fifo.rok()){
    156189            if (r_broadcast_req.read()){
     190              m_address_to_send = (((((((((m_xmin << 5) | m_xmax ) << 5 ) | m_ymin ) << 5 ) | m_ymax ) << 5 ) << vci_param::N-(4*5) ) | 0x3) | 0 ;
    157191              r_vci_fsm = VCI_BC_SEND ;
    158192            } else {
    159193              r_vci_fsm = VCI_SINGLE_SEND ;
    160               r_address_to_send = destAdress();
     194              m_address_to_send = destAdress() << 32-10;
    161195              m_count = 0;
    162196            }
     
    168202        {
    169203          if (p_vci.cmdack.read()){
    170             m_count++;
    171204            if (m_count == m_length-1) {
    172205              m_start_latency1 = m_date_fifo.read();
     
    175208            } else {
    176209              r_vci_fsm = VCI_SINGLE_SEND ;
     210              m_count++;
    177211            }
    178212          }
     
    187221            m_npackets++;
    188222            date_fifo_get = true;
     223            m_address_to_send = 0;
    189224            r_vci_fsm = VCI_IDLE ;
    190225          }
     
    194229      case VCI_BC_SEND:
    195230        {
    196           r_address_to_send = (((((((((m_xmin << 5) & m_xmax ) << 5 ) & m_ymin ) << 5 ) & m_ymax ) << 5 ) << 17 ) & 0x3) | 0 ;
    197           //m_address_to_send.broadcast_address.xmin = m_xmin;
    198           //m_address_to_send.broadcast_address.xmax = m_xmax;
    199           //m_address_to_send.broadcast_address.ymin = m_ymin;
    200           //m_address_to_send.broadcast_address.ymax = m_ymax;
    201           //m_address_to_send.broadcast_address.bc   = 0x3;
    202231          m_bc_nrsp = (m_xmax - m_xmin) * (m_ymax - m_ymin);
    203232          r_vci_fsm = VCI_BC_SEND;
     
    210239            if (m_bc_nrsp == 0) {
    211240              r_broadcast_req = false;
     241              m_address_to_send = 0;
    212242              r_vci_fsm = VCI_IDLE ;
    213243            } else {
     
    221251
    222252
    223 /////////////////// Filling fifo
    224     if( (m_rhos < m_rho) && (rand()/RAND_MAX) ){
     253    /////////////////// Filling fifo
     254    if( ( (uint64_t)(m_rho*m_cpt_cycles) >= (uint64_t)(m_length*m_npackets*1000)) ){
    225255      if (m_date_fifo.wok()){
    226256        date_fifo_put = true ;
    227257      }
    228       if (!r_broadcast_req.read() && (m_cpt_cycles % m_bc_period)){
    229         r_broadcast_req = true;
     258      if (m_bc_period){
     259              if (!r_broadcast_req.read() && (m_cpt_cycles % m_bc_period)){
     260                      r_broadcast_req = true;
     261              }
    230262      }
    231263    }
     
    243275    }
    244276   
    245     m_rhos = (float) ((m_npackets * m_length) / m_cpt_cycles) ;
    246 
    247277    m_cpt_cycles++;
    248278
     
    287317        {
    288318          p_vci.cmdval  = true;                 
    289           p_vci.address = (vci_addr_t)(r_address_to_send.read() + (m_count*4));
     319          p_vci.address = (addr_t)(m_address_to_send + (m_count*4));
    290320          p_vci.plen    = m_length*4;                                         
    291321          p_vci.wdata   = 0;                                       
     
    315345        {
    316346          p_vci.cmdval  = true;                 
    317           p_vci.address = (vci_addr_t) r_address_to_send.read();
     347          p_vci.address = (addr_t) m_address_to_send;
    318348          p_vci.plen    = 4;                                         
    319349          p_vci.wdata   = 0;                                       
Note: See TracChangeset for help on using the changeset viewer.