- Timestamp:
- Mar 27, 2013, 2:25:37 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/v5/modules/vci_mem_cache_dspin_coherence/caba/source/src/vci_mem_cache_dspin_coherence.cpp
r335 r336 1940 1940 // consume a word in the FIFO & write it in the local buffer 1941 1941 cmd_write_fifo_get = true; 1942 r_write_pending_sc = false;1943 1942 size_t index = m_x[(vci_addr_t)(m_cmd_write_addr_fifo.read())]; 1944 1943 … … 1950 1949 r_write_trdid = m_cmd_write_trdid_fifo.read(); 1951 1950 r_write_pktid = m_cmd_write_pktid_fifo.read(); 1951 r_write_pending_sc = false; 1952 1952 1953 1953 // initialize the be field for all words … … 1955 1955 { 1956 1956 if(word == index) r_write_be[word] = m_cmd_write_be_fifo.read(); 1957 else 1958 } 1959 1960 if (m_cmd_write_eop_fifo.read() || ((m_cmd_write_pktid_fifo.read() & 0x7)== TYPE_SC))1957 else r_write_be[word] = 0x0; 1958 } 1959 1960 if (m_cmd_write_eop_fifo.read() || ((m_cmd_write_pktid_fifo.read() & 0x7) == TYPE_SC)) 1961 1961 { 1962 1962 r_write_fsm = WRITE_DIR_REQ; … … 1989 1989 if(m_debug_write_fsm) 1990 1990 { 1991 std::cout << " <MEMC " << name() << ".WRITE_NEXT> Write another word in local buffer" 1991 std::cout << " <MEMC " << name() 1992 << ".WRITE_NEXT> Write another word in local buffer" 1992 1993 << std::endl; 1993 1994 } … … 2007 2008 // consume a word in the FIFO & write it in the local buffer 2008 2009 cmd_write_fifo_get = true; 2009 r_write_pending_sc = false;2010 2010 size_t index = r_write_word_index.read() + r_write_word_count.read(); 2011 2011 … … 2024 2024 //////////////////// 2025 2025 case WRITE_DIR_REQ: 2026 { 2026 2027 // Get the lock to the directory 2027 {2028 // and access the llsc_global_table 2028 2029 if(r_alloc_dir_fsm.read() == ALLOC_DIR_WRITE) 2029 2030 { 2030 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) 2031 { 2032 if(m_cmd_write_addr_fifo.rok()) 2033 { 2034 size_t index = m_x[(vci_addr_t)(r_write_address.read())]; 2035 bool sc_success = m_llsc_table.sc(r_write_address.read(),r_write_data[index].read()); 2036 r_write_sc_fail = !sc_success; 2037 2038 assert(m_cmd_write_eop_fifo.read() && "Error in VCI_MEM_CACHE : invalid packet format for SC command"); 2039 // consume a word in the FIFO & write it in the local buffer 2040 cmd_write_fifo_get = true; 2041 r_write_pending_sc = true; 2042 index = m_x[(vci_addr_t)(m_cmd_write_addr_fifo.read())]; 2043 2044 r_write_address = (addr_t)(m_cmd_write_addr_fifo.read()); 2045 r_write_word_index = index; 2046 r_write_word_count = 1; 2047 r_write_data[index] = m_cmd_write_data_fifo.read(); 2048 if(!sc_success) 2049 { 2050 r_write_fsm = WRITE_RSP; 2051 break; 2052 } 2053 } 2054 else break; 2055 } 2056 //else it is a TYPE_WRITE, need a simple sw access to the 2057 // llsc_global_table 2058 else 2059 { 2060 m_llsc_table.sw(r_write_address.read()); 2061 } 2031 /////////////////////////////////////////////////////////////////////// 2032 // SC command treatment 2033 // We test the r_write_pending_sc register to know if we are returning 2034 // from the WAIT state. 2035 // In this case, the SC has already succeed and we cannot consume 2036 // another time from the FIFO. Also, we don't have to test another 2037 // time if the SC has succeed 2038 if(((r_write_pktid.read() & 0x7) == TYPE_SC) and not r_write_pending_sc.read()) 2039 { 2040 if(not m_cmd_write_addr_fifo.rok()) break; 2041 2042 assert(m_cmd_write_eop_fifo.read() && 2043 "Error in VCI_MEM_CACHE : " 2044 "invalid packet format for SC command"); 2045 2046 size_t index = r_write_word_index.read(); 2047 bool sc_success = m_llsc_table.sc(r_write_address.read() , 2048 r_write_data[index].read()); 2049 2050 // consume a word in the FIFO & write it in the local buffer 2051 cmd_write_fifo_get = true; 2052 r_write_data[index] = m_cmd_write_data_fifo.read(); 2053 r_write_sc_fail = not sc_success; 2054 r_write_pending_sc = true; 2055 2056 if(not sc_success) r_write_fsm = WRITE_RSP; 2057 else r_write_fsm = WRITE_DIR_LOCK; 2058 2059 break; 2060 } 2061 2062 /////////////////////////////////////////////////////////////////////// 2063 // WRITE command treatment or SC command returning from the WAIT state 2064 // In the second case, we must access the LL/SC global table to 2065 // erase any possible new reservation when we release the lock on the 2066 // directory 2067 m_llsc_table.sw(r_write_address.read()); 2068 2062 2069 r_write_fsm = WRITE_DIR_LOCK; 2063 2070 } … … 2231 2238 2232 2239 if(no_update) 2233 2240 // Write transaction completed 2234 2241 { 2235 2242 r_write_fsm = WRITE_RSP; 2236 2243 } 2237 2244 else 2238 2245 // coherence update required 2239 2246 { 2240 2247 if(!r_write_to_cc_send_multi_req.read() && … … 2323 2330 // releases the lock protecting UPT and the DIR if no entry... 2324 2331 if(wok) r_write_fsm = WRITE_UPT_HEAP_LOCK; 2325 else 2332 else r_write_fsm = WRITE_WAIT; 2326 2333 } 2327 2334 break; … … 2539 2546 // consume a word in the FIFO & write it in the local buffer 2540 2547 cmd_write_fifo_get = true; 2541 r_write_pending_sc = false;2542 2548 size_t index = m_x[(vci_addr_t)(m_cmd_write_addr_fifo.read())]; 2543 2549 … … 2549 2555 r_write_trdid = m_cmd_write_trdid_fifo.read(); 2550 2556 r_write_pktid = m_cmd_write_pktid_fifo.read(); 2557 r_write_pending_sc = false; 2551 2558 2552 2559 // initialize the be field for all words
Note: See TracChangeset
for help on using the changeset viewer.