Changeset 616 for trunk/modules/vci_cc_vcache_wrapper/caba
- Timestamp:
- Jan 7, 2014, 4:26:39 PM (11 years ago)
- Location:
- trunk/modules/vci_cc_vcache_wrapper/caba/source
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/vci_cc_vcache_wrapper/caba/source/include/vci_cc_vcache_wrapper.h
r549 r616 148 148 CMD_INS_UNC, 149 149 CMD_DATA_MISS, 150 CMD_DATA_UNC, 150 CMD_DATA_UNC_READ, 151 CMD_DATA_UNC_WRITE, 151 152 CMD_DATA_WRITE, 152 153 CMD_DATA_LL, … … 202 203 // b1 accÚs table llsc type SW / other 203 204 // b2 WRITE/CAS/LL/SC 204 TYPE_ READ_DATA_UNC= 0x0,205 TYPE_DATA_UNC = 0x0, 205 206 TYPE_READ_DATA_MISS = 0x1, 206 207 TYPE_READ_INS_UNC = 0x2, … … 274 275 }; 275 276 276 enum transaction_type_d_e277 {278 // b0 : 1 if cached279 // b1 : 1 if instruction280 TYPE_DATA_UNC = 0x0,281 TYPE_DATA_MISS = 0x1,282 TYPE_INS_UNC = 0x2,283 TYPE_INS_MISS = 0x3,284 };277 // enum transaction_type_d_e 278 // { 279 // // b0 : 1 if cached 280 // // b1 : 1 if instruction 281 // TYPE_DATA_UNC = 0x0, 282 // TYPE_DATA_MISS = 0x1, 283 // TYPE_INS_UNC = 0x2, 284 // TYPE_INS_MISS = 0x3, 285 // }; 285 286 286 287 public: … … 412 413 sc_signal<uint32_t> r_dcache_save_be; // byte enable (from proc) 413 414 sc_signal<paddr_t> r_dcache_save_paddr; // physical address 414 sc_signal<bool> r_dcache_save_cacheable; // address cacheable415 415 sc_signal<size_t> r_dcache_save_cache_way; // selected way (from dcache) 416 416 sc_signal<size_t> r_dcache_save_cache_set; // selected set (from dcache) … … 423 423 // communication between DCACHE FSM and VCI_CMD FSM 424 424 sc_signal<paddr_t> r_dcache_vci_paddr; // physical address for VCI command 425 sc_signal<uint32_t> r_dcache_vci_wdata; // write unc data for VCI command 425 426 sc_signal<bool> r_dcache_vci_miss_req; // read miss request 426 sc_signal<bool> r_dcache_vci_unc_req; // uncacheable read request 427 sc_signal<uint32_t> r_dcache_vci_unc_be; // uncacheable read byte enable 427 sc_signal<bool> r_dcache_vci_unc_req; // uncacheable request (read/write) 428 sc_signal<uint32_t> r_dcache_vci_unc_be; // uncacheable byte enable 429 sc_signal<uint32_t> r_dcache_vci_unc_write; // uncacheable data write request 428 430 sc_signal<bool> r_dcache_vci_cas_req; // atomic write request CAS 429 431 sc_signal<uint32_t> r_dcache_vci_cas_old; // previous data value for a CAS … … 436 438 sc_signal<size_t> r_dcache_xtn_way; // selected way (from dcache) 437 439 sc_signal<size_t> r_dcache_xtn_set; // selected set (from dcache) 438 439 // write buffer state extension440 sc_signal<bool> r_dcache_pending_unc_write; // pending uncacheable write in WBUF441 440 442 441 // handling dcache miss -
trunk/modules/vci_cc_vcache_wrapper/caba/source/src/vci_cc_vcache_wrapper.cpp
r583 r616 119 119 "CMD_INS_UNC", 120 120 "CMD_DATA_MISS", 121 "CMD_DATA_UNC", 121 "CMD_DATA_UNC_READ", 122 "CMD_DATA_UNC_WRITE", 122 123 "CMD_DATA_WRITE", 123 124 "CMD_DATA_LL", … … 127 128 128 129 const char *vci_pktid_type_str[] = { 129 "TYPE_ READ_DATA_UNC",130 "TYPE_DATA_UNC", 130 131 "TYPE_READ_DATA_MISS", 131 132 "TYPE_READ_INS_UNC", … … 296 297 r_dcache_save_be("r_dcache_save_be"), 297 298 r_dcache_save_paddr("r_dcache_save_paddr"), 298 r_dcache_save_cacheable("r_dcache_save_cacheable"),299 299 r_dcache_save_cache_way("r_dcache_save_cache_way"), 300 300 r_dcache_save_cache_set("r_dcache_save_cache_set"), … … 306 306 307 307 r_dcache_vci_paddr("r_dcache_vci_paddr"), 308 r_dcache_vci_wdata("r_dcache_vci_wdata"), 308 309 r_dcache_vci_miss_req("r_dcache_vci_miss_req"), 309 310 r_dcache_vci_unc_req("r_dcache_vci_unc_req"), 311 r_dcache_vci_unc_write("r_dcache_vci_unc_write"), 310 312 r_dcache_vci_unc_be("r_dcache_vci_unc_be"), 311 313 r_dcache_vci_cas_req("r_dcache_vci_cas_req"), … … 318 320 r_dcache_xtn_way("r_dcache_xtn_way"), 319 321 r_dcache_xtn_set("r_dcache_xtn_set"), 320 321 r_dcache_pending_unc_write("r_dcache_pending_unc_write"),322 322 323 323 r_dcache_miss_type("r_dcache_miss_type"), … … 775 775 r_dcache_vci_ll_req = false; 776 776 r_dcache_vci_sc_req = false; 777 778 // No uncacheable write pending779 r_dcache_pending_unc_write = false;780 777 781 778 // No processor XTN request pending … … 2145 2142 // This component implement a strong order between non cacheable access 2146 2143 // (read or write) : A new non cacheable VCI transaction starts only when 2147 // the previous non cacheable transaction is completed. Both cacheable and 2148 // non cacheable transactions use the write buffer, but the DCACHE FSM registers 2149 // a non cacheable write transaction posted in the write buffer by setting the 2150 // r_dcache_pending_unc_write flip_flop. All other non cacheable requests 2151 // are stalled until this flip-flop is reset by the VCI_RSP_FSM (when the 2152 // pending non cacheable write transaction completes). 2144 // the previous non cacheable transaction is completed. After send the VCI 2145 // transaction, the DCACHE FSM wait for the respone in the DCACHE_UNC_WAIT state. 2146 // So the processor is blocked until the respone arrives in CACHE L1. 2153 2147 // 2154 2148 // 6/ Error handling: 2155 2149 // When the MMU is not activated, Read Bus Errors are synchronous events, 2156 // but Write Bus Errors are asynchronous events (processor is not frozen). 2157 // - If a Read Bus Error is detected, the VCI_RSP FSM sets the 2150 // Some Write Bus Errors are synchronous events when the request is a non cacheable access 2151 // but some Write Bus Errors are asynchronous events when the request is cacheable access 2152 // (processor is not frozen). 2153 // - If a Read Bus Error or a Non Cacheable Write Bus Error is detected, the VCI_RSP FSM sets the 2158 2154 // r_vci_rsp_data_error flip-flop, without writing any data in the 2159 2155 // r_vci_rsp_fifo_dcache FIFO, and the synchronous error is signaled 2160 2156 // by the DCACHE FSM. 2161 // - If a Write Bus Error is detected, the VCI_RSP FSM signals2162 // 2157 // - If a Cacheable Write Bus Error is detected, the VCI_RSP_FSM signals 2158 // the asynchronous error using the setWriteBerr() method. 2163 2159 // When the MMU is activated bus error are rare events, as the MMU 2164 2160 // checks the physical address before the VCI transaction starts. … … 2334 2330 if ( r_dcache_wbuf_req.read() ) 2335 2331 { 2336 // miss if write not cacheable, and previous non cacheable write registered 2337 if ( not r_dcache_save_cacheable.read() and r_dcache_pending_unc_write.read() ) 2338 { 2339 wbuf_write_miss = true; 2340 } 2341 else // try a registration into write buffer 2342 { 2343 bool wok = r_wbuf.write( r_dcache_save_paddr.read(), 2344 r_dcache_save_be.read(), 2345 r_dcache_save_wdata.read(), 2346 r_dcache_save_cacheable.read() ); 2332 bool wok = r_wbuf.write( r_dcache_save_paddr.read(), 2333 r_dcache_save_be.read(), 2334 r_dcache_save_wdata.read(), 2335 true); 2347 2336 #ifdef INSTRUMENTATION 2348 2337 m_cpt_wbuf_write++; 2349 2338 #endif 2350 if ( not wok ) // miss if write buffer full 2351 { 2352 wbuf_write_miss = true; 2353 } 2354 else // update the write_buffer state extension 2355 { 2356 if(not r_dcache_pending_unc_write.read()) 2357 r_dcache_pending_unc_write = not r_dcache_save_cacheable.read(); 2358 } 2339 if ( not wok ) // miss if write buffer full 2340 { 2341 wbuf_write_miss = true; 2359 2342 } 2360 2343 } // end WBUF update … … 2712 2695 if ( valid_req ) // processor request is valid (after MMU check) 2713 2696 { 2714 r_dcache_save_cacheable = cacheable;2715 2716 2697 // READ request 2717 2698 // The read requests are taken only if there is no cache update. … … 2770 2751 else // uncacheable read 2771 2752 { 2772 r_dcache_vci_paddr = paddr; 2773 r_dcache_vci_unc_be = m_dreq.be; 2774 r_dcache_vci_unc_req = true; 2775 r_dcache_fsm = DCACHE_UNC_WAIT; 2753 r_dcache_vci_paddr = paddr; 2754 r_dcache_vci_unc_be = m_dreq.be; 2755 r_dcache_vci_unc_write = false; 2756 r_dcache_vci_unc_req = true; 2757 r_dcache_fsm = DCACHE_UNC_WAIT; 2776 2758 #if DEBUG_DCACHE 2777 2759 if ( m_debug_activated ) … … 2837 2819 r_dcache_llsc_valid = false; 2838 2820 2839 // response to processor 2840 m_drsp.valid = true; 2841 2842 // activating P1 stage 2843 wbuf_request = true; 2844 updt_request = (cache_state == CACHE_SLOT_STATE_VALID); 2821 if (not cacheable) 2822 { 2823 r_dcache_vci_paddr = paddr; 2824 r_dcache_vci_wdata = m_dreq.wdata; 2825 r_dcache_vci_unc_write = true; 2826 r_dcache_vci_unc_be = m_dreq.be; 2827 r_dcache_vci_unc_req = true; 2828 r_dcache_fsm = DCACHE_UNC_WAIT; 2829 } 2830 else 2831 { 2832 // response to processor 2833 m_drsp.valid = true; 2834 // activating P1 stage 2835 wbuf_request = true; 2836 updt_request = (cache_state == CACHE_SLOT_STATE_VALID); 2837 } 2845 2838 } 2846 2839 } // end WRITE … … 4416 4409 if ( r_vci_rsp_data_error.read() ) // bus error 4417 4410 { 4418 r_mmu_detr = MMU_READ_DATA_ILLEGAL_ACCESS; 4411 if(r_dcache_vci_unc_write.read()) 4412 r_mmu_detr = MMU_WRITE_DATA_ILLEGAL_ACCESS; 4413 else 4414 r_mmu_detr = MMU_READ_DATA_ILLEGAL_ACCESS; 4415 4419 4416 r_mmu_dbvar = m_dreq.addr; 4420 4417 r_vci_rsp_data_error = false; … … 5093 5090 size_t wbuf_max; 5094 5091 5095 bool dcache_unc_req = r_dcache_vci_unc_req.read() and5096 ( not r_icache_miss_req.read() or not r_vci_cmd_imiss_prio.read() );5097 5098 5092 bool dcache_miss_req = r_dcache_vci_miss_req.read() and 5099 5093 ( not r_icache_miss_req.read() or not r_vci_cmd_imiss_prio.read() ); … … 5102 5096 ( not r_icache_miss_req.read() or not r_vci_cmd_imiss_prio.read() ); 5103 5097 5098 bool dcache_sc_req = r_dcache_vci_sc_req.read() and 5099 ( not r_icache_miss_req.read() or not r_vci_cmd_imiss_prio.read() ); 5100 5101 bool dcache_cas_req = r_dcache_vci_cas_req.read() and 5102 ( not r_icache_miss_req.read() or not r_vci_cmd_imiss_prio.read() ); 5103 5104 5104 bool icache_miss_req = r_icache_miss_req.read() and 5105 5105 ( not (r_dcache_vci_miss_req.read() or 5106 r_dcache_vci_ll_req.read() or 5107 r_dcache_vci_unc_req.read()) 5106 r_dcache_vci_ll_req.read() or 5107 r_dcache_vci_cas_req.read() or 5108 r_dcache_vci_sc_req.read()) 5108 5109 or r_vci_cmd_imiss_prio.read() ); 5109 5110 5110 // 1 - Data Read Miss 5111 if ( dcache_miss_req and r_wbuf.miss(r_dcache_vci_paddr.read()) ) 5111 // 1 - Data unc write 5112 if ( r_dcache_vci_unc_req.read() and r_dcache_vci_unc_write.read()) 5113 { 5114 r_vci_cmd_fsm = CMD_DATA_UNC_WRITE; 5115 r_dcache_vci_unc_req = false; 5116 // m_cpt_dunc_transaction++; 5117 } 5118 // 2 data read miss 5119 else if ( dcache_miss_req and r_wbuf.miss(r_dcache_vci_paddr.read()) ) 5112 5120 { 5113 5121 r_vci_cmd_fsm = CMD_DATA_MISS; … … 5116 5124 // m_cpt_dmiss_transaction++; 5117 5125 } 5118 // 2- Data Read Uncachable5119 else if ( dcache_unc_req and r_wbuf.miss(r_dcache_vci_paddr.read()))5120 { 5121 r_vci_cmd_fsm = CMD_DATA_UNC ;5126 // 3 - Data Read Uncachable 5127 else if ( r_dcache_vci_unc_req.read() and not r_dcache_vci_unc_write.read() ) 5128 { 5129 r_vci_cmd_fsm = CMD_DATA_UNC_READ; 5122 5130 r_dcache_vci_unc_req = false; 5123 5131 // m_cpt_dunc_transaction++; 5124 5132 } 5125 // 3- Data Linked Load5133 // 4 - Data Linked Load 5126 5134 else if ( dcache_ll_req and r_wbuf.miss(r_dcache_vci_paddr.read())) 5127 5135 { 5128 r_dcache_vci_ll_req = false; 5129 r_vci_cmd_fsm = CMD_DATA_LL; 5136 r_vci_cmd_fsm = CMD_DATA_LL; 5137 r_dcache_vci_ll_req = false; 5138 r_vci_cmd_imiss_prio = true; 5130 5139 // m_cpt_ll_transaction++; 5131 5140 } 5132 // 4- Instruction Miss5141 // 5 - Instruction Miss 5133 5142 else if ( icache_miss_req and r_wbuf.miss(r_icache_vci_paddr.read()) ) 5134 5143 { … … 5138 5147 // m_cpt_imiss_transaction++; 5139 5148 } 5140 // 5- Instruction Uncachable5149 // 6 - Instruction Uncachable 5141 5150 else if ( r_icache_unc_req.read() ) 5142 5151 { … … 5145 5154 // m_cpt_iunc_transaction++; 5146 5155 } 5147 // 6- Data Write5156 // 7 - Data Write 5148 5157 else if ( r_wbuf.rok(&wbuf_min, &wbuf_max) ) 5149 5158 { … … 5155 5164 // m_length_write_transaction += (wbuf_max-wbuf_min+1); 5156 5165 } 5157 // 7 - Data Store Conditionnal 5158 else if ( r_dcache_vci_sc_req.read() ) 5159 { 5160 r_dcache_vci_sc_req = false; 5161 r_vci_cmd_cpt = 0; 5162 r_vci_cmd_fsm = CMD_DATA_SC; 5166 // 8 - Data Store Conditionnal 5167 else if ( dcache_sc_req and r_wbuf.miss(r_dcache_vci_paddr.read()) ) 5168 { 5169 r_vci_cmd_fsm = CMD_DATA_SC; 5170 r_dcache_vci_sc_req = false; 5171 r_vci_cmd_imiss_prio = true; 5172 r_vci_cmd_cpt = 0; 5163 5173 // m_cpt_sc_transaction++; 5164 5174 } 5165 // 8 - Compare And Swap 5166 else if ( r_dcache_vci_cas_req.read() ) 5167 { 5168 r_vci_cmd_fsm = CMD_DATA_CAS; 5169 r_dcache_vci_cas_req = false; 5170 r_vci_cmd_cpt = 0; 5175 // 9 - Compare And Swap 5176 else if ( dcache_cas_req and r_wbuf.miss(r_dcache_vci_paddr.read()) ) 5177 { 5178 r_vci_cmd_fsm = CMD_DATA_CAS; 5179 r_dcache_vci_cas_req = false; 5180 r_vci_cmd_imiss_prio = true; 5181 r_vci_cmd_cpt = 0; 5171 5182 // m_cpt_cas_transaction++; 5172 5183 } … … 5213 5224 case CMD_INS_UNC: 5214 5225 case CMD_DATA_MISS: 5215 case CMD_DATA_UNC: 5226 case CMD_DATA_UNC_READ: 5227 case CMD_DATA_UNC_WRITE: 5216 5228 case CMD_DATA_LL: 5217 5229 { … … 5261 5273 r_vci_rsp_cpt = 0; 5262 5274 5263 if ( (p_vci.rpktid.read() & 0x7) == TYPE_ READ_DATA_UNC )5275 if ( (p_vci.rpktid.read() & 0x7) == TYPE_DATA_UNC ) 5264 5276 { 5265 5277 r_vci_rsp_fsm = RSP_DATA_UNC; … … 5470 5482 r_vci_rsp_fsm = RSP_IDLE; 5471 5483 uint32_t wbuf_index = p_vci.rtrdid.read(); 5472 bool cacheable = r_wbuf.completed(wbuf_index); 5473 if ( not cacheable ) r_dcache_pending_unc_write = false; 5484 r_wbuf.completed(wbuf_index); 5474 5485 if ( (p_vci.rerror.read()&0x1) != 0 ) r_iss.setWriteBerr(); 5475 5486 } … … 5970 5981 break; 5971 5982 5972 case CMD_DATA_UNC :5983 case CMD_DATA_UNC_READ: 5973 5984 p_vci.cmdval = true; 5974 5985 p_vci.address = r_dcache_vci_paddr.read() & ~0x3; … … 5976 5987 p_vci.be = r_dcache_vci_unc_be.read(); 5977 5988 p_vci.trdid = 0; 5978 p_vci.pktid = TYPE_ READ_DATA_UNC;5989 p_vci.pktid = TYPE_DATA_UNC; 5979 5990 p_vci.plen = 4; 5980 5991 p_vci.cmd = vci_param::CMD_READ; 5992 p_vci.eop = true; 5993 break; 5994 5995 case CMD_DATA_UNC_WRITE: 5996 p_vci.cmdval = true; 5997 p_vci.address = r_dcache_vci_paddr.read() & ~0x3; 5998 p_vci.wdata = r_dcache_vci_wdata.read(); 5999 p_vci.be = r_dcache_vci_unc_be.read(); 6000 p_vci.trdid = 0; 6001 p_vci.pktid = TYPE_DATA_UNC; 6002 p_vci.plen = 4; 6003 p_vci.cmd = vci_param::CMD_WRITE; 5981 6004 p_vci.eop = true; 5982 6005 break;
Note: See TracChangeset
for help on using the changeset viewer.