Changeset 138


Ignore:
Timestamp:
Feb 18, 2011, 11:10:07 AM (13 years ago)
Author:
guthmull
Message:

Handle bad accesses cleanly : transmit all accesses to the xram and handle rerror in responses. The simulation is no more stopped and gdb can be used for debug.

Location:
trunk/modules/vci_mem_cache_v4/caba/source
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/modules/vci_mem_cache_v4/caba/source/include/vci_mem_cache_v4.h

    r116 r138  
    189189        XRAM_RSP_HEAP_ERASE,
    190190        XRAM_RSP_HEAP_LAST,
     191        XRAM_RSP_ERROR_ERASE,
     192        XRAM_RSP_ERROR_RSP,
    191193      };
    192194
     
    393395      sc_signal<int>         r_tgt_cmd_fsm;
    394396
    395       sc_signal<size_t>      r_index;
    396397      size_t nseg;
    397398      size_t ncseg;
     
    634635      sc_signal<size_t>    r_xram_rsp_to_tgt_rsp_word;  // first word index
    635636      sc_signal<size_t>    r_xram_rsp_to_tgt_rsp_length;// length of the response
     637      sc_signal<bool>      r_xram_rsp_to_tgt_rsp_rerror;// send error to requester
    636638
    637639      // Buffer between XRAM_RSP fsm and INIT_CMD fsm (Inval L1 Caches)
  • trunk/modules/vci_mem_cache_v4/caba/source/include/xram_transaction_v4.h

    r2 r138  
    3131  std::vector<data_t> wdata;        // write buffer (one cache line)
    3232  std::vector<be_t>   wdata_be;         // be for each data in the write buffer
     33  bool            rerror;           // error returned by xram
    3334
    3435  /////////////////////////////////////////////////////////////////////
     
    7273    word_index  = source.word_index;
    7374    wdata_be.assign(source.wdata_be.begin(),source.wdata_be.end());
    74     wdata.assign(source.wdata.begin(),source.wdata.end());     
     75    wdata.assign(source.wdata.begin(),source.wdata.end());
     76    rerror      = source.rerror;
    7577  }
    7678
     
    9597    }
    9698    std::cout << std::endl;
     99    std::cout << "rerror      = " << rerror       << std::endl;
    97100  }
    98101
     
    106109      wdata.clear();
    107110      valid=false;
     111      rerror=false;
    108112    }
    109113
     
    120124    wdata_be.assign(source.wdata_be.begin(),source.wdata_be.end());
    121125    wdata.assign(source.wdata.begin(),source.wdata.end());     
     126    rerror      = source.rerror;
    122127  }
    123128
     
    363368  /////////////////////////////////////////////////////////////////////
    364369  void write_rsp(const size_t index,
    365                  const size_t word,
    366                  const data_t data)
     370                 const size_t word,
     371                 const data_t data,
     372                 const bool   rerror)
    367373  {
    368374    assert( (index < size_tab)
     
    377383    data_t mask = be_to_mask(tab[index].wdata_be[word]);
    378384    tab[index].wdata[word] = (tab[index].wdata[word] & mask) | (data & ~mask);
     385    tab[index].rerror |= rerror;
    379386  }
    380387
  • trunk/modules/vci_mem_cache_v4/caba/source/src/vci_mem_cache_v4.cpp

    r134 r138  
    143143    "XRAM_RSP_HEAP_ERASE ",
    144144    "XRAM_RSP_HEAP_LAST  ",
     145    "XRAM_RSP_ERROR_ERASE",
     146    "XRAM_RSP_ERROR_RSP  ",
    145147  };
    146148  const char *ixr_cmd_fsm_str[] = {
     
    651653              PRINTF("  * <TGT> Request from %d at address %llx\n",(uint32_t)p_vci_tgt.srcid.read(),(uint64_t)p_vci_tgt.address.read());
    652654
    653             assert( (p_vci_tgt.srcid.read() < m_initiators) &&
    654             "VCI_MEM_CACHE error in direct request : received SRCID is larger than the number of initiators");
    655 
    656             bool reached = false;
    657             for ( size_t index = 0 ; index < nseg && !reached ; index++)
    658             {
    659 //              if ( m_seg[index]->contains((addr_t)(p_vci_tgt.address.read())) ) {
    660               if ( m_seg[index]->contains(p_vci_tgt.address.read()) ) {
    661                 reached = true;
    662                 r_index = index;
    663               }
    664             }
    665 
    666             if ( !reached )
    667             {
    668               std::cout << "VCI_MEM_CACHE Out of segment access in " << name() << std::endl;
    669               std::cout << "Faulty address = " << std::hex << (addr_t)(p_vci_tgt.address.read()) << std::endl;
    670               std::cout << "Faulty initiator = " << std::dec << p_vci_tgt.srcid.read() << std::endl;
    671               exit(0);
    672             }
    673             else if ( p_vci_tgt.cmd.read() == vci_param::CMD_READ )
     655            if ( p_vci_tgt.cmd.read() == vci_param::CMD_READ )
    674656            {
    675657              r_tgt_cmd_fsm = TGT_CMD_READ;
     
    18671849      case IXR_RSP_IDLE:        // test if it's a read or a write transaction
    18681850        {
    1869           if ( p_vci_ixr.rspval ) {
     1851          if ( p_vci_ixr.rspval.read() ) {
    18701852            r_ixr_rsp_cpt   = 0;
    18711853            r_ixr_rsp_trt_index = p_vci_ixr.rtrdid.read();
    1872             if ( p_vci_ixr.reop )  r_ixr_rsp_fsm = IXR_RSP_ACK;
    1873             else                   r_ixr_rsp_fsm = IXR_RSP_TRT_READ;
     1854            if ( p_vci_ixr.reop.read() && !(p_vci_ixr.rerror.read()&0x1)) 
     1855                r_ixr_rsp_fsm = IXR_RSP_ACK;
     1856            else                   
     1857                r_ixr_rsp_fsm = IXR_RSP_TRT_READ;
    18741858          }
    18751859          break; 
     
    18771861        ////////////////////////
    18781862      case IXR_RSP_ACK:        // Acknowledge the vci response
    1879         r_ixr_rsp_fsm = IXR_RSP_TRT_ERASE;
    1880         break;
     1863        {
     1864            if(p_vci_ixr.rspval.read())
     1865                r_ixr_rsp_fsm = IXR_RSP_TRT_ERASE;
     1866            break;
     1867        }
    18811868        ////////////////////////
    18821869      case IXR_RSP_TRT_ERASE:   // erase the entry in the TRT
     
    19031890            data_t data         = p_vci_ixr.rdata.read();
    19041891            size_t index        = r_ixr_rsp_trt_index.read();
    1905             assert( eop == (r_ixr_rsp_cpt.read() == (m_words-1))
     1892            assert( ((eop == (r_ixr_rsp_cpt.read() == (m_words-1))) ||
     1893                     p_vci_ixr.rerror.read())
    19061894                && "Error in VCI_MEM_CACHE : invalid length for a response from XRAM");
    1907             m_transaction_tab.write_rsp(index, r_ixr_rsp_cpt.read(), data);
     1895            m_transaction_tab.write_rsp(index, r_ixr_rsp_cpt.read(), data, p_vci_ixr.rerror.read()&0x1);
    19081896            r_ixr_rsp_cpt = r_ixr_rsp_cpt.read() + 1;
    19091897            if ( eop ) {
     
    19721960        {
    19731961          if( r_alloc_dir_fsm.read() == ALLOC_DIR_XRAM_RSP ) {
    1974             r_xram_rsp_fsm           = XRAM_RSP_TRT_COPY;
     1962            r_xram_rsp_fsm = XRAM_RSP_TRT_COPY;
    19751963#ifdef TDEBUG
    19761964if(m_cpt_cycles > DEBUG_START_CYCLE){
     
    20101998            r_xram_rsp_victim_dirty     = victim.dirty;
    20111999
    2012             r_xram_rsp_fsm = XRAM_RSP_INVAL_LOCK;
     2000            if(!trt_entry.rerror)
     2001              r_xram_rsp_fsm = XRAM_RSP_INVAL_LOCK;
     2002            else
     2003              r_xram_rsp_fsm = XRAM_RSP_ERROR_ERASE;     
    20132004#ifdef TDEBUG
    20142005if(m_cpt_cycles > DEBUG_START_CYCLE){
     
    22122203            r_xram_rsp_to_tgt_rsp_word   = r_xram_rsp_trt_buf.word_index;
    22132204            r_xram_rsp_to_tgt_rsp_length = r_xram_rsp_trt_buf.read_length;
     2205            r_xram_rsp_to_tgt_rsp_rerror = false;
    22142206            r_xram_rsp_to_tgt_rsp_req    = true;
    22152207
     
    23242316          r_xram_rsp_fsm = XRAM_RSP_IDLE;
    23252317
     2318          break;
     2319        }
     2320        ///////////////////////
     2321      case XRAM_RSP_ERROR_ERASE:                // erase xram transaction
     2322        {
     2323
     2324#ifdef TDEBUG
     2325if(m_cpt_cycles > DEBUG_START_CYCLE){
     2326        std::cout << sc_time_stamp() << " " << name() << " XRAM_RSP_ERROR_ERASE transaction table : " << std::endl;
     2327        for(size_t i = 0 ; i < m_transaction_tab.size() ; i++)
     2328          m_transaction_tab.print(i);
     2329}
     2330#endif
     2331
     2332          m_transaction_tab.erase(r_xram_rsp_trt_index.read());
     2333
     2334          // Next state
     2335          if ( r_xram_rsp_trt_buf.proc_read  ) r_xram_rsp_fsm = XRAM_RSP_ERROR_RSP;
     2336          else                                 r_xram_rsp_fsm = XRAM_RSP_IDLE;
     2337          break;
     2338        }
     2339        //////////////////////
     2340      case XRAM_RSP_ERROR_RSP:     // send a request to TGT_RSP FSM in case of read
     2341        {
     2342          if ( !r_xram_rsp_to_tgt_rsp_req.read() ) {
     2343            r_xram_rsp_to_tgt_rsp_srcid = r_xram_rsp_trt_buf.srcid;
     2344            r_xram_rsp_to_tgt_rsp_trdid = r_xram_rsp_trt_buf.trdid;
     2345            r_xram_rsp_to_tgt_rsp_pktid = r_xram_rsp_trt_buf.pktid;
     2346            for (size_t i=0; i < m_words; i++) {
     2347              r_xram_rsp_to_tgt_rsp_data[i] = r_xram_rsp_trt_buf.wdata[i];
     2348            }
     2349            r_xram_rsp_to_tgt_rsp_word   = r_xram_rsp_trt_buf.word_index;
     2350            r_xram_rsp_to_tgt_rsp_length = r_xram_rsp_trt_buf.read_length;
     2351            r_xram_rsp_to_tgt_rsp_rerror = true;
     2352            r_xram_rsp_to_tgt_rsp_req    = true;
     2353
     2354            r_xram_rsp_fsm = XRAM_RSP_IDLE;
     2355
     2356#ifdef DDEBUG
     2357if(m_cpt_cycles > DEBUG_START_CYCLE){
     2358        std::cout << "XRAM_RSP FSM in XRAM_RSP_DIR_RSP state" << std::endl;
     2359}
     2360#endif
     2361          }
    23262362          break;
    23272363        }
     
    36133649        {
    36143650          if ( p_vci_tgt.rspack ) {
    3615             if ( r_tgt_rsp_cpt.read() == (r_xram_rsp_to_tgt_rsp_word.read()+r_xram_rsp_to_tgt_rsp_length.read()-1)) {
     3651              if ( (r_tgt_rsp_cpt.read() == (r_xram_rsp_to_tgt_rsp_word.read()+r_xram_rsp_to_tgt_rsp_length.read()-1))
     3652                   || r_xram_rsp_to_tgt_rsp_rerror.read() ) {
    36163653              r_tgt_rsp_fsm = TGT_RSP_XRAM_IDLE;
    36173654              r_xram_rsp_to_tgt_rsp_req = false;
     
    43014338        p_vci_tgt.rtrdid   = r_xram_rsp_to_tgt_rsp_trdid.read();
    43024339        p_vci_tgt.rpktid   = r_xram_rsp_to_tgt_rsp_pktid.read();
    4303         p_vci_tgt.rerror   = 0;
    4304         p_vci_tgt.reop     = ( r_tgt_rsp_cpt.read() == (r_xram_rsp_to_tgt_rsp_word.read()+r_xram_rsp_to_tgt_rsp_length.read()-1));
     4340        p_vci_tgt.rerror   = r_xram_rsp_to_tgt_rsp_rerror.read();
     4341        p_vci_tgt.reop     = (( r_tgt_rsp_cpt.read() == (r_xram_rsp_to_tgt_rsp_word.read()+r_xram_rsp_to_tgt_rsp_length.read()-1))
     4342                              || r_xram_rsp_to_tgt_rsp_rerror.read());
    43054343        break;
    43064344      case TGT_RSP_INIT:
Note: See TracChangeset for help on using the changeset viewer.