Changeset 81 for trunk


Ignore:
Timestamp:
Aug 31, 2010, 2:18:16 PM (14 years ago)
Author:
choichil
Message:

vci_synthetic_initiator draft

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_initator.h

    r78 r81  
    6161      };
    6262
    63       uint32_t     m_cpt_cycles;            // Counter of cycles
     63      uint64_t     m_cpt_cycles;            // Counter of cycles
     64     
    6465
    6566    protected:
     
    7778                float  rho,       // Packets ratio on the network
    7879                size_t depth,     // Fifo depth
    79                 size_t x,               //
    80                 size_t y,               //
     80                size_t x,         // X location of the synthetic initiator
     81                size_t y,         // Y location of the synthetic initiator
    8182                size_t xmesh,   
    8283                size_t ymesh,
     
    8586                size_t xmax,
    8687                size_t ymin,
    87                 size_t ymax
    88                 const soclib::common::IntTab &vci_index,
     88                size_t ymax,
     89                const soclib::common::IntTab &vci_index
    8990                );                                 
    9091
     
    9596      void genMoore();
    9697
    97       void print_stats();
     98      void destAdress(size_t X_local, size_t Y_local, size_t &X_dest, size_t &Y_dest);
    9899
    99100    private:
     
    102103      const size_t                        m_length;             // Number of flits of a packet
    103104      const size_t                        m_rho;                // Rate of packets in the network wanted
    104       const size_t                        m_depth,              // Fifo depth
    105       const size_t                        m_x,                  //
    106       const size_t                        m_y,                  //
    107       const size_t                        m_xmesh,     
    108       const size_t                        m_ymesh,
    109       const size_t                        m_bc_period,          // Broadcast period, if no broadcast => 0
    110       const size_t                        m_xmin,
    111       const size_t                        m_xmax,
    112       const size_t                        m_ymin,
    113       const size_t                        m_ymax
     105      const size_t                        m_depth;              // Fifo depth
     106      const size_t                        m_x;                  // X location
     107      const size_t                        m_y;                  // Y location
     108      const size_t                        m_xmesh;     
     109      const size_t                        m_ymesh;
     110      const size_t                        m_bc_period;          // Broadcast period, if no broadcast => 0
     111      const size_t                        m_xmin;
     112      const size_t                        m_xmax;
     113      const size_t                        m_ymin;
     114      const size_t                        m_ymax;
     115
     116      size_t       m_count;
     117      size_t       m_npackets;              // Total number of packets already sent
    114118
    115119      // Fifo transmitting date to the VCI FSM
     
    120124      sc_signal<size_t>      r_index;
    121125
     126      sc_signal<bool>        r_broadcast_req;
     127
    122128    }; // end class VciSyntheticInitiator
    123129 
  • trunk/modules/vci_synthetic_initator/caba/sources/src/vci_synthetic_initator.cpp

    r78 r81  
    6767    m_srcid_ini( mtc.indexForId(vci_ini_index) ),
    6868    //  FIFOs
     69    m_length(length),
     70    m_rho(rho),
     71    m_depth(depth),
     72    m_x(x),
     73    m_y(y),
     74    m_xmesh(xmesh),
     75    m_ymesh(ymesh),
     76    m_bc_period(bc_period),
     77    m_xmin(xmin),
     78    m_xmax(xmax),
     79    m_ymin(ymin),
     80    m_ymax(ymax),
    6981    m_date_fifo("m_date_fifo", depth),
    70 
    7182    r_tgt_cmd_fsm("r_tgt_cmd_fsm"),
    7283    {
    7384
    74       // Memory cache allocation & initialisation
    75       m_cache_data = new data_t**[nways];
    76       for ( size_t i=0 ; i<nways ; ++i ) {
    77         m_cache_data[i] = new data_t*[nsets];
    78       }
    79       for ( size_t i=0; i<nways; ++i ) {
    80         for ( size_t j=0; j<nsets; ++j ) {
    81           m_cache_data[i][j] = new data_t[nwords];
    82           for ( size_t k=0; k<nwords; k++){
    83             m_cache_data[i][j][k]=0;
    84           }     
    85         }
    86       }
    8785
    8886      SC_METHOD(transition);
     
    10199    /////////////////////////////////
    102100  {
    103     delete [] r_write_to_init_cmd_data;
     101  }
     102
     103  ///////////////////////////////////
     104  tmpl(void)::destAdress(size_t X_local, size_t Y_local, size_t &X_dest, size_t &Y_dest)
     105  ///////////////////////////////////
     106  {
     107    X_dest = (size_t) ((rand())%m_xmesh);
     108    Y_dest = (size_t) ((rand())%m_ymesh);
    104109  }
    105110
     
    111116    //  RESET         
    112117    if ( ! p_resetn.read() ) {
    113 
     118      //srand(time(NULL));
    114119      //     Initializing FSMs
    115120      r_tgt_cmd_fsm     = TGT_CMD_IDLE;
     
    119124      m_date_fifo.init();
    120125
    121       r_read_to_tgt_rsp_req             = false;
    122       r_read_to_xram_cmd_req            = false;
    123 
    124       r_write_to_tgt_rsp_req            = false;
    125       r_write_to_xram_cmd_req           = false;
    126       r_write_to_init_cmd_req           = false;
    127 
    128 
    129126      // Activity counters
    130127      m_cpt_cycles              = 0;
     128      m_npackets                = 0;
    131129
    132130      return;
    133131    }
    134132
    135     bool    cmd_read_fifo_put = false;
    136     bool    cmd_read_fifo_get = false;
     133    bool    date_fifo_put = false;
     134    bool    date_fifo_get = false;
    137135
    138136    switch ( r_vci_fsm.read() ) {
     
    151149      case VCI_SINGLE_RECEIVE:
    152150        {
     151          if (p_vci.cmdack.read()) {
     152            // LATENCY
     153            r_vci_fsm = VCI_IDLE ;
     154          }
    153155          break;
    154156        }
     
    161163      case VCI_BC_RECEIVE:
    162164        {
     165          r_broadcast_req = false;
    163166          break;
    164167        }
     
    166169
    167170
    168     if ( cmd_cleanup_fifo_put ) {
    169       if ( cmd_cleanup_fifo_get ) {
    170         m_cmd_cleanup_srcid_fifo.put_and_get(p_vci_tgt.srcid.read());
    171         m_cmd_cleanup_trdid_fifo.put_and_get(p_vci_tgt.trdid.read());
    172         m_cmd_cleanup_pktid_fifo.put_and_get(p_vci_tgt.pktid.read());
    173         m_cmd_cleanup_nline_fifo.put_and_get(p_vci_tgt.wdata.read());
     171/////////////////// Filling fifo
     172    if(){
     173      if (m_date_fifo.wok()){
     174        date_fifo_put = true ;
     175      }
     176      if (!r_broadcast_req.read() && (m_cpt_cycles % bc_period)){
     177        r_broadcast_req = true;
     178      }
     179    }
     180
     181    if (date_fifo_put){
     182      if (date_fifo_get){
     183        m_date_fifo.put_and_get(m_cpt_cycles);
    174184      } else {
    175         m_cmd_cleanup_srcid_fifo.simple_put(p_vci_tgt.srcid.read());
    176         m_cmd_cleanup_trdid_fifo.simple_put(p_vci_tgt.trdid.read());
    177         m_cmd_cleanup_pktid_fifo.simple_put(p_vci_tgt.pktid.read());
    178         m_cmd_cleanup_nline_fifo.simple_put(p_vci_tgt.wdata.read());
     185        m_date_fifo.simple_put(m_cpt_cycles);
    179186      }
    180187    } else {
    181       if ( cmd_cleanup_fifo_get ) {
    182         m_cmd_cleanup_srcid_fifo.simple_get();
    183         m_cmd_cleanup_trdid_fifo.simple_get();
    184         m_cmd_cleanup_pktid_fifo.simple_get();
    185         m_cmd_cleanup_nline_fifo.simple_get();
     188      if (date_fifo_get){
     189        m_date_fifo.simple_get();
    186190      }
    187191    }
    188192
     193
    189194    m_cpt_cycles++;
     195
     196    return;
    190197
    191198  } // end transition()
     
    198205    // Command signals on the p_vci_ixr port
    199206    ////////////////////////////////////////////////////////////
     207     p_vci.cmd        = vci_param::CMD_READ;   
     208     p_vci.be         = 0xF;                             
     209     p_vci.pktid      = 0;     
     210     p_vci.srcid      = m_srcid_ixr;   
     211     p_vci.cons       = false;       
     212     p_vci.wrap       = false;       
     213     p_vci.contig     = true;       
     214     p_vci.clen       = 0;         
     215     p_vci.cfixed     = false;           
    200216
    201217
     
    205221      case VCI_IDLE:
    206222        {
     223          p_vci.cmdval  = false;                 
     224          p_vci.address = 0;
     225          p_vci.plen    = 0;                                         
     226          p_vci.wdata   = 0;                                       
     227          p_vci.trdid   = 0;                 
     228          p_vci.eop     = false;                                   
    207229          break;
    208230        }
     
    210232      case VCI_SINGLE_SEND:
    211233        {
     234          p_vci.cmdval = true ;
    212235          break;
    213236        }
Note: See TracChangeset for help on using the changeset viewer.