Changeset 106 for trunk/modules


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

Location:
trunk/modules/vci_synthetic_initator/caba
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/modules/vci_synthetic_initator/caba/metadata/vci_synthetic_initiator.sd

    r98 r106  
    1818                parameter.IntTab('vci_index'),
    1919                parameter.Int('length'),
    20                 parameter.Float('rho'),
     20                parameter.Int('rho'),
    2121                parameter.Int('depth'),
    2222                parameter.Int('xmesh'),
  • trunk/modules/vci_synthetic_initator/caba/sources/include/vci_synthetic_initiator.h

    r102 r106  
    4747      : public soclib::caba::BaseModule
    4848    {
    49       typedef sc_dt::sc_uint<40> addr_t;
    50       typedef typename vci_param::fast_addr_t vci_addr_t;
     49      typedef uint32_t addr_t;
    5150      typedef uint32_t data_t;
    5251      typedef uint32_t tag_t;
     
    5453      typedef uint32_t be_t;
    5554      typedef uint32_t copy_t;
    56 
    57       // Type of the addr_t and access of the fields
    58       //typedef union{
    59       //  PACKED_BITFIELD(
    60       //    vci_addr_t srcid:vci_param::S,
    61       //    vci_addr_t null:(8*sizeof(vci_addr_t)-(2*vci_param::S)),
    62       //  ) normal_address;
    63       //  PACKED_BITFIELD(
    64       //    vci_addr_t xmin:vci_param::S,
    65       //    vci_addr_t xmax:vci_param::S,
    66       //    vci_addr_t ymin:vci_param::S,
    67       //    vci_addr_t ymax:vci_param::S,
    68       //    vci_addr_t null_:(8*sizeof(vci_addr_t)-(4*vci_param::S)),
    69       //    vci_addr_t bc:2,
    70       //  ) broadcast_address;
    71       //} addr_t;
    7255
    7356
     
    8568      };
    8669
    87       uint64_t     m_cpt_cycles;            // Counter of cycles
     70      uint32_t     m_cpt_cycles;            // Counter of cycles
    8871     
    8972
     
    10285                const soclib::common::IntTab       &vci_index,
    10386                const uint32_t length,    // Packet length (flit numbers)
    104                 const float  rho,       // Packets ratio on the network
     87                const uint32_t rho,       // Packets ratio on the network
     88                //const float    rho,       // Packets ratio on the network
    10589                const uint32_t depth,     // Fifo depth
    10690                const uint32_t xmesh,   
     
    121105      size_t destAdress();
    122106
     107      void printStats();
     108
     109      void print_trace();
     110
    123111    private:
    124112
    125113      // Component attributes
    126114      const size_t                        m_length;             // Number of words to write
    127       const float                         m_rho;                // Rate of packets in the network wanted
     115      const size_t                        m_rho;                // Rate of packets in the network wanted
     116      //const float                       m_rho;                // Rate of packets in the network wanted
    128117      const size_t                        m_depth;              // Fifo depth
    129118      const size_t                        m_xmesh;     
     
    135124      const size_t                        m_ymax;
    136125      const size_t                        m_srcid;
    137       const size_t                        m_coord;
    138126
    139127      size_t                              m_count;                  // Numbers of words sent
     
    141129      uint64_t                            m_start_latency1;         // Start time of sending packet wanted
    142130      uint64_t                            m_start_latency2;         // Start time of sending packet
    143       float                               m_rhos;                   // Effective Rho during the simulation
     131//      float                             m_rhos;                   // Effective Rho during the simulation
    144132      size_t                              m_bc_nrsp;                // Expected number of responses for a broadcast command
     133      addr_t                              m_address_to_send;        // Address to send the write command
    145134
    146135      // Fifo transmitting date to the VCI FSM
    147       GenericFifo<uint64_t>    m_date_fifo;
     136      GenericFifo<uint32_t>    m_date_fifo;
    148137
    149138      sc_signal<int>           r_vci_fsm;
     
    153142      sc_signal<bool>          r_broadcast_req;
    154143
    155       sc_signal<addr_t>        r_address_to_send;        // Address to send the write command
    156144
    157145    }; // end class VciSyntheticInitiator
  • 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.