Changeset 215 for trunk/modules/vci_mem_cache_v4/caba
- Timestamp:
- Mar 22, 2012, 5:12:29 PM (13 years ago)
- Location:
- trunk/modules/vci_mem_cache_v4/caba/source
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/vci_mem_cache_v4/caba/source/include/vci_mem_cache_v4.h
r200 r215 296 296 size_t m_debug_previous_count; 297 297 298 bool m_monitor_ok; 299 vci_addr_t m_monitor_base; 300 vci_addr_t m_monitor_length; 301 298 302 // instrumentation counters 299 303 uint32_t m_cpt_cycles; // Counter of cycles … … 322 326 323 327 public: 324 sc_in<bool> p_clk;325 sc_in<bool> p_resetn;328 sc_in<bool> p_clk; 329 sc_in<bool> p_resetn; 326 330 soclib::caba::VciTarget<vci_param> p_vci_tgt; 327 331 soclib::caba::VciTarget<vci_param> p_vci_tgt_cleanup; … … 344 348 size_t transaction_tab_lines=TRANSACTION_TAB_LINES, // Size of the TRT 345 349 size_t update_tab_lines=UPDATE_TAB_LINES, // Size of the UPT 346 size_t debug_start_cycle=0, 350 size_t debug_start_cycle=0, 347 351 bool debug_ok=false); 348 352 349 353 ~VciMemCacheV4(); 354 355 void print_stats(); 356 void print_trace(); 357 void copies_monitor(vci_addr_t addr); 358 void start_monitor(vci_addr_t addr, vci_addr_t length); 359 void stop_monitor(); 360 361 private: 350 362 351 363 void transition(); 352 364 void genMoore(); 353 void print_stats(); 354 void print_trace(); 355 void cache_monitor(vci_addr_t addr); 356 357 private: 365 void check_monitor(vci_addr_t addr, data_t data); 358 366 359 367 // Component attributes … … 530 538 531 539 // Buffer between INIT_RSP fsm and TGT_RSP fsm (complete write/update transaction) 532 sc_signal<bool> 540 sc_signal<bool> r_init_rsp_to_tgt_rsp_req; // valid request 533 541 sc_signal<size_t> r_init_rsp_to_tgt_rsp_srcid; // Transaction srcid 534 542 sc_signal<size_t> r_init_rsp_to_tgt_rsp_trdid; // Transaction trdid -
trunk/modules/vci_mem_cache_v4/caba/source/src/vci_mem_cache_v4.cpp
r212 r215 46 46 #define DEBUG_MEMC_INIT_CMD 1 // detailed trace of INIT_CMD FSM 47 47 #define DEBUG_MEMC_INIT_RSP 1 // detailed trace of INIT_RSP FSM 48 #define DEBUG_MEMC_TGT_CMD 0// detailed trace of TGT_CMD FSM49 #define DEBUG_MEMC_TGT_RSP 0// detailed trace of TGT_RSP FSM50 #define DEBUG_MEMC_CLEANUP 0// detailed trace of CLEANUP FSM48 #define DEBUG_MEMC_TGT_CMD 1 // detailed trace of TGT_CMD FSM 49 #define DEBUG_MEMC_TGT_RSP 1 // detailed trace of TGT_RSP FSM 50 #define DEBUG_MEMC_CLEANUP 1 // detailed trace of CLEANUP FSM 51 51 52 52 #define RANDOMIZE_SC 1 … … 444 444 } // end constructor 445 445 446 /////////////////////////////////////////////////////////////////////// 447 tmpl(void)::start_monitor( vci_addr_t addr, vci_addr_t length ) 448 /////////////////////////////////////////////////////////////////////// 449 { 450 m_monitor_ok = true; 451 m_monitor_base = addr; 452 m_monitor_length = length; 453 } 454 455 /////////////////////////////////////////////////////////////////////// 456 tmpl(void)::stop_monitor() 457 /////////////////////////////////////////////////////////////////////// 458 { 459 m_monitor_ok = false; 460 } 461 462 /////////////////////////////////////////////////////////////////////// 463 tmpl(void)::check_monitor( vci_addr_t addr, data_t data ) 464 /////////////////////////////////////////////////////////////////////// 465 { 466 if ( (addr >= m_monitor_base) and 467 (addr < m_monitor_base + m_monitor_length) ) 468 { 469 std::cout << " MEMC Write Monitor : Address = " << std::hex << addr 470 << " / Data = " << data << std::endl; 471 } 472 } 473 446 474 ///////////////////////////////////////////////////// 447 tmpl(void)::c ache_monitor( vci_addr_t addr )475 tmpl(void)::copies_monitor( vci_addr_t addr ) 448 476 ///////////////////////////////////////////////////// 449 477 { … … 1694 1722 { 1695 1723 r_write_data[i] = (r_write_data[i].read() & mask) | 1696 1724 (m_cache_data[way][set][i] & ~mask); 1697 1725 } 1698 1726 } // end for … … 1757 1785 for(size_t i=0 ; i<m_words ; i++) 1758 1786 { 1759 if ( r_write_be[i].read() ) m_cache_data[way][set][i] = r_write_data[i].read(); 1787 if ( r_write_be[i].read() ) 1788 { 1789 m_cache_data[way][set][i] = r_write_data[i].read(); 1790 1791 if ( m_monitor_ok ) 1792 { 1793 vci_addr_t address = (r_write_address.read() & ~(vci_addr_t)0x3F) | i<<2; 1794 check_monitor( address, r_write_data[i].read() ); 1795 } 1796 } 1760 1797 } 1761 1798 } … … 1821 1858 for(size_t i=0 ; i<m_words ; i++) 1822 1859 { 1823 if ( r_write_be[i].read() ) m_cache_data[way][set][i] = r_write_data[i].read(); 1860 if ( r_write_be[i].read() ) 1861 { 1862 m_cache_data[way][set][i] = r_write_data[i].read(); 1863 1864 if ( m_monitor_ok ) 1865 { 1866 vci_addr_t address = (r_write_address.read() & ~(vci_addr_t)0x3F) | i<<2; 1867 check_monitor( address, r_write_data[i].read() ); 1868 } 1869 } 1824 1870 } 1825 1871 } … … 1980 2026 /////////////// 1981 2027 case WRITE_RSP: // Post a request to TGT_RSP FSM to acknowledge the write 2028 // In order to increase the Write requests throughput, 2029 // we don't wait to return in the IDLE state to consume 2030 // a new request in the write FIFO 1982 2031 { 1983 2032 if ( !r_write_to_tgt_rsp_req.read() ) 1984 2033 { 1985 1986 #if DEBUG_MEMC_WRITE 1987 if( m_debug_write_fsm ) 1988 { 1989 std::cout << " <MEMC.WRITE_RSP> Post a request to TGT_RSP FSM: rsrcid = " 1990 << std::hex << r_write_srcid.read() << std:: endl; 1991 } 1992 #endif 2034 // post the request to TGT_RSP_FSM 1993 2035 r_write_to_tgt_rsp_req = true; 1994 2036 r_write_to_tgt_rsp_srcid = r_write_srcid.read(); 1995 2037 r_write_to_tgt_rsp_trdid = r_write_trdid.read(); 1996 2038 r_write_to_tgt_rsp_pktid = r_write_pktid.read(); 1997 r_write_fsm = WRITE_IDLE; 2039 2040 // try to get a new write request from the FIFO 2041 if ( m_cmd_write_addr_fifo.rok() ) 2042 { 2043 m_cpt_write++; 2044 m_cpt_write_cells++; 2045 2046 // consume a word in the FIFO & write it in the local buffer 2047 cmd_write_fifo_get = true; 2048 size_t index = m_x[(vci_addr_t)(m_cmd_write_addr_fifo.read())]; 2049 2050 r_write_address = (addr_t)(m_cmd_write_addr_fifo.read()); 2051 r_write_word_index = index; 2052 r_write_word_count = 1; 2053 r_write_data[index] = m_cmd_write_data_fifo.read(); 2054 r_write_srcid = m_cmd_write_srcid_fifo.read(); 2055 r_write_trdid = m_cmd_write_trdid_fifo.read(); 2056 r_write_pktid = m_cmd_write_pktid_fifo.read(); 2057 2058 // initialize the be field for all words 2059 for ( size_t i=0 ; i<m_words ; i++ ) 2060 { 2061 if ( i == index ) r_write_be[i] = m_cmd_write_be_fifo.read(); 2062 else r_write_be[i] = 0x0; 2063 } 2064 2065 if( !((m_cmd_write_be_fifo.read() == 0x0)||(m_cmd_write_be_fifo.read() == 0xF)) ) 2066 r_write_byte = true; 2067 else 2068 r_write_byte = false; 2069 2070 if( m_cmd_write_eop_fifo.read() ) r_write_fsm = WRITE_DIR_LOCK; 2071 else r_write_fsm = WRITE_NEXT; 2072 } 2073 else 2074 { 2075 r_write_fsm = WRITE_IDLE; 2076 } 2077 2078 #if DEBUG_MEMC_WRITE 2079 if( m_debug_write_fsm ) 2080 { 2081 std::cout << " <MEMC.WRITE_RSP> Post a request to TGT_RSP FSM: rsrcid = " 2082 << std::hex << r_write_srcid.read() << std::endl; 2083 if ( m_cmd_write_addr_fifo.rok() ) 2084 { 2085 std::cout << " New Write request: " 2086 << " srcid = " << std::hex << m_cmd_write_srcid_fifo.read() 2087 << " / address = " << m_cmd_write_addr_fifo.read() 2088 << " / data = " << m_cmd_write_data_fifo.read() << std::endl; 2089 } 2090 } 2091 #endif 1998 2092 } 1999 2093 break; … … 2731 2825 2732 2826 } 2733 else if (m_update_tab.is_full() && r_xram_rsp_victim_inval.read())2734 { 2735 r_xram_rsp_fsm = XRAM_RSP_INVAL_WAIT;2827 else if (m_update_tab.is_full() && r_xram_rsp_victim_inval.read()) 2828 { 2829 r_xram_rsp_fsm = XRAM_RSP_INVAL_WAIT; 2736 2830 2737 2831 #if DEBUG_MEMC_XRAM_RSP … … 2743 2837 } 2744 2838 #endif 2745 }2839 } 2746 2840 else 2747 2841 { … … 2774 2868 size_t set = r_xram_rsp_victim_set.read(); 2775 2869 size_t way = r_xram_rsp_victim_way.read(); 2776 for(size_t i=0; i<m_words ; i++) m_cache_data[way][set][i] = r_xram_rsp_trt_buf.wdata[i]; 2870 for(size_t i=0; i<m_words ; i++) 2871 { 2872 m_cache_data[way][set][i] = r_xram_rsp_trt_buf.wdata[i]; 2873 2874 if ( m_monitor_ok ) 2875 { 2876 vci_addr_t address = r_xram_rsp_trt_buf.nline<<6 | i<<2; 2877 check_monitor( address, r_write_data[i].read() ); 2878 } 2879 } 2777 2880 // compute dirty 2778 2881 bool dirty = false; … … 3843 3946 if(r_sc_cpt.read()==4) 3844 3947 m_cache_data[way][set][word+1] = m_cmd_sc_wdata_fifo.read(); 3845 3948 3949 // monitor 3950 if ( m_monitor_ok ) 3951 { 3952 vci_addr_t address = m_cmd_sc_addr_fifo.read(); 3953 check_monitor( address, r_sc_wdata.read() ); 3954 if ( r_sc_cpt.read()==4 ) 3955 check_monitor( address+4, m_cmd_sc_wdata_fifo.read() ); 3956 } 3957 3846 3958 // test coherence request 3847 3959 if(r_sc_count.read()) // replicated line
Note: See TracChangeset
for help on using the changeset viewer.