- Timestamp:
- Apr 19, 2015, 5:19:35 PM (10 years ago)
- Location:
- branches/reconfiguration/modules/vci_mem_cache/caba/source
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/reconfiguration/modules/vci_mem_cache/caba/source/include/vci_mem_cache.h
r915 r985 549 549 550 550 // Component attributes 551 std::list<soclib::common::Segment> m_seglist; // segments allocated552 551 size_t m_nseg; // number of segments 553 soclib::common::Segment **m_seg; // array of segments pointers554 size_t m_seg_config; // config segment index555 552 const size_t m_srcid_x; // global index on RAM network 556 553 const size_t m_initiators; // Number of initiators … … 587 584 588 585 // broadcast address 589 uint32_t 586 uint32_t m_broadcast_boundaries; 590 587 591 588 // configuration interface constants 589 soclib::common::Segment* m_config_seg; 592 590 const uint32_t m_config_addr_mask; 593 591 const uint32_t m_config_regr_width; -
branches/reconfiguration/modules/vci_mem_cache/caba/source/src/vci_mem_cache.cpp
r919 r985 373 373 p_dspin_clack("p_dspin_clack"), 374 374 375 m_seglist(mtp.getSegmentList(tgtid_d)),376 375 m_nseg(0), 377 376 m_srcid_x(mtx.indexForId(srcid_x)), … … 408 407 409 408 // CONFIG interface 409 m_config_seg(NULL), 410 410 m_config_addr_mask((1 << 12) - 1), 411 412 411 m_config_regr_width(7), 413 412 m_config_func_width(3), … … 532 531 533 532 // Get the segments associated to the MemCache 533 std::list<soclib::common::Segment> seglist = mtp.getSegmentList(tgtid_d); 534 534 std::list<soclib::common::Segment>::iterator seg; 535 size_t i = 0; 536 537 for (seg = m_seglist.begin(); seg != m_seglist.end(); seg++) 535 for (seg = seglist.begin(); seg != seglist.end(); seg++) 538 536 { 539 537 std::cout << " => segment " << seg->name() … … 543 541 } 544 542 545 assert((m_nseg > 0) and 546 "MEMC ERROR : At least one segment must be mapped to this component"); 547 548 m_seg = new soclib::common::Segment*[m_nseg]; 549 550 for (seg = m_seglist.begin(); seg != m_seglist.end(); seg++) 551 { 552 if (seg->special()) m_seg_config = i; 553 m_seg[i] = & (*seg); 554 i++; 555 } 556 557 addr_t gid = m_seg[0]->baseAddress() >> (vci_param_int::N - x_width - y_width); 543 assert((m_nseg > 1) and 544 "MEMC ERROR : At least two segments must be mapped to this component"); 545 546 for (seg = seglist.begin(); seg != seglist.end(); ++seg) 547 { 548 if (!seg->special()) continue; 549 m_config_seg = new soclib::common::Segment(*seg); 550 break; 551 } 552 553 assert(m_config_seg && "MEMC_ERROR: the configuration segment is not mapped"); 554 555 const int cluster_offset_width = (vci_param_int::N - x_width - y_width); 556 const addr_t cluster_offset_mask = (1ULL << cluster_offset_width) - 1; 557 558 addr_t gid = m_config_seg->baseAddress() >> cluster_offset_width; 558 559 m_x_self = (gid >> m_y_width) & ((1 << m_x_width) - 1); 559 560 m_y_self = gid & ((1 << m_y_width) - 1); 561 562 // mask the cluster coordinates to support configuration requests on 563 // reallocated segments 564 *m_config_seg = m_config_seg->masked(cluster_offset_mask); 560 565 561 566 // Allocation for IXR_RSP FSM … … 987 992 ///////////////////////////////// 988 993 { 989 delete [] m_seg;994 if (m_config_seg) delete m_config_seg; 990 995 991 996 delete [] r_ixr_rsp_to_xram_rsp_rok; … … 1303 1308 } 1304 1309 #endif 1305 // checking segmentation violation 1306 addr_t address = p_vci_tgt.address.read(); 1307 uint32_t plen = p_vci_tgt.plen.read(); 1308 bool config = false; 1309 1310 for (size_t seg_id = 0; (seg_id < m_nseg) ; seg_id++) 1311 { 1312 if (m_seg[seg_id]->contains(address) && 1313 m_seg[seg_id]->contains(address + plen - vci_param_int::B)) 1314 { 1315 if (m_seg[seg_id]->special()) config = true; 1316 } 1317 } 1318 1319 if (config) /////////// configuration command 1320 { 1310 // check for configuration commands 1311 uint32_t plen = p_vci_tgt.plen.read(); 1312 addr_t mask = (1ULL << (vci_param_int::N - m_x_width - m_y_width)) - 1; 1313 addr_t base = p_vci_tgt.address.read() & mask; 1314 addr_t last = base + plen - vci_param_int::B; 1315 1316 if (m_config_seg->contains(base) && m_config_seg->contains(last)) 1317 { 1318 // configuration command 1321 1319 if (!p_vci_tgt.eop.read()) r_tgt_cmd_fsm = TGT_CMD_ERROR; 1322 1320 else r_tgt_cmd_fsm = TGT_CMD_CONFIG; 1323 1321 } 1324 else //////////// memory access 1325 { 1322 else 1323 { 1324 // memory access 1326 1325 if (p_vci_tgt.cmd.read() == vci_param_int::CMD_READ) 1327 1326 {
Note: See TracChangeset
for help on using the changeset viewer.