Changeset 131


Ignore:
Timestamp:
Jan 20, 2011, 5:37:52 PM (13 years ago)
Author:
choichil
Message:

Initiator with only one FSM for responses

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

    r128 r131  
    44 * Copyright    : UPMC / LIP6
    55 * Authors      : Christophe Choichillon
    6  * Version      : 2.0
     6 * Version      : 2.1
    77 *
    88 * SOCLIB_LGPL_HEADER_BEGIN
     
    2626 * SOCLIB_LGPL_HEADER_END
    2727 *
     28 * Versions :
     29 *           - 1.0 Sending only one request at a time
     30 *           - 2.0 Sending multiple transactions and broadcast responses
     31 *                 identified with pktid (deprecated)
     32 *           - 2.1 Broadcast responses identified with the value 0 of trdid
     33 *
    2834 * Maintainers: christophe.choichillon@lip6.fr
    2935 */
     
    3238#define SOCLIB_CABA_SYNTHETIC_INITIATOR_H
    3339
     40#include <cassert>
    3441#include <systemc>
    3542#include <inttypes.h>
     
    6269        VCI_SINGLE_SEND,
    6370        VCI_BC_SEND,
     71        VCI_SINGLE_REGISTER
    6472      };
    6573
     
    140148
    141149      // Broadcast FSM
    142       sc_signal<bool>           r_bc_fsm;       // FSM state
    143       sc_signal<uint64_t>       r_bc_date;      // broadcast transaction requested date
     150      //sc_signal<bool>           r_bc_fsm;     // FSM state
     151      //sc_signal<uint64_t>             r_bc_date;      // broadcast transaction requested date
    144152      sc_signal<uint32_t>       r_bc_nrsp;      // Expected number of responses for a broadcast command
    145153       
  • trunk/modules/vci_synthetic_initator/caba/sources/src/vci_synthetic_initiator.cpp

    r129 r131  
    55 * Copyright    : UPMC / LIP6
    66 * Authors      : Christophe Choichillon
    7  * Version      : 2.0
     7 * Version      : 2.1
    88 *
    99 * SOCLIB_LGPL_HEADER_BEGIN
     
    8181    m_ymin(ymin),
    8282    m_ymax(ymax),
    83     r_date_fifo("r_date_fifo", depth),
    84     r_type_fifo("r_type_fifo", depth),
    85     r_cmd_fsm;        ("r_count"),             
    86     r_bc_rsp_fsm("r_bc_rsp_fsm"),
    87     r_index("r_index"),
    88     r_broadcast_req("r_broadcast_req"),
    89     r_broadcast_rsp("r_broadcast_rsp"),
    90     r_bc_nrsp("r_bc_nrsp")                 
    91     //r_req_id("r_req_id")
     83    r_date_fifo("r_date_fifo", m_depth),
     84    r_bc_fifo("r_bc_fifo", m_depth),
     85    r_cmd_fsm("r_cmd_fsm"),
     86    r_cmd_address("r_cmd_address"),             
     87    r_cmd_trdid("r_cmd_trdid"),
     88    r_cmd_count("r_cmd_count"),         
     89    r_cmd_seed("r_cmd_seed"),   
     90    //r_bc_fsm("r_bc_fsm"),     
     91    //r_bc_date("r_bc_date"),   
     92    r_bc_nrsp("r_bc_nrsp"),     
     93    r_cpt_cycles("r_cpt_cycles"),               
     94    r_cpt_period("r_cpt_period"),               
     95    r_nb_single("r_nb_single"),
     96    r_latency_single("r_latency_single"),       
     97    r_nb_bc("r_nb_bc"),
     98    r_latency_bc("r_latency_bc")               
    9299{
    93100
    94       r_req_id = new sc_signal<uint64_t>*[tab_size];
    95       for(int i = 0; i < tab_size ; i++){
    96         r_req_id[i] = new sc_signal<uint64_t>[2];
    97       }
     101      r_pending_fsm = new sc_signal<bool>[m_tab_size];
     102      r_pending_date = new sc_signal<uint64_t>[m_tab_size];
    98103
    99104      SC_METHOD(transition);
     
    112117    /////////////////////////////////
    113118  {
    114         for(int i = 0; i < tab_size ; i++){
    115           delete r_req_id[i];
    116         }
    117         delete r_req_id;
     119        delete r_pending_fsm;
     120        delete r_pending_date;
    118121  }
    119122
     
    146149
    147150        std::cout << "Vci_Synthetic_Initiator " << name()
    148                   << " : " << std::dec << m_cpt_cycles << " cycles "
     151                  << " : " << std::dec << r_cpt_cycles.read() << " cycles "
    149152                  << " : state_cmd_fsm = " << state_cmd_str[r_cmd_fsm]
    150                   << " : state_rsp_fsm = " << state_bc_rsp_str[r_bc_rsp_fsm]
     153                  << " : state_rsp_fsm = " << state_bc_rsp_str[r_pending_fsm[0].read()]
    151154                  << " Adresse to send : " << std::hex << r_cmd_address.read()
    152155                  << " Number of broadcast to receive : " << std::dec << r_bc_nrsp.read()
    153                   << " Number of packets sent : " << std::dec << r_nb_single.read() << " " << r_id_to_send.read() << std::endl;
     156                  << " Number of packets sent : " << std::dec << r_nb_single.read() << " " << r_cmd_trdid.read() << std::endl;
    154157        for(int i = 0; i < (1<<vci_param::T) ; i++){
    155           std::cout << "ID : " << i << " " << (uint64_t)(r_req_id[i][0].read()) << " " << (uint64_t)(r_req_id[i][1].read()) << std::endl;
     158          std::cout << "ID : " << i << " " << (uint64_t)(r_pending_date[i].read()) << std::endl;
    156159        }
    157160  }
     
    161164  //////////////////////////////////
    162165  {
    163         std::cout << name() << " : "<< std::dec << m_cpt_cycles << " cycles, " << r_nb_single.read() << " packets sent" << std::endl;
    164         std::cout << ((double)r_latency1.read()/(double)r_nb_single.read()) << " | " << ((double)r_latency2.read()/(double)r_nb_single.read()) << std::endl;
     166        std::cout << name() << " : "<< std::dec << r_cpt_cycles.read() << " cycles, " << r_nb_single.read() << " packets sent" << std::endl;
    165167        if(m_bc_period)
    166168          std::cout << ((double)r_latency_bc.read()/(double)r_nb_bc.read()) << std::endl;
     
    182184      // Initializing FSMs
    183185      r_cmd_fsm = VCI_IDLE;
    184       r_bc_fsm = BC_RSP_IDLE;
     186      //r_bc_fsm = false;
    185187      for(size_t i=0 ; i<m_tab_size ; i++) r_pending_fsm[i] = false;
    186188
     
    216218          if (r_date_fifo.rok())
    217219          {
    218             if ( r_bc_fifo() = true )   // its a broadcast request
     220            if ( r_bc_fifo.read() == true )     // its a broadcast request
    219221            {
    220               if ( r_bc_fsm.read() = false )    // no current broadcast
     222              if ( r_pending_fsm[0].read() == false )   // no current broadcast
    221223              {
    222               r_cmd_fsm = VCI_BC_SEND ;
    223               r_cmd_address = 0x3 | (0x7c1f << vci_param::N-20) ;
     224                r_cmd_fsm = VCI_BC_SEND ;
     225                r_cmd_address = 0x3 | (0x7c1f << vci_param::N-20) ;
    224226              }
    225227            }
     
    227229            {
    228230              int id = -1;
    229               for(int i = 0; i < tab_size; i++){
     231              for(int i = 1; i < m_tab_size; i++){      // ID 0 reserved for broadcast transactions
    230232                if(r_pending_fsm[i].read() == false)
    231233                {
     
    254256          if ( p_vci.cmdack.read())
    255257          {
    256             r_count = r_count.read() + 1;
     258            r_cmd_count = r_cmd_count.read() + 1;
    257259            if (r_cmd_count.read() == m_length-1)
    258260            {
     
    265267      case VCI_SINGLE_REGISTER:
    266268        {
    267           r_pending_date[r_cmd_trdid.read()] = (uint64_t)(m_date_fifo.read());
     269          r_pending_date[r_cmd_trdid.read()] = (uint64_t)(r_date_fifo.read());
    268270          r_pending_fsm[r_cmd_trdid.read()] = true;
    269271          fifo_get = true;
     
    274276          if (p_vci.cmdack.read())
    275277          {
    276             r_bc_fsm = true;
     278            //r_bc_fsm = true;
    277279            r_bc_nrsp = (m_xmax - m_xmin) * (m_ymax - m_ymin) ;
    278             r_bc_date = (uint64_t)(m_date_fifo.read());
     280            //r_bc_date = (uint64_t)(r_date_fifo.read());
     281            r_pending_fsm[0] = true;
     282            r_pending_date[0] = (uint64_t)(r_date_fifo.read());
    279283            fifo_get = true;
    280284            r_cmd_fsm = VCI_IDLE;
     
    287291    // BC_FSM
    288292    /////////////////////
    289     if ( r_bc_fsm.read() && p_vci.rspval.read() )
    290     {
    291       if ( p_vci.rpktid.read() == 1 ) r_bc_nrsp = r_bc_nrsp.read() - 1;
    292       if (r_bc_nrsp == 1)
    293       {
    294         r_bc_fsm = false;
    295         r_latency_bc = r_latency_bc.read() + (r_cpt_cycle.read() - r_bc_date.read());
    296       }
    297     }
     293    //if ( r_pending_fsm[0].read() && p_vci.rspval.read() )
     294    //{
     295    //  if ( p_vci.rtrdid.read() == 0 ) r_bc_nrsp = r_bc_nrsp.read() - 1;
     296    //  if (r_bc_nrsp.read() == 1)
     297    //  {
     298    //    //r_bc_fsm = false;
     299    //    r_pending_fsm[0] = false ;
     300    //    r_latency_bc = r_latency_bc.read() + (r_cpt_cycles.read() - r_pending_date[0].read());
     301    //  }
     302    //}
    298303
    299304    ///////////////////
    300305    // PENDING FSMs
    301306    //////////////////
    302     if(p_vci.rspval.read())i
     307    if(p_vci.rspval.read())
    303308    {
    304       if((int)(p_vci.pktid.read()) == 0)        // not a broadcast
     309      if(p_vci.rtrdid.read() == 0)      // not a broadcast
     310      {
     311        assert( ( r_pending_fsm[0].read() == true ) &&
     312                "illegal broadcast response received");
     313        r_bc_nrsp = r_bc_nrsp.read() - 1 ;
     314        if(r_bc_nrsp.read() == 1)
     315        {
     316          r_pending_fsm[0] = false;
     317          r_latency_bc = r_latency_bc.read() + (r_cpt_cycles.read() - r_pending_date[0].read());
     318        }
     319      }
     320      else
    305321      {
    306322        assert( ( r_pending_fsm[(int)p_vci.rtrdid.read()] == true ) &&
    307                 "illegal single response received")
     323                "illegal single response received");
    308324        r_pending_fsm[p_vci.rtrdid.read()] = false;
    309325        r_latency_single = r_latency_single.read() +
     
    332348    }
    333349
    334     if ( m_bc_period && (r_cpt_period.read() > m_bc_period) && r_data_fifo.wok() )
    335       m_cpt_period = 0;
     350    if ( m_bc_period && (r_cpt_period.read() > m_bc_period) && r_date_fifo.wok() )
     351      r_cpt_period = 0;
    336352    else
    337       m_cpt_period = m_cpt_period.read() + 1;
     353      r_cpt_period = r_cpt_period.read() + 1;
    338354
    339355    ////////////////////////
    340356    //  update fifos
    341357    ////////////////////////
    342     if (date_fifo_put){
    343       if (date_fifo_get){
     358    if (fifo_put){
     359      if (fifo_get){
    344360        r_date_fifo.put_and_get(r_cpt_cycles.read());
    345361        r_bc_fifo.put_and_get(fifo_bc);
    346362      } else {
    347         r_date_fifo.simple_put(m_cpt_cycles);
     363        r_date_fifo.simple_put(r_cpt_cycles.read());
    348364        r_bc_fifo.simple_put(fifo_bc);
    349365      }
    350366    } else {
    351       if (date_fifo_get){
     367      if (fifo_get){
    352368        r_date_fifo.simple_get();
    353369        r_bc_fifo.simple_get();
     
    374390     p_vci.be         = 0xF;                             
    375391     p_vci.srcid      = m_srcid;   
    376      p_vci.pktid      = 0;     
    377392     p_vci.cons       = false;       
    378393     p_vci.wrap       = false;       
     
    393408          p_vci.wdata   = 0;                                       
    394409          p_vci.trdid   = 0;                 
     410          p_vci.pktid      = 0;     
    395411          p_vci.eop     = false;                                   
    396412          break;
     
    400416        {
    401417          p_vci.cmdval  = true;                 
    402           p_vci.address = (addr_t)(r_cmd_address.read() + (r_count.read()*4));
     418          p_vci.address = (addr_t)(r_cmd_address.read() + (r_cmd_count.read()*4));
    403419          p_vci.plen    = m_length*4;                                         
    404420          p_vci.wdata   = 0;                                       
    405           p_vci.trdid   = r_id_to_send.read();                 
    406           if (r_count.read() == m_length - 1 ) {
     421          p_vci.trdid   = r_cmd_trdid.read();                 
     422          p_vci.pktid   = 0;     
     423          if (r_cmd_count.read() == m_length - 1 ) {
    407424            p_vci.eop     = true;                                   
    408425          } else {
     
    418435          p_vci.plen    = 4;                                         
    419436          p_vci.wdata   = 0;                                       
    420           p_vci.pktid   = 1;     
    421437          p_vci.trdid   = 0;                 
     438          p_vci.pktid   = 0;     
    422439          p_vci.eop     = true;                                   
    423440          break;
    424441        }
     442      //////////////////
     443      case VCI_SINGLE_REGISTER:
     444        {
     445          p_vci.cmdval  = false;                 
     446          p_vci.address = 0;
     447          p_vci.plen    = 0;                                         
     448          p_vci.wdata   = 0;                                       
     449          p_vci.trdid   = 0;                 
     450          p_vci.pktid   = 0;     
     451          p_vci.eop     = false;                                   
     452          break;
     453        }
    425454    } // end switch vci_cmd_fsm
    426455
Note: See TracChangeset for help on using the changeset viewer.