Changeset 82 for trunk/modules/vci_mem_cache_v2/caba
- Timestamp:
- Sep 2, 2010, 2:22:12 PM (14 years ago)
- Location:
- trunk/modules/vci_mem_cache_v2/caba/source
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/vci_mem_cache_v2/caba/source/include/vci_mem_cache_v2.h
r2 r82 334 334 const soclib::common::AddressMaskingTable<vci_addr_t> m_nline; 335 335 336 // broadcast address 337 vci_addr_t broadcast_addr; 338 336 339 ////////////////////////////////////////////////// 337 340 // Others registers … … 448 451 sc_signal<copy_t> r_write_to_init_cmd_d_copies; // bit_vector of L1 to update 449 452 sc_signal<data_t> *r_write_to_init_cmd_data; // data (one cache line) 450 sc_signal<b ool> *r_write_to_init_cmd_we; // word enable453 sc_signal<be_t> *r_write_to_init_cmd_be; // word enable 451 454 sc_signal<size_t> r_write_to_init_cmd_count; // number of words in line 452 455 sc_signal<size_t> r_write_to_init_cmd_index; // index of first word in line -
trunk/modules/vci_mem_cache_v2/caba/source/src/vci_mem_cache_v2.cpp
r59 r82 34 34 //#define DEBUG_VCI_MEM_CACHE 1 35 35 #define RANDOMIZE_SC 36 #define DEBUG_START_CYCLE 33069000 36 37 37 38 namespace soclib { namespace caba { … … 295 296 296 297 298 // Set the broadcast address with Xmin,Xmax,Ymin,Ymax set to maximum 299 broadcast_addr = 0x3 | (0x7C1F << (vci_param::N-20)); 300 297 301 // Get the segments associated to the MemCache 298 302 std::list<soclib::common::Segment>::iterator seg; … … 348 352 r_write_be = new sc_signal<be_t>[nwords]; 349 353 r_write_to_init_cmd_data = new sc_signal<data_t>[nwords]; 350 r_write_to_init_cmd_ we = new sc_signal<bool>[nwords];354 r_write_to_init_cmd_be = new sc_signal<be_t>[nwords]; 351 355 r_write_to_ixr_cmd_data = new sc_signal<data_t>[nwords]; 352 356 … … 530 534 531 535 #if DEBUG_VCI_MEM_CACHE 536 if(m_cpt_cycles > DEBUG_START_CYCLE){ 532 537 std::cout << "---------------------------------------------" << std::dec << std::endl; 533 538 std::cout << "MEM_CACHE " << m_srcid_ini << " ; Time = " << m_cpt_cycles << std::endl … … 546 551 << " - ALLOC_TRT FSM = " << alloc_trt_fsm_str[r_alloc_trt_fsm] << std::endl 547 552 << " - ALLOC_UPT FSM = " << alloc_upt_fsm_str[r_alloc_upt_fsm] << std::endl; 553 } 548 554 #endif 549 555 … … 700 706 bool valid = m_update_tab.decrement(r_init_rsp_upt_index.read(), count); 701 707 #ifdef IDEBUG 708 if(m_cpt_cycles > DEBUG_START_CYCLE){ 702 709 std::cout << sc_time_stamp() << " " << name() << " INIT_RSP_UPT_LOCK update table : " << std::endl; 703 710 m_update_tab.print(); 711 } 704 712 #endif 705 713 assert ( valid … … 724 732 m_update_tab.clear(r_init_rsp_upt_index.read()); 725 733 #ifdef IDEBUG 734 if(m_cpt_cycles > DEBUG_START_CYCLE){ 726 735 std::cout << sc_time_stamp() << " " << name() << " INIT_RSP_UPT_CLEAR update table : " << std::endl; 727 736 m_update_tab.print(); 737 } 728 738 #endif 729 739 } … … 777 787 DirectoryEntry entry = m_cache_directory.read(m_cmd_read_addr_fifo.read(), way); 778 788 #ifdef DDEBUG 789 if(m_cpt_cycles > DEBUG_START_CYCLE){ 779 790 std::cout << "In READ_DIR_LOCK printing the entry of address is : " << std::hex << m_cmd_read_addr_fifo.read() << std::endl; 780 791 entry.print(); 781 792 std::cout << "done" << std::endl; 793 } 782 794 #endif 783 795 … … 832 844 } 833 845 if(!inst_read && !is_cnt){ // Data read, vector mode 834 assert(!(r_read_d_copies.read() & (0x1 << m_cmd_read_srcid_fifo.read())) && "MemCache Error : processor read on an already owned cache line"); 846 if(r_read_d_copies.read() & (0x1 << m_cmd_read_srcid_fifo.read())) { 847 std::cout << "MemCache Error : processor read on an already owned cache line, Time : " << m_cpt_cycles << std::endl; 848 exit(0); 849 } 835 850 entry.d_copies = r_read_d_copies.read() | (0x1 << m_cmd_read_srcid_fifo.read()); 836 851 entry.i_copies = r_read_i_copies.read(); … … 848 863 } 849 864 #ifdef DDEBUG 865 if(m_cpt_cycles > DEBUG_START_CYCLE){ 850 866 std::cout << "In READ_DIR_HIT printing the entry of address is : " << std::endl; 851 867 entry.print(); 852 868 std::cout << "done" << std::endl; 869 } 853 870 #endif 854 871 … … 881 898 if ( r_alloc_trt_fsm.read() == ALLOC_TRT_READ ) { 882 899 #ifdef TDEBUG 900 if(m_cpt_cycles > DEBUG_START_CYCLE){ 883 901 std::cout << sc_time_stamp() << " " << name() << " READ_TRT_LOCK " << std::endl; 902 } 884 903 #endif 885 904 size_t index = 0; … … 912 931 std::vector<data_t>(m_words,0)); 913 932 #ifdef TDEBUG 933 if(m_cpt_cycles > DEBUG_START_CYCLE){ 914 934 std::cout << sc_time_stamp() << " " << name() << " READ_TRT_SET transaction table : " << std::endl; 915 935 for(size_t i = 0 ; i < m_transaction_tab.size() ; i++) 916 936 m_transaction_tab.print(i); 937 } 917 938 #endif 918 939 … … 1178 1199 index); 1179 1200 #ifdef IDEBUG 1201 if(m_cpt_cycles > DEBUG_START_CYCLE){ 1180 1202 if(wok){ 1181 1203 std::cout << sc_time_stamp() << " " << name() << " WRITE_UPT_LOCK update table : " << std::endl; 1182 1204 m_update_tab.print(); 1183 1205 } 1206 } 1184 1207 #endif 1185 1208 r_write_upt_index = index; … … 1210 1233 1211 1234 for(size_t i=0; i<m_words ; i++){ 1212 if(r_write_be[i].read()) r_write_to_init_cmd_we[i]=true; 1213 else r_write_to_init_cmd_we[i]=false; 1235 r_write_to_init_cmd_be[i]=r_write_be[i].read(); 1214 1236 } 1215 1237 … … 1241 1263 if ( r_alloc_trt_fsm.read() == ALLOC_TRT_WRITE ) { 1242 1264 #ifdef TDEBUG 1265 if(m_cpt_cycles > DEBUG_START_CYCLE){ 1243 1266 std::cout << sc_time_stamp() << " " << name() << " READ_TRT_LOCK " << std::endl; 1267 } 1244 1268 #endif 1245 1269 size_t hit_index = 0; … … 1292 1316 data_vector); 1293 1317 #ifdef TDEBUG 1318 if(m_cpt_cycles > DEBUG_START_CYCLE){ 1294 1319 std::cout << sc_time_stamp() << " " << name() << " WRITE_TRT_SET transaction table : " << std::endl; 1295 1320 for(size_t i = 0 ; i < m_transaction_tab.size() ; i++) 1296 1321 m_transaction_tab.print(i); 1322 } 1297 1323 #endif 1298 1324 … … 1318 1344 r_write_fsm = WRITE_RSP; 1319 1345 #ifdef TDEBUG 1346 if(m_cpt_cycles > DEBUG_START_CYCLE){ 1320 1347 std::cout << sc_time_stamp() << " " << name() << " WRITE_TRT_DATA transaction table : " << std::endl; 1321 1348 for(size_t i = 0 ; i < m_transaction_tab.size() ; i++) 1322 1349 m_transaction_tab.print(i); 1350 } 1323 1351 #endif 1324 1352 … … 1377 1405 index); 1378 1406 #ifdef IDEBUG 1407 if(m_cpt_cycles > DEBUG_START_CYCLE){ 1379 1408 if(wok){ 1380 1409 std::cout << sc_time_stamp() << " " << name() << " WRITE_INVAL_LOCK update table : " << std::endl; 1381 1410 m_update_tab.print(); 1382 1411 } 1412 } 1383 1413 #endif 1384 1414 r_write_upt_index = index; … … 1408 1438 std::vector<data_t>(m_words,0)); 1409 1439 #ifdef TDEBUG 1440 if(m_cpt_cycles > DEBUG_START_CYCLE){ 1410 1441 std::cout << sc_time_stamp() << " " << name() << " WRITE_DIR_INVAL transaction table : " << std::endl; 1411 1442 for(size_t i = 0 ; i < m_transaction_tab.size() ; i++) 1412 1443 m_transaction_tab.print(i); 1444 } 1413 1445 #endif 1414 1446 … … 1447 1479 1448 1480 for(size_t i=0; i<m_words ; i++){ 1449 r_write_to_init_cmd_ we[i]=false;1481 r_write_to_init_cmd_be[i]=0; 1450 1482 r_write_to_init_cmd_data[i] = 0; 1451 1483 } … … 1617 1649 r_ixr_rsp_fsm = IXR_RSP_IDLE; 1618 1650 #ifdef TDEBUG 1651 if(m_cpt_cycles > DEBUG_START_CYCLE){ 1619 1652 std::cout << sc_time_stamp() << " " << name() << " IXR_RSP_TRT_ERASE transaction table : " << std::endl; 1620 1653 for(size_t i = 0 ; i < m_transaction_tab.size() ; i++) 1621 1654 m_transaction_tab.print(i); 1655 } 1622 1656 #endif 1623 1657 … … 1638 1672 if ( eop ) { 1639 1673 #ifdef TDEBUG 1674 if(m_cpt_cycles > DEBUG_START_CYCLE){ 1640 1675 std::cout << sc_time_stamp() << " " << name() << " IXR_RSP_TRT_READ transaction table : " << std::endl; 1641 1676 for(size_t i = 0 ; i < m_transaction_tab.size() ; i++) 1642 1677 m_transaction_tab.print(i); 1678 } 1643 1679 #endif 1644 1680 … … 1687 1723 break; 1688 1724 #ifdef TDEBUG 1725 if(m_cpt_cycles > DEBUG_START_CYCLE){ 1689 1726 std::cout << "XRAM_RSP FSM in XRAM_RSP_IDLE state" << std::endl; 1727 } 1690 1728 #endif 1691 1729 } … … 1699 1737 r_xram_rsp_fsm = XRAM_RSP_TRT_COPY; 1700 1738 #ifdef TDEBUG 1739 if(m_cpt_cycles > DEBUG_START_CYCLE){ 1701 1740 std::cout << "XRAM_RSP FSM in XRAM_RSP_DIR_LOCK state" << std::endl; 1741 } 1702 1742 #endif 1703 1743 } … … 1734 1774 r_xram_rsp_fsm = XRAM_RSP_INVAL_LOCK; 1735 1775 #ifdef TDEBUG 1776 if(m_cpt_cycles > DEBUG_START_CYCLE){ 1736 1777 std::cout << "XRAM_RSP FSM in XRAM_RSP_TRT_COPY state" << std::endl; 1737 1778 std::cout << "Victim way : " << std::hex << way << " set " << std::hex << set << std::endl; 1738 1779 victim.print(); 1780 } 1739 1781 #endif 1740 1782 } … … 1746 1788 if ( r_alloc_upt_fsm == ALLOC_UPT_XRAM_RSP ) { 1747 1789 #ifdef IDEBUG 1790 if(m_cpt_cycles > DEBUG_START_CYCLE){ 1748 1791 std::cout << "XRAM_RSP FSM in XRAM_RSP_INVAL_LOCK state" << std::endl; 1792 } 1749 1793 #endif 1750 1794 size_t index; … … 1752 1796 r_xram_rsp_fsm = XRAM_RSP_INVAL_WAIT; 1753 1797 #ifdef IDEBUG 1798 if(m_cpt_cycles > DEBUG_START_CYCLE){ 1754 1799 std::cout << "XRAM_RSP FSM in XRAM_RSP_INVAL_LOCK state to XRAM_RSP_INVAL_WAIT state" << std::endl; 1800 } 1755 1801 #endif 1756 1802 … … 1759 1805 r_xram_rsp_fsm = XRAM_RSP_INVAL_WAIT; 1760 1806 #ifdef IDEBUG 1807 if(m_cpt_cycles > DEBUG_START_CYCLE){ 1761 1808 std::cout << "XRAM_RSP FSM in XRAM_RSP_INVAL_LOCK state to XRAM_RSP_INVAL_WAIT state" << std::endl; 1809 } 1762 1810 #endif 1763 1811 } … … 1765 1813 r_xram_rsp_fsm = XRAM_RSP_DIR_UPDT; 1766 1814 #ifdef IDEBUG 1815 if(m_cpt_cycles > DEBUG_START_CYCLE){ 1767 1816 std::cout << "XRAM_RSP FSM in XRAM_RSP_INVAL_LOCK state to XRAM_RSP_DIR_UPDT state" << std::endl; 1817 } 1768 1818 #endif 1769 1819 } … … 1777 1827 break; 1778 1828 #ifdef IDEBUG 1829 if(m_cpt_cycles > DEBUG_START_CYCLE){ 1779 1830 std::cout << "XRAM_RSP FSM in XRAM_RSP_INVAL_WAIT state" << std::endl; 1831 } 1780 1832 #endif 1781 1833 } … … 1822 1874 m_cache_directory.write(set, way, entry); 1823 1875 #ifdef DDEBUG 1876 if(m_cpt_cycles > DEBUG_START_CYCLE){ 1824 1877 std::cout << "printing the entry : " << std::endl; 1825 1878 entry.print(); 1826 1879 std::cout << "done" << std::endl; 1880 } 1827 1881 #endif 1828 1882 1829 1883 #ifdef TDEBUG 1884 if(m_cpt_cycles > DEBUG_START_CYCLE){ 1830 1885 std::cout << sc_time_stamp() << " " << name() << " XRAM_RSP_DIR_UPDT transaction table : " << std::endl; 1831 1886 for(size_t i = 0 ; i < m_transaction_tab.size() ; i++) 1832 1887 m_transaction_tab.print(i); 1888 } 1833 1889 #endif 1834 1890 … … 1849 1905 1850 1906 #ifdef IDEBUG 1907 if(m_cpt_cycles > DEBUG_START_CYCLE){ 1851 1908 std::cout << "xram_rsp : record invalidation, time = " << std::dec << m_cpt_cycles << std::endl; 1852 1909 m_update_tab.print(); 1910 } 1853 1911 #endif 1854 1912 r_xram_rsp_upt_index = index; … … 1885 1943 std::vector<data_t>(m_words,0) ); 1886 1944 #ifdef TDEBUG 1945 if(m_cpt_cycles > DEBUG_START_CYCLE){ 1887 1946 std::cout << sc_time_stamp() << " " << name() << " XRAM_RSP_TRT_DIRTY transaction table : " << std::endl; 1888 1947 for(size_t i = 0 ; i < m_transaction_tab.size() ; i++) 1889 1948 m_transaction_tab.print(i); 1949 } 1890 1950 #endif 1891 1951 … … 1915 1975 1916 1976 #ifdef DDEBUG 1977 if(m_cpt_cycles > DEBUG_START_CYCLE){ 1917 1978 std::cout << "XRAM_RSP FSM in XRAM_RSP_DIR_RSP state" << std::endl; 1979 } 1918 1980 #endif 1919 1981 } … … 1933 1995 else r_xram_rsp_fsm = XRAM_RSP_IDLE; 1934 1996 #ifdef DDEBUG 1997 if(m_cpt_cycles > DEBUG_START_CYCLE){ 1935 1998 std::cout << "XRAM_RSP FSM in XRAM_RSP_INVAL state" << std::endl; 1999 } 1936 2000 #endif 1937 2001 } … … 1951 2015 r_xram_rsp_fsm = XRAM_RSP_IDLE; 1952 2016 #ifdef TDEBUG 2017 if(m_cpt_cycles > DEBUG_START_CYCLE){ 1953 2018 std::cout << "XRAM_RSP FSM in XRAM_RSP_WRITE_DIRTY state" << std::endl; 2019 } 1954 2020 #endif 1955 2021 } … … 1981 2047 } 1982 2048 if ( (p_vci_tgt_cleanup.cmd.read() == vci_param::CMD_WRITE) && 1983 (((addr_t)(p_vci_tgt_cleanup.address.read()) ) != BROADCAST_ADDR) &&2049 (((addr_t)(p_vci_tgt_cleanup.address.read())&0x3) != 0x3) && 1984 2050 reached) { 1985 2051 … … 2006 2072 DirectoryEntry entry = m_cache_directory.read(cleanup_address , way); 2007 2073 #ifdef DDEBUG 2074 if(m_cpt_cycles > DEBUG_START_CYCLE){ 2008 2075 std::cout << "In CLEANUP_DIR_LOCK printing the entry of address is : " << std::hex << cleanup_address << std::endl; 2009 2076 entry.print(); 2010 2077 std::cout << "done" << std::endl; 2078 } 2011 2079 #endif 2012 2080 r_cleanup_is_cnt = entry.is_cnt; … … 2089 2157 if(!hit_inval) { 2090 2158 #ifdef DEBUG_VCI_MEM_CACHE 2159 if(m_cpt_cycles > DEBUG_START_CYCLE){ 2091 2160 std::cout << "MEM_CACHE WARNING: cleanup with no corresponding entry at address : " << std::hex << (r_cleanup_nline.read()*4*m_words) << std::dec << std::endl; 2161 } 2092 2162 #endif 2093 2163 r_cleanup_fsm = CLEANUP_RSP; … … 2111 2181 m_update_tab.clear(r_cleanup_index.read()); 2112 2182 #ifdef IDEBUG 2183 if(m_cpt_cycles > DEBUG_START_CYCLE){ 2113 2184 std::cout << sc_time_stamp() << " " << name() << " CLEANUP_UPT_WRITE update table : " << std::endl; 2114 2185 m_update_tab.print(); 2186 } 2115 2187 #endif 2116 2188 … … 2206 2278 // set Atomic Table 2207 2279 m_atomic_tab.set(m_cmd_llsc_srcid_fifo.read(), m_cmd_llsc_addr_fifo.read()); 2280 2281 #ifdef DDEBUG 2282 if(m_cpt_cycles > DEBUG_START_CYCLE){ 2283 std::cout << "In LLSC_DIR_LOCK printing the entry of address is : " << std::hex << m_cmd_llsc_addr_fifo.read() << std::endl; 2284 entry.print(); 2285 std::cout << "done" << std::endl; 2286 } 2287 #endif 2288 2208 2289 2209 2290 if ( entry.valid ) r_llsc_fsm = LL_DIR_HIT; … … 2347 2428 index); 2348 2429 #ifdef IDEBUG 2430 if(m_cpt_cycles > DEBUG_START_CYCLE){ 2349 2431 if(wok){ 2350 2432 std::cout << sc_time_stamp() << " " << name() << " SC_UPT_LOCK update table : " << std::endl; 2351 2433 m_update_tab.print(); 2352 2434 } 2435 } 2353 2436 #endif 2354 2437 r_llsc_upt_index = index; … … 2436 2519 index); 2437 2520 #ifdef IDEBUG 2521 if(m_cpt_cycles > DEBUG_START_CYCLE){ 2438 2522 if(wok){ 2439 2523 std::cout << sc_time_stamp() << " " << name() << " LLSC_INVAL_LOCK update table : " << std::endl; 2440 2524 m_update_tab.print(); 2441 2525 } 2526 } 2442 2527 #endif 2443 2528 r_llsc_upt_index = index; … … 2466 2551 std::vector<data_t>(m_words,0)); 2467 2552 #ifdef TDEBUG 2553 if(m_cpt_cycles > DEBUG_START_CYCLE){ 2468 2554 std::cout << sc_time_stamp() << " " << name() << " SC_DIR_INVAL transaction table : " << std::endl; 2469 2555 for(size_t i = 0 ; i < m_transaction_tab.size() ; i++) 2470 2556 m_transaction_tab.print(i); 2557 } 2471 2558 #endif 2472 2559 // reset Atomic Table … … 2624 2711 } 2625 2712 #ifdef TDEBUG 2713 if(m_cpt_cycles > DEBUG_START_CYCLE){ 2626 2714 std::cout << sc_time_stamp() << " " << name() << " LLSC_TRT_SET transaction table : " << std::endl; 2627 2715 for(size_t i = 0 ; i < m_transaction_tab.size() ; i++) 2628 2716 m_transaction_tab.print(i); 2717 } 2629 2718 #endif 2630 2719 … … 3611 3700 p_vci_tgt.rtrdid = r_write_to_tgt_rsp_trdid.read(); 3612 3701 p_vci_tgt.rpktid = r_write_to_tgt_rsp_pktid.read(); 3613 p_vci_tgt.rerror = 0 ;3702 p_vci_tgt.rerror = 0x2 & ( (1 << (vci_param::E + 1)) - 1); // Write OK 3614 3703 p_vci_tgt.reop = true; 3615 3704 break; … … 3684 3773 p_vci_ini.cmdval = true; 3685 3774 if(r_xram_rsp_to_init_cmd_brdcast.read()) 3686 p_vci_ini.address = BROADCAST_ADDR;3775 p_vci_ini.address = broadcast_addr; 3687 3776 else { 3688 3777 if(r_init_cmd_inst.read()) { … … 3700 3789 case INIT_CMD_BRDCAST: 3701 3790 p_vci_ini.cmdval = true; 3702 p_vci_ini.address = BROADCAST_ADDR;3791 p_vci_ini.address = broadcast_addr; 3703 3792 p_vci_ini.wdata = (addr_t)r_write_to_init_cmd_nline.read(); 3704 3793 p_vci_ini.be = ((r_write_to_init_cmd_nline.read() >> 32) & 0x3); … … 3730 3819 p_vci_ini.wdata = r_write_to_init_cmd_data[r_init_cmd_cpt.read() + 3731 3820 r_write_to_init_cmd_index.read()].read(); 3732 if(r_write_to_init_cmd_we[r_init_cmd_cpt.read() + 3733 r_write_to_init_cmd_index.read()].read()) 3734 p_vci_ini.be = 0xF; 3735 else p_vci_ini.be = 0x0; 3821 p_vci_ini.be = r_write_to_init_cmd_be[r_init_cmd_cpt.read() +r_write_to_init_cmd_index.read()].read() ; 3736 3822 p_vci_ini.plen = 4 * (r_write_to_init_cmd_count.read() + 2); 3737 3823 p_vci_ini.trdid = r_write_to_init_cmd_trdid.read(); … … 3741 3827 case INIT_CMD_SC_BRDCAST: 3742 3828 p_vci_ini.cmdval = true; 3743 p_vci_ini.address = BROADCAST_ADDR;3829 p_vci_ini.address = broadcast_addr; 3744 3830 p_vci_ini.wdata = (addr_t)r_llsc_to_init_cmd_nline.read(); 3745 3831 p_vci_ini.be = ((r_llsc_to_init_cmd_nline.read() >> 32) & 0x3); … … 3810 3896 p_vci_tgt_cleanup.rpktid = r_cleanup_pktid.read(); 3811 3897 p_vci_tgt_cleanup.rtrdid = r_cleanup_trdid.read(); 3812 p_vci_tgt_cleanup.rerror = 0 ;3898 p_vci_tgt_cleanup.rerror = 0x2 & ( (1 << (vci_param::E + 1)) - 1); 3813 3899 p_vci_tgt_cleanup.reop = 1; 3814 3900 break;
Note: See TracChangeset
for help on using the changeset viewer.