Changeset 336 for branches/v5/modules/vci_mem_cache/caba/source
- Timestamp:
- Mar 27, 2013, 2:25:37 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/v5/modules/vci_mem_cache/caba/source/src/vci_mem_cache.cpp
r335 r336 1793 1793 // consume a word in the FIFO & write it in the local buffer 1794 1794 cmd_write_fifo_get = true; 1795 r_write_pending_sc = false;1796 1795 size_t index = m_x[(vci_addr_t)(m_cmd_write_addr_fifo.read())]; 1797 1796 … … 1803 1802 r_write_trdid = m_cmd_write_trdid_fifo.read(); 1804 1803 r_write_pktid = m_cmd_write_pktid_fifo.read(); 1804 r_write_pending_sc = false; 1805 1805 1806 1806 // initialize the be field for all words … … 1860 1860 // consume a word in the FIFO & write it in the local buffer 1861 1861 cmd_write_fifo_get = true; 1862 r_write_pending_sc = false;1863 1862 size_t index = r_write_word_index.read() + r_write_word_count.read(); 1864 1863 … … 1877 1876 //////////////////// 1878 1877 case WRITE_DIR_REQ: 1879 // Get the lock to the directory1880 1878 { 1881 if ( r_alloc_dir_fsm.read() == ALLOC_DIR_WRITE ) 1882 { 1883 if(((r_write_pktid.read() & 0x7) == TYPE_SC) && not r_write_pending_sc.read()) // check for an SC command (and check that its second flit is not already consumed) 1884 { 1885 if ( m_cmd_write_addr_fifo.rok() ) 1886 { 1887 size_t index = m_x[(vci_addr_t)(r_write_address.read())]; 1888 bool sc_success = m_llsc_table.sc(r_write_address.read(),r_write_data[index].read()); 1889 r_write_sc_fail = !sc_success; 1890 1891 assert(m_cmd_write_eop_fifo.read() && "Error in VCI_MEM_CACHE : invalid packet format for SC command"); 1892 // consume a word in the FIFO & write it in the local buffer 1893 cmd_write_fifo_get = true; 1894 r_write_pending_sc = true; 1895 index = m_x[(vci_addr_t)(m_cmd_write_addr_fifo.read())]; 1896 1897 r_write_address = (addr_t)(m_cmd_write_addr_fifo.read()); 1898 r_write_word_index = index; 1899 r_write_word_count = 1; 1900 r_write_data[index] = m_cmd_write_data_fifo.read(); 1901 if (!sc_success) 1902 { 1903 r_write_fsm = WRITE_RSP; 1904 break; 1905 } 1906 } 1907 else break; 1908 } 1909 //else it is a TYPE_WRITE, need a simple sw access to the 1910 // llsc_global_table 1911 else 1912 { 1913 m_llsc_table.sw(r_write_address.read()); 1914 } 1879 // Get the lock to the directory 1880 // and access the llsc_global_table 1881 if(r_alloc_dir_fsm.read() == ALLOC_DIR_WRITE) 1882 { 1883 /////////////////////////////////////////////////////////////////////// 1884 // SC command treatment 1885 // We test the r_write_pending_sc register to know if we are returning 1886 // from the WAIT state. 1887 // In this case, the SC has already succeed and we cannot consume 1888 // another time from the FIFO. Also, we don't have to test another 1889 // time if the SC has succeed 1890 if(((r_write_pktid.read() & 0x7) == TYPE_SC) and not r_write_pending_sc.read()) 1891 { 1892 if(not m_cmd_write_addr_fifo.rok()) break; 1893 1894 assert(m_cmd_write_eop_fifo.read() && 1895 "Error in VCI_MEM_CACHE : " 1896 "invalid packet format for SC command"); 1897 1898 size_t index = r_write_word_index.read(); 1899 bool sc_success = m_llsc_table.sc(r_write_address.read() , 1900 r_write_data[index].read()); 1901 1902 // consume a word in the FIFO & write it in the local buffer 1903 cmd_write_fifo_get = true; 1904 r_write_data[index] = m_cmd_write_data_fifo.read(); 1905 r_write_sc_fail = not sc_success; 1906 r_write_pending_sc = true; 1907 1908 if(not sc_success) r_write_fsm = WRITE_RSP; 1909 else r_write_fsm = WRITE_DIR_LOCK; 1910 1911 break; 1912 } 1913 1914 /////////////////////////////////////////////////////////////////////// 1915 // WRITE command or SC command treatment returning from the WAIT state 1916 // In the second case, we must access the LL/SC global table to 1917 // erase any possible new reservation when we release the lock on the 1918 // directory 1919 m_llsc_table.sw(r_write_address.read()); 1920 1915 1921 r_write_fsm = WRITE_DIR_LOCK; 1916 1922 } 1917 1923 1918 1924 #if DEBUG_MEMC_WRITE 1919 if( m_debug_write_fsm)1920 { 1921 std::cout 1922 << " <MEMC " << name() << ".WRITE_DIR_REQ> Requesting DIR lock "1923 << std::endl;1925 if(m_debug_write_fsm) 1926 { 1927 std::cout 1928 << " <MEMC " << name() << ".WRITE_DIR_REQ> Requesting DIR lock " 1929 << std::endl; 1924 1930 } 1925 1931 #endif … … 2392 2398 // consume a word in the FIFO & write it in the local buffer 2393 2399 cmd_write_fifo_get = true; 2394 r_write_pending_sc = false;2395 2400 size_t index = m_x[(vci_addr_t)(m_cmd_write_addr_fifo.read())]; 2396 2401 … … 2402 2407 r_write_trdid = m_cmd_write_trdid_fifo.read(); 2403 2408 r_write_pktid = m_cmd_write_pktid_fifo.read(); 2409 r_write_pending_sc = false; 2404 2410 2405 2411 // initialize the be field for all words
Note: See TracChangeset
for help on using the changeset viewer.