Changeset 304
- Timestamp:
- Feb 26, 2013, 4:32:04 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/v5/modules/vci_cc_vcache_wrapper/caba/source/src/vci_cc_vcache_wrapper.cpp
r299 r304 23 23 * 24 24 * SOCLIB_LGPL_HEADER_END 25 * 26 * Maintainers: cesar.fuguet-tortolero@lip6.fr 27 * alexandre.joannou@lip6.fr 25 28 */ 26 29 … … 1183 1186 if ( not r_tgt_dcache_req.read() ) 1184 1187 { 1185 if ( not r_ icache_tgt_need_rsp.read() or1188 if ( not r_dcache_tgt_need_rsp.read() or 1186 1189 p_vci_tgt_c.rspack.read() ) r_tgt_fsm = TGT_IDLE; 1187 1190 } … … 1724 1727 break; 1725 1728 } 1726 1729 1727 1730 if ( not r_icache_cleanup_req.read() ) 1728 1731 { … … 1764 1767 { 1765 1768 std::cout << " <PROC " << name() 1766 << " DCACHE_MISS_SELECT> Select a slot:" << std::dec1769 << " ICACHE_MISS_SELECT> Select a slot:" << std::dec 1767 1770 << " / WAY = " << way 1768 1771 << " / SET = " << set; … … 1799 1802 { 1800 1803 std::cout << " <PROC " << name() 1801 << " DCACHE_MISS_CLEAN> Switch to ZOMBI state" << std::dec1804 << " ICACHE_MISS_CLEAN> Switch to ZOMBI state" << std::dec 1802 1805 << " / WAY = " << r_icache_miss_way.read() 1803 1806 << " / SET = " << r_icache_miss_set.read() << std::endl; … … 2035 2038 2036 2039 r_icache_fsm = r_icache_fsm_save.read() ; 2040 r_cleanup_icache_req = false; 2037 2041 2038 2042 #if DEBUG_ICACHE … … 2058 2062 paddr_t mask = ~((m_icache_words<<2)-1); 2059 2063 2060 if( (r_icache_fsm_save.read() == ICACHE_MISS_WAIT) and 2061 ((r_icache_vci_paddr.read() & mask) == (paddr & mask))) // matching 2064 if( ((r_icache_fsm_save.read() == ICACHE_MISS_WAIT) or 2065 (r_icache_fsm_save.read() == ICACHE_MISS_DIR_UPDT)) and 2066 ((r_icache_vci_paddr.read() & mask) == (paddr & mask))) // matching 2062 2067 { 2063 2068 // signaling the matching … … 2454 2459 // Miss if the write request is non cacheable, and there is a pending 2455 2460 // non cacheable write, or if the write buffer is full. 2456 if ( r_dcache_ updt_req.read() )2461 if ( r_dcache_wbuf_req.read() ) 2457 2462 { 2458 2463 // miss if write not cacheable, and previous non cacheable write registered … … 2511 2516 else if ( m_dreq.valid and not wbuf_write_miss ) 2512 2517 { 2518 // register processor request and DCACHE response 2519 r_dcache_save_vaddr = m_dreq.addr; 2520 r_dcache_save_be = m_dreq.be; 2521 r_dcache_save_wdata = m_dreq.wdata; 2522 r_dcache_save_paddr = paddr; 2523 r_dcache_save_cache_way = cache_way; 2524 r_dcache_save_cache_set = cache_set; 2525 r_dcache_save_cache_word = cache_word; 2526 2513 2527 // READ XTN requests from processor 2514 2528 // They are executed in this DCACHE_IDLE state. … … 2818 2832 if ( valid_req ) // processor request is valid after TLB check 2819 2833 { 2820 // register processor request and DCACHE response2821 r_dcache_save_vaddr = m_dreq.addr;2822 r_dcache_save_be = m_dreq.be;2823 r_dcache_save_wdata = m_dreq.wdata;2824 r_dcache_save_paddr = paddr;2825 r_dcache_save_cache_way = cache_way;2826 r_dcache_save_cache_set = cache_set;2827 r_dcache_save_cache_word = cache_word;2828 2834 r_dcache_save_cacheable = cacheable; 2829 2835 … … 3016 3022 3017 3023 // itlb miss request 3018 else if ( r_icache_tlb_miss_req.read() )3024 else if ( r_icache_tlb_miss_req.read() and not wbuf_write_miss ) 3019 3025 { 3020 3026 r_dcache_tlb_ins = true; … … 3026 3032 r_dcache_updt_req = updt_request; 3027 3033 r_dcache_wbuf_req = wbuf_request or 3028 (r_dcache_wbuf_req.read() and wbuf_write_miss); 3034 (r_dcache_wbuf_req.read() and wbuf_write_miss); 3029 3035 break; 3030 3036 } … … 3201 3207 r_dcache_vci_miss_req = true; 3202 3208 r_dcache_vci_paddr = r_dcache_tlb_paddr.read(); 3209 r_dcache_save_paddr = r_dcache_tlb_paddr.read(); 3203 3210 r_dcache_miss_type = PTE1_MISS; 3204 3211 r_dcache_fsm = DCACHE_MISS_SELECT; … … 3437 3444 r_dcache_vci_miss_req = true; 3438 3445 r_dcache_vci_paddr = r_dcache_tlb_paddr.read(); 3446 r_dcache_save_paddr = r_dcache_tlb_paddr.read(); 3439 3447 r_dcache_miss_type = PTE2_MISS; 3440 3448 … … 3926 3934 { 3927 3935 r_dcache_fsm = DCACHE_IDLE; 3928 m_drsp.valid 3936 m_drsp.valid = true; 3929 3937 } 3930 3938 … … 4050 4058 { 4051 4059 r_dcache_cleanup_req = true; 4060 r_dcache_miss_clack = true; 4052 4061 r_dcache_cleanup_line = victim; 4053 4062 r_dcache_cleanup_way = way; … … 4065 4074 << " DCACHE_MISS_SELECT> Select a slot:" << std::dec 4066 4075 << " / WAY = " << way 4067 << " / SET = " << set; 4076 << " / SET = " << set 4077 << " / PADDR = " << std::hex << r_dcache_save_paddr.read(); 4068 4078 if(cleanup) std::cout << " / VICTIM = " << std::hex << victim << std::endl; 4069 4079 else std::cout << std::endl; … … 4103 4113 { 4104 4114 std::cout << " <PROC " << name() 4105 << " DCACHE_MISS_ INVAL> Switch to ZOMBI state" << std::dec4115 << " DCACHE_MISS_CLEAN> Switch to ZOMBI state" << std::dec 4106 4116 << " / way = " << way 4107 4117 << " / set = " << set << std::endl; … … 4289 4299 if ( r_dcache_miss_inval.read() ) // switch slot to ZOMBI state, and new cleanup 4290 4300 { 4291 if ( not r_ icache_cleanup_req.read() )4301 if ( not r_dcache_cleanup_req.read() ) 4292 4302 { 4293 4303 r_dcache_cleanup_req = true; 4294 r_dcache_cleanup_line = r_dcache_ vci_paddr.read()/(m_dcache_words<<2);4304 r_dcache_cleanup_line = r_dcache_save_paddr.read()/(m_dcache_words<<2); 4295 4305 r_dcache_cleanup_way = r_dcache_miss_way.read(); 4296 4306 r_dcache_miss_inval = false; … … 4299 4309 m_cpt_dcache_dir_write++; 4300 4310 #endif 4301 r_dcache.write_dir( r_dcache_ vci_paddr.read(),4311 r_dcache.write_dir( r_dcache_save_paddr.read(), 4302 4312 r_dcache_miss_way.read(), 4303 4313 r_dcache_miss_set.read(), … … 4308 4318 std::cout << " <PROC " << name() 4309 4319 << " DCACHE_MISS_DIR_UPDT> Switch slot to ZOMBI state" 4310 << " PADDR = " << std::hex << r_dcache_ vci_paddr.read()4320 << " PADDR = " << std::hex << r_dcache_save_paddr.read() 4311 4321 << " / WAY = " << std::dec << r_dcache_miss_way.read() 4312 4322 << " / SET = " << r_dcache_miss_set.read() << std::endl; … … 4321 4331 m_cpt_dcache_dir_write++; 4322 4332 #endif 4323 r_dcache.write_dir( r_dcache_ vci_paddr.read(),4333 r_dcache.write_dir( r_dcache_save_paddr.read(), 4324 4334 r_dcache_miss_way.read(), 4325 4335 r_dcache_miss_set.read(), 4326 CACHE_SLOT_STATE_ZOMBI ); 4336 CACHE_SLOT_STATE_VALID ); 4337 4327 4338 #if DEBUG_DCACHE 4328 4339 if ( m_debug_dcache_fsm ) … … 4330 4341 std::cout << " <PROC " << name() 4331 4342 << " DCACHE_MISS_DIR_UPDT> Switch slot to VALID state" 4332 << " PADDR = " << std::hex << r_dcache_ vci_paddr.read()4343 << " PADDR = " << std::hex << r_dcache_save_paddr.read() 4333 4344 << " / WAY = " << std::dec << r_dcache_miss_way.read() 4334 4345 << " / SET = " << r_dcache_miss_set.read() << std::endl; 4346 4347 r_dcache.printTrace(); 4348 4349 4335 4350 } 4336 4351 #endif … … 4609 4624 4610 4625 r_dcache_fsm = r_dcache_fsm_cc_save.read() ; 4611 4626 r_cleanup_dcache_req = false; 4612 4627 #if DEBUG_DCACHE 4613 4628 if ( m_debug_dcache_fsm ) … … 4635 4650 4636 4651 4637 if( (r_dcache_fsm_cc_save == DCACHE_MISS_WAIT) and 4652 if( ((r_dcache_fsm_cc_save == DCACHE_MISS_WAIT) or 4653 (r_dcache_fsm_cc_save == DCACHE_MISS_DIR_UPDT)) and 4638 4654 ((r_dcache_vci_paddr.read() & mask) == (paddr & mask)) ) // matching 4639 4655 { … … 5047 5063 size_t wbuf_max; 5048 5064 5065 bool dcache_unc_req = r_dcache_vci_unc_req.read() and 5066 ( not r_icache_miss_req.read() or not r_vci_cmd_imiss_prio.read() ); 5067 5049 5068 bool dcache_miss_req = r_dcache_vci_miss_req.read() and 5050 5069 ( not r_icache_miss_req.read() or not r_vci_cmd_imiss_prio.read() ); 5051 5070 5052 bool dcache_ll_req = r_dcache_vci_ll_req.read() and5071 bool dcache_ll_req = r_dcache_vci_ll_req.read() and 5053 5072 ( not r_icache_miss_req.read() or not r_vci_cmd_imiss_prio.read() ); 5054 5073 5055 5074 bool icache_miss_req = r_icache_miss_req.read() and 5056 ( not (r_dcache_vci_miss_req.read() or r_dcache_vci_ll_req.read()) 5057 or not r_vci_cmd_imiss_prio.read() ); 5075 ( not (r_dcache_vci_miss_req.read() or 5076 r_dcache_vci_ll_req.read() or 5077 r_dcache_vci_unc_req.read()) 5078 or r_vci_cmd_imiss_prio.read() ) ; 5058 5079 5059 5080 // 1 - Data Read Miss … … 5066 5087 } 5067 5088 // 2 - Data Read Uncachable 5068 else if ( r_dcache_vci_unc_req.read())5089 else if ( dcache_unc_req and r_wbuf.miss(r_dcache_vci_paddr.read())) 5069 5090 { 5070 5091 r_vci_cmd_fsm = CMD_DATA_UNC; … … 5072 5093 // m_cpt_dunc_transaction++; 5073 5094 } 5074 // 3 - Instruction Miss 5095 // 3 - Data Linked Load 5096 else if ( dcache_ll_req and r_wbuf.miss(r_dcache_vci_paddr.read())) 5097 { 5098 r_dcache_vci_ll_req = false; 5099 r_vci_cmd_fsm = CMD_DATA_LL; 5100 // m_cpt_ll_transaction++; 5101 } 5102 // 4 - Instruction Miss 5075 5103 else if ( icache_miss_req and r_wbuf.miss(r_icache_vci_paddr.read()) ) 5076 5104 { … … 5080 5108 // m_cpt_imiss_transaction++; 5081 5109 } 5082 // 4- Instruction Uncachable5110 // 5 - Instruction Uncachable 5083 5111 else if ( r_icache_unc_req.read() ) 5084 5112 { … … 5087 5115 // m_cpt_iunc_transaction++; 5088 5116 } 5089 // 5- Data Write5117 // 6 - Data Write 5090 5118 else if ( r_wbuf.rok(&wbuf_min, &wbuf_max) ) 5091 5119 { … … 5096 5124 // m_cpt_write_transaction++; 5097 5125 // m_length_write_transaction += (wbuf_max-wbuf_min+1); 5098 }5099 // 6 - Data Linked Load5100 else if ( dcache_ll_req and r_wbuf.miss(r_dcache_vci_paddr.read()))5101 {5102 r_dcache_vci_ll_req = false;5103 r_vci_cmd_fsm = CMD_DATA_LL;5104 // m_cpt_ll_transaction++;5105 5126 } 5106 5127 // 7 - Data Store Conditionnal … … 5437 5458 { 5438 5459 r_cleanup_cmd_fsm = CLEANUP_CMD_INS_GO; 5439 r_cleanup_cmd_trdid = r_icache_cleanup_way.read()<<1+ 1;5460 r_cleanup_cmd_trdid = (r_icache_cleanup_way.read()<<1) + 1; 5440 5461 } 5441 5462 break; … … 5447 5468 { 5448 5469 r_cleanup_cmd_fsm = CLEANUP_CMD_INS_GO; 5449 r_cleanup_cmd_trdid = r_icache_cleanup_way.read()<<1+ 1;5470 r_cleanup_cmd_trdid = (r_icache_cleanup_way.read()<<1) + 1; 5450 5471 } 5451 5472 else if ( r_dcache_cleanup_req.read() ) // dcache request … … 5468 5489 { 5469 5490 std::cout << " <PROC " << name() 5470 << " CLEANUP_ DATA_GO> Cleanup request for icache:" << std::hex5491 << " CLEANUP_CMD_DATA_GO> Cleanup request for icache:" << std::hex 5471 5492 << " PADDR = " << (r_dcache_cleanup_line.read()*m_dcache_words*4) 5472 5493 << " / TRDID = " << std::dec << r_cleanup_cmd_trdid.read() << std::endl; … … 5488 5509 { 5489 5510 std::cout << " <PROC " << name() 5490 << " CLEANUP_ INS_GO> Cleanup request for dcache:" << std::hex5511 << " CLEANUP_CMD_INS_GO> Cleanup request for dcache:" << std::hex 5491 5512 << " PADDR = " << (r_icache_cleanup_line.read()*m_icache_words*4) 5492 5513 << " / TRDID = " << std::dec << r_cleanup_cmd_trdid.read() << std::endl; … … 5718 5739 p_vci_ini_d.wdata = 0; 5719 5740 p_vci_ini_d.be = 0xF; 5720 p_vci_ini_d.trdid = 0; //TODO local table index5741 p_vci_ini_d.trdid = 0; 5721 5742 p_vci_ini_d.pktid = TYPE_LL; 5722 5743 p_vci_ini_d.plen = 8;
Note: See TracChangeset
for help on using the changeset viewer.