Changeset 487
- Timestamp:
- Aug 8, 2013, 1:33: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
r468 r487 175 175 CC_RECEIVE_INS_UPDT_HEADER, 176 176 CC_RECEIVE_INS_UPDT_NLINE, 177 CC_RECEIVE_INS_UPDT_DATA,178 177 CC_RECEIVE_DATA_INVAL_HEADER, 179 178 CC_RECEIVE_DATA_INVAL_NLINE, 180 179 CC_RECEIVE_DATA_UPDT_HEADER, 181 180 CC_RECEIVE_DATA_UPDT_NLINE, 181 CC_RECEIVE_INS_UPDT_DATA, 182 182 CC_RECEIVE_DATA_UPDT_DATA, 183 183 }; … … 388 388 sc_signal<bool> r_icache_tlb_rsp_error; // tlb miss response error 389 389 390 // Filp-Flop in ICACHE FSM for saving the cleanup victim request 391 sc_signal<bool> r_icache_cleanup_victim_req; 392 sc_signal<paddr_t> r_icache_cleanup_victim_nline; 393 390 394 // communication between ICACHE FSM and CC_SEND FSM 391 395 sc_signal<bool> r_icache_cc_send_req; // ICACHE cc_send request … … 480 484 sc_signal<bool> r_dcache_xtn_req; // xtn request (caused by processor) 481 485 sc_signal<int> r_dcache_xtn_opcode; // xtn request type 486 487 // Filp-Flop in DCACHE FSM for saving the cleanup victim request 488 sc_signal<bool> r_dcache_cleanup_victim_req; 489 sc_signal<paddr_t> r_dcache_cleanup_victim_nline; 482 490 483 491 // communication between DCACHE FSM and CC_SEND FSM -
trunk/modules/vci_cc_vcache_wrapper/caba/source/src/vci_cc_vcache_wrapper.cpp
r484 r487 277 277 r_icache_tlb_rsp_error("r_icache_tlb_rsp_error"), 278 278 279 r_icache_cleanup_victim_req("r_icache_cleanup_victim_req"), 280 r_icache_cleanup_victim_nline("r_icache_cleanup_victim_nline"), 281 279 282 r_icache_cc_send_req("r_icache_cc_send_req"), 280 283 r_icache_cc_send_type("r_icache_cc_send_type"), … … 349 352 r_dcache_xtn_opcode("r_dcache_xtn_opcode"), 350 353 354 r_dcache_cleanup_victim_req("r_dcache_cleanup_victim_req"), 355 r_dcache_cleanup_victim_nline("r_dcache_cleanup_victim_nline"), 356 351 357 r_dcache_cc_send_req("r_dcache_cc_send_req"), 352 358 r_dcache_cc_send_type("r_dcache_cc_send_type"), … … 755 761 // No request from ICACHE_FSM to CC_SEND FSM 756 762 r_icache_cc_send_req = false; 763 r_icache_cleanup_victim_req = false; 757 764 758 765 r_icache_clack_req = false; … … 777 784 // No request from DCACHE FSM to CC_SEND FSM 778 785 r_dcache_cc_send_req = false; 786 r_dcache_cleanup_victim_req = false; 779 787 780 788 r_dcache_clack_req = false; … … 1508 1516 //////////////////////// 1509 1517 case ICACHE_MISS_SELECT: // Try to select a slot in associative set, 1510 // if previous cleanup has been sent.1511 1518 // Waiting in this state if no slot available. 1512 // Set the r_icache_cleanup_req flip-flop 1513 // and the r_icache_miss_clack flip-flop, 1519 // If a victim slot has been choosen and the r_icache_cc_send_req is false, 1520 // we send the cleanup request in this state. 1521 // If not, a r_icache_cleanup_victim_req flip-flop is 1522 // utilized for saving this cleanup request, and it will be sent later 1523 // in state ICACHE_MISS_WAIT or ICACHE_MISS_UPDT_DIR. 1524 // The r_icache_miss_clack flip-flop is set 1514 1525 // when a cleanup is required 1515 1526 { … … 1532 1543 } 1533 1544 1534 if ( not r_icache_cc_send_req.read() ) // wait for previous cc_send request to be sent 1535 { 1536 bool found; 1537 bool cleanup; 1538 size_t way; 1539 size_t set; 1540 paddr_t victim; 1545 1546 bool found; 1547 bool cleanup; 1548 size_t way; 1549 size_t set; 1550 paddr_t victim; 1541 1551 1542 1552 #ifdef INSTRUMENTATION 1543 1553 m_cpt_icache_dir_read++; 1544 1554 #endif 1545 r_icache.read_select(r_icache_vci_paddr.read(), 1546 &victim, 1547 &way, 1548 &set, 1549 &found, 1550 &cleanup ); 1551 if ( found ) 1552 { 1553 r_icache_miss_way = way; 1554 r_icache_miss_set = set; 1555 1556 if ( cleanup ) 1555 r_icache.read_select(r_icache_vci_paddr.read(), 1556 &victim, 1557 &way, 1558 &set, 1559 &found, 1560 &cleanup ); 1561 if ( not found ) 1562 { 1563 break; 1564 } 1565 else 1566 { 1567 r_icache_miss_way = way; 1568 r_icache_miss_set = set; 1569 1570 if ( cleanup ) 1571 { 1572 if ( not r_icache_cc_send_req.read() ) 1557 1573 { 1558 r_icache_fsm = ICACHE_MISS_CLEAN; 1559 r_icache_miss_clack = true; 1560 // request cleanup 1561 r_icache_cc_send_req = true; 1562 r_icache_cc_send_nline = victim; 1563 r_icache_cc_send_way = way; 1564 r_icache_cc_send_type = CC_TYPE_CLEANUP; 1574 r_icache_cc_send_req = true; 1575 r_icache_cc_send_nline = victim; 1576 r_icache_cc_send_way = way; 1577 r_icache_cc_send_type = CC_TYPE_CLEANUP; 1565 1578 } 1566 1579 else 1567 1580 { 1568 r_icache_fsm = ICACHE_MISS_WAIT; 1581 r_icache_cleanup_victim_req = true; 1582 r_icache_cleanup_victim_nline = victim; 1569 1583 } 1584 1585 r_icache_miss_clack = true; 1586 r_icache_fsm = ICACHE_MISS_CLEAN; 1587 } 1588 else 1589 { 1590 r_icache_fsm = ICACHE_MISS_WAIT; 1591 } 1570 1592 1571 1593 #if DEBUG_ICACHE … … 1580 1602 } 1581 1603 #endif 1582 }1583 1604 } 1584 1605 break; … … 1620 1641 break; 1621 1642 } 1643 1644 // send cleanup victim request 1645 if ( r_icache_cleanup_victim_req.read() and not r_icache_cc_send_req.read() ) 1646 { 1647 r_icache_cc_send_req = true; 1648 r_icache_cc_send_nline = r_icache_cleanup_victim_nline; 1649 r_icache_cc_send_way = r_icache_miss_way; 1650 r_icache_cc_send_type = CC_TYPE_CLEANUP; 1651 r_icache_cleanup_victim_req = false; 1652 } 1622 1653 1623 1654 // coherence interrupt 1624 if ( r_cc_receive_icache_req.read() and not r_icache_cc_send_req.read() )1655 if ( r_cc_receive_icache_req.read() and not r_icache_cc_send_req.read() and not r_icache_cleanup_victim_req.read() ) 1625 1656 { 1626 1657 r_icache_fsm = ICACHE_CC_CHECK; … … 1700 1731 } 1701 1732 1733 // send cleanup victim request 1734 if ( r_icache_cleanup_victim_req.read() and not r_icache_cc_send_req.read() ) 1735 { 1736 r_icache_cc_send_req = true; 1737 r_icache_cc_send_nline = r_icache_cleanup_victim_nline; 1738 r_icache_cc_send_way = r_icache_miss_way; 1739 r_icache_cc_send_type = CC_TYPE_CLEANUP; 1740 r_icache_cleanup_victim_req = false; 1741 } 1742 1702 1743 // coherence interrupt 1703 if ( r_cc_receive_icache_req.read() and not r_icache_cc_send_req.read() )1744 if ( r_cc_receive_icache_req.read() and not r_icache_cc_send_req.read() and not r_icache_cleanup_victim_req.read() ) 1704 1745 { 1705 1746 r_icache_fsm = ICACHE_CC_CHECK; … … 1860 1901 } 1861 1902 1903 assert ( not r_icache_cc_send_req.read() and "CC_SEND must be available in ICACHE_CC_CHECK"); 1904 1862 1905 // Match between MISS address and CC address 1863 // note: In the same cycle we can handle a CLACK and a MISS match1864 // because the CLACK access the directory but the MISS match dont.1865 1906 if (r_cc_receive_icache_req.read() and 1866 1907 ((r_icache_fsm_save.read() == ICACHE_MISS_SELECT ) or … … 1897 1938 #endif 1898 1939 } 1899 1900 assert ( not r_icache_cc_send_req.read() and "CC_SEND must be available in ICACHE_CC_CHECK");1901 1940 1902 1941 // CC request handler … … 3823 3862 { 3824 3863 paddr = (paddr_t)r_dcache_save_wdata.read(); 3864 if (vci_param::N > 32) 3865 paddr = paddr | ((paddr_t)(r_dcache_paddr_ext.read()) << 32); 3825 3866 hit = true; 3826 3867 } … … 3964 4005 } 3965 4006 //////////////////////// 3966 case DCACHE_MISS_SELECT: // Try to select a slot in associative set 3967 // if previous cleanup has been sent. 3968 // Waiting in this state if no slot available 3969 // Set the r_dcache_cleanup_req flip-flop 3970 // and the r_dcache_miss_clack flip-flop 3971 // when a cleanup is required 4007 case DCACHE_MISS_SELECT: // Try to select a slot in associative set, 4008 // Waiting in this state if no slot available. 4009 // If a victim slot has been choosen and the r_icache_cc_send_req is false, 4010 // we send the cleanup request in this state. 4011 // If not, a r_icache_cleanup_victim_req flip-flop is 4012 // utilized for saving this cleanup request, and it will be sent later 4013 // in state ICACHE_MISS_WAIT or ICACHE_MISS_UPDT_DIR. 4014 // The r_icache_miss_clack flip-flop is set 4015 // when a cleanup is required 3972 4016 { 3973 4017 if ( m_dreq.valid) m_cost_data_miss_frz++; … … 3989 4033 } 3990 4034 3991 if ( not r_dcache_cc_send_req.read() ) // blocked until previous cc_send request is sent 3992 { 3993 bool found = false; 3994 bool cleanup = false; 3995 size_t way = 0; 3996 size_t set = 0; 3997 paddr_t victim = 0; 4035 bool found = false; 4036 bool cleanup = false; 4037 size_t way = 0; 4038 size_t set = 0; 4039 paddr_t victim = 0; 3998 4040 3999 4041 #ifdef INSTRUMENTATION 4000 4042 m_cpt_dcache_dir_read++; 4001 4043 #endif 4002 r_dcache.read_select( r_dcache_save_paddr.read(), 4003 &victim, 4004 &way, 4005 &set, 4006 &found, 4007 &cleanup ); 4008 4009 if ( found ) 4010 { 4011 r_dcache_miss_way = way; 4012 r_dcache_miss_set = set; 4013 4014 if ( cleanup ) 4044 r_dcache.read_select( r_dcache_save_paddr.read(), 4045 &victim, 4046 &way, 4047 &set, 4048 &found, 4049 &cleanup ); 4050 4051 if ( not found ) 4052 { 4053 break; 4054 } 4055 else 4056 { 4057 r_dcache_miss_way = way; 4058 r_dcache_miss_set = set; 4059 4060 if ( cleanup ) 4061 { 4062 if ( not r_dcache_cc_send_req.read() ) 4015 4063 { 4016 r_dcache_miss_clack = true; 4017 r_dcache_fsm = DCACHE_MISS_CLEAN; 4018 // request cleanup 4019 r_dcache_cc_send_req = true; 4020 r_dcache_cc_send_nline = victim; 4021 r_dcache_cc_send_way = way; 4022 r_dcache_cc_send_type = CC_TYPE_CLEANUP; 4064 r_dcache_cc_send_req = true; 4065 r_dcache_cc_send_nline = victim; 4066 r_dcache_cc_send_way = way; 4067 r_dcache_cc_send_type = CC_TYPE_CLEANUP; 4068 4023 4069 } 4024 4070 else 4025 4071 { 4026 r_dcache_fsm = DCACHE_MISS_WAIT; 4072 r_dcache_cleanup_victim_req = true; 4073 r_dcache_cleanup_victim_nline = victim; 4027 4074 } 4075 4076 r_dcache_miss_clack = true; 4077 r_dcache_fsm = DCACHE_MISS_CLEAN; 4078 } 4079 else 4080 { 4081 r_dcache_fsm = DCACHE_MISS_WAIT; 4082 } 4028 4083 4029 4084 #if DEBUG_DCACHE … … 4039 4094 } 4040 4095 #endif 4041 } // end found 4042 } 4096 } // end found 4043 4097 break; 4044 4098 } … … 4105 4159 } 4106 4160 4161 // send cleanup victim request 4162 if ( r_dcache_cleanup_victim_req.read() and not r_dcache_cc_send_req.read() ) 4163 { 4164 r_dcache_cc_send_req = true; 4165 r_dcache_cc_send_nline = r_dcache_cleanup_victim_nline; 4166 r_dcache_cc_send_way = r_dcache_miss_way; 4167 r_dcache_cc_send_type = CC_TYPE_CLEANUP; 4168 r_dcache_cleanup_victim_req = false; 4169 } 4170 4107 4171 // coherence request (from CC_RECEIVE FSM) 4108 if ( r_cc_receive_dcache_req.read() and not r_dcache_cc_send_req.read() )4172 if ( r_cc_receive_dcache_req.read() and not r_dcache_cc_send_req.read() and not r_dcache_cleanup_victim_req.read()) 4109 4173 { 4110 4174 r_dcache_fsm = DCACHE_CC_CHECK; … … 4228 4292 } 4229 4293 4294 // send cleanup victim request 4295 if ( r_dcache_cleanup_victim_req.read() and not r_dcache_cc_send_req.read() ) 4296 { 4297 r_dcache_cc_send_req = true; 4298 r_dcache_cc_send_nline = r_dcache_cleanup_victim_nline; 4299 r_dcache_cc_send_way = r_dcache_miss_way; 4300 r_dcache_cc_send_type = CC_TYPE_CLEANUP; 4301 r_dcache_cleanup_victim_req = false; 4302 } 4303 4230 4304 // coherence request (from CC_RECEIVE FSM) 4231 if ( r_cc_receive_dcache_req.read() and not r_dcache_cc_send_req.read() )4305 if ( r_cc_receive_dcache_req.read() and not r_dcache_cc_send_req.read() and not r_dcache_cleanup_victim_req.read() ) 4232 4306 { 4233 4307 r_dcache_fsm = DCACHE_CC_CHECK; … … 4604 4678 } 4605 4679 4606 4680 assert ( not r_dcache_cc_send_req.read() and "CC_SEND must be available in DCACHE_CC_CHECK" ); 4681 4607 4682 // Match between MISS address and CC address 4608 // note: In the same cycle we can handle a CLACK and a MISS match4609 // because the CLACK access the directory but the MISS match dont.4610 4683 if (r_cc_receive_dcache_req.read() and 4611 4684 ((r_dcache_fsm_cc_save == DCACHE_MISS_SELECT ) or … … 4643 4716 #endif 4644 4717 } 4645 4646 4647 assert ( not r_dcache_cc_send_req.read() and "CC_SEND must be available in DCACHE_CC_CHECK" );4648 4718 4649 4719 // CC request handler
Note: See TracChangeset
for help on using the changeset viewer.