Changeset 138 for trunk/modules/vci_mem_cache_v4/caba/source/src
- Timestamp:
- Feb 18, 2011, 11:10:07 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/vci_mem_cache_v4/caba/source/src/vci_mem_cache_v4.cpp
r134 r138 143 143 "XRAM_RSP_HEAP_ERASE ", 144 144 "XRAM_RSP_HEAP_LAST ", 145 "XRAM_RSP_ERROR_ERASE", 146 "XRAM_RSP_ERROR_RSP ", 145 147 }; 146 148 const char *ixr_cmd_fsm_str[] = { … … 651 653 PRINTF(" * <TGT> Request from %d at address %llx\n",(uint32_t)p_vci_tgt.srcid.read(),(uint64_t)p_vci_tgt.address.read()); 652 654 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 ) 674 656 { 675 657 r_tgt_cmd_fsm = TGT_CMD_READ; … … 1867 1849 case IXR_RSP_IDLE: // test if it's a read or a write transaction 1868 1850 { 1869 if ( p_vci_ixr.rspval ) {1851 if ( p_vci_ixr.rspval.read() ) { 1870 1852 r_ixr_rsp_cpt = 0; 1871 1853 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; 1874 1858 } 1875 1859 break; … … 1877 1861 //////////////////////// 1878 1862 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 } 1881 1868 //////////////////////// 1882 1869 case IXR_RSP_TRT_ERASE: // erase the entry in the TRT … … 1903 1890 data_t data = p_vci_ixr.rdata.read(); 1904 1891 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()) 1906 1894 && "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); 1908 1896 r_ixr_rsp_cpt = r_ixr_rsp_cpt.read() + 1; 1909 1897 if ( eop ) { … … 1972 1960 { 1973 1961 if( r_alloc_dir_fsm.read() == ALLOC_DIR_XRAM_RSP ) { 1974 r_xram_rsp_fsm 1962 r_xram_rsp_fsm = XRAM_RSP_TRT_COPY; 1975 1963 #ifdef TDEBUG 1976 1964 if(m_cpt_cycles > DEBUG_START_CYCLE){ … … 2010 1998 r_xram_rsp_victim_dirty = victim.dirty; 2011 1999 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; 2013 2004 #ifdef TDEBUG 2014 2005 if(m_cpt_cycles > DEBUG_START_CYCLE){ … … 2212 2203 r_xram_rsp_to_tgt_rsp_word = r_xram_rsp_trt_buf.word_index; 2213 2204 r_xram_rsp_to_tgt_rsp_length = r_xram_rsp_trt_buf.read_length; 2205 r_xram_rsp_to_tgt_rsp_rerror = false; 2214 2206 r_xram_rsp_to_tgt_rsp_req = true; 2215 2207 … … 2324 2316 r_xram_rsp_fsm = XRAM_RSP_IDLE; 2325 2317 2318 break; 2319 } 2320 /////////////////////// 2321 case XRAM_RSP_ERROR_ERASE: // erase xram transaction 2322 { 2323 2324 #ifdef TDEBUG 2325 if(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 2357 if(m_cpt_cycles > DEBUG_START_CYCLE){ 2358 std::cout << "XRAM_RSP FSM in XRAM_RSP_DIR_RSP state" << std::endl; 2359 } 2360 #endif 2361 } 2326 2362 break; 2327 2363 } … … 3613 3649 { 3614 3650 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() ) { 3616 3653 r_tgt_rsp_fsm = TGT_RSP_XRAM_IDLE; 3617 3654 r_xram_rsp_to_tgt_rsp_req = false; … … 4301 4338 p_vci_tgt.rtrdid = r_xram_rsp_to_tgt_rsp_trdid.read(); 4302 4339 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()); 4305 4343 break; 4306 4344 case TGT_RSP_INIT:
Note: See TracChangeset
for help on using the changeset viewer.