Changeset 115


Ignore:
Timestamp:
Nov 10, 2010, 6:53:40 PM (14 years ago)
Author:
choichil
Message:

Adding deterministic for debug

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

    r111 r115  
    104104      void genMoore();
    105105
    106       size_t destAdress();
     106      uint32_t destAdress();
     107
     108      uint32_t destAdress(uint32_t *rand_seed);
    107109
    108110      void printStats();
     
    133135      size_t                              m_bc_nrsp;                // Expected number of responses for a broadcast command
    134136      addr_t                              m_address_to_send;        // Address to send the write command
     137      uint32_t                            m_local_seed;
    135138
    136139      // Fifo transmitting date to the VCI FSM
  • trunk/modules/vci_synthetic_initator/caba/sources/src/vci_synthetic_initiator.cpp

    r111 r115  
    3232
    3333
     34//#define DETERMINISM
    3435
    3536namespace soclib { namespace caba {
     
    8081    m_ymax(ymax),
    8182    m_date_fifo("m_date_fifo", depth),
     83    m_local_seed(m_srcid),
    8284    r_vci_fsm("r_vci_fsm")
    8385    {
     
    102104
    103105  ///////////////////////////////////
    104   tmpl(size_t)::destAdress()
     106  tmpl(uint32_t)::destAdress()
    105107  ///////////////////////////////////
    106108  {
    107     return (size_t) (rand() % (m_xmesh * m_ymesh)) ;
     109    return (uint32_t) (rand() % (m_xmesh * m_ymesh)) ;
    108110  }
    109111
    110112
    111113  ///////////////////////////////////
    112 //  tmpl(void)::destAdress(/*size_t X_local, size_t Y_local,*/ size_t &X_dest, size_t &Y_dest)
     114  tmpl(uint32_t)::destAdress(uint32_t *rand_seed)
    113115  ///////////////////////////////////
    114 //  {
    115 //    size_t x_dest_calc, y_dest_calc;
    116 //    do{
    117 //      x_dest_calc = (rand()%m_xmesh);
    118 //      y_dest_calc = (rand()%m_ymesh);
    119 //    } while((x_dest_calc = m_x) && (y_dest_calc == m_y));
    120 //  }
     116  {
     117    return (uint32_t) (rand_r(rand_seed) % (m_xmesh * m_ymesh)) ;
     118  }
    121119
    122120 
     
    132130
    133131        std::cout << "Vci_Synthetic_Initiator " << name()
    134                   << " : " << m_cpt_cycles << " cycles "
     132                  << " : " << std::dec << m_cpt_cycles << " cycles "
    135133                  << " : state = " << state_str[r_vci_fsm]
    136                   << " Adresse to send : " << m_address_to_send
    137                   << " Number of broadcast to receive : " << m_bc_nrsp << std::endl;
     134                  << " Adresse to send : " << std::hex << m_address_to_send
     135                  << " Number of broadcast to receive : " << std::dec << m_bc_nrsp << std::endl;
    138136  }
    139137
     
    152150    if ( ! p_resetn.read() ) {
    153151      // Initializing seed for random numbers generation
     152#ifndef DETERMINISM
    154153      srand(time(NULL));
     154#endif
    155155
    156156      // Initializing FSMs
     
    193193            } else {
    194194              r_vci_fsm = VCI_SINGLE_SEND ;
     195#ifdef DETERMINISM
     196              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));
     197#else
    195198              m_address_to_send = destAdress() << (vci_param::N)-(soclib::common::uint32_log2((uint32_t)m_xmesh)+soclib::common::uint32_log2((uint32_t)m_ymesh));
     199#endif
    196200              m_count = 0;
    197201            }
Note: See TracChangeset for help on using the changeset viewer.