Changeset 362 for branches/v5/modules


Ignore:
Timestamp:
Apr 10, 2013, 12:58:52 PM (11 years ago)
Author:
cfuguet
Message:

Bugfix in vci_mem_cache:

In function "copy()" of the xram_transaction table the LL key was not
copied into register. Hence, the key coming from the XRAM_RSP to the
TGT_RSP FSM was never correct.

In TGT_RSP FSM, in case of LL response, the two response flits were
inverted. We must send first the key and then the data.

Location:
branches/v5/modules/vci_mem_cache/caba/source
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/v5/modules/vci_mem_cache/caba/source/include/vci_mem_cache.h

    r351 r362  
    782782      sc_signal<int>      r_tgt_rsp_fsm;
    783783      sc_signal<size_t>   r_tgt_rsp_cpt;
     784      sc_signal<bool>     r_tgt_rsp_key_sent;
    784785
    785786      ////////////////////////////////////////////////////
  • branches/v5/modules/vci_mem_cache/caba/source/include/xram_transaction.h

    r307 r362  
    7878        wdata.assign(source.wdata.begin(),source.wdata.end());
    7979        rerror      = source.rerror;
     80        ll_key      = source.ll_key;
    8081    }
    8182
  • branches/v5/modules/vci_mem_cache/caba/source/src/vci_mem_cache.cpp

    r354 r362  
    729729    r_alloc_heap_reset_cpt = 0;
    730730
     731    r_tgt_rsp_key_sent  = false;
     732
    731733    // Activity counters
    732734    m_cpt_cycles        = 0;
     
    61956197    case TGT_RSP_READ:    // send the response to a read
    61966198    {
    6197       if(p_vci_tgt.rspack)
     6199      if ( p_vci_tgt.rspack )
    61986200      {
    61996201
    62006202#if DEBUG_MEMC_TGT_RSP
    6201         if(m_debug_tgt_rsp_fsm)
    6202         {
    6203           std::cout << "  <MEMC " << name() << ".TGT_RSP_READ> Read response"
    6204                     << " / rsrcid = " << std::dec << r_read_to_tgt_rsp_srcid.read()
    6205                     << " / rtrdid = " << r_read_to_tgt_rsp_trdid.read()
    6206                     << " / rpktid = " << r_read_to_tgt_rsp_pktid.read()
    6207                     << " / rdata = " << std::hex << r_read_to_tgt_rsp_data[r_tgt_rsp_cpt.read()].read()
    6208                     << " / cpt = " << std::dec << r_tgt_rsp_cpt.read() << std::endl;
    6209         }
    6210 #endif
    6211         if(r_tgt_rsp_cpt.read() == (r_read_to_tgt_rsp_word.read() +r_read_to_tgt_rsp_length-1))
    6212         {
    6213           r_tgt_rsp_fsm = TGT_RSP_READ_IDLE;
     6203if( m_debug_tgt_rsp_fsm )
     6204{
     6205  std::cout
     6206    << "  <MEMC " << name() << ".TGT_RSP_READ> Read response"
     6207    << " / rsrcid = " << std::dec << r_read_to_tgt_rsp_srcid.read()
     6208    << " / rtrdid = " << r_read_to_tgt_rsp_trdid.read()
     6209    << " / rpktid = " << r_read_to_tgt_rsp_pktid.read()
     6210    << " / rdata = " << std::hex << r_read_to_tgt_rsp_data[r_tgt_rsp_cpt.read()].read()
     6211    << " / cpt = " << std::dec << r_tgt_rsp_cpt.read() << std::endl;
     6212}
     6213#endif
     6214 
     6215        uint32_t last_word_idx = r_read_to_tgt_rsp_word.read() + r_read_to_tgt_rsp_length.read() - 1;
     6216        bool     is_last_word  = (r_tgt_rsp_cpt.read() == last_word_idx);
     6217        bool     is_ll         = ((r_read_to_tgt_rsp_pktid.read() & 0x7) == TYPE_LL);
     6218
     6219        if ( (is_last_word and not is_ll) or (r_tgt_rsp_key_sent.read() and is_ll))
     6220        {
     6221          // Last word in case of READ or second flit in case if LL
     6222          r_tgt_rsp_key_sent    = false;
    62146223          r_read_to_tgt_rsp_req = false;
     6224          r_tgt_rsp_fsm         = TGT_RSP_READ_IDLE;
    62156225        }
    62166226        else
    62176227        {
    6218           r_tgt_rsp_cpt = r_tgt_rsp_cpt.read() + 1;
    6219         }
    6220       }
    6221       break;
    6222     }
    6223     ///////////////////
     6228          if (is_ll)
     6229          {
     6230            r_tgt_rsp_key_sent = true;                // Send second flit of ll
     6231          }
     6232          else
     6233          {
     6234            r_tgt_rsp_cpt = r_tgt_rsp_cpt.read() + 1; // Send next word of read
     6235          }
     6236        }
     6237      }
     6238      break;
     6239    }
     6240    //////////////////
    62246241    case TGT_RSP_WRITE:   // send the write acknowledge
    62256242    {
     
    62856302    case TGT_RSP_XRAM:    // send the response after XRAM access
    62866303    {
    6287       if(p_vci_tgt.rspack)
     6304      if ( p_vci_tgt.rspack )
    62886305      {
    62896306
    62906307#if DEBUG_MEMC_TGT_RSP
    6291         if(m_debug_tgt_rsp_fsm)
    6292         {
    6293           std::cout << "  <MEMC " << name() << ".TGT_RSP_XRAM> Response following XRAM access"
    6294                     << " / rsrcid = " << std::dec << r_xram_rsp_to_tgt_rsp_srcid.read()
    6295                     << " / rtrdid = " << r_xram_rsp_to_tgt_rsp_trdid.read()
    6296                     << " / rpktid = " << r_xram_rsp_to_tgt_rsp_pktid.read()
    6297                     << " / rdata = " << std::hex << r_xram_rsp_to_tgt_rsp_data[r_tgt_rsp_cpt.read()].read()
    6298                     << " / cpt = " << std::dec << r_tgt_rsp_cpt.read() << std::endl;
    6299         }
    6300 #endif
    6301         if((r_tgt_rsp_cpt.read() ==
    6302             (r_xram_rsp_to_tgt_rsp_word.read() +r_xram_rsp_to_tgt_rsp_length.read()-1))
    6303             || r_xram_rsp_to_tgt_rsp_rerror.read())
    6304         {
    6305           r_tgt_rsp_fsm = TGT_RSP_XRAM_IDLE;
     6308if( m_debug_tgt_rsp_fsm )
     6309{
     6310  std::cout
     6311    << "  <MEMC " << name() << ".TGT_RSP_XRAM> Response following XRAM access"
     6312    << " / rsrcid = " << std::dec << r_xram_rsp_to_tgt_rsp_srcid.read()
     6313    << " / rtrdid = " << r_xram_rsp_to_tgt_rsp_trdid.read()
     6314    << " / rpktid = " << r_xram_rsp_to_tgt_rsp_pktid.read()
     6315    << " / rdata = " << std::hex << r_xram_rsp_to_tgt_rsp_data[r_tgt_rsp_cpt.read()].read()
     6316    << " / cpt = " << std::dec << r_tgt_rsp_cpt.read() << std::endl;
     6317}
     6318#endif
     6319        uint32_t last_word_idx = r_xram_rsp_to_tgt_rsp_word.read() + r_xram_rsp_to_tgt_rsp_length.read() - 1;
     6320        bool     is_last_word  = (r_tgt_rsp_cpt.read() == last_word_idx);
     6321        bool     is_ll         = ((r_xram_rsp_to_tgt_rsp_pktid.read() & 0x7) == TYPE_LL);
     6322        bool     is_error      = r_xram_rsp_to_tgt_rsp_rerror.read();
     6323
     6324        if (((is_last_word or is_error) and not is_ll) or
     6325             (r_tgt_rsp_key_sent.read() and     is_ll))
     6326        {
     6327          // Last word sent in case of READ or second flit sent in case if LL
     6328          r_tgt_rsp_key_sent        = false;
    63066329          r_xram_rsp_to_tgt_rsp_req = false;
     6330          r_tgt_rsp_fsm             = TGT_RSP_XRAM_IDLE;
    63076331        }
    63086332        else
    63096333        {
    6310           r_tgt_rsp_cpt = r_tgt_rsp_cpt.read() + 1;
     6334          if (is_ll)
     6335          {
     6336            r_tgt_rsp_key_sent = true;                     // Send second flit of ll
     6337          }                                                                           
     6338          else
     6339          {
     6340            r_tgt_rsp_cpt      = r_tgt_rsp_cpt.read() + 1; // Send next word of read
     6341          }
    63116342        }
    63126343      }
     
    72877318
    72887319    case TGT_RSP_READ:
    7289       p_vci_tgt.rspval   = true;
    7290       if(((r_read_to_tgt_rsp_pktid.read() & 0x7) == TYPE_LL)
    7291           && (r_tgt_rsp_cpt.read() == (r_read_to_tgt_rsp_word.read() +r_read_to_tgt_rsp_length-1)))
    7292         p_vci_tgt.rdata  = r_read_to_tgt_rsp_data[r_tgt_rsp_cpt.read()-1].read();
    7293       else if((r_read_to_tgt_rsp_pktid.read() & 0x7) == TYPE_LL)
    7294         p_vci_tgt.rdata  = r_read_to_tgt_rsp_ll_key.read();
     7320    {
     7321      uint32_t last_word_idx = r_read_to_tgt_rsp_word.read() + r_read_to_tgt_rsp_length - 1;
     7322      bool     is_last_word  = (r_tgt_rsp_cpt.read() == last_word_idx);
     7323      bool     is_ll         = ((r_read_to_tgt_rsp_pktid.read() & 0x7) == TYPE_LL);
     7324
     7325      p_vci_tgt.rspval  = true;
     7326
     7327      if ( is_ll and not r_tgt_rsp_key_sent.read() )
     7328      {
     7329        // LL response first flit
     7330        p_vci_tgt.rdata = r_read_to_tgt_rsp_ll_key.read();
     7331      }
    72957332      else
    7296         p_vci_tgt.rdata  = r_read_to_tgt_rsp_data[r_tgt_rsp_cpt.read()].read();
    7297       p_vci_tgt.rsrcid   = r_read_to_tgt_rsp_srcid.read();
    7298       p_vci_tgt.rtrdid   = r_read_to_tgt_rsp_trdid.read();
    7299       p_vci_tgt.rpktid   = r_read_to_tgt_rsp_pktid.read();
    7300       p_vci_tgt.rerror   = 0;
    7301       p_vci_tgt.reop     = (r_tgt_rsp_cpt.read() == (r_read_to_tgt_rsp_word.read() +r_read_to_tgt_rsp_length-1));
    7302       break;
     7333      {
     7334        // LL response second flit or READ response
     7335        p_vci_tgt.rdata = r_read_to_tgt_rsp_data[r_tgt_rsp_cpt.read()].read();
     7336      }
     7337
     7338      p_vci_tgt.rsrcid  = r_read_to_tgt_rsp_srcid.read();
     7339      p_vci_tgt.rtrdid  = r_read_to_tgt_rsp_trdid.read();
     7340      p_vci_tgt.rpktid  = r_read_to_tgt_rsp_pktid.read();
     7341      p_vci_tgt.rerror  = 0;
     7342      p_vci_tgt.reop    = (is_last_word and not is_ll) or (r_tgt_rsp_key_sent.read() and is_ll);
     7343      break;
     7344    }
    73037345
    73047346    case TGT_RSP_WRITE:
     
    73367378
    73377379    case TGT_RSP_XRAM:
    7338       p_vci_tgt.rspval   = true;
    7339       if(((r_xram_rsp_to_tgt_rsp_pktid.read() & 0x7) == TYPE_LL)
    7340           && (r_tgt_rsp_cpt.read() == (r_xram_rsp_to_tgt_rsp_word.read() +r_xram_rsp_to_tgt_rsp_length-1)))
    7341         p_vci_tgt.rdata  = r_xram_rsp_to_tgt_rsp_ll_key.read();
    7342       else
    7343         p_vci_tgt.rdata  = r_xram_rsp_to_tgt_rsp_data[r_tgt_rsp_cpt.read()].read();
    7344       p_vci_tgt.rsrcid   = r_xram_rsp_to_tgt_rsp_srcid.read();
    7345       p_vci_tgt.rtrdid   = r_xram_rsp_to_tgt_rsp_trdid.read();
    7346       p_vci_tgt.rpktid   = r_xram_rsp_to_tgt_rsp_pktid.read();
    7347       p_vci_tgt.rerror   = r_xram_rsp_to_tgt_rsp_rerror.read();
    7348       p_vci_tgt.reop     = ((r_tgt_rsp_cpt.read()
    7349                              == (r_xram_rsp_to_tgt_rsp_word.read() +r_xram_rsp_to_tgt_rsp_length.read()-1))
    7350                             || r_xram_rsp_to_tgt_rsp_rerror.read());
    7351       break;
     7380    {
     7381      uint32_t last_word_idx = r_xram_rsp_to_tgt_rsp_word.read() + r_xram_rsp_to_tgt_rsp_length.read() - 1;
     7382      bool     is_last_word  = (r_tgt_rsp_cpt.read() == last_word_idx);
     7383      bool     is_ll         = ((r_xram_rsp_to_tgt_rsp_pktid.read() & 0x7) == TYPE_LL);
     7384      bool     is_error      = r_xram_rsp_to_tgt_rsp_rerror.read();
     7385
     7386      p_vci_tgt.rspval  = true;
     7387
     7388      if( is_ll and not r_tgt_rsp_key_sent.read() ) {
     7389        // LL response first flit
     7390        p_vci_tgt.rdata = r_xram_rsp_to_tgt_rsp_ll_key.read();
     7391      }
     7392      else {
     7393        // LL response second flit or READ response
     7394        p_vci_tgt.rdata = r_xram_rsp_to_tgt_rsp_data[r_tgt_rsp_cpt.read()].read();
     7395      }
     7396
     7397      p_vci_tgt.rsrcid  = r_xram_rsp_to_tgt_rsp_srcid.read();
     7398      p_vci_tgt.rtrdid  = r_xram_rsp_to_tgt_rsp_trdid.read();
     7399      p_vci_tgt.rpktid  = r_xram_rsp_to_tgt_rsp_pktid.read();
     7400      p_vci_tgt.rerror  = is_error;
     7401      p_vci_tgt.reop    = (((is_last_word or is_error) and not is_ll) or
     7402                            (r_tgt_rsp_key_sent.read() and     is_ll));
     7403      break;
     7404    }
    73527405
    73537406    case TGT_RSP_INIT:
Note: See TracChangeset for help on using the changeset viewer.