Changeset 146 for trunk


Ignore:
Timestamp:
Apr 9, 2011, 5:48:37 PM (14 years ago)
Author:
choichil
Message:

Modifications to make the code easier to read

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

    r145 r146  
    152152
    153153      // Broadcast FSM
    154       sc_signal<uint32_t>       r_bc_nrsp;      // Expected number of responses for a broadcast command
     154      sc_signal<uint32_t>       r_bc_nrsp;         // Expected number of responses for a broadcast command
     155      sc_signal<uint32_t>       r_time_to_next_bc; // Time to wait between 2 BC
    155156       
    156157      // Pending transaction FSMs
  • trunk/modules/vci_synthetic_initator/caba/sources/src/vci_synthetic_initiator.cpp

    r145 r146  
    9494    r_latency_single("r_latency_single"),       
    9595    r_nb_bc("r_nb_bc"),
    96     r_latency_bc("r_latency_bc")               
     96    r_latency_bc("r_latency_bc"),
     97    r_time_to_next_bc("r_time_to_next_bc")
    9798{
    9899
     
    172173                  << " : state_rsp_fsm = " << state_bc_rsp_str[r_pending_fsm[0].read()]
    173174                  << " Adresse to send : " << std::hex << r_cmd_address.read()
    174                   << " Number of broadcast to receive : " << std::dec << r_bc_nrsp.read()
     175                  << " Number of BC_RSP to receive : " << std::dec << r_bc_nrsp.read()
    175176                  << " Number of packets sent : " << std::dec << r_nb_single.read() << " " << r_cmd_trdid.read()
    176                   << " Cycles to the next BC : " << r_cpt_period.read() << std::endl;
     177                  << " Number of BC sent : " << r_nb_bc.read()
     178                  << " Cycles to the next BC : " << r_time_to_next_bc.read() << std::endl;
    177179        for(int i = 0; i < (1<<vci_param::T) ; i++){
    178180          std::cout << "ID : " << i << " " << (uint64_t)(r_pending_date[i].read()) << std::endl;
     
    226228     
    227229      r_cmd_seed                = (uint32_t)m_srcid;
     230
     231#ifndef RANDOM_PERIOD
     232      r_time_to_next_bc         = m_bc_period;
     233#endif
    228234
    229235      return;
     
    345351    //  traffic regulator
    346352    ////////////////////////
    347 #ifdef RANDOM_PERIOD
    348     if ( m_bc_period && (r_cpt_period.read() == 0) )
    349 #else
    350     if ( m_bc_period && (r_cpt_period.read() > m_bc_period) )
    351 #endif
     353    if ( m_bc_period && (r_cpt_period.read() > r_time_to_next_bc.read()) )
    352354    {
    353355      fifo_put = true ;
     
    356358      {
    357359        r_nb_bc = r_nb_bc.read() + 1;
    358 #ifdef RANDOM_PERIOD
    359         r_cpt_period = (uint64_t) (rand()%(2*m_bc_period));
    360 #else
    361360        r_cpt_period = 0;
    362 #endif
    363361      }
    364362    }
     
    370368    }
    371369
     370    if ( m_bc_period && (r_cpt_period.read() > r_time_to_next_bc.read()) && r_date_fifo.wok() )
     371    {
    372372#ifdef RANDOM_PERIOD
    373     if ( m_bc_period && (r_cpt_period.read() == 0) && r_date_fifo.wok() )
    374         r_cpt_period = (uint64_t) (rand()%(2*m_bc_period));
    375     else
    376       r_cpt_period = r_cpt_period.read() - 1;
    377 #else
    378     if ( m_bc_period && (r_cpt_period.read() > m_bc_period) && r_date_fifo.wok() )
     373      r_time_to_next_bc = (uint32_t)(rand()%(2*m_bc_period));
     374#endif
    379375      r_cpt_period = 0;
     376    }
    380377    else
    381378      r_cpt_period = r_cpt_period.read() + 1;
    382 #endif
    383379
    384380    ////////////////////////
Note: See TracChangeset for help on using the changeset viewer.