Changeset 460 for branches/ODCCP
- Timestamp:
- Jul 19, 2013, 2:34:03 PM (11 years ago)
- Location:
- branches/ODCCP
- Files:
-
- 8 edited
- 4 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/ODCCP/communication/dspin_dhccp_param/caba/source/include/dspin_dhccp_param.h
r356 r460 49 49 * flit 2 50 50 * ---------------------------------------------------------------------------------------------- 51 * EOP:1 | NLINE(32 bits) 51 * EOP:0/1 | NLINE(32 bits) 52 * ---------------------------------------------------------------------------------------------- 53 * 54 * flit N for data 55 * ---------------------------------------------------------------------------------------------- 56 * EOP:0/1 | WDATA(32 bits) 52 57 * ---------------------------------------------------------------------------------------------- 53 58 * … … 135 140 public: 136 141 137 static const uint8_t from_memc_flit_width = 40; 138 static const uint8_t from_l1_flit_width = 33; 139 140 static const uint8_t UPDT_INDEX_WIDTH = 4; 141 static const uint8_t NLINE_WIDTH = 34; 142 static const uint8_t SRCID_WIDTH = 14; 143 static const uint8_t GLOBALID_WIDTH = 10; 144 static const uint8_t WORD_INDEX_WIDTH = 4; 145 static const uint8_t BE_WIDTH = 4; 146 static const uint8_t DATA_WIDTH = 32; 147 static const uint8_t SET_INDEX_WIDTH = 16; 148 static const uint8_t WAY_INDEX_WIDTH = 2; 149 static const uint8_t BROADCAST_BOX_WIDTH = 20; 150 static const uint8_t MC_TYPE_WIDTH = 3; 151 static const uint8_t L1_TYPE_WIDTH = 2; 152 153 static const uint8_t FROM_L1_TYPE_SHIFT = 1; 154 static const uint64_t FROM_L1_TYPE_MASK = ((1ULL<<L1_TYPE_WIDTH)-1); 155 static const uint8_t FROM_L1_EOP_SHIFT = 32; 156 static const uint64_t FROM_L1_EOP_MASK = 1; 157 static const uint8_t FROM_L1_BC_SHIFT = 0; 158 static const uint64_t FROM_L1_BC_MASK = 1; 159 160 static const uint8_t CLEANUP_DEST_SHIFT = 22; 161 static const uint64_t CLEANUP_DEST_MASK = ((1ULL<<GLOBALID_WIDTH)-1); 162 static const uint8_t CLEANUP_SRCID_SHIFT = 8; 163 static const uint64_t CLEANUP_SRCID_MASK = ((1ULL<<SRCID_WIDTH)-1); 164 static const uint8_t CLEANUP_NLINE_MSB_SHIFT = 6; 165 static const uint64_t CLEANUP_NLINE_MSB_MASK = ((1ULL<< 2)-1); 166 static const uint8_t CLEANUP_WAY_INDEX_SHIFT = 3; 167 static const uint64_t CLEANUP_WAY_INDEX_MASK = ((1ULL<<WAY_INDEX_WIDTH)-1); 168 static const uint8_t CLEANUP_NLINE_LSB_SHIFT = 0; 169 static const uint64_t CLEANUP_NLINE_LSB_MASK = ((1ULL<<32)-1); 170 171 static const uint8_t MULTI_ACK_DEST_SHIFT = CLEANUP_DEST_SHIFT; 172 static const uint64_t MULTI_ACK_DEST_MASK = CLEANUP_DEST_MASK; 173 static const uint8_t MULTI_ACK_UPDT_INDEX_SHIFT = 3; 174 static const uint64_t MULTI_ACK_UPDT_INDEX_MASK = ((1ULL<<UPDT_INDEX_WIDTH)-1); 175 176 static const uint8_t FROM_MC_TYPE_SHIFT = 1; 177 static const uint64_t FROM_MC_TYPE_MASK = ((1ULL<<MC_TYPE_WIDTH)-1); 178 static const uint8_t FROM_MC_EOP_SHIFT = 39; 179 static const uint64_t FROM_MC_EOP_MASK = 1; 180 static const uint8_t FROM_MC_BC_SHIFT = 0; 181 static const uint64_t FROM_MC_BC_MASK = 1; 182 183 static const uint8_t MULTI_INVAL_DEST_SHIFT = 25; 184 static const uint64_t MULTI_INVAL_DEST_MASK = ((1ULL<<SRCID_WIDTH)-1); 185 static const uint8_t MULTI_INVAL_SRCID_SHIFT = 8; 186 static const uint64_t MULTI_INVAL_SRCID_MASK = ((1ULL<<SRCID_WIDTH)-1); 187 static const uint8_t MULTI_INVAL_UPDT_INDEX_SHIFT = 4; 188 static const uint64_t MULTI_INVAL_UPDT_INDEX_MASK = ((1ULL<<UPDT_INDEX_WIDTH)-1); 189 static const uint8_t MULTI_INVAL_NLINE_SHIFT = 0; 190 static const uint64_t MULTI_INVAL_NLINE_MASK = ((1ULL<<NLINE_WIDTH)-1); 191 192 static const uint8_t MULTI_UPDT_DEST_SHIFT = MULTI_INVAL_DEST_SHIFT; 193 static const uint64_t MULTI_UPDT_DEST_MASK = MULTI_INVAL_DEST_MASK; 194 static const uint8_t MULTI_UPDT_SRCID_SHIFT = MULTI_INVAL_SRCID_SHIFT; 195 static const uint64_t MULTI_UPDT_SRCID_MASK = MULTI_INVAL_SRCID_MASK; 196 static const uint8_t MULTI_UPDT_UPDT_INDEX_SHIFT = MULTI_INVAL_UPDT_INDEX_SHIFT; 197 static const uint64_t MULTI_UPDT_UPDT_INDEX_MASK = MULTI_INVAL_UPDT_INDEX_MASK; 198 static const uint8_t MULTI_UPDT_WORD_INDEX_SHIFT = 34; 199 static const uint64_t MULTI_UPDT_WORD_INDEX_MASK = ((1ULL<<WORD_INDEX_WIDTH)-1); 200 static const uint8_t MULTI_UPDT_NLINE_SHIFT = MULTI_INVAL_NLINE_SHIFT; 201 static const uint64_t MULTI_UPDT_NLINE_MASK = MULTI_INVAL_NLINE_MASK; 202 static const uint8_t MULTI_UPDT_BE_SHIFT = 32; 203 static const uint64_t MULTI_UPDT_BE_MASK = ((1ULL<<BE_WIDTH)-1); 204 static const uint8_t MULTI_UPDT_DATA_SHIFT = 0; 205 static const uint64_t MULTI_UPDT_DATA_MASK = ((1ULL<<DATA_WIDTH)-1); 206 207 static const uint8_t CLEANUP_ACK_DEST_SHIFT = MULTI_INVAL_DEST_SHIFT; 208 static const uint64_t CLEANUP_ACK_DEST_MASK = MULTI_INVAL_DEST_MASK; 209 static const uint8_t CLEANUP_ACK_SET_SHIFT = 6; 210 static const uint64_t CLEANUP_ACK_SET_MASK = ((1ULL<<SET_INDEX_WIDTH)-1); 211 static const uint8_t CLEANUP_ACK_WAY_SHIFT = 4; 212 static const uint64_t CLEANUP_ACK_WAY_MASK = ((1ULL<<WAY_INDEX_WIDTH)-1); 213 214 static const uint8_t BROADCAST_BOX_SHIFT = 19; 215 static const uint64_t BROADCAST_BOX_MASK = ((1ULL<<BROADCAST_BOX_WIDTH)-1); 216 static const uint8_t BROADCAST_SRCID_SHIFT = 5; 217 static const uint64_t BROADCAST_SRCID_MASK = MULTI_INVAL_SRCID_MASK; 218 static const uint8_t BROADCAST_NLINE_SHIFT = 0; 219 static const uint64_t BROADCAST_NLINE_MASK = MULTI_INVAL_NLINE_MASK; 142 static const uint8_t from_memc_flit_width = 40; 143 static const uint8_t from_l1_flit_width = 33; 144 145 static const uint8_t UPDT_INDEX_WIDTH = 4; 146 static const uint8_t NLINE_WIDTH = 34; 147 static const uint8_t SRCID_WIDTH = 14; 148 static const uint8_t GLOBALID_WIDTH = 10; 149 static const uint8_t WORD_INDEX_WIDTH = 4; 150 static const uint8_t BE_WIDTH = 4; 151 static const uint8_t DATA_WIDTH = 32; 152 static const uint8_t SET_INDEX_WIDTH = 16; 153 static const uint8_t WAY_INDEX_WIDTH = 2; 154 static const uint8_t BROADCAST_BOX_WIDTH = 20; 155 static const uint8_t MC_TYPE_WIDTH = 3; 156 static const uint8_t L1_TYPE_WIDTH = 2; 157 158 static const uint8_t FROM_L1_TYPE_SHIFT = 1; 159 static const uint64_t FROM_L1_TYPE_MASK = ((1ULL<<L1_TYPE_WIDTH)-1); 160 static const uint8_t FROM_L1_EOP_SHIFT = 32; 161 static const uint64_t FROM_L1_EOP_MASK = 1; 162 static const uint8_t FROM_L1_BC_SHIFT = 0; 163 static const uint64_t FROM_L1_BC_MASK = 1; 164 165 static const uint8_t CLEANUP_NCC_SHIFT = 5; 166 static const uint64_t CLEANUP_NCC_MASK = 1; 167 static const uint8_t CLEANUP_DEST_SHIFT = 22; 168 static const uint64_t CLEANUP_DEST_MASK = ((1ULL<<GLOBALID_WIDTH)-1); 169 static const uint8_t CLEANUP_SRCID_SHIFT = 8; 170 static const uint64_t CLEANUP_SRCID_MASK = ((1ULL<<SRCID_WIDTH)-1); 171 static const uint8_t CLEANUP_NLINE_MSB_SHIFT = 6; 172 static const uint64_t CLEANUP_NLINE_MSB_MASK = ((1ULL<< 2)-1); 173 static const uint8_t CLEANUP_WAY_INDEX_SHIFT = 3; 174 static const uint64_t CLEANUP_WAY_INDEX_MASK = ((1ULL<<WAY_INDEX_WIDTH)-1); 175 static const uint8_t CLEANUP_NLINE_LSB_SHIFT = 0; 176 static const uint64_t CLEANUP_NLINE_LSB_MASK = ((1ULL<<32)-1); 177 static const uint8_t CLEANUP_DATA_UPDT_SHIFT = 0; 178 static const uint64_t CLEANUP_DATA_UPDT_MASK = ((1ULL<<32)-1); 179 180 static const uint8_t MULTI_ACK_DEST_SHIFT = CLEANUP_DEST_SHIFT; 181 static const uint64_t MULTI_ACK_DEST_MASK = CLEANUP_DEST_MASK; 182 static const uint8_t MULTI_ACK_UPDT_INDEX_SHIFT = 3; 183 static const uint64_t MULTI_ACK_UPDT_INDEX_MASK = ((1ULL<<UPDT_INDEX_WIDTH)-1); 184 185 static const uint8_t FROM_MC_TYPE_SHIFT = 1; 186 static const uint64_t FROM_MC_TYPE_MASK = ((1ULL<<MC_TYPE_WIDTH)-1); 187 static const uint8_t FROM_MC_EOP_SHIFT = 39; 188 static const uint64_t FROM_MC_EOP_MASK = 1; 189 static const uint8_t FROM_MC_BC_SHIFT = 0; 190 static const uint64_t FROM_MC_BC_MASK = 1; 191 192 static const uint8_t MULTI_INVAL_DEST_SHIFT = 25; 193 static const uint64_t MULTI_INVAL_DEST_MASK = ((1ULL<<SRCID_WIDTH)-1); 194 static const uint8_t MULTI_INVAL_SRCID_SHIFT = 8; 195 static const uint64_t MULTI_INVAL_SRCID_MASK = ((1ULL<<SRCID_WIDTH)-1); 196 static const uint8_t MULTI_INVAL_UPDT_INDEX_SHIFT = 4; 197 static const uint64_t MULTI_INVAL_UPDT_INDEX_MASK = ((1ULL<<UPDT_INDEX_WIDTH)-1); 198 static const uint8_t MULTI_INVAL_NLINE_SHIFT = 0; 199 static const uint64_t MULTI_INVAL_NLINE_MASK = ((1ULL<<NLINE_WIDTH)-1); 200 201 static const uint8_t MULTI_UPDT_DEST_SHIFT = MULTI_INVAL_DEST_SHIFT; 202 static const uint64_t MULTI_UPDT_DEST_MASK = MULTI_INVAL_DEST_MASK; 203 static const uint8_t MULTI_UPDT_SRCID_SHIFT = MULTI_INVAL_SRCID_SHIFT; 204 static const uint64_t MULTI_UPDT_SRCID_MASK = MULTI_INVAL_SRCID_MASK; 205 static const uint8_t MULTI_UPDT_UPDT_INDEX_SHIFT = MULTI_INVAL_UPDT_INDEX_SHIFT; 206 static const uint64_t MULTI_UPDT_UPDT_INDEX_MASK = MULTI_INVAL_UPDT_INDEX_MASK; 207 static const uint8_t MULTI_UPDT_WORD_INDEX_SHIFT = 34; 208 static const uint64_t MULTI_UPDT_WORD_INDEX_MASK = ((1ULL<<WORD_INDEX_WIDTH)-1); 209 static const uint8_t MULTI_UPDT_NLINE_SHIFT = MULTI_INVAL_NLINE_SHIFT; 210 static const uint64_t MULTI_UPDT_NLINE_MASK = MULTI_INVAL_NLINE_MASK; 211 static const uint8_t MULTI_UPDT_BE_SHIFT = 32; 212 static const uint64_t MULTI_UPDT_BE_MASK = ((1ULL<<BE_WIDTH)-1); 213 static const uint8_t MULTI_UPDT_DATA_SHIFT = 0; 214 static const uint64_t MULTI_UPDT_DATA_MASK = ((1ULL<<DATA_WIDTH)-1); 215 216 static const uint8_t CLEANUP_ACK_DEST_SHIFT = MULTI_INVAL_DEST_SHIFT; 217 static const uint64_t CLEANUP_ACK_DEST_MASK = MULTI_INVAL_DEST_MASK; 218 static const uint8_t CLEANUP_ACK_SET_SHIFT = 6; 219 static const uint64_t CLEANUP_ACK_SET_MASK = ((1ULL<<SET_INDEX_WIDTH)-1); 220 static const uint8_t CLEANUP_ACK_WAY_SHIFT = 4; 221 static const uint64_t CLEANUP_ACK_WAY_MASK = ((1ULL<<WAY_INDEX_WIDTH)-1); 222 223 static const uint8_t BROADCAST_BOX_SHIFT = 19; 224 static const uint64_t BROADCAST_BOX_MASK = ((1ULL<<BROADCAST_BOX_WIDTH)-1); 225 static const uint8_t BROADCAST_SRCID_SHIFT = 5; 226 static const uint64_t BROADCAST_SRCID_MASK = MULTI_INVAL_SRCID_MASK; 227 static const uint8_t BROADCAST_NLINE_SHIFT = 0; 228 static const uint64_t BROADCAST_NLINE_MASK = MULTI_INVAL_NLINE_MASK; 220 229 221 230 /* … … 252 261 FROM_L1_BC, 253 262 263 CLEANUP_NCC, 254 264 CLEANUP_DEST, 255 265 CLEANUP_SRCID, … … 257 267 CLEANUP_WAY_INDEX, 258 268 CLEANUP_NLINE_LSB, 269 CLEANUP_DATA_UPDT, 259 270 260 271 MULTI_ACK_DEST, … … 294 305 GET_FIELD(flit,FROM_L1_EOP); 295 306 GET_FIELD(flit,FROM_L1_BC); 307 GET_FIELD(flit,CLEANUP_NCC); 296 308 GET_FIELD(flit,CLEANUP_DEST); 297 309 GET_FIELD(flit,CLEANUP_SRCID); … … 299 311 GET_FIELD(flit,CLEANUP_WAY_INDEX); 300 312 GET_FIELD(flit,CLEANUP_NLINE_LSB); 313 GET_FIELD(flit,CLEANUP_DATA_UPDT); 301 314 GET_FIELD(flit,MULTI_ACK_DEST); 302 315 GET_FIELD(flit,MULTI_ACK_UPDT_INDEX); … … 333 346 SET_FIELD(flit,value,FROM_L1_EOP); 334 347 SET_FIELD(flit,value,FROM_L1_BC); 348 SET_FIELD(flit,value,CLEANUP_NCC); 335 349 SET_FIELD(flit,value,CLEANUP_DEST); 336 350 SET_FIELD(flit,value,CLEANUP_SRCID); … … 338 352 SET_FIELD(flit,value,CLEANUP_WAY_INDEX); 339 353 SET_FIELD(flit,value,CLEANUP_NLINE_LSB); 354 SET_FIELD(flit,value,CLEANUP_DATA_UPDT); 340 355 SET_FIELD(flit,value,MULTI_ACK_DEST); 341 356 SET_FIELD(flit,value,MULTI_ACK_UPDT_INDEX); -
branches/ODCCP/lib/generic_cache_tsar/include/generic_cache.h
r393 r460 76 76 { 77 77 CACHE_SLOT_STATE_EMPTY, 78 CACHE_SLOT_STATE_VALID ,78 CACHE_SLOT_STATE_VALID_CC, 79 79 CACHE_SLOT_STATE_ZOMBI, 80 CACHE_SLOT_STATE_VALID_NCC, 80 81 }; 81 82 … … 118 119 return r_lru[(way*m_sets)+set]; 119 120 } 120 121 121 122 ////////////////////////////////////////////// 122 123 inline int &cache_state(size_t way, size_t set) … … 125 126 } 126 127 128 127 129 ///////////////////////////////////////////////// 128 130 inline void cache_set_lru(size_t way, size_t set) … … 218 220 } 219 221 222 inline int get_cache_state(int way, int set) 223 { 224 return cache_state(way,set); 225 } 226 220 227 ///////////////////////////////////////////////////////////////////// 221 228 // Read a single 32 bits word. … … 233 240 { 234 241 if ( (tag == cache_tag(way, set)) 235 && ( cache_state(way, set) == CACHE_SLOT_STATE_VALID) )242 && ( (cache_state(way, set) == CACHE_SLOT_STATE_VALID_CC) or (cache_state(way, set) == CACHE_SLOT_STATE_VALID_NCC)) ) 236 243 { 237 244 *dt = cache_data(way, set, word); … … 262 269 { 263 270 if ( (tag == cache_tag(way, set)) and 264 ( cache_state(way, set) == CACHE_SLOT_STATE_VALID))271 ( (cache_state(way, set) == CACHE_SLOT_STATE_VALID_CC)or (cache_state(way, set) == CACHE_SLOT_STATE_VALID_NCC))) 265 272 { 266 273 *selway = way; … … 308 315 { 309 316 310 if ( cache_state(way, set) == CACHE_SLOT_STATE_VALID )317 if ( cache_state(way, set) == CACHE_SLOT_STATE_VALID_CC ) 311 318 { 312 *state = CACHE_SLOT_STATE_VALID; 319 *state = CACHE_SLOT_STATE_VALID_CC; 320 *selway = way; 321 *selset = set; 322 *selword = word; 323 *dt = cache_data(way, set, word); 324 cache_set_lru(way, set); 325 } 326 else if ( cache_state(way, set) == CACHE_SLOT_STATE_VALID_NCC ) 327 { 328 *state = CACHE_SLOT_STATE_VALID_NCC; 313 329 *selway = way; 314 330 *selset = set; … … 347 363 { 348 364 if ( (tag == cache_tag(way, set)) 349 && ( cache_state(way, set) == CACHE_SLOT_STATE_VALID) )365 && ( (cache_state(way, set) == CACHE_SLOT_STATE_VALID_CC) or (cache_state(way, set) == CACHE_SLOT_STATE_VALID_NCC) ) ) 350 366 { 351 367 *selway = way; … … 382 398 { 383 399 if ( (tag == cache_tag(way, set)) 384 && (cache_state(way, set) == CACHE_SLOT_STATE_VALID) )400 &&( (cache_state(way, set) == CACHE_SLOT_STATE_VALID_CC) ) ) 385 401 { 386 402 *dt = cache_data(way, set, word); … … 433 449 { 434 450 435 if ( cache_state(way, set) == CACHE_SLOT_STATE_VALID )451 if ( cache_state(way, set) == CACHE_SLOT_STATE_VALID_CC ) 436 452 { 437 *state = CACHE_SLOT_STATE_VALID ;453 *state = CACHE_SLOT_STATE_VALID_CC; 438 454 *selway = way; 439 455 *selset = set; … … 446 462 cache_set_lru(way, set); 447 463 } 464 465 /*else if ( cache_state(way, set) == CACHE_SLOT_STATE_VALID_NCC ) 466 { 467 *state = CACHE_SLOT_STATE_VALID_NCC; 468 *selway = way; 469 *selset = set; 470 *selword = word; 471 *dt = cache_data(way, set, word); 472 if ( word+1 < m_words) 473 { 474 *dt_next = cache_data(way, set, word+1); 475 } 476 cache_set_lru(way, set); 477 }*/ 478 448 479 else if ( cache_state(way, set) == CACHE_SLOT_STATE_ZOMBI ) 449 480 { … … 477 508 { 478 509 if ( (tag == cache_tag(way, set)) 479 && ( cache_state(way, set) == CACHE_SLOT_STATE_VALID) )510 && ( (cache_state(way, set) == CACHE_SLOT_STATE_VALID_CC)or(cache_state(way, set) == CACHE_SLOT_STATE_VALID_NCC) ) ) 480 511 { 481 512 *selway = way; … … 509 540 const size_t ad_set = m_y[ad]; 510 541 const size_t ad_word = m_x[ad]; 511 512 542 for ( size_t _way = 0; _way < m_ways; _way++ ) 513 543 { … … 556 586 data_t data) 557 587 { 588 /**/ //std::cout << "write cache : way = "<<way<<" | set = "<<set<<" | word = "<<word<<" | data = "<<(uint32_t)data << std::endl; 558 589 cache_data(way, set, word) = data; 559 590 cache_set_lru(way, set); … … 584 615 addr_t* nline) 585 616 { 586 if ( cache_state(way,set) == CACHE_SLOT_STATE_VALID )617 if( (cache_state(way,set) == CACHE_SLOT_STATE_VALID_CC) ) 587 618 { 588 619 cache_state(way,set) = CACHE_SLOT_STATE_EMPTY; … … 615 646 for ( size_t _way = 0 ; _way < m_ways && !found ; _way++ ) 616 647 { 617 if ( cache_state(_way, *set) != CACHE_SLOT_STATE_VALID) // empty648 if( ( cache_state(_way, *set) != CACHE_SLOT_STATE_VALID_CC ) ) // empty 618 649 { 619 650 found = true; … … 674 705 } 675 706 } 707 ////////////////////////////////////////////////////////////// 708 /*for ( size_t _way = 0 ; _way < m_ways && !(*found) ; _way++ ) 709 { 710 if ( not cache_lru(_way, _set) and 711 (cache_state(_way, _set) != CACHE_SLOT_STATE_ZOMBI) and 712 (cache_state(_way, _set) == CACHE_SLOT_STATE_VALID_NCC) ) 713 { 714 *found = true; 715 *cleanup = true; 716 *way = _way; 717 *set = m_y[ad]; 718 *victim = (addr_t)((cache_tag(*way,_set) * m_sets) + _set); 719 return; 720 } 721 }*/ 676 722 // Search first not zombi old slot 677 723 for ( size_t _way = 0 ; _way < m_ways && !(*found) ; _way++ ) … … 718 764 719 765 cache_tag(way, set) = tag; 720 cache_state(way, set) = CACHE_SLOT_STATE_VALID ;766 cache_state(way, set) = CACHE_SLOT_STATE_VALID_CC; 721 767 cache_set_lru(way, set); 722 768 } … … 733 779 addr_t tag = m_z[ad]; 734 780 735 assert( ( (state == CACHE_SLOT_STATE_VALID) or 781 assert( ( (state == CACHE_SLOT_STATE_VALID_CC) or 782 (state == CACHE_SLOT_STATE_VALID_NCC) or 736 783 (state == CACHE_SLOT_STATE_ZOMBI) or 737 784 (state == CACHE_SLOT_STATE_EMPTY) ) and … … 747 794 cache_state(way, set) = state; 748 795 749 if ( state == CACHE_SLOT_STATE_VALID) cache_set_lru(way, set);796 if ( (state == CACHE_SLOT_STATE_VALID_CC) or (state == CACHE_SLOT_STATE_VALID_NCC) ) cache_set_lru(way, set); 750 797 } 751 798 … … 759 806 int state) 760 807 { 761 assert( ( (state == CACHE_SLOT_STATE_VALID) or 808 assert( ( (state == CACHE_SLOT_STATE_VALID_CC) or 809 (state == CACHE_SLOT_STATE_VALID_NCC) or 762 810 (state == CACHE_SLOT_STATE_ZOMBI) or 763 811 (state == CACHE_SLOT_STATE_EMPTY) ) and … … 772 820 cache_state(way, set) = state; 773 821 774 if ( state == CACHE_SLOT_STATE_VALID) cache_set_lru(way, set);822 if ( (state == CACHE_SLOT_STATE_VALID_CC) or (state == CACHE_SLOT_STATE_VALID_NCC) ) cache_set_lru(way, set); 775 823 } 776 824 … … 788 836 789 837 cache_tag(way, set) = tag; 790 cache_state(way, set) = CACHE_SLOT_STATE_VALID ;838 cache_state(way, set) = CACHE_SLOT_STATE_VALID_CC; 791 839 cache_set_lru(way, set); 792 840 for ( size_t word = 0 ; word < m_words ; word++ ) … … 853 901 { 854 902 if ( (tag == cache_tag(way, set)) and 855 (cache_state(way, set) == CACHE_SLOT_STATE_VALID ) )903 (cache_state(way, set) == CACHE_SLOT_STATE_VALID_CC) ) 856 904 { 857 905 hit = true; … … 878 926 { 879 927 if ( (tag == cache_tag(way, set)) and 880 (cache_state(way, set) == CACHE_SLOT_STATE_VALID ) )928 (cache_state(way, set) == CACHE_SLOT_STATE_VALID_CC) ) 881 929 { 882 930 hit = true; … … 923 971 { 924 972 if ( (tag == cache_tag(way, set)) and 925 (cache_state(way, set) == CACHE_SLOT_STATE_VALID ) )973 (cache_state(way, set) == CACHE_SLOT_STATE_VALID_CC) ) 926 974 { 927 975 cache_data(way, set, word) = dt; … … 948 996 { 949 997 if ( (tag == cache_tag(way, set)) and 950 (cache_state(way, set) == CACHE_SLOT_STATE_VALID ) )998 (cache_state(way, set) == CACHE_SLOT_STATE_VALID_CC) ) 951 999 { 952 1000 data_t mask = be2mask(be); … … 975 1023 { 976 1024 if ( (tag == cache_tag(way, set)) and 977 (cache_state(way, set) == CACHE_SLOT_STATE_VALID ) )1025 (cache_state(way, set) == CACHE_SLOT_STATE_VALID_CC) ) 978 1026 { 979 1027 cache_data(way, set, word) = dt; … … 1002 1050 { 1003 1051 if ( (tag == cache_tag(way, set)) and 1004 (cache_state(way, set) == CACHE_SLOT_STATE_VALID ) )1052 (cache_state(way, set) == CACHE_SLOT_STATE_VALID_CC) ) 1005 1053 { 1006 1054 data_t mask = be2mask(be); -
branches/ODCCP/modules/vci_cc_vcache_wrapper/caba/source/include/vci_cc_vcache_wrapper.h
r432 r460 117 117 DCACHE_XTN_IT_INVAL, 118 118 DCACHE_XTN_DC_FLUSH, 119 DCACHE_XTN_DC_FLUSH_DATA, 119 120 DCACHE_XTN_DC_FLUSH_GO, 120 121 DCACHE_XTN_DC_INVAL_VA, … … 122 123 DCACHE_XTN_DC_INVAL_END, 123 124 DCACHE_XTN_DC_INVAL_GO, 125 DCACHE_XTN_DC_INVAL_DATA, 124 126 DCACHE_XTN_DT_INVAL, 125 127 //handling dirty bit update … … 129 131 DCACHE_MISS_SELECT, 130 132 DCACHE_MISS_CLEAN, 133 DCACHE_MISS_DATA, 131 134 DCACHE_MISS_WAIT, 132 135 DCACHE_MISS_DATA_UPDT, … … 138 141 // handling coherence requests 139 142 DCACHE_CC_CHECK, 143 DCACHE_CC_INVAL_DATA, 140 144 DCACHE_CC_INVAL, 141 145 DCACHE_CC_UPDT, … … 188 192 CC_SEND_CLEANUP_1, 189 193 CC_SEND_CLEANUP_2, 194 CC_SEND_CLEANUP_DATA_UPDT, 190 195 CC_SEND_MULTI_ACK, 191 196 }; … … 194 199 enum transaction_type_e 195 200 { 196 // b3 unused201 // b3 ODCCP/RWT : COHERENT/NO COHERENT 197 202 // b2 READ / NOT READ 198 203 // if READ … … 202 207 // b1 accÚs table llsc type SW / other 203 208 // b2 WRITE/CAS/LL/SC 204 TYPE_READ_DATA_UNC = 0x0, 205 TYPE_READ_DATA_MISS = 0x1, 206 TYPE_READ_INS_UNC = 0x2, 207 TYPE_READ_INS_MISS = 0x3, 208 TYPE_WRITE = 0x4, 209 TYPE_CAS = 0x5, 210 TYPE_LL = 0x6, 211 TYPE_SC = 0x7 209 TYPE_READ_DATA_UNC = 0x0, 210 TYPE_READ_DATA_MISS = 0x1, 211 TYPE_READ_INS_UNC = 0x2, 212 TYPE_READ_INS_MISS = 0x3, 213 TYPE_WRITE = 0x4, 214 TYPE_CAS = 0x5, 215 TYPE_LL = 0x6, 216 TYPE_SC = 0x7, 217 TYPE_READ_DATA_MISS_NO_COHERENT = 0x9 212 218 }; 213 219 … … 283 289 TYPE_INS_MISS = 0x3, 284 290 }; 291 292 //////////////////MODIFIED//////////////// 293 enum content_line_cache_status_e 294 { 295 LINE_CACHE_DATA_NOT_DIRTY, 296 LINE_CACHE_DATA_DIRTY, 297 LINE_CACHE_IN_TLB, 298 LINE_CACHE_CONTAINS_PTD, 299 }; 300 ////////////////////////////////////////// 285 301 286 302 public: … … 384 400 // communication between ICACHE FSM and CC_SEND FSM 385 401 sc_signal<bool> r_icache_cc_send_req; // ICACHE cc_send request 386 sc_signal< cc_send_t>r_icache_cc_send_type; // ICACHE cc_send request type402 sc_signal<int> r_icache_cc_send_type; // ICACHE cc_send request type 387 403 sc_signal<paddr_t> r_icache_cc_send_nline; // ICACHE cc_send nline 388 404 sc_signal<size_t> r_icache_cc_send_way; // ICACHE cc_send way … … 472 488 // communication between DCACHE FSM and CC_SEND FSM 473 489 sc_signal<bool> r_dcache_cc_send_req; // DCACHE cc_send request 474 sc_signal< cc_send_t>r_dcache_cc_send_type; // DCACHE cc_send request type490 sc_signal<int> r_dcache_cc_send_type; // DCACHE cc_send request type 475 491 sc_signal<paddr_t> r_dcache_cc_send_nline; // DCACHE cc_send nline 476 492 sc_signal<size_t> r_dcache_cc_send_way; // DCACHE cc_send way 477 493 sc_signal<size_t> r_dcache_cc_send_updt_tab_idx; // DCACHE cc_send update table index 478 494 495 // special registers for ODCCP/RWT 496 sc_signal<bool> r_dcache_cc_cleanup_updt_data; // Register for cleanup with data (wb updt) 497 sc_signal<bool> r_dcache_cleanup_ncc; // Register for cleanup no coherent 498 sc_signal<bool> r_dcache_miss_victim_no_coherence; // Register for victim in no coherence mode 499 sc_signal<bool> r_dcache_line_no_coherence; // Register for line current in no coherence mode 500 sc_signal<bool> r_dcache_miss_no_coherent; // Register for miss on NCC line 501 sc_signal<bool> r_vci_rsp_read_data_miss_no_coherent; // Read miss rsp on line NCC 502 sc_signal<uint32_t> r_cc_send_cpt_word; 503 504 sc_signal<uint32_t> r_dcache_miss_data_cpt; // Cpt a word to read for sending Cleanup with data (MISS STATE) 505 sc_signal<paddr_t> r_dcache_miss_data_addr; // Addr for read word for sending Cleanup with data (MISS STATE) 506 507 sc_signal<int> r_dcache_xtn_state; 508 sc_signal<paddr_t> r_dcache_xtn_data_addr; // Cpt a word to read for sending Cleanup with data (XTN DC INVAL STATE) 509 sc_signal<uint32_t> r_dcache_xtn_data_cpt; // Addr for read word for sending Cleanup with data (XTN DC INVAL STATE) 510 511 sc_signal<paddr_t> r_dcache_cc_inval_addr; // Cpt a word to read for sending Cleanup with data (CC INVAL STATE) 512 sc_signal<uint32_t> r_dcache_cc_inval_data_cpt; // Addr for read word for sending Cleanup with data (CC INVAL STATE) 513 sc_signal<int> r_dcache_cc_state; 514 515 sc_signal<paddr_t> r_dcache_xtn_flush_addr_data; // Cpt a word to read for sending Cleanup with data (XTN DC FLUSH STATE) 516 sc_signal<uint32_t> r_dcache_xtn_flush_data_cpt; // Addr for read word for sending Cleanup with data (XTN DC FLUSH STATE) 517 518 /*STATS DIRTY*/ 519 bool *dirty_stats; 520 uint32_t m_cpt_words_dirty; // total number of words dirty when we send a cleanup with data 521 522 ////////////// 523 GenericFifo<uint32_t> r_cc_send_data_fifo; // Fifo for save data value (before sending cleanup with data) 479 524 // dcache directory extension 480 bool *r_dcache_in_tlb; // copy exist in dtlb or itlb 481 bool *r_dcache_contains_ptd; // cache line contains a PTD 525 ///////////////////////////MODIFIED/////////////////////////////////////////////////// 526 //bool *r_dcache_in_tlb; // copy exist in dtlb or itlb 527 //bool *r_dcache_contains_ptd; // cache line contains a PTD 528 int *r_dcache_content_state; // content state of one cache line 529 ////////////////////////////////////////////////////////////////////////////////////// 482 530 483 531 // Physical address extension for data access … … 502 550 GenericFifo<uint32_t> r_vci_rsp_fifo_icache; // response FIFO to ICACHE FSM 503 551 GenericFifo<uint32_t> r_vci_rsp_fifo_dcache; // response FIFO to DCACHE FSM 552 504 553 505 554 /////////////////////////////////// … … 523 572 // communication between CC_RECEIVE FSM and ICACHE FSM 524 573 sc_signal<bool> r_cc_receive_icache_req; // cc_receive to icache request 525 sc_signal< cc_receive_t>r_cc_receive_icache_type; // cc_receive type of request574 sc_signal<int> r_cc_receive_icache_type; // cc_receive type of request 526 575 sc_signal<size_t> r_cc_receive_icache_way; // cc_receive to icache way 527 576 sc_signal<size_t> r_cc_receive_icache_set; // cc_receive to icache set … … 531 580 // communication between CC_RECEIVE FSM and DCACHE FSM 532 581 sc_signal<bool> r_cc_receive_dcache_req; // cc_receive to dcache request 533 sc_signal< cc_receive_t>r_cc_receive_dcache_type; // cc_receive type of request582 sc_signal<int> r_cc_receive_dcache_type; // cc_receive type of request 534 583 sc_signal<size_t> r_cc_receive_dcache_way; // cc_receive to dcache way 535 584 sc_signal<size_t> r_cc_receive_dcache_set; // cc_receive to dcache set … … 576 625 uint32_t m_cpt_data_read; // total number of read data 577 626 uint32_t m_cpt_data_write; // total number of write data 627 uint32_t m_cpt_data_write_back; // total number of write NCC 628 uint32_t m_cpt_data_cleanup; // total number of flits cleanup data 629 uint32_t m_cpt_data_cleanup_dirty; // total number of cleanup data dirty 630 uint32_t m_cpt_data_sc; 631 uint32_t m_cpt_data_write_miss_ncc; // total number of write NCC miss 578 632 uint32_t m_cpt_data_miss; // number of read miss 579 633 uint32_t m_cpt_ins_miss; // number of instruction miss -
branches/ODCCP/modules/vci_cc_vcache_wrapper/caba/source/src/vci_cc_vcache_wrapper.cpp
r434 r460 32 32 #include "../include/vci_cc_vcache_wrapper.h" 33 33 34 #define DEBUG_DCACHE 1 35 #define DEBUG_ICACHE 1 36 #define DEBUG_CMD 0 34 #define DEBUG_DCACHE 1 35 #define DEBUG_ICACHE 1 36 #define DEBUG_CLEANUP 1 37 #define INSTRUMENTATION 1 38 #define FETCH_ON_WRITE_ENABLE 1 39 #define DEBUG_CMD 0 37 40 38 41 namespace soclib { … … 89 92 "DCACHE_XTN_IT_INVAL", 90 93 "DCACHE_XTN_DC_FLUSH", 94 "DCACHE_XTN_DC_FLUSH_DATA", 91 95 "DCACHE_XTN_DC_FLUSH_GO", 92 96 "DCACHE_XTN_DC_INVAL_VA", … … 94 98 "DCACHE_XTN_DC_INVAL_END", 95 99 "DCACHE_XTN_DC_INVAL_GO", 100 "DCACHE_XTN_DC_INVAL_DATA", 96 101 "DCACHE_XTN_DT_INVAL", 97 102 … … 101 106 "DCACHE_MISS_SELECT", 102 107 "DCACHE_MISS_CLEAN", 108 "DCACHE_MISS_DATA", 103 109 "DCACHE_MISS_WAIT", 104 110 "DCACHE_MISS_DATA_UPDT", … … 110 116 111 117 "DCACHE_CC_CHECK", 118 "DCACHE_CC_INVAL_DATA", 112 119 "DCACHE_CC_INVAL", 113 120 "DCACHE_CC_UPDT", … … 174 181 "CC_SEND_CLEANUP_1", 175 182 "CC_SEND_CLEANUP_2", 183 "CC_SEND_CLEANUP_DATA_UPDT", 176 184 "CC_SEND_MULTI_ACK", 177 185 }; … … 353 361 r_dcache_cc_send_way("r_dcache_cc_send_way"), 354 362 r_dcache_cc_send_updt_tab_idx("r_dcache_cc_send_updt_tab_idx"), 363 364 r_cc_send_data_fifo("r_cc_send_data_fifo", 2), // ODCCP 355 365 356 366 r_vci_cmd_fsm("r_vci_cmd_fsm"), … … 423 433 r_mmu_release = (uint32_t)(1 << 16) | 0x1; 424 434 425 r_dcache_in_tlb = new bool[dcache_ways*dcache_sets]; 426 r_dcache_contains_ptd = new bool[dcache_ways*dcache_sets]; 435 ////////////////////MODIFIED/////////////////////////////// 436 //r_dcache_in_tlb = new bool[dcache_ways*dcache_sets]; 437 //r_dcache_contains_ptd = new bool[dcache_ways*dcache_sets]; 438 dirty_stats = new bool [dcache_ways*dcache_sets*dcache_words]; 439 r_dcache_content_state = new int [dcache_ways*dcache_sets]; 440 /////////////////////////////////////////////////////////// 441 427 442 428 443 SC_METHOD(transition); … … 449 464 ///////////////////////////////////// 450 465 { 451 delete [] r_dcache_in_tlb; 452 delete [] r_dcache_contains_ptd; 466 ////////////MODIFIED///////////// 467 //delete [] r_dcache_in_tlb; 468 //delete [] r_dcache_contains_ptd; 469 delete [] dirty_stats; 470 delete [] r_dcache_content_state; 471 ///////////////////////////////// 453 472 } 454 473 … … 479 498 std::cout << " " << m_drsp << std::endl; 480 499 500 std::cout << r_iss << std::endl; 501 481 502 std::cout << " " << icache_fsm_state_str[r_icache_fsm.read()] 482 503 << " | " << dcache_fsm_state_str[r_dcache_fsm.read()] … … 561 582 } 562 583 563 /* 584 564 585 //////////////////////// 565 586 tmpl(void)::print_stats() … … 568 589 float run_cycles = (float)(m_cpt_total_cycles - m_cpt_frz_cycles); 569 590 std::cout << name() << std::endl 570 << "- CPI = " << (float)m_cpt_total_cycles/run_cycles << std::endl 571 << "- READ RATE = " << (float)m_cpt_read/run_cycles << std::endl 572 << "- WRITE RATE = " << (float)m_cpt_write/run_cycles << std::endl 573 << "- IMISS_RATE = " << (float)m_cpt_ins_miss/m_cpt_ins_read << std::endl 574 << "- DMISS RATE = " << (float)m_cpt_data_miss/(m_cpt_read-m_cpt_unc_read) << std::endl 575 << "- INS MISS COST = " << (float)m_cost_ins_miss_frz/m_cpt_ins_miss << std::endl 576 << "- DATA MISS COST = " << (float)m_cost_data_miss_frz/m_cpt_data_miss << std::endl 577 << "- WRITE COST = " << (float)m_cost_write_frz/m_cpt_write << std::endl 578 << "- UNC COST = " << (float)m_cost_unc_read_frz/m_cpt_unc_read << std::endl 579 << "- UNCACHED READ RATE = " << (float)m_cpt_unc_read/m_cpt_read << std::endl 580 << "- CACHED WRITE RATE = " << (float)m_cpt_write_cached/m_cpt_write << std::endl 581 << "- INS TLB MISS RATE = " << (float)m_cpt_ins_tlb_miss/m_cpt_ins_tlb_read << std::endl 582 << "- DATA TLB MISS RATE = " << (float)m_cpt_data_tlb_miss/m_cpt_data_tlb_read << std::endl 583 << "- ITLB MISS COST = " << (float)m_cost_ins_tlb_miss_frz/m_cpt_ins_tlb_miss << std::endl 584 << "- DTLB MISS COST = " << (float)m_cost_data_tlb_miss_frz/m_cpt_data_tlb_miss << std::endl 585 << "- ITLB UPDATE ACC COST = " << (float)m_cost_ins_tlb_update_acc_frz/m_cpt_ins_tlb_update_acc << std::endl 586 << "- DTLB UPDATE ACC COST = " << (float)m_cost_data_tlb_update_acc_frz/m_cpt_data_tlb_update_acc << std::endl 587 << "- DTLB UPDATE DIRTY COST = " << (float)m_cost_data_tlb_update_dirty_frz/m_cpt_data_tlb_update_dirty << std::endl 588 << "- ITLB HIT IN DCACHE RATE= " << (float)m_cpt_ins_tlb_hit_dcache/m_cpt_ins_tlb_miss << std::endl 589 << "- DTLB HIT IN DCACHE RATE= " << (float)m_cpt_data_tlb_hit_dcache/m_cpt_data_tlb_miss << std::endl 590 << "- DCACHE FROZEN BY ITLB = " << (float)m_cost_ins_tlb_occup_cache_frz/m_cpt_dcache_frz_cycles << std::endl 591 << "- DCACHE FOR TLB % = " << (float)m_cpt_tlb_occup_dcache/(m_dcache_ways*m_dcache_sets) << std::endl 592 << "- NB CC BROADCAST = " << m_cpt_cc_broadcast << std::endl 593 << "- NB CC UPDATE DATA = " << m_cpt_cc_update_data << std::endl 594 << "- NB CC INVAL DATA = " << m_cpt_cc_inval_data << std::endl 595 << "- NB CC INVAL INS = " << m_cpt_cc_inval_ins << std::endl 596 << "- CC BROADCAST COST = " << (float)m_cost_broadcast_frz/m_cpt_cc_broadcast << std::endl 597 << "- CC UPDATE DATA COST = " << (float)m_cost_updt_data_frz/m_cpt_cc_update_data << std::endl 598 << "- CC INVAL DATA COST = " << (float)m_cost_inval_data_frz/m_cpt_cc_inval_data << std::endl 599 << "- CC INVAL INS COST = " << (float)m_cost_inval_ins_frz/m_cpt_cc_inval_ins << std::endl 600 << "- NB CC CLEANUP DATA = " << m_cpt_cc_cleanup_data << std::endl 601 << "- NB CC CLEANUP INS = " << m_cpt_cc_cleanup_ins << std::endl 602 << "- IMISS TRANSACTION = " << (float)m_cost_imiss_transaction/m_cpt_imiss_transaction << std::endl 603 << "- DMISS TRANSACTION = " << (float)m_cost_dmiss_transaction/m_cpt_dmiss_transaction << std::endl 604 << "- UNC TRANSACTION = " << (float)m_cost_unc_transaction/m_cpt_unc_transaction << std::endl 605 << "- WRITE TRANSACTION = " << (float)m_cost_write_transaction/m_cpt_write_transaction << std::endl 606 << "- WRITE LENGTH = " << (float)m_length_write_transaction/m_cpt_write_transaction << std::endl 607 << "- ITLB MISS TRANSACTION = " << (float)m_cost_itlbmiss_transaction/m_cpt_itlbmiss_transaction << std::endl 608 << "- DTLB MISS TRANSACTION = " << (float)m_cost_dtlbmiss_transaction/m_cpt_dtlbmiss_transaction << std::endl; 591 << "- CPI = " << (float)m_cpt_total_cycles/run_cycles << std::endl 592 << "- READ RATE = " << (float)m_cpt_data_read/run_cycles << std::endl 593 << "- WRITE RATE = " << (float)m_cpt_data_write/run_cycles << std::endl 594 << "- IMISS_RATE = " << (float)m_cpt_ins_miss/m_cpt_ins_read << std::endl 595 << "- DMISS RATE = " << (float)m_cpt_data_miss/(m_cpt_data_read-m_cpt_unc_read) << std::endl 596 << "- INS MISS COST = " << (float)m_cost_ins_miss_frz/m_cpt_ins_miss << std::endl 597 << "- DATA MISS COST = " << (float)m_cost_data_miss_frz/m_cpt_data_miss << std::endl 598 << "- WRITE COST = " << (float)m_cost_write_frz/m_cpt_data_write << std::endl 599 << "- UNC COST = " << (float)m_cost_unc_read_frz/m_cpt_unc_read << std::endl 600 << "- UNCACHED READ RATE = " << (float)m_cpt_unc_read/m_cpt_data_read << std::endl 601 << "- CACHED WRITE RATE = " << (float)m_cpt_write_cached/m_cpt_data_write << std::endl 602 << "- INS TLB MISS RATE = " << (float)m_cpt_ins_tlb_miss/m_cpt_ins_tlb_read << std::endl 603 << "- DATA TLB MISS RATE = " << (float)m_cpt_data_tlb_miss/m_cpt_data_tlb_read << std::endl 604 << "- ITLB MISS COST = " << (float)m_cost_ins_tlb_miss_frz/m_cpt_ins_tlb_miss << std::endl 605 << "- DTLB MISS COST = " << (float)m_cost_data_tlb_miss_frz/m_cpt_data_tlb_miss << std::endl 606 << "- ITLB UPDATE ACC COST = " << (float)m_cost_ins_tlb_update_acc_frz/m_cpt_ins_tlb_update_acc << std::endl 607 << "- DTLB UPDATE ACC COST = " << (float)m_cost_data_tlb_update_acc_frz/m_cpt_data_tlb_update_acc << std::endl 608 << "- DTLB UPDATE DIRTY COST = " << (float)m_cost_data_tlb_update_dirty_frz/m_cpt_data_tlb_update_dirty << std::endl 609 << "- ITLB HIT IN DCACHE RATE = " << (float)m_cpt_ins_tlb_hit_dcache/m_cpt_ins_tlb_miss << std::endl 610 << "- DTLB HIT IN DCACHE RATE = " << (float)m_cpt_data_tlb_hit_dcache/m_cpt_data_tlb_miss << std::endl 611 //<< "- DCACHE FROZEN BY ITLB = " << (float)m_cost_ins_tlb_occup_cache_frz/m_cpt_dcache_frz_cycles << std::endl 612 << "- DCACHE FOR TLB % = " << (float)m_cpt_tlb_occup_dcache/(m_dcache_ways*m_dcache_sets) << std::endl 613 << "- NB CC BROADCAST = " << m_cpt_cc_broadcast << std::endl 614 << "- NB CC UPDATE DATA = " << m_cpt_cc_update_dcache << std::endl 615 << "- NB CC INVAL DATA = " << m_cpt_cc_inval_dcache << std::endl 616 << "- NB CC INVAL INS = " << m_cpt_cc_inval_icache << std::endl 617 << "- CC BROADCAST COST = " << (float)m_cost_broadcast_frz/m_cpt_cc_broadcast << std::endl 618 << "- CC UPDATE DATA COST = " << (float)m_cost_updt_data_frz/m_cpt_cc_update_dcache << std::endl 619 << "- CC INVAL DATA COST = " << (float)m_cost_inval_data_frz/m_cpt_cc_inval_dcache << std::endl 620 << "- CC INVAL INS COST = " << (float)m_cost_inval_ins_frz/m_cpt_cc_inval_icache << std::endl 621 << "- NB CC CLEANUP DATA = " << m_cpt_cc_cleanup_data << std::endl 622 << "- NB CC CLEANUP INS = " << m_cpt_cc_cleanup_ins << std::endl 623 << "- IMISS TRANSACTION = " << (float)m_cost_imiss_transaction/m_cpt_imiss_transaction << std::endl 624 << "- DMISS TRANSACTION = " << (float)m_cost_dmiss_transaction/m_cpt_dmiss_transaction << std::endl 625 << "- UNC TRANSACTION = " << (float)m_cost_unc_transaction/m_cpt_unc_transaction << std::endl 626 << "- WRITE TRANSACTION = " << (float)m_cost_write_transaction/m_cpt_write_transaction << std::endl 627 << "- NB WRITE TRANSACTION = " << m_cpt_write_transaction << std::endl 628 << "- NB WRITE WORDS VCI = " << m_length_write_transaction << std::endl 629 << "- NB WRITE PROC = " << m_cpt_data_write << std::endl 630 << "- NB WRITE NCC PROC = " << m_cpt_data_write_back << std::endl 631 << "- NB WRITE NCC COHERENCE = " << m_cpt_data_cleanup << std::endl 632 << "- NB CLEANUP DATA DIRTY = " << m_cpt_data_cleanup_dirty*16 << std::endl 633 << "- NB WORDS DIRTY = " << m_cpt_words_dirty << std::endl 634 << "- NB WRITE MISS NCC = " << m_cpt_data_write_miss_ncc << std::endl 635 << "- NB DATA SC = " << m_cpt_data_sc << std::endl 636 << "- WRITE LENGTH = " << (float)m_length_write_transaction/m_cpt_write_transaction << std::endl 637 << "- ITLB MISS TRANSACTION = " << (float)m_cost_itlbmiss_transaction/m_cpt_itlbmiss_transaction << std::endl 638 << "- DTLB MISS TRANSACTION = " << (float)m_cost_dtlbmiss_transaction/m_cpt_dtlbmiss_transaction << std::endl; 609 639 } 610 640 /* 611 641 //////////////////////// 612 642 tmpl(void)::clear_stats() … … 733 763 for (size_t i=0 ; i< m_dcache_ways*m_dcache_sets ; i++) 734 764 { 735 r_dcache_in_tlb[i] = false; 736 r_dcache_contains_ptd[i] = false; 765 // MODIFIED 766 //r_dcache_in_tlb[i] = false; 767 //r_dcache_contains_ptd[i] = false; 768 r_dcache_content_state[i] = LINE_CACHE_DATA_NOT_DIRTY; 769 } 770 for (size_t i=0; i<m_dcache_ways*m_dcache_sets*m_dcache_words; i++) 771 { 772 dirty_stats[i] = false; 737 773 } 738 774 … … 740 776 r_vci_rsp_fifo_icache.init(); 741 777 r_vci_rsp_fifo_dcache.init(); 778 r_cc_send_data_fifo.init(); 742 779 743 780 // ICACHE & DCACHE activated … … 799 836 m_debug_activated = false; 800 837 838 // SPECIAL REGISTERS ODCCP 839 r_dcache_cc_cleanup_updt_data = false; 840 r_dcache_miss_victim_no_coherence = false; 841 r_dcache_line_no_coherence = false; 842 r_dcache_miss_no_coherent = false; 843 r_vci_rsp_read_data_miss_no_coherent = false; 844 r_cc_send_cpt_word = 0; 845 r_dcache_miss_data_cpt = 0; 846 r_dcache_miss_data_addr = 0; 847 801 848 // activity counters 802 m_cpt_dcache_data_read = 0; 803 m_cpt_dcache_data_write = 0; 804 m_cpt_dcache_dir_read = 0; 805 m_cpt_dcache_dir_write = 0; 806 m_cpt_icache_data_read = 0; 807 m_cpt_icache_data_write = 0; 808 m_cpt_icache_dir_read = 0; 809 m_cpt_icache_dir_write = 0; 810 811 m_cpt_frz_cycles = 0; 812 m_cpt_total_cycles = 0; 813 m_cpt_stop_simulation = 0; 814 815 m_cpt_data_miss = 0; 816 m_cpt_ins_miss = 0; 817 m_cpt_unc_read = 0; 818 m_cpt_write_cached = 0; 819 m_cpt_ins_read = 0; 820 821 m_cost_write_frz = 0; 822 m_cost_data_miss_frz = 0; 823 m_cost_unc_read_frz = 0; 824 m_cost_ins_miss_frz = 0; 825 826 m_cpt_imiss_transaction = 0; 827 m_cpt_dmiss_transaction = 0; 828 m_cpt_unc_transaction = 0; 829 m_cpt_write_transaction = 0; 830 m_cpt_icache_unc_transaction = 0; 831 832 m_cost_imiss_transaction = 0; 833 m_cost_dmiss_transaction = 0; 834 m_cost_unc_transaction = 0; 835 m_cost_write_transaction = 0; 836 m_cost_icache_unc_transaction = 0; 837 m_length_write_transaction = 0; 838 839 m_cpt_ins_tlb_read = 0; 840 m_cpt_ins_tlb_miss = 0; 841 m_cpt_ins_tlb_update_acc = 0; 842 843 m_cpt_data_tlb_read = 0; 844 m_cpt_data_tlb_miss = 0; 845 m_cpt_data_tlb_update_acc = 0; 846 m_cpt_data_tlb_update_dirty = 0; 847 m_cpt_ins_tlb_hit_dcache = 0; 848 m_cpt_data_tlb_hit_dcache = 0; 849 m_cpt_ins_tlb_occup_cache = 0; 850 m_cpt_data_tlb_occup_cache = 0; 851 852 m_cost_ins_tlb_miss_frz = 0; 853 m_cost_data_tlb_miss_frz = 0; 854 m_cost_ins_tlb_update_acc_frz = 0; 855 m_cost_data_tlb_update_acc_frz = 0; 856 m_cost_data_tlb_update_dirty_frz = 0; 857 m_cost_ins_tlb_occup_cache_frz = 0; 858 m_cost_data_tlb_occup_cache_frz = 0; 859 860 m_cpt_ins_tlb_inval = 0; 861 m_cpt_data_tlb_inval = 0; 862 m_cost_ins_tlb_inval_frz = 0; 863 m_cost_data_tlb_inval_frz = 0; 864 865 m_cpt_cc_broadcast = 0; 866 867 m_cost_updt_data_frz = 0; 868 m_cost_inval_ins_frz = 0; 869 m_cost_inval_data_frz = 0; 870 m_cost_broadcast_frz = 0; 871 872 m_cpt_cc_cleanup_data = 0; 873 m_cpt_cc_cleanup_ins = 0; 874 875 m_cpt_itlbmiss_transaction = 0; 876 m_cpt_itlb_ll_transaction = 0; 877 m_cpt_itlb_sc_transaction = 0; 878 m_cpt_dtlbmiss_transaction = 0; 879 m_cpt_dtlb_ll_transaction = 0; 880 m_cpt_dtlb_sc_transaction = 0; 881 m_cpt_dtlb_ll_dirty_transaction = 0; 882 m_cpt_dtlb_sc_dirty_transaction = 0; 883 884 m_cost_itlbmiss_transaction = 0; 885 m_cost_itlb_ll_transaction = 0; 886 m_cost_itlb_sc_transaction = 0; 887 m_cost_dtlbmiss_transaction = 0; 888 m_cost_dtlb_ll_transaction = 0; 889 m_cost_dtlb_sc_transaction = 0; 890 m_cost_dtlb_ll_dirty_transaction = 0; 891 m_cost_dtlb_sc_dirty_transaction = 0; 849 m_cpt_dcache_data_read = 0; 850 m_cpt_dcache_data_write = 0; 851 m_cpt_dcache_dir_read = 0; 852 m_cpt_dcache_dir_write = 0; 853 m_cpt_icache_data_read = 0; 854 m_cpt_icache_data_write = 0; 855 m_cpt_icache_dir_read = 0; 856 m_cpt_icache_dir_write = 0; 857 858 m_cpt_frz_cycles = 0; 859 m_cpt_total_cycles = 0; 860 m_cpt_stop_simulation = 0; 861 862 m_cpt_data_miss = 0; 863 m_cpt_data_write = 0; 864 m_cpt_data_sc = 0; 865 m_cpt_data_write_back = 0; 866 m_cpt_data_write_miss_ncc = 0; 867 m_cpt_data_cleanup = 0; 868 m_cpt_data_cleanup_dirty = 0; 869 m_cpt_words_dirty = 0; 870 m_cpt_ins_miss = 0; 871 m_cpt_unc_read = 0; 872 m_cpt_write_cached = 0; 873 m_cpt_ins_read = 0; 874 875 m_cost_write_frz = 0; 876 m_cost_data_miss_frz = 0; 877 m_cost_unc_read_frz = 0; 878 m_cost_ins_miss_frz = 0; 879 880 m_cpt_imiss_transaction = 0; 881 m_cpt_dmiss_transaction = 0; 882 m_cpt_unc_transaction = 0; 883 m_cpt_write_transaction = 0; 884 m_cpt_icache_unc_transaction = 0; 885 886 m_cost_imiss_transaction = 0; 887 m_cost_dmiss_transaction = 0; 888 m_cost_unc_transaction = 0; 889 m_cost_write_transaction = 0; 890 m_cost_icache_unc_transaction = 0; 891 m_length_write_transaction = 0; 892 893 m_cpt_ins_tlb_read = 0; 894 m_cpt_ins_tlb_miss = 0; 895 m_cpt_ins_tlb_update_acc = 0; 896 897 m_cpt_data_tlb_read = 0; 898 m_cpt_data_tlb_miss = 0; 899 m_cpt_data_tlb_update_acc = 0; 900 m_cpt_data_tlb_update_dirty = 0; 901 m_cpt_ins_tlb_hit_dcache = 0; 902 m_cpt_data_tlb_hit_dcache = 0; 903 m_cpt_ins_tlb_occup_cache = 0; 904 m_cpt_data_tlb_occup_cache = 0; 905 906 m_cost_ins_tlb_miss_frz = 0; 907 m_cost_data_tlb_miss_frz = 0; 908 m_cost_ins_tlb_update_acc_frz = 0; 909 m_cost_data_tlb_update_acc_frz = 0; 910 m_cost_data_tlb_update_dirty_frz = 0; 911 m_cost_ins_tlb_occup_cache_frz = 0; 912 m_cost_data_tlb_occup_cache_frz = 0; 913 914 m_cpt_ins_tlb_inval = 0; 915 m_cpt_data_tlb_inval = 0; 916 m_cost_ins_tlb_inval_frz = 0; 917 m_cost_data_tlb_inval_frz = 0; 918 919 m_cpt_cc_broadcast = 0; 920 921 m_cost_updt_data_frz = 0; 922 m_cost_inval_ins_frz = 0; 923 m_cost_inval_data_frz = 0; 924 m_cost_broadcast_frz = 0; 925 926 m_cpt_cc_cleanup_data = 0; 927 m_cpt_cc_cleanup_ins = 0; 928 929 m_cpt_itlbmiss_transaction = 0; 930 m_cpt_itlb_ll_transaction = 0; 931 m_cpt_itlb_sc_transaction = 0; 932 m_cpt_dtlbmiss_transaction = 0; 933 m_cpt_dtlb_ll_transaction = 0; 934 m_cpt_dtlb_sc_transaction = 0; 935 m_cpt_dtlb_ll_dirty_transaction = 0; 936 m_cpt_dtlb_sc_dirty_transaction = 0; 937 938 m_cost_itlbmiss_transaction = 0; 939 m_cost_itlb_ll_transaction = 0; 940 m_cost_itlb_sc_transaction = 0; 941 m_cost_dtlbmiss_transaction = 0; 942 m_cost_dtlb_ll_transaction = 0; 943 m_cost_dtlb_sc_transaction = 0; 944 m_cost_dtlb_ll_dirty_transaction = 0; 945 m_cost_dtlb_sc_dirty_transaction = 0; 892 946 /* 893 947 m_cpt_dcache_frz_cycles = 0; … … 910 964 return; 911 965 } 966 /*ODDCP*/ 967 968 /*std::cout << "r_dcache_cc_send_req = " << r_dcache_cc_send_req.read() << std::endl; 969 std::cout << "r_icache_cc_send_req = " << r_icache_cc_send_req.read() << std::endl;*/ 912 970 913 971 // Response FIFOs default values … … 919 977 bool vci_rsp_fifo_dcache_put = false; 920 978 uint32_t vci_rsp_fifo_dcache_data = 0; 979 980 // FIFO for cleanup data updt 981 bool cleanup_data_updt_fifo_dcache_get = false; 982 bool cleanup_data_updt_fifo_dcache_put = false; 983 uint32_t cleanup_data_updt_fifo_dcache_data = 0; 921 984 922 985 // updt fifo … … 928 991 929 992 #ifdef INSTRUMENTATION 930 m_cpt_fsm_dcache [r_dcache_fsm.read()] ++;931 m_cpt_fsm_icache [r_icache_fsm.read()] ++;932 m_cpt_fsm_cmd [r_vci_cmd_fsm.read()] ++;933 m_cpt_fsm_rsp [r_vci_rsp_fsm.read()] ++;934 m_cpt_fsm_ tgt [r_tgt_fsm.read()] ++;935 m_cpt_fsm_c leanup [r_cleanup_cmd_fsm.read()] ++;993 m_cpt_fsm_dcache [r_dcache_fsm.read() ] ++; 994 m_cpt_fsm_icache [r_icache_fsm.read() ] ++; 995 m_cpt_fsm_cmd [r_vci_cmd_fsm.read() ] ++; 996 m_cpt_fsm_rsp [r_vci_rsp_fsm.read() ] ++; 997 m_cpt_fsm_cc_send [r_cc_send_fsm.read() ] ++; 998 m_cpt_fsm_cc_receive [r_cc_receive_fsm.read()] ++; 936 999 #endif 937 1000 … … 1015 1078 { 1016 1079 // coherence interrupt 1017 if ( r_cc_receive_icache_req.read() 1080 if ( r_cc_receive_icache_req.read()) 1018 1081 { 1019 1082 r_icache_fsm = ICACHE_CC_CHECK; … … 1084 1147 1085 1148 // We register processor request 1149 ///*ODCCP*/ std::cout << "DEBUG IREQ.ADDR = " << std::hex << m_ireq.addr << std::dec << " | on " << name() << std::endl; 1086 1150 r_icache_vaddr_save = m_ireq.addr; 1087 1151 … … 1091 1155 1092 1156 #ifdef INSTRUMENTATION 1093 m_cpt_i tlb_read++;1157 m_cpt_ins_tlb_read++; 1094 1158 #endif 1095 1159 tlb_hit = r_itlb.translate( m_ireq.addr, … … 1166 1230 1167 1231 #ifdef INSTRUMENTATION 1168 m_cpt_i tlb_miss++;1232 m_cpt_ins_tlb_miss++; 1169 1233 #endif 1170 1234 r_icache_fsm = ICACHE_TLB_WAIT; … … 1184 1248 1185 1249 #ifdef INSTRUMENTATION 1186 m_cpt_i cache_miss++;1250 m_cpt_ins_miss++; 1187 1251 #endif 1188 1252 // we request a VCI transaction … … 1309 1373 &state ); 1310 1374 1311 if ( state == CACHE_SLOT_STATE_VALID ) // inval required1375 if ( state == CACHE_SLOT_STATE_VALID_CC ) // inval required 1312 1376 { 1313 1377 // request cleanup … … 1390 1454 1391 1455 #ifdef INSTRUMENTATION 1392 m_cpt_i tlb_read++;1456 m_cpt_ins_tlb_read++; 1393 1457 #endif 1394 1458 hit = r_itlb.translate(r_dcache_save_wdata.read(), … … 1410 1474 1411 1475 #ifdef INSTRUMENTATION 1412 m_cpt_i tlb_miss++;1476 m_cpt_ins_tlb_miss++; 1413 1477 #endif 1414 1478 r_icache_tlb_miss_req = true; … … 1437 1501 &word); 1438 1502 1439 if ( state == CACHE_SLOT_STATE_VALID ) // inval to be done1503 if ( state == CACHE_SLOT_STATE_VALID_CC ) // inval to be done 1440 1504 { 1441 1505 r_icache_miss_way = way; … … 1696 1760 r_icache_miss_way.read(), 1697 1761 r_icache_miss_set.read(), 1698 CACHE_SLOT_STATE_VALID );1762 CACHE_SLOT_STATE_VALID_CC ); 1699 1763 #if DEBUG_ICACHE 1700 1764 if ( m_debug_activated ) … … 1840 1904 r_icache_cc_set = set; 1841 1905 1842 if ( state == CACHE_SLOT_STATE_VALID ) // hit1906 if ( state == CACHE_SLOT_STATE_VALID_CC) // hit 1843 1907 { 1844 1908 // need to update the cache state … … 1885 1949 { 1886 1950 std::cout << " <PROC " << name() 1887 << " ICACHE_ CC_INVAL> slot returns to empty state"1951 << " ICACHE_//CC_INVAL> slot returns to empty state" 1888 1952 << " set = " << r_icache_cc_set.read() 1889 1953 << " / way = " << r_icache_cc_way.read() << std::endl; … … 1894 1958 m_cpt_icache_dir_read++; 1895 1959 #endif 1896 if (r_icache_cc_need_write.read()) 1897 {1898 r_icache.write_dir( 0,1899 r_icache_cc_way.read(),1900 r_icache_cc_set.read(),1901 CACHE_SLOT_STATE_EMPTY );1902 // no need to write in the cache anymore1903 r_icache_cc_need_write = false;1904 }1905 1960 1961 if (r_icache_cc_need_write.read()) 1962 { 1963 r_icache.write_dir( 0, 1964 r_icache_cc_way.read(), 1965 r_icache_cc_set.read(), 1966 CACHE_SLOT_STATE_EMPTY ); 1967 // no need to write in the cache anymore 1968 r_icache_cc_need_write = false; 1969 } 1906 1970 // multicast acknowledgement 1907 1971 // send a request to cc_send_fsm … … 2001 2065 m_cpt_icache_dir_write++; 2002 2066 #endif 2003 2004 2067 if (r_icache_cc_need_write.read()) 2068 { 2005 2069 r_icache.write_dir( r_icache_cc_way.read(), 2006 2070 r_icache_cc_set.read(), 2007 2071 CACHE_SLOT_STATE_ZOMBI ); 2008 // no need to write in the cache anymore2072 // no need to write in the cache anymore 2009 2073 r_icache_cc_need_write = false; 2010 2074 } … … 2174 2238 &tlb_set ); 2175 2239 #ifdef INSTRUMENTATION 2176 m_cpt_d tlb_read++;2240 m_cpt_data_tlb_read++; 2177 2241 #endif 2178 2242 } … … 2239 2303 size_t way = r_dcache_save_cache_way.read(); 2240 2304 size_t set = r_dcache_save_cache_set.read(); 2241 2242 if ( r_dcache_in_tlb[way*m_dcache_sets+set] ) 2305 if ( r_dcache_content_state[way*m_dcache_sets+set] == LINE_CACHE_IN_TLB ) 2243 2306 { 2244 2307 tlb_inval_required = true; … … 2246 2309 r_dcache_tlb_inval_line = r_dcache_save_paddr.read()>> 2247 2310 (uint32_log2(m_dcache_words<<2)); 2248 r_dcache_in_tlb[way*m_dcache_sets+set] = false;2249 } 2250 else if ( r_dcache_cont ains_ptd[way*m_dcache_sets+set])2311 r_dcache_content_state[way*m_dcache_sets+set] = LINE_CACHE_DATA_NOT_DIRTY; 2312 } 2313 else if ( r_dcache_content_state[way*m_dcache_sets+set] == LINE_CACHE_CONTAINS_PTD ) 2251 2314 { 2252 2315 r_itlb.reset(); 2253 2316 r_dtlb.reset(); 2254 r_dcache_contains_ptd[way*m_dcache_sets+set] = false;2317 r_dcache_content_state[way*m_dcache_sets+set] = LINE_CACHE_DATA_NOT_DIRTY; 2255 2318 } 2256 2319 … … 2283 2346 r_dcache_save_wdata.read(), 2284 2347 r_dcache_save_cacheable.read() ); 2285 #ifdef INSTRUMENTATION2348 /*#ifdef INSTRUMENTATION 2286 2349 m_cpt_wbuf_write++; 2287 #endif 2350 #endif*/ 2288 2351 if ( not wok ) // miss if write buffer full 2289 2352 { … … 2588 2651 if ( not (r_mmu_mode.read() & DATA_CACHE_MASK) ) cacheable = false; 2589 2652 else cacheable = tlb_flags.c; 2590 2591 2653 // access rights checking 2592 2654 if ( not tlb_flags.u and (m_dreq.mode == iss_t::MODE_USER)) … … 2658 2720 { 2659 2721 #ifdef INSTRUMENTATION 2660 m_cpt_dcache_miss++; 2661 #endif 2662 // request a VCI DMISS transaction 2722 m_cpt_data_miss++; 2723 #endif 2663 2724 r_dcache_vci_paddr = paddr; 2664 2725 r_dcache_vci_miss_req = true; 2665 2726 r_dcache_miss_type = PROC_MISS; 2666 2727 r_dcache_fsm = DCACHE_MISS_SELECT; 2728 2729 /*ODCCP*/ // if tlb's flag cc egal 0 that means line is no coherent 2730 bool ncc = ((tlb_flags.cc == 0) and (r_mmu_mode.read() & DATA_TLB_MASK)); 2731 2732 if(ncc) 2733 { 2734 r_dcache_miss_no_coherent = true; 2667 2735 #if DEBUG_DCACHE 2668 2736 if ( m_debug_activated ) 2669 2737 std::cout << " <PROC " << name() << " DCACHE_IDLE>" 2670 << " READ MISS in dcache"2738 << " READ MISS NCC in dcache" 2671 2739 << " / PADDR = " << std::hex << paddr << std::endl; 2672 2740 #endif 2741 } 2742 else 2743 { 2744 r_dcache_miss_no_coherent = false; 2745 #if DEBUG_DCACHE 2746 if ( m_debug_activated ) 2747 std::cout << " <PROC " << name() << " DCACHE_IDLE>" 2748 << " READ MISS CC in dcache" 2749 << " / PADDR = " << std::hex << paddr << std::endl; 2750 #endif 2751 } 2673 2752 } 2674 2753 else if (cache_state == CACHE_SLOT_STATE_ZOMBI ) // pending cleanup … … 2765 2844 m_cpt_data_write++; 2766 2845 #endif 2846 // check if line is ncc or cc. 2847 bool ncc = ((tlb_flags.cc == 0) and (r_mmu_mode.read() & DATA_TLB_MASK)); 2848 2767 2849 // cleaning llsc buffer if address matching 2768 2850 if ( paddr == r_dcache_llsc_paddr.read() ) … … 2770 2852 2771 2853 // response to processor 2772 m_drsp.valid = true;2773 2774 2854 // activating P1 stage 2775 wbuf_request = true; 2776 updt_request = (cache_state == CACHE_SLOT_STATE_VALID); 2855 if( (cache_state != CACHE_SLOT_STATE_ZOMBI) && (cache_state != CACHE_SLOT_STATE_EMPTY) && (cacheable) ) 2856 { 2857 m_drsp.valid = true; 2858 2859 /*ODCCP*/ // if ncc we write locally the new data 2860 if (ncc) 2861 { 2862 #if DEBUG_DCACHE 2863 if ( m_debug_activated ) 2864 { 2865 std::cout << " <PROC " << name() 2866 << " DCACHE_IDLE> WRITE HIT NCC in dcache" 2867 << " : PADDR = " << std::hex << paddr << std::endl; 2868 } 2869 #endif 2870 m_cpt_data_write_back++; 2871 wbuf_request = false; 2872 r_dcache_content_state[cache_way*m_dcache_sets+cache_set] = LINE_CACHE_DATA_DIRTY; 2873 2874 /*STATS DIRTY*/ 2875 dirty_stats[(cache_way * m_dcache_sets + cache_set) * m_dcache_words + cache_word] = true; 2876 2877 updt_request = (cache_state == CACHE_SLOT_STATE_VALID_NCC) or (cache_state == CACHE_SLOT_STATE_VALID_CC); 2878 2879 } 2880 else 2881 { 2882 assert((cache_state != CACHE_SLOT_STATE_VALID_NCC) and "ODCCP/RWT : IMPOSSIBLE STATE NCC HERE !"); 2883 wbuf_request = true; 2884 updt_request = (cache_state == CACHE_SLOT_STATE_VALID_CC)or(cache_state == CACHE_SLOT_STATE_VALID_NCC); 2885 } 2886 } 2887 /*ODCCP We stall proc when Write NCC on line ZOMBI until line becomes not ZOMBI*/ 2888 else if( (cache_state == CACHE_SLOT_STATE_ZOMBI) && (ncc) && (cacheable) ) 2889 { 2890 #if DEBUG_DCACHE 2891 if ( m_debug_activated ) 2892 { 2893 std::cout << " <PROC " << name() 2894 << " DCACHE_IDLE> WRITE NCC on ZOMBI line in dcache" 2895 << " : PADDR = " << std::hex << paddr << std::endl; 2896 } 2897 #endif 2898 m_drsp.valid = false; 2899 r_dcache_fsm = DCACHE_IDLE; 2900 } 2901 #if FETCH_ON_WRITE_ENABLE 2902 /*ODCCP*/ // IF Fetch-on-Write is enabled, when a write NCC miss cache L1 fetch the missing line before writting it. 2903 else if( (cache_state == CACHE_SLOT_STATE_EMPTY) && (ncc) && (cacheable) ) 2904 { 2905 #if DEBUG_DCACHE 2906 if ( m_debug_activated ) 2907 { 2908 std::cout << " <PROC " << name() 2909 << " DCACHE_IDLE> WRITE MISS NCC in dcache" 2910 << " : PADDR = " << std::hex << paddr << std::endl; 2911 } 2912 #endif 2913 // request a VCI DMISS transaction 2914 r_dcache_vci_paddr = paddr; 2915 r_dcache_vci_miss_req = true; 2916 r_dcache_miss_type = PROC_MISS; 2917 r_dcache_fsm = DCACHE_MISS_SELECT; 2918 m_cpt_data_write_miss_ncc++; 2919 r_dcache_miss_no_coherent = true; 2920 } 2921 #endif 2922 else 2923 { 2924 m_drsp.valid = true; 2925 wbuf_request = true; 2926 updt_request = (cache_state == CACHE_SLOT_STATE_VALID_CC)or(cache_state == CACHE_SLOT_STATE_VALID_NCC); 2927 } 2777 2928 } 2778 2929 } // end WRITE … … 2867 3018 bool bypass; 2868 3019 paddr_t pte_paddr; 3020 3021 //r_dcache.printTrace(); 2869 3022 2870 3023 // evaluate bypass in order to skip first level page table access … … 2877 3030 bypass = r_dtlb.get_bypass(r_dcache_tlb_vaddr.read(), &ptba); 2878 3031 } 2879 3032 3033 2880 3034 if ( not bypass ) // Try to read PTE1/PTD1 in dcache 2881 3035 { 2882 3036 pte_paddr = (((paddr_t)r_mmu_ptpr.read()) << (INDEX1_NBITS+2)) | 2883 3037 ((((paddr_t)r_dcache_tlb_vaddr.read()) >> PAGE_M_NBITS) << 2); 2884 3038 r_dcache_tlb_paddr = pte_paddr; 2885 3039 r_dcache_fsm = DCACHE_TLB_PTE1_GET; … … 2888 3042 { 2889 3043 pte_paddr = (paddr_t)ptba << PAGE_K_NBITS | 2890 3044 (paddr_t)(r_dcache_tlb_vaddr.read()&PTD_ID2_MASK)>>(PAGE_K_NBITS-3); 2891 3045 r_dcache_tlb_paddr = pte_paddr; 2892 3046 r_dcache_fsm = DCACHE_TLB_PTE2_GET; … … 2903 3057 << " / ptpr = " << (((paddr_t)r_mmu_ptpr.read()) << (INDEX1_NBITS+2)) 2904 3058 << " / BYPASS = " << bypass 3059 << " / PTBA = " << ptba 2905 3060 << " / PTE_ADR = " << pte_paddr << std::endl; 2906 3061 } … … 2935 3090 m_cpt_dcache_dir_read++; 2936 3091 #endif 2937 if ( cache_state == CACHE_SLOT_STATE_VALID ) // hit in dcache 3092 /*ODCCP*/ 3093 assert((cache_state != CACHE_SLOT_STATE_VALID_NCC) and "DCACHE_TLB_PTE1_GET : IMPOSSIBLE NCC HERE"); 3094 if ( cache_state == CACHE_SLOT_STATE_VALID_CC ) // hit in dcache 2938 3095 { 2939 3096 if ( not (entry & PTE_V_MASK) ) // unmapped … … 2972 3129 { 2973 3130 // mark the cache line ac containing a PTD 2974 r_dcache_cont ains_ptd[m_dcache_sets*way+set] = true;3131 r_dcache_content_state[way*m_dcache_sets+set] = LINE_CACHE_CONTAINS_PTD; 2975 3132 2976 3133 // register bypass … … 3007 3164 else // PTE1 : we must update the TLB 3008 3165 { 3009 r_dcache_ in_tlb[m_icache_sets*way+set] = true;3166 r_dcache_content_state[m_icache_sets*way+set] = LINE_CACHE_IN_TLB; 3010 3167 r_dcache_tlb_pte_flags = entry; 3011 3168 r_dcache_tlb_cache_way = way; … … 3065 3222 &set ); 3066 3223 #ifdef INSTRUMENTATION 3067 m_cpt_i tlb_read++;3224 m_cpt_ins_tlb_read++; 3068 3225 #endif 3069 3226 } … … 3075 3232 &set ); 3076 3233 #ifdef INSTRUMENTATION 3077 m_cpt_d tlb_read++;3234 m_cpt_data_tlb_read++; 3078 3235 #endif 3079 3236 } … … 3151 3308 nline ); 3152 3309 #ifdef INSTRUMENTATION 3153 m_cpt_i tlb_write++;3310 m_cpt_ins_tlb_update_acc++; 3154 3311 #endif 3155 3312 … … 3175 3332 nline ); 3176 3333 #ifdef INSTRUMENTATION 3177 m_cpt_d tlb_write++;3334 m_cpt_data_tlb_update_acc++; 3178 3335 #endif 3179 3336 … … 3218 3375 3219 3376 uint32_t pte_flags; 3220 uint32_t pte_ppn ;3377 uint32_t pte_ppn=0; 3221 3378 size_t way; 3222 3379 size_t set; … … 3235 3392 m_cpt_dcache_dir_read++; 3236 3393 #endif 3237 if ( cache_state == CACHE_SLOT_STATE_VALID ) // hit in dcache 3394 /*ODCCP*/ 3395 assert((cache_state != CACHE_SLOT_STATE_VALID_NCC) and "DCACHE_TLB_PTE2_GET : IMPOSSIBLE NCC HERE"); 3396 if (cache_state == CACHE_SLOT_STATE_VALID_CC) // hit in dcache 3238 3397 { 3239 3398 if ( not (pte_flags & PTE_V_MASK) ) // unmapped … … 3267 3426 else // mapped : we must update the TLB 3268 3427 { 3269 r_dcache_ in_tlb[m_dcache_sets*way+set] = true;3428 r_dcache_content_state[m_dcache_sets*way+set] = LINE_CACHE_IN_TLB; 3270 3429 r_dcache_tlb_pte_flags = pte_flags; 3271 3430 r_dcache_tlb_pte_ppn = pte_ppn; … … 3332 3491 &set ); 3333 3492 #ifdef INSTRUMENTATION 3334 m_cpt_i tlb_read++;3493 m_cpt_ins_tlb_read++; 3335 3494 #endif 3336 3495 } … … 3342 3501 &set ); 3343 3502 #ifdef INSTRUMENTATION 3344 m_cpt_d tlb_read++;3503 m_cpt_data_tlb_read++; 3345 3504 #endif 3346 3505 } … … 3419 3578 nline ); 3420 3579 #ifdef INSTRUMENTATION 3421 m_cpt_i tlb_write++;3580 m_cpt_ins_tlb_update_acc++; 3422 3581 #endif 3423 3582 … … 3443 3602 nline ); 3444 3603 #ifdef INSTRUMENTATION 3445 m_cpt_d tlb_write++;3604 m_cpt_data_tlb_update_acc++; 3446 3605 #endif 3447 3606 … … 3656 3815 &state ); 3657 3816 3658 if ( state == CACHE_SLOT_STATE_VALID ) // inval required3817 if ( state == CACHE_SLOT_STATE_VALID_CC ) // inval required 3659 3818 { 3660 3819 // request cleanup … … 3667 3826 r_dcache_miss_way = way; 3668 3827 r_dcache_miss_set = set; 3828 r_dcache_cleanup_ncc = false; 3829 r_dcache_cc_cleanup_updt_data = false; 3669 3830 r_dcache_fsm = DCACHE_XTN_DC_FLUSH_GO; 3831 } 3832 else if ( state == CACHE_SLOT_STATE_VALID_NCC ) 3833 { 3834 // request cleanup 3835 r_dcache_cc_send_req = true; 3836 r_dcache_cc_send_nline = tag * m_dcache_sets + set; 3837 r_dcache_cc_send_way = way; 3838 r_dcache_cc_send_type = CC_TYPE_CLEANUP; 3839 3840 // goes to DCACHE_XTN_DC_FLUSH_GO to inval directory 3841 r_dcache_miss_way = way; 3842 r_dcache_miss_set = set; 3843 r_dcache_cleanup_ncc = true; 3844 3845 if (r_dcache_content_state[m_dcache_sets*way+set] == LINE_CACHE_DATA_NOT_DIRTY) 3846 { 3847 r_dcache_cc_cleanup_updt_data = false; 3848 r_dcache_fsm = DCACHE_XTN_DC_FLUSH_GO; 3849 } 3850 else // if line is dirty we save the data values for send into cleanup data 3851 { 3852 r_dcache_xtn_flush_addr_data = (tag * m_dcache_sets + set) * m_dcache_words * 4; 3853 r_dcache_xtn_flush_data_cpt = 0; 3854 r_dcache_cc_cleanup_updt_data = true; 3855 r_dcache_fsm = DCACHE_XTN_DC_FLUSH_DATA; 3856 3857 /*STATS DIRTY*/ 3858 for (size_t w = 0; w < m_dcache_words; w++) 3859 { 3860 if(dirty_stats[(way * m_dcache_sets + set) * m_dcache_words + w] == true) 3861 m_cpt_words_dirty++; 3862 } 3863 } 3670 3864 } 3671 3865 else if ( r_dcache_flush_count.read() == … … 3685 3879 } 3686 3880 //////////////////////////// 3881 case DCACHE_XTN_DC_FLUSH_DATA: /*ODCCP*/ // In this state we save data values into cc_send_data_fifo for 3882 // send cleanup with data 3883 { 3884 uint32_t rdata; 3885 size_t way; 3886 size_t set; 3887 size_t word; 3888 r_dcache.read_neutral(r_dcache_xtn_flush_addr_data.read(), 3889 &rdata, 3890 &way, 3891 &set, 3892 &word); 3893 if(r_cc_send_data_fifo.wok()) 3894 { 3895 r_dcache_xtn_flush_addr_data = r_dcache_xtn_flush_addr_data.read() + 4; 3896 3897 cleanup_data_updt_fifo_dcache_get = false; 3898 cleanup_data_updt_fifo_dcache_put = true; 3899 cleanup_data_updt_fifo_dcache_data = rdata; 3900 3901 r_dcache_xtn_flush_data_cpt = r_dcache_xtn_flush_data_cpt + 1; 3902 if(r_dcache_xtn_flush_data_cpt.read() == (m_dcache_words - 1)) 3903 { 3904 r_dcache_xtn_flush_data_cpt = 0; 3905 r_dcache_fsm = DCACHE_XTN_DC_FLUSH_GO; 3906 } 3907 } 3908 break; 3909 3910 } 3911 //////////////////////////// 3687 3912 case DCACHE_XTN_DC_FLUSH_GO: // Switch the cache slot to ZOMBI state 3688 3913 // and reset directory extension. … … 3692 3917 size_t set = r_dcache_miss_set.read(); 3693 3918 3694 r_dcache_in_tlb[m_dcache_sets*way+set] = false; 3695 r_dcache_contains_ptd[m_dcache_sets*way+set] = false; 3919 r_dcache_content_state[m_dcache_sets*way+set] = LINE_CACHE_DATA_NOT_DIRTY; 3696 3920 3697 3921 #ifdef INSTRUMENTATION … … 3736 3960 3737 3961 #ifdef INSTRUMENTATION 3738 m_cpt_d tlb_read++;3962 m_cpt_data_tlb_read++; 3739 3963 #endif 3740 3964 hit = r_dtlb.translate( r_dcache_save_wdata.read(), … … 3756 3980 3757 3981 #ifdef INSTRUMENTATION 3758 m_cpt_d tlb_miss++;3982 m_cpt_data_tlb_miss++; 3759 3983 #endif 3760 3984 r_dcache_tlb_ins = false; // dtlb … … 3793 4017 &set, 3794 4018 &word ); 3795 3796 if ( state == CACHE_SLOT_STATE_VALID ) // inval to be done 3797 { 3798 r_dcache_xtn_way = way; 3799 r_dcache_xtn_set = set; 3800 r_dcache_fsm = DCACHE_XTN_DC_INVAL_GO; 4019 /*ODCCP*/ 4020 if ((state == CACHE_SLOT_STATE_VALID_CC) or (state == CACHE_SLOT_STATE_VALID_NCC)) // inval to be done 4021 { 4022 r_dcache_xtn_way = way; 4023 r_dcache_xtn_set = set; 4024 r_dcache_xtn_state = state; 4025 r_dcache_xtn_data_addr = r_dcache_save_paddr.read()&~0x3F; 4026 r_dcache_fsm = DCACHE_XTN_DC_INVAL_GO; 4027 3801 4028 } 3802 4029 else // miss : nothing to do … … 3812 4039 << " DCACHE_XTN_DC_INVAL_PA> Test hit in dcache" << std::hex 3813 4040 << " / PADDR = " << r_dcache_save_paddr.read() << std::dec 3814 << " / HIT = " << ( state == CACHE_SLOT_STATE_VALID)4041 << " / HIT = " << ((state == CACHE_SLOT_STATE_VALID_CC) or (state == CACHE_SLOT_STATE_VALID_NCC)) 3815 4042 << " / SET = " << set 3816 4043 << " / WAY = " << way << std::endl; 4044 //r_dcache.printTrace(); 3817 4045 } 3818 4046 #endif … … 3826 4054 if ( not r_dcache_cc_send_req.read() ) // blocked until previous cc_send request is sent 3827 4055 { 4056 int state = r_dcache_xtn_state.read(); 3828 4057 size_t way = r_dcache_xtn_way.read(); 3829 4058 size_t set = r_dcache_xtn_set.read(); … … 3833 4062 m_cpt_dcache_dir_write++; 3834 4063 #endif 3835 r_dcache.write_dir( way, 3836 set, 3837 CACHE_SLOT_STATE_ZOMBI ); 4064 if(state == CACHE_SLOT_STATE_VALID_CC) 4065 { 4066 r_dcache.write_dir( way, 4067 set, 4068 CACHE_SLOT_STATE_ZOMBI ); 4069 } 3838 4070 3839 4071 // request cleanup … … 3842 4074 r_dcache_cc_send_way = way; 3843 4075 r_dcache_cc_send_type = CC_TYPE_CLEANUP; 4076 r_dcache_cleanup_ncc = false; 4077 4078 /*ODCCP*/ 4079 if( (state == CACHE_SLOT_STATE_VALID_NCC) /*and (r_dcache_content_state[way*m_dcache_sets+set] == LINE_CACHE_DATA_DIRTY)*/ ) 4080 { 4081 r_dcache_cleanup_ncc = true; 4082 /*ODCCP*/ // If line is dirty we read data values for send cleanup with data 4083 if (r_dcache_content_state[way*m_dcache_sets+set] == LINE_CACHE_DATA_DIRTY) 4084 { 4085 r_dcache_cc_cleanup_updt_data = true; 4086 r_dcache_fsm = DCACHE_XTN_DC_INVAL_DATA; 4087 m_cpt_data_cleanup_dirty ++; 4088 4089 /*STATS DIRTY*/ 4090 for (size_t w = 0; w < m_dcache_words; w++) 4091 { 4092 if(dirty_stats[(way * m_dcache_sets + set) * m_dcache_words + w] == true) 4093 m_cpt_words_dirty++; 4094 } 4095 } 4096 else 4097 { 4098 r_dcache.write_dir( way, 4099 set, 4100 CACHE_SLOT_STATE_ZOMBI ); 4101 r_dcache_cc_cleanup_updt_data = false; 4102 r_dcache_fsm = DCACHE_IDLE; 4103 m_drsp.valid = true; 4104 } 4105 } 3844 4106 3845 4107 // possible itlb & dtlb invalidate 3846 if ( r_dcache_in_tlb[way*m_dcache_sets+set])4108 else if ( r_dcache_content_state[way*m_dcache_sets+set] == LINE_CACHE_IN_TLB ) 3847 4109 { 3848 4110 r_dcache_tlb_inval_line = nline; … … 3850 4112 r_dcache_fsm_scan_save = DCACHE_XTN_DC_INVAL_END; 3851 4113 r_dcache_fsm = DCACHE_INVAL_TLB_SCAN; 3852 r_dcache_ in_tlb[way*m_dcache_sets+set] = false;3853 } 3854 else if ( r_dcache_cont ains_ptd[way*m_dcache_sets+set])4114 r_dcache_content_state[way*m_dcache_sets+set] = LINE_CACHE_DATA_NOT_DIRTY; 4115 } 4116 else if ( r_dcache_content_state[way*m_dcache_sets+set] == LINE_CACHE_CONTAINS_PTD) 3855 4117 { 3856 4118 r_itlb.reset(); 3857 4119 r_dtlb.reset(); 3858 r_dcache_cont ains_ptd[way*m_dcache_sets+set] = false;4120 r_dcache_content_state[way*m_dcache_sets+set] = LINE_CACHE_DATA_NOT_DIRTY; 3859 4121 r_dcache_fsm = DCACHE_IDLE; 3860 4122 m_drsp.valid = true; … … 3877 4139 break; 3878 4140 } 4141 4142 /*ODCCP*/ 4143 ////////////////////////////// 4144 case DCACHE_XTN_DC_INVAL_DATA: 4145 { 4146 4147 uint32_t rdata; 4148 size_t way; 4149 size_t set; 4150 size_t word; 4151 r_dcache.read_neutral(r_dcache_xtn_data_addr.read(), 4152 &rdata, 4153 &way, 4154 &set, 4155 &word); 4156 if(r_cc_send_data_fifo.wok()) 4157 { 4158 r_dcache_xtn_data_addr = r_dcache_xtn_data_addr.read() + 4; 4159 4160 cleanup_data_updt_fifo_dcache_get = false; 4161 cleanup_data_updt_fifo_dcache_put = true; 4162 cleanup_data_updt_fifo_dcache_data = rdata; 4163 4164 r_dcache_xtn_data_cpt = r_dcache_xtn_data_cpt.read() + 1; 4165 /*ODCCP*/ // after read the last word we set the line as ZOMBI 4166 if(r_dcache_xtn_data_cpt.read() == (m_dcache_words - 1)) 4167 { 4168 r_dcache_xtn_data_cpt = 0; 4169 r_dcache_fsm = DCACHE_IDLE; 4170 r_dcache.write_dir( way, 4171 set, 4172 CACHE_SLOT_STATE_ZOMBI ); 4173 m_drsp.valid = true; 4174 } 4175 } 4176 break; 4177 } 4178 3879 4179 ////////////////////////////// 3880 4180 case DCACHE_XTN_DC_INVAL_END: // send response to processor XTN request … … 3909 4209 size_t set = 0; 3910 4210 paddr_t victim = 0; 4211 int state; 3911 4212 3912 4213 #ifdef INSTRUMENTATION … … 3919 4220 &found, 3920 4221 &cleanup ); 3921 4222 state = r_dcache.get_cache_state(way,set); 3922 4223 if ( found ) 3923 4224 { … … 3934 4235 r_dcache_cc_send_way = way; 3935 4236 r_dcache_cc_send_type = CC_TYPE_CLEANUP; 4237 4238 if( (state == CACHE_SLOT_STATE_VALID_NCC) ) 4239 { 4240 r_dcache_cleanup_ncc = true; 4241 4242 /*ODCCP*/ // if line is dirty we must save the data values 4243 if (r_dcache_content_state[way*m_dcache_sets+set] == LINE_CACHE_DATA_DIRTY) 4244 { 4245 r_dcache_cc_cleanup_updt_data = true; 4246 r_dcache_miss_data_addr = (victim*m_dcache_words)*4; 4247 r_dcache_fsm = DCACHE_MISS_DATA; 4248 m_cpt_data_cleanup_dirty ++; 4249 4250 /*STATS DIRTY*/ 4251 for (size_t w = 0; w < m_dcache_words; w++) 4252 { 4253 if(dirty_stats[(way * m_dcache_sets + set) * m_dcache_words + w] == true) 4254 m_cpt_words_dirty++; 4255 } 4256 } 4257 else 4258 { 4259 r_dcache_cc_cleanup_updt_data = false; 4260 } 4261 } 4262 else 4263 { 4264 r_dcache_cc_cleanup_updt_data = false; 4265 r_dcache_cleanup_ncc = false; 4266 } 3936 4267 } 3937 4268 else … … 3957 4288 } 3958 4289 /////////////////////// 4290 case DCACHE_MISS_DATA: 4291 { 4292 uint32_t rdata; 4293 size_t way; 4294 size_t set; 4295 size_t word; 4296 4297 r_dcache.read_neutral(r_dcache_miss_data_addr, 4298 &rdata, 4299 &way, 4300 &set, 4301 &word); 4302 if(r_cc_send_data_fifo.wok()) 4303 { 4304 r_dcache_miss_data_addr = r_dcache_miss_data_addr.read() + 4; 4305 4306 cleanup_data_updt_fifo_dcache_get = false; 4307 cleanup_data_updt_fifo_dcache_put = true; 4308 cleanup_data_updt_fifo_dcache_data = rdata; 4309 4310 r_dcache_miss_data_cpt = r_dcache_miss_data_cpt.read() + 1; 4311 if (r_dcache_miss_data_cpt.read() == m_dcache_words-1 ) 4312 { 4313 r_dcache_miss_data_cpt = 0; 4314 r_dcache_fsm = DCACHE_MISS_CLEAN; 4315 } 4316 } 4317 break; 4318 } 4319 /////////////////////// 3959 4320 case DCACHE_MISS_CLEAN: // switch the slot to ZOMBI state 3960 4321 // and possibly request itlb or dtlb invalidate … … 3982 4343 // if selective itlb & dtlb invalidate are required 3983 4344 // the miss response is not handled before invalidate completed 3984 if ( r_dcache_ in_tlb[way*m_dcache_sets+set])3985 { 3986 r_dcache_ in_tlb[way*m_dcache_sets+set] = false;4345 if ( r_dcache_content_state[way*m_dcache_sets+set] == LINE_CACHE_IN_TLB ) 4346 { 4347 r_dcache_content_state[way*m_dcache_sets+set] = LINE_CACHE_DATA_NOT_DIRTY; 3987 4348 r_dcache_tlb_inval_line = r_dcache_cc_send_nline; 3988 4349 r_dcache_tlb_inval_set = 0; … … 3990 4351 r_dcache_fsm = DCACHE_INVAL_TLB_SCAN; 3991 4352 } 3992 else if ( r_dcache_cont ains_ptd[way*m_dcache_sets+set])4353 else if ( r_dcache_content_state[way*m_dcache_sets+set] == LINE_CACHE_CONTAINS_PTD ) 3993 4354 { 3994 4355 r_itlb.reset(); 3995 4356 r_dtlb.reset(); 3996 r_dcache_cont ains_ptd[way*m_dcache_sets+set] = false;4357 r_dcache_content_state[way*m_dcache_sets+set] = LINE_CACHE_DATA_NOT_DIRTY; 3997 4358 r_dcache_fsm = DCACHE_MISS_WAIT; 3998 4359 } … … 4145 4506 r_dcache_cc_send_way = r_dcache_miss_way.read(); 4146 4507 r_dcache_cc_send_type = CC_TYPE_CLEANUP; 4508 4509 if (r_vci_rsp_read_data_miss_no_coherent.read() == true) 4510 { 4511 r_dcache_cleanup_ncc = true; 4512 r_dcache_cc_cleanup_updt_data = false; 4513 } 4514 else 4515 { 4516 r_dcache_cleanup_ncc = false; 4517 r_dcache_cc_cleanup_updt_data = false; 4518 } 4147 4519 4148 4520 #ifdef INSTRUMENTATION … … 4171 4543 m_cpt_dcache_dir_write++; 4172 4544 #endif 4173 r_dcache.write_dir( r_dcache_save_paddr.read(), 4174 r_dcache_miss_way.read(), 4175 r_dcache_miss_set.read(), 4176 CACHE_SLOT_STATE_VALID ); 4177 4545 size_t way = r_dcache_miss_way.read(); 4546 size_t set = r_dcache_miss_set.read(); 4547 4548 /*ODCCP*/ // if the read miss is on line NCC we set the state's line as VALID_NCC 4549 if (r_vci_rsp_read_data_miss_no_coherent.read() == true) 4550 { 4551 r_dcache.write_dir( r_dcache_save_paddr.read(), 4552 r_dcache_miss_way.read(), 4553 r_dcache_miss_set.read(), 4554 CACHE_SLOT_STATE_VALID_NCC ); 4555 r_vci_rsp_read_data_miss_no_coherent = false; 4178 4556 #if DEBUG_DCACHE 4179 4557 if ( m_debug_activated ) 4180 4558 std::cout << " <PROC " << name() 4181 << " DCACHE_MISS_DIR_UPDT> Switch slot to VALID state"4559 << " DCACHE_MISS_DIR_UPDT> Switch slot to VALID_NCC state" 4182 4560 << " PADDR = " << std::hex << r_dcache_save_paddr.read() 4183 4561 << " / WAY = " << std::dec << r_dcache_miss_way.read() 4184 4562 << " / SET = " << r_dcache_miss_set.read() << std::endl; 4185 4563 #endif 4564 } 4565 else 4566 { 4567 r_dcache.write_dir( r_dcache_save_paddr.read(), 4568 r_dcache_miss_way.read(), 4569 r_dcache_miss_set.read(), 4570 CACHE_SLOT_STATE_VALID_CC ); 4571 #if DEBUG_DCACHE 4572 if ( m_debug_activated ) 4573 std::cout << " <PROC " << name() 4574 << " DCACHE_MISS_DIR_UPDT> Switch slot to VALID_CC state" 4575 << " PADDR = " << std::hex << r_dcache_save_paddr.read() 4576 << " / WAY = " << std::dec << r_dcache_miss_way.read() 4577 << " / SET = " << r_dcache_miss_set.read() << std::endl; 4578 #endif 4579 } 4186 4580 // reset directory extension 4187 size_t way = r_dcache_miss_way.read(); 4188 size_t set = r_dcache_miss_set.read(); 4189 r_dcache_in_tlb[way*m_dcache_sets+set] = false; 4190 r_dcache_contains_ptd[way*m_dcache_sets+set] = false; 4581 /*ODCCP*/ // We set the new line as not dirty 4582 r_dcache_content_state[way*m_dcache_sets+set] = LINE_CACHE_DATA_NOT_DIRTY; 4583 4191 4584 } 4192 4585 if (r_dcache_miss_type.read()==PTE1_MISS) r_dcache_fsm = DCACHE_TLB_PTE1_GET; … … 4335 4728 &state ); 4336 4729 4337 assert( (state == CACHE_SLOT_STATE_VALID ) and4730 assert( (state == CACHE_SLOT_STATE_VALID_CC) and 4338 4731 "error in DCACHE_DIRTY_TLB_SET: the PTE should be in dcache" ); 4339 4732 … … 4447 4840 r_cc_receive_dcache_set.read(), 4448 4841 CACHE_SLOT_STATE_EMPTY); 4449 4842 4843 /*STATS DIRTY*/ 4844 for (size_t word = 0; word < m_dcache_words; word++) 4845 { 4846 dirty_stats[(r_cc_receive_dcache_way * m_dcache_sets + r_cc_receive_dcache_set) * m_dcache_words + word] = false; 4847 } 4848 4849 4450 4850 if ( (r_dcache_miss_set.read() == r_cc_receive_dcache_set.read()) and 4451 4851 (r_dcache_miss_way.read() == r_cc_receive_dcache_way.read()) ) … … 4516 4916 r_dcache_cc_way = way; 4517 4917 r_dcache_cc_set = set; 4518 4519 if ( state == CACHE_SLOT_STATE_VALID)// hit4918 /*ODCCP*/ 4919 if ((state == CACHE_SLOT_STATE_VALID_CC) or (state == CACHE_SLOT_STATE_VALID_NCC)) // hit 4520 4920 { 4521 4921 // need to update the cache state 4922 r_dcache_cleanup_ncc = false; 4522 4923 r_dcache_cc_need_write = true; 4523 4924 if (r_cc_receive_dcache_type.read() == CC_TYPE_UPDT) // hit update 4524 4925 { 4926 /*ODCCP*/ // we can't receive a CC_UPDT on a NCC line 4927 if (state == CACHE_SLOT_STATE_VALID_NCC) 4928 std::cout << "DCACHE_CC_CHECK : IMPOSSIBLE NCC STATE FOR CC_UPDT at cycle " << m_cpt_total_cycles << std::endl; 4929 assert((state != CACHE_SLOT_STATE_VALID_NCC) and "DCACHE_CC_CHECK : IMPOSSIBLE NCC STATE FOR CC_UPDT"); 4930 4525 4931 r_dcache_fsm = DCACHE_CC_UPDT; 4526 4932 r_dcache_cc_word = r_cc_receive_word_idx.read(); … … 4528 4934 else if (r_cc_receive_dcache_type.read() == CC_TYPE_INVAL) // hit inval 4529 4935 { 4530 r_dcache_fsm = DCACHE_CC_INVAL; 4936 if ( (state == CACHE_SLOT_STATE_VALID_NCC) ) 4937 { 4938 if (r_dcache_content_state[way*m_dcache_sets+set] == LINE_CACHE_DATA_DIRTY) 4939 m_cpt_data_cleanup_dirty ++; 4940 r_dcache_cc_state = state; 4941 r_dcache_cc_inval_addr = (paddr &~0x3F); 4942 r_dcache_cc_inval_data_cpt = 0; 4943 } 4944 else 4945 { 4946 r_dcache_cc_state = state; 4947 r_dcache_cc_inval_addr = (paddr &~0x3F); 4948 } 4949 r_dcache_fsm = DCACHE_CC_INVAL; 4531 4950 } 4532 4951 else if ( r_cc_receive_dcache_type.read() == CC_TYPE_BRDCAST) // hit broadcast 4533 4952 { 4953 assert((state != CACHE_SLOT_STATE_VALID_NCC) and "DCACHE_CC_CHECK : IMPOSSIBLE NCC STATE FOR CC_BROADCAST"); 4534 4954 r_dcache_fsm = DCACHE_CC_BROADCAST; 4535 4955 } … … 4559 4979 << " PADDR = " << std::hex << paddr 4560 4980 << " / TYPE = " << std::dec << r_cc_receive_dcache_type.read() 4561 << " / HIT = " << ( state == CACHE_SLOT_STATE_VALID) << std::endl;4981 << " / HIT = " << ((state == CACHE_SLOT_STATE_VALID_CC) or (state == CACHE_SLOT_STATE_VALID_NCC)) << std::endl; 4562 4982 } 4563 4983 #endif 4984 } 4985 break; 4986 } 4987 ///////////////////// 4988 case DCACHE_CC_INVAL_DATA: 4989 { 4990 uint32_t rdata; 4991 size_t way; 4992 size_t set; 4993 size_t word; 4994 r_dcache.read_neutral(r_dcache_cc_inval_addr.read(), 4995 &rdata, 4996 &way, 4997 &set, 4998 &word); 4999 if(r_cc_send_data_fifo.wok()) 5000 { 5001 r_dcache_cc_inval_addr = r_dcache_cc_inval_addr.read() + 4; 5002 5003 cleanup_data_updt_fifo_dcache_get = false; 5004 cleanup_data_updt_fifo_dcache_put = true; 5005 cleanup_data_updt_fifo_dcache_data = rdata; 5006 5007 r_dcache_cc_inval_data_cpt = r_dcache_cc_inval_data_cpt.read() + 1; 5008 /*ODCCP*/ // After reading the last word we switch slot to ZOMBI state 5009 if(r_dcache_cc_inval_data_cpt.read() == (m_dcache_words - 1)) 5010 { 5011 r_dcache_fsm = r_dcache_fsm_cc_save.read(); 5012 r_dcache.write_dir( way, 5013 set, 5014 CACHE_SLOT_STATE_ZOMBI ); 5015 #if DEBUG_DCACHE 5016 if ( m_debug_activated ) 5017 { 5018 std::cout << " <PROC " << name() 5019 << " DCACHE_CC_INVAL_DATA> Switch slot to ZOMBI state:" << std::dec 5020 << " / WAY = " << way 5021 << " / SET = " << set << std::endl; 5022 } 5023 #endif 5024 } 4564 5025 } 4565 5026 break; … … 4571 5032 size_t way = r_dcache_cc_way.read(); 4572 5033 size_t set = r_dcache_cc_set.read(); 4573 5034 int state = r_dcache_cc_state.read(); 4574 5035 if (r_dcache_cc_need_write.read()) 4575 5036 { 4576 if ( r_dcache_ in_tlb[way*m_dcache_sets+set] ) // selective TLB inval4577 { 4578 r_dcache_ in_tlb[way*m_dcache_sets+set] = false;5037 if ( r_dcache_content_state[way*m_dcache_sets+set] == LINE_CACHE_IN_TLB ) 5038 { 5039 r_dcache_content_state[way*m_dcache_sets+set] = LINE_CACHE_DATA_NOT_DIRTY; 4579 5040 r_dcache_tlb_inval_line = r_cc_receive_dcache_nline.read(); 4580 5041 r_dcache_tlb_inval_set = 0; … … 4585 5046 else 4586 5047 { 4587 if ( r_dcache_cont ains_ptd[way*m_dcache_sets+set] ) // TLB flush5048 if ( r_dcache_content_state[way*m_dcache_sets+set] == LINE_CACHE_CONTAINS_PTD ) 4588 5049 { 4589 5050 r_itlb.reset(); 4590 5051 r_dtlb.reset(); 4591 r_dcache_cont ains_ptd[way*m_dcache_sets+set] = false;5052 r_dcache_content_state[way*m_dcache_sets+set] = LINE_CACHE_DATA_NOT_DIRTY; 4592 5053 4593 5054 #if DEBUG_DCACHE 4594 if ( m_debug_activated ) 4595 { 4596 std::cout << " <PROC " << name() 4597 << " DCACHE_CC_INVAL> Flush DTLB & ITLB" << std::endl; 4598 } 4599 #endif 4600 } 4601 4602 r_dcache.write_dir( 0, 4603 way, 4604 set, 4605 CACHE_SLOT_STATE_EMPTY ); 4606 5055 if ( m_debug_activated ) 5056 { 5057 std::cout << " <PROC " << name() 5058 << " DCACHE_CC_INVAL> Flush DTLB & ITLB" << std::endl; 5059 } 5060 #endif 5061 } 5062 5063 if ( state == CACHE_SLOT_STATE_VALID_CC ) 5064 { 5065 r_dcache.write_dir( 0, 5066 way, 5067 set, 5068 CACHE_SLOT_STATE_EMPTY ); 5069 #if DEBUG_DCACHE 5070 if ( m_debug_activated ) 5071 { 5072 std::cout << " <PROC " << name() 5073 5074 << " DCACHE_CC_INVAL> Switch slot to EMPTY state:" << std::dec 5075 << " / WAY = " << way 5076 << " / SET = " << set << std::endl; 5077 } 5078 #endif 5079 } 4607 5080 r_dcache_cc_need_write = false; 4608 5081 4609 #if DEBUG_DCACHE 4610 if ( m_debug_activated ) 4611 { 4612 std::cout << " <PROC " << name() 4613 << " DCACHE_CC_INVAL> Switch slot to EMPTY state:" << std::dec 4614 << " / WAY = " << way 4615 << " / SET = " << set << std::endl; 4616 } 4617 #endif 4618 } 4619 } 5082 } 5083 } 5084 4620 5085 // multicast acknowledgement 4621 5086 // send a request to cc_send_fsm 4622 5087 if(not r_dcache_cc_send_req.read()) // cc_send is available 4623 5088 { 5089 4624 5090 // coherence request completed 4625 5091 r_cc_receive_dcache_req = false; 4626 // request multicast acknowledgement4627 5092 r_dcache_cc_send_req = true; 4628 5093 r_dcache_cc_send_nline = r_cc_receive_dcache_nline.read(); 4629 r_dcache_cc_send_updt_tab_idx = r_cc_receive_dcache_updt_tab_idx.read(); 4630 r_dcache_cc_send_type = CC_TYPE_MULTI_ACK; 4631 4632 r_dcache_fsm = r_dcache_fsm_cc_save.read(); 5094 5095 5096 if ( (state == CACHE_SLOT_STATE_VALID_NCC) ) 5097 { 5098 r_dcache_cleanup_ncc = true; 5099 r_dcache_cc_send_type = CC_TYPE_CLEANUP; 5100 r_dcache_cc_send_way = way; 5101 5102 if (r_dcache_content_state[way*m_dcache_sets+set] == LINE_CACHE_DATA_DIRTY) 5103 { 5104 r_dcache_cc_cleanup_updt_data = true; 5105 r_dcache_fsm = DCACHE_CC_INVAL_DATA; 5106 5107 /*STATS DIRTY*/ 5108 for (size_t w = 0; w < m_dcache_words; w++) 5109 { 5110 if(dirty_stats[(way * m_dcache_sets + set) * m_dcache_words + w] == true) 5111 m_cpt_words_dirty++; 5112 } 5113 } 5114 else 5115 { 5116 r_dcache_cc_cleanup_updt_data = false; 5117 r_dcache.write_dir( way, 5118 set, 5119 CACHE_SLOT_STATE_ZOMBI ); 5120 r_dcache_fsm = r_dcache_fsm_cc_save.read(); 5121 } 5122 } 5123 else 5124 { 5125 // request multicast acknowledgement 5126 r_dcache_cc_send_updt_tab_idx = r_cc_receive_dcache_updt_tab_idx.read(); 5127 r_dcache_cc_send_type = CC_TYPE_MULTI_ACK; 5128 r_dcache_fsm = r_dcache_fsm_cc_save.read(); 5129 } 4633 5130 } 4634 5131 //else wait for previous cc_send request to be sent … … 4647 5144 if (r_dcache_cc_need_write.read()) 4648 5145 { 4649 if ( r_dcache_in_tlb[way*m_dcache_sets+set] ) // selective TLB inval 4650 { 4651 r_dcache_in_tlb[way*m_dcache_sets+set] = false; 5146 // selective TLB inval 5147 if ( r_dcache_content_state[way*m_dcache_sets+set] == LINE_CACHE_IN_TLB ) 5148 { 5149 r_dcache_content_state[way*m_dcache_sets+set] = LINE_CACHE_DATA_NOT_DIRTY; 4652 5150 r_dcache_tlb_inval_line = r_cc_receive_dcache_nline.read(); 4653 5151 r_dcache_tlb_inval_set = 0; … … 4656 5154 break; 4657 5155 } 4658 4659 if ( r_dcache_cont ains_ptd[way*m_dcache_sets+set] ) // TLB flush5156 // TLB flush 5157 if ( r_dcache_content_state[way*m_dcache_sets+set] == LINE_CACHE_CONTAINS_PTD ) 4660 5158 { 4661 5159 r_itlb.reset(); 4662 5160 r_dtlb.reset(); 4663 r_dcache_cont ains_ptd[way*m_dcache_sets+set] = false;5161 r_dcache_content_state[way*m_dcache_sets+set] = LINE_CACHE_DATA_NOT_DIRTY; 4664 5162 4665 5163 #if DEBUG_DCACHE … … 4739 5237 if (r_dcache_cc_need_write.read()) 4740 5238 { 4741 if ( r_dcache_in_tlb[way*m_dcache_sets+set] ) // selective TLB inval 4742 { 4743 r_dcache_in_tlb[way*m_dcache_sets+set] = false; 5239 // selective TLB inval 5240 if ( r_dcache_content_state[way*m_dcache_sets+set] == LINE_CACHE_IN_TLB ) 5241 { 5242 r_dcache_content_state[way*m_dcache_sets+set] = LINE_CACHE_DATA_NOT_DIRTY; 4744 5243 r_dcache_tlb_inval_line = nline; 4745 5244 r_dcache_tlb_inval_set = 0; … … 4750 5249 else 4751 5250 { 4752 if ( r_dcache_contains_ptd[way*m_dcache_sets+set] ) // TLB flush 5251 // TLB flush 5252 if ( r_dcache_content_state[way*m_dcache_sets+set] == LINE_CACHE_CONTAINS_PTD ) 4753 5253 { 4754 5254 r_itlb.reset(); 4755 5255 r_dtlb.reset(); 4756 r_dcache_cont ains_ptd[way*m_dcache_sets+set] = false;5256 r_dcache_content_state[way*m_dcache_sets+set] = LINE_CACHE_DATA_NOT_DIRTY; 4757 5257 4758 5258 #if DEBUG_DCACHE 4759 if ( m_debug_activated )4760 {4761 std::cout << " <PROC " << name()4762 << " DCACHE_CC_BROADCAST> Flush DTLB & ITLB" << std::endl;4763 }5259 if ( m_debug_activated ) 5260 { 5261 std::cout << " <PROC " << name() 5262 << " DCACHE_CC_BROADCAST> Flush DTLB & ITLB" << std::endl; 5263 } 4764 5264 #endif 4765 5265 } 4766 5266 4767 5267 #ifdef INSTRUMENTATION 4768 m_cpt_dcache_dir_write++;5268 m_cpt_dcache_dir_write++; 4769 5269 #endif 4770 5270 r_dcache.write_dir( way, 4771 4772 5271 set, 5272 CACHE_SLOT_STATE_ZOMBI ); 4773 5273 4774 5274 r_dcache_cc_need_write = false; 4775 5275 #if DEBUG_DCACHE 4776 if ( m_debug_activated )4777 {4778 std::cout << " <PROC " << name()4779 << " DCACHE_CC_BROADCAST > Slot goes to ZOMBI state "4780 << " SET = " << set4781 << " / WAY = " << way << std::endl;4782 }5276 if ( m_debug_activated ) 5277 { 5278 std::cout << " <PROC " << name() 5279 << " DCACHE_CC_BROADCAST > Slot goes to ZOMBI state " 5280 << " SET = " << set 5281 << " / WAY = " << way << std::endl; 5282 } 4783 5283 #endif 4784 5284 } … … 4969 5469 r_dcache_vci_unc_req.read()) 4970 5470 or r_vci_cmd_imiss_prio.read() ); 4971 4972 5471 // 1 - Data Read Miss 4973 5472 if ( dcache_miss_req and r_wbuf.miss(r_dcache_vci_paddr.read()) ) … … 4976 5475 r_dcache_vci_miss_req = false; 4977 5476 r_vci_cmd_imiss_prio = true; 4978 //m_cpt_dmiss_transaction++;5477 m_cpt_dmiss_transaction++; 4979 5478 } 4980 5479 // 2 - Data Read Uncachable … … 4983 5482 r_vci_cmd_fsm = CMD_DATA_UNC; 4984 5483 r_dcache_vci_unc_req = false; 4985 //m_cpt_dunc_transaction++;5484 //m_cpt_dunc_transaction++; 4986 5485 } 4987 5486 // 3 - Data Linked Load … … 4990 5489 r_dcache_vci_ll_req = false; 4991 5490 r_vci_cmd_fsm = CMD_DATA_LL; 4992 //m_cpt_ll_transaction++;5491 //m_cpt_ll_transaction++; 4993 5492 } 4994 5493 // 4 - Instruction Miss … … 4998 5497 r_icache_miss_req = false; 4999 5498 r_vci_cmd_imiss_prio = false; 5000 //m_cpt_imiss_transaction++;5499 m_cpt_imiss_transaction++; 5001 5500 } 5002 5501 // 5 - Instruction Uncachable … … 5005 5504 r_vci_cmd_fsm = CMD_INS_UNC; 5006 5505 r_icache_unc_req = false; 5007 //m_cpt_iunc_transaction++;5506 //m_cpt_iunc_transaction++; 5008 5507 } 5009 5508 // 6 - Data Write … … 5014 5513 r_vci_cmd_min = wbuf_min; 5015 5514 r_vci_cmd_max = wbuf_max; 5016 //m_cpt_write_transaction++;5017 //m_length_write_transaction += (wbuf_max-wbuf_min+1);5515 m_cpt_write_transaction++; 5516 m_length_write_transaction += (wbuf_max-wbuf_min+1); 5018 5517 } 5019 5518 // 7 - Data Store Conditionnal … … 5023 5522 r_vci_cmd_cpt = 0; 5024 5523 r_vci_cmd_fsm = CMD_DATA_SC; 5025 //m_cpt_sc_transaction++;5524 //m_cpt_sc_transaction++; 5026 5525 } 5027 5526 // 8 - Compare And Swap … … 5031 5530 r_dcache_vci_cas_req = false; 5032 5531 r_vci_cmd_cpt = 0; 5033 //m_cpt_cas_transaction++;5532 //m_cpt_cas_transaction++; 5034 5533 } 5035 5534 … … 5074 5573 case CMD_INS_MISS: 5075 5574 case CMD_INS_UNC: 5076 case CMD_DATA_MISS:5077 5575 case CMD_DATA_UNC: 5078 5576 case CMD_DATA_LL: … … 5080 5578 // all read VCI commands contain one single flit 5081 5579 if ( p_vci.cmdack.read() ) { 5580 r_vci_cmd_fsm = CMD_IDLE; 5581 } 5582 break; 5583 } 5584 5585 case CMD_DATA_MISS: 5586 { 5587 // all read VCI commands contain one single flit 5588 if ( p_vci.cmdack.read() ) { 5589 r_dcache_miss_no_coherent = false; 5082 5590 r_vci_cmd_fsm = CMD_IDLE; 5083 5591 } … … 5123 5631 r_vci_rsp_cpt = 0; 5124 5632 5125 if ( (p_vci.rpktid.read() & 0x 7) == TYPE_READ_DATA_UNC )5633 if ( (p_vci.rpktid.read() & 0xF) == TYPE_READ_DATA_UNC ) 5126 5634 { 5127 5635 r_vci_rsp_fsm = RSP_DATA_UNC; 5128 5636 } 5129 else if ( (p_vci.rpktid.read() & 0x 7) == TYPE_READ_DATA_MISS )5637 else if ( (p_vci.rpktid.read() & 0xF) == TYPE_READ_DATA_MISS ) 5130 5638 { 5131 5639 r_vci_rsp_fsm = RSP_DATA_MISS; 5132 5640 } 5133 else if ( (p_vci.rpktid.read() & 0x7) == TYPE_READ_INS_UNC ) 5641 else if ( (p_vci.rpktid.read() & 0xF) == TYPE_READ_DATA_MISS_NO_COHERENT ) 5642 { 5643 r_vci_rsp_read_data_miss_no_coherent = true; 5644 r_vci_rsp_fsm = RSP_DATA_MISS; 5645 } 5646 else if ( (p_vci.rpktid.read() & 0xF) == TYPE_READ_INS_UNC ) 5134 5647 { 5135 5648 r_vci_rsp_fsm = RSP_INS_UNC; 5136 5649 } 5137 else if ( (p_vci.rpktid.read() & 0x 7) == TYPE_READ_INS_MISS )5650 else if ( (p_vci.rpktid.read() & 0xF) == TYPE_READ_INS_MISS ) 5138 5651 { 5139 5652 r_vci_rsp_fsm = RSP_INS_MISS; 5140 5653 } 5141 else if ( (p_vci.rpktid.read() & 0x 7) == TYPE_WRITE )5654 else if ( (p_vci.rpktid.read() & 0xF) == TYPE_WRITE ) 5142 5655 { 5143 5656 r_vci_rsp_fsm = RSP_DATA_WRITE; 5144 5657 } 5145 else if ( (p_vci.rpktid.read() & 0x 7) == TYPE_CAS )5658 else if ( (p_vci.rpktid.read() & 0xF) == TYPE_CAS ) 5146 5659 { 5147 5660 r_vci_rsp_fsm = RSP_DATA_UNC; 5148 5661 } 5149 else if ( (p_vci.rpktid.read() & 0x 7) == TYPE_LL )5662 else if ( (p_vci.rpktid.read() & 0xF) == TYPE_LL ) 5150 5663 { 5151 5664 r_vci_rsp_fsm = RSP_DATA_LL; 5152 5665 } 5153 else if ( (p_vci.rpktid.read() & 0x 7) == TYPE_SC )5666 else if ( (p_vci.rpktid.read() & 0xF) == TYPE_SC ) 5154 5667 { 5155 5668 r_vci_rsp_fsm = RSP_DATA_UNC; … … 5400 5913 if (p_dspin_out.read.read()) 5401 5914 { 5402 if (r_cc_send_last_client.read() == 0) // dcache active request 5403 r_dcache_cc_send_req = false; // reset dcache request 5404 else // icache active request 5405 r_icache_cc_send_req = false; // reset icache request 5406 5407 // go back to idle state 5408 r_cc_send_fsm = CC_SEND_IDLE; 5915 /*ODCCP*/ // If there is a cleanup with data and dcache active request we send other flits contained data 5916 if(r_dcache_cc_cleanup_updt_data.read() and (r_cc_send_last_client.read() == 0) ) 5917 { 5918 r_cc_send_fsm = CC_SEND_CLEANUP_DATA_UPDT; 5919 } 5920 else 5921 { 5922 if (r_cc_send_last_client.read() == 0) // dcache active request 5923 r_dcache_cc_send_req = false; // reset dcache request 5924 else // icache active request 5925 r_icache_cc_send_req = false; // reset icache request 5926 // go back to idle state 5927 r_cc_send_fsm = CC_SEND_IDLE; 5928 } 5929 } 5930 break; 5931 } 5932 /////////////////////////// 5933 case CC_SEND_CLEANUP_DATA_UPDT: /*ODCCP*/ // we send the data values of line cache into [m_dcache_words] flits 5934 { 5935 if (p_dspin_out.read.read()) 5936 { 5937 if(r_cc_send_data_fifo.rok()) 5938 { 5939 m_cpt_data_cleanup++; 5940 cleanup_data_updt_fifo_dcache_get = true; 5941 r_cc_send_cpt_word = r_cc_send_cpt_word.read() + 1; 5942 if (r_cc_send_cpt_word.read() == m_dcache_words-1) 5943 { 5944 /*ODCCP*/ 5945 r_dcache_cc_send_req = false; 5946 r_dcache_cc_cleanup_updt_data = false; 5947 r_cc_send_cpt_word = 0; 5948 r_cc_send_fsm = CC_SEND_IDLE; 5949 } 5950 } 5409 5951 } 5410 5952 break; … … 5487 6029 // for data CLACK, wait for dcache to take the request 5488 6030 if ((r_cc_receive_data_ins.read() == 0) and 5489 not (r_cc_receive_dcache_req.read()))6031 not r_cc_receive_dcache_req.read()) 5490 6032 { 5491 6033 // request dcache to handle the CLACK 5492 6034 r_cc_receive_dcache_req = true; 5493 r_cc_receive_dcache_set = DspinDhccpParam::dspin_get(receive_data, 6035 r_cc_receive_dcache_set = DspinDhccpParam::dspin_get(receive_data, 5494 6036 DspinDhccpParam::CLEANUP_ACK_SET) & 5495 6037 ((1ULL<<(uint32_log2(m_dcache_sets)))-1); 5496 r_cc_receive_dcache_way = DspinDhccpParam::dspin_get(receive_data, 6038 r_cc_receive_dcache_way = DspinDhccpParam::dspin_get(receive_data, 5497 6039 DspinDhccpParam::CLEANUP_ACK_WAY) & 5498 6040 ((1ULL<<(uint32_log2(m_dcache_ways)))-1); … … 5710 6252 vci_rsp_fifo_dcache_data); 5711 6253 6254 r_cc_send_data_fifo.update(cleanup_data_updt_fifo_dcache_get, 6255 cleanup_data_updt_fifo_dcache_put, 6256 cleanup_data_updt_fifo_dcache_data); 6257 5712 6258 ///////////////// updt FIFO update ////////////////////// 5713 6259 //TODO check this … … 5804 6350 p_vci.be = 0xF; 5805 6351 p_vci.trdid = 0; 5806 p_vci.pktid = TYPE_READ_DATA_MISS; 6352 /*ODCCP*/ // If miss on no coherent line pktid = TYPE_READ_DATA_MISS_NO_COHERENT 6353 if(r_dcache_miss_no_coherent.read() == true) 6354 p_vci.pktid = TYPE_READ_DATA_MISS_NO_COHERENT; 6355 else 6356 p_vci.pktid = TYPE_READ_DATA_MISS; 5807 6357 p_vci.plen = m_dcache_words << 2; 5808 6358 p_vci.cmd = vci_param::CMD_READ; … … 5904 6454 { 5905 6455 // initialize dspin send data 5906 // DspinDhccpParam::dspin_set(dspin_send_data,5907 // 0,5908 // DspinDhccpParam::FROM_L1_EOP);5909 6456 DspinDhccpParam::dspin_set(dspin_send_data, 5910 6457 m_cc_global_id, … … 5919 6466 >> (m_nline_width - m_x_width - m_y_width) 5920 6467 << (DspinDhccpParam::GLOBALID_WIDTH - m_x_width - m_y_width); 5921 5922 6468 DspinDhccpParam::dspin_set(dspin_send_data, 5923 6469 dest, … … 5935 6481 DspinDhccpParam::TYPE_CLEANUP_DATA, 5936 6482 DspinDhccpParam::FROM_L1_TYPE); 6483 /*ODCCP*/ // If cleanup on NCC line we set the CLEANUP_NCC bit in cleanup flit 6484 if (r_dcache_cleanup_ncc.read()) 6485 { 6486 DspinDhccpParam::dspin_set(dspin_send_data, 6487 1, 6488 DspinDhccpParam::CLEANUP_NCC); 6489 } 6490 else 6491 { 6492 DspinDhccpParam::dspin_set(dspin_send_data, 6493 0, 6494 DspinDhccpParam::CLEANUP_NCC); 6495 } 6496 5937 6497 } 5938 6498 else // icache active request … … 5957 6517 DspinDhccpParam::TYPE_CLEANUP_INST, 5958 6518 DspinDhccpParam::FROM_L1_TYPE); 6519 6520 DspinDhccpParam::dspin_set(dspin_send_data, 6521 0, 6522 DspinDhccpParam::CLEANUP_NCC); 5959 6523 } 5960 6524 // send flit … … 5968 6532 { 5969 6533 // initialize dspin send data 5970 // DspinDhccpParam::dspin_set(dspin_send_data, 5971 // 1, 5972 // DspinDhccpParam::FROM_L1_EOP); 6534 /*ODCCP*/ // if cleanup contains data and dcache active request, there is other flits to send 6535 if (r_dcache_cc_cleanup_updt_data.read() and not r_cc_send_last_client.read()) 6536 { 6537 p_dspin_out.eop = false; 6538 } 6539 else 6540 { 6541 p_dspin_out.eop = true; 6542 } 5973 6543 5974 6544 if(r_cc_send_last_client.read() == 0) // dcache active request … … 5987 6557 p_dspin_out.data = dspin_send_data; 5988 6558 p_dspin_out.write = true; 5989 p_dspin_out.eop = true; 6559 break; 6560 } 6561 /////////////////////// 6562 case CC_SEND_CLEANUP_DATA_UPDT: 6563 { 6564 if (r_cc_send_cpt_word.read() == m_dcache_words-1) /*ODCCP*/ // Last flit sent 6565 { 6566 p_dspin_out.eop = true; 6567 } 6568 else 6569 { 6570 p_dspin_out.eop = false; 6571 } 6572 6573 DspinDhccpParam::dspin_set(dspin_send_data, 6574 r_cc_send_data_fifo.read(), 6575 DspinDhccpParam::CLEANUP_DATA_UPDT); 6576 6577 p_dspin_out.data = dspin_send_data; 6578 p_dspin_out.write = true; 5990 6579 break; 5991 6580 } -
branches/ODCCP/modules/vci_mem_cache/caba/source/include/mem_cache_directory.h
r449 r460 99 99 bool dirty; // entry dirty 100 100 bool lock; // entry locked 101 bool coherent; // entry coherent or not 101 102 tag_t tag; // tag of the entry 102 103 size_t count; // number of copies … … 110 111 dirty = false; 111 112 lock = false; 113 coherent = true; 112 114 tag = 0; 113 115 count = 0; … … 126 128 dirty = source.dirty; 127 129 lock = source.lock; 130 coherent = source.coherent; 128 131 tag = source.tag; 129 132 count = source.count; … … 141 144 dirty = false; 142 145 lock = false; 146 coherent = true; 143 147 count = 0; 144 148 } … … 153 157 dirty = source.dirty; 154 158 lock = source.lock; 159 coherent = source.coherent; 155 160 tag = source.tag; 156 161 count = source.count; -
branches/ODCCP/modules/vci_mem_cache/caba/source/include/vci_mem_cache.h
r449 r460 254 254 IXR_CMD_CAS_IDLE, 255 255 IXR_CMD_XRAM_IDLE, 256 IXR_CMD_CLEANUP_IDLE, 256 257 IXR_CMD_READ, 257 258 IXR_CMD_WRITE, 258 259 IXR_CMD_CAS, 259 IXR_CMD_XRAM 260 IXR_CMD_XRAM, 261 IXR_CMD_CLEANUP_DATA 260 262 }; 261 263 … … 291 293 CLEANUP_IDLE, 292 294 CLEANUP_GET_NLINE, 295 CLEANUP_GET_DATA, 293 296 CLEANUP_DIR_REQ, 294 297 CLEANUP_DIR_LOCK, … … 304 307 CLEANUP_WRITE_RSP, 305 308 CLEANUP_CONFIG_ACK, 309 CLEANUP_IXR_REQ, 310 CLEANUP_WAIT, 306 311 CLEANUP_SEND_CLACK 307 312 }; … … 326 331 ALLOC_TRT_CAS, 327 332 ALLOC_TRT_XRAM_RSP, 328 ALLOC_TRT_IXR_RSP 333 ALLOC_TRT_IXR_RSP, 334 ALLOC_TRT_CLEANUP 329 335 }; 330 336 … … 425 431 uint32_t m_cpt_inval_brdcast; // Number of BROADCAST INVAL 426 432 uint32_t m_cpt_cleanup; // Number of CLEANUP transactions 433 uint32_t m_cpt_cleanup_data; // Number of CLEANUP WITH DATA transactions 427 434 uint32_t m_cpt_ll; // Number of LL transactions 428 435 uint32_t m_cpt_sc; // Number of SC transactions 429 436 uint32_t m_cpt_cas; // Number of CAS transactions 437 438 uint32_t m_cpt_read_fsm_dir_lock; // wait DIR LOCK 439 uint32_t m_cpt_read_fsm_n_dir_lock; // NB DIR LOCK 440 uint32_t m_cpt_write_fsm_dir_lock; // wait DIR LOCK 441 uint32_t m_cpt_write_fsm_n_dir_lock; // NB DIR LOCK 442 uint32_t m_cpt_xram_rsp_fsm_dir_lock; // wait DIR LOCK 443 uint32_t m_cpt_xram_rsp_fsm_n_dir_lock; // NB DIR LOCK 444 uint32_t m_cpt_cas_fsm_dir_lock; // wait DIR LOCK 445 uint32_t m_cpt_cas_fsm_n_dir_lock; // NB DIR LOCK 446 uint32_t m_cpt_cleanup_fsm_dir_lock; // wait DIR LOCK 447 uint32_t m_cpt_cleanup_fsm_n_dir_lock; // NB DIR LOCK 448 449 uint32_t m_cpt_dir_unused; // NB cycles DIR LOCK unused 450 uint32_t m_cpt_read_fsm_dir_used; // NB cycles DIR LOCK used 451 uint32_t m_cpt_write_fsm_dir_used; // NB cycles DIR LOCK used 452 uint32_t m_cpt_cas_fsm_dir_used; // NB cycles DIR LOCK used 453 uint32_t m_cpt_xram_rsp_fsm_dir_used; // NB cycles DIR LOCK used 454 uint32_t m_cpt_cleanup_fsm_dir_used; // NB cycles DIR LOCK used 455 456 uint32_t m_cpt_read_fsm_trt_lock; // wait TRT LOCK 457 uint32_t m_cpt_write_fsm_trt_lock; // wait TRT LOCK 458 uint32_t m_cpt_cas_fsm_trt_lock; // wait TRT LOCK 459 uint32_t m_cpt_xram_rsp_fsm_trt_lock; // wait TRT LOCK 460 uint32_t m_cpt_ixr_fsm_trt_lock; // wait TRT LOCK 461 462 uint32_t m_cpt_read_fsm_n_trt_lock; // NB TRT LOCK 463 uint32_t m_cpt_write_fsm_n_trt_lock; // NB TRT LOCK 464 uint32_t m_cpt_cas_fsm_n_trt_lock; // NB TRT LOCK 465 uint32_t m_cpt_xram_rsp_fsm_n_trt_lock; // NB TRT LOCK 466 uint32_t m_cpt_ixr_fsm_n_trt_lock; // NB TRT LOCK 467 468 uint32_t m_cpt_read_fsm_trt_used; // NB cycles TRT LOCK used 469 uint32_t m_cpt_write_fsm_trt_used; // NB cycles TRT LOCK used 470 uint32_t m_cpt_cas_fsm_trt_used; // NB cycles TRT LOCK used 471 uint32_t m_cpt_xram_rsp_fsm_trt_used; // NB cycles TRT LOCK used 472 uint32_t m_cpt_ixr_fsm_trt_used; // NB cycles TRT LOCK used 473 474 uint32_t m_cpt_trt_unused; // NB cycles TRT LOCK unused 475 476 uint32_t m_cpt_write_fsm_upt_lock; // wait UPT LOCK 477 uint32_t m_cpt_xram_rsp_fsm_upt_lock; // wait UPT LOCK 478 uint32_t m_cpt_multi_ack_fsm_upt_lock; // wait UPT LOCK 479 uint32_t m_cpt_cleanup_fsm_upt_lock; // wait UPT LOCK 480 uint32_t m_cpt_cas_fsm_upt_lock; // wait UPT LOCK 481 482 uint32_t m_cpt_write_fsm_n_upt_lock; // NB UPT LOCK 483 uint32_t m_cpt_xram_rsp_fsm_n_upt_lock; // NB UPT LOCK 484 uint32_t m_cpt_multi_ack_fsm_n_upt_lock; // NB UPT LOCK 485 uint32_t m_cpt_cleanup_fsm_n_upt_lock; // NB UPT LOCK 486 uint32_t m_cpt_cas_fsm_n_upt_lock; // NB UPT LOCK 487 488 uint32_t m_cpt_write_fsm_upt_used; // NB cycles UPT LOCK used 489 uint32_t m_cpt_xram_rsp_fsm_upt_used; // NB cycles UPT LOCK used 490 uint32_t m_cpt_multi_ack_fsm_upt_used; // NB cycles UPT LOCK used 491 uint32_t m_cpt_cleanup_fsm_upt_used; // NB cycles UPT LOCK used 492 uint32_t m_cpt_cas_fsm_upt_used; // NB cycles UPT LOCK used 493 494 uint32_t m_cpt_upt_unused; // NB cycles UPT LOCK unused 495 496 uint32_t m_cpt_read_fsm_heap_lock; // wait HEAP LOCK 497 uint32_t m_cpt_write_fsm_heap_lock; // wait HEAP LOCK 498 uint32_t m_cpt_cas_fsm_heap_lock; // wait HEAP LOCK 499 uint32_t m_cpt_cleanup_fsm_heap_lock; // wait HEAP LOCK 500 uint32_t m_cpt_xram_rsp_fsm_heap_lock; // wait HEAP LOCK 501 502 uint32_t m_cpt_read_fsm_n_heap_lock; // NB HEAP LOCK 503 uint32_t m_cpt_write_fsm_n_heap_lock; // NB HEAP LOCK 504 uint32_t m_cpt_cas_fsm_n_heap_lock; // NB HEAP LOCK 505 uint32_t m_cpt_cleanup_fsm_n_heap_lock; // NB HEAP LOCK 506 uint32_t m_cpt_xram_rsp_fsm_n_heap_lock; // NB HEAP LOCK 507 508 uint32_t m_cpt_read_fsm_heap_used; // NB cycles HEAP LOCK used 509 uint32_t m_cpt_write_fsm_heap_used; // NB cycles HEAP LOCK used 510 uint32_t m_cpt_cas_fsm_heap_used; // NB cycles HEAP LOCK used 511 uint32_t m_cpt_cleanup_fsm_heap_used; // NB cycles HEAP LOCK used 512 uint32_t m_cpt_xram_rsp_fsm_heap_used; // NB cycles HEAP LOCK used 513 514 uint32_t m_cpt_heap_unused; // NB cycles HEAP LOCK unused 430 515 431 516 uint32_t m_cpt_cleanup_cost; // Number of (flits * distance) for CLEANUPs … … 473 558 ~VciMemCache(); 474 559 560 void clear_stats(); 475 561 void print_stats(); 476 562 void print_trace(); … … 852 938 // Buffer between IXR_RSP fsm and XRAM_RSP fsm (response from the XRAM) 853 939 sc_signal<bool> * r_ixr_rsp_to_xram_rsp_rok; // A xram response is ready 940 sc_signal<bool> * r_ixr_rsp_to_xram_rsp_no_coherent; // A xram response is ready and no coherent (ODCCP) 854 941 855 942 //////////////////////////////////////////////////// … … 861 948 TransactionTabEntry r_xram_rsp_trt_buf; // TRT entry local buffer 862 949 sc_signal<bool> r_xram_rsp_victim_inval; // victim line invalidate 950 sc_signal<bool> r_xram_rsp_victim_coherent; // victim line coherent 863 951 sc_signal<bool> r_xram_rsp_victim_is_cnt; // victim line inst bit 864 952 sc_signal<bool> r_xram_rsp_victim_dirty; // victim line dirty bit … … 958 1046 sc_signal<int> r_alloc_heap_fsm; 959 1047 sc_signal<unsigned> r_alloc_heap_reset_cpt; 1048 1049 1050 //////////////////////////////////////////////////// 1051 // REGISTERS FOR ODCCP 1052 //////////////////////////////////////////////////// 1053 1054 sc_signal<uint32_t> r_cleanup_data_index; 1055 sc_signal<uint32_t> r_cleanup_trdid; 1056 sc_signal<uint32_t> r_cleanup_pktid; 1057 sc_signal<data_t> *r_cleanup_data; // buffer for saving data from cleanup 1058 sc_signal<bool> r_cleanup_contains_data; 1059 sc_signal<bool> r_cleanup_ncc; 1060 1061 sc_signal<bool> r_xram_rsp_to_ixr_cmd_inval_ncc_pending; 1062 1063 sc_signal<bool> r_cleanup_to_ixr_cmd_req; 1064 sc_signal<data_t> *r_cleanup_to_ixr_cmd_data; 1065 sc_signal<uint32_t> r_cleanup_to_ixr_cmd_srcid; 1066 sc_signal<bool> r_cleanup_to_ixr_cmd_l1_dirty_ncc; // this cleanup was dirty in L1 1067 sc_signal<uint32_t> r_cleanup_to_ixr_cmd_trdid; 1068 sc_signal<uint32_t> r_cleanup_to_ixr_cmd_pktid; 1069 sc_signal<addr_t> r_cleanup_to_ixr_cmd_nline; 960 1070 }; // end class VciMemCache 961 1071 -
branches/ODCCP/modules/vci_mem_cache/caba/source/include/xram_transaction.h
r422 r460 293 293 return false; 294 294 } 295 296 /////////////////////////////////////////////////////////////////////// 297 // The hit_write() function looks if an XRAM write transaction exists 298 // for a given line. 299 // Arguments : 300 // - nline : the index (zy) of the requested line 301 // The function returns true if a write request has already been sent 302 /////////////////////////////////////////////////////////////////////// 303 bool hit_write(const addr_t nline, size_t *index) 304 { 305 for(size_t i=0; i<size_tab; i++){ 306 if(tab[i].valid && (nline==tab[i].nline) && !(tab[i].xram_read)) { 307 *index = i; 308 return true; 309 } 310 } 311 return false; 312 } 295 313 296 314 ///////////////////////////////////////////////////////////////////// -
branches/ODCCP/modules/vci_mem_cache/caba/source/src/vci_mem_cache.cpp
r449 r460 217 217 "IXR_CMD_CAS_IDLE", 218 218 "IXR_CMD_XRAM_IDLE", 219 "IXR_CMD_CLEANUP_IDLE", 219 220 "IXR_CMD_READ", 220 221 "IXR_CMD_WRITE", 221 222 "IXR_CMD_CAS", 222 "IXR_CMD_XRAM" 223 "IXR_CMD_XRAM", 224 "IXR_CMD_CLEANUP_DATA" 223 225 }; 224 226 const char *cas_fsm_str[] = … … 250 252 "CLEANUP_IDLE", 251 253 "CLEANUP_GET_NLINE", 254 "CLEANUP_GET_DATA", 252 255 "CLEANUP_DIR_REQ", 253 256 "CLEANUP_DIR_LOCK", … … 263 266 "CLEANUP_WRITE_RSP", 264 267 "CLEANUP_CONFIG_ACK", 268 "CLEANUP_IXR_REQ", 269 "CLEANUP_WAIT", 265 270 "CLEANUP_SEND_CLACK" 266 271 }; … … 280 285 "ALLOC_TRT_CAS", 281 286 "ALLOC_TRT_XRAM_RSP", 282 "ALLOC_TRT_IXR_RSP" 287 "ALLOC_TRT_IXR_RSP", 288 "ALLOC_TRT_CLEANUP" 283 289 }; 284 290 const char *alloc_upt_fsm_str[] = … … 333 339 : soclib::caba::BaseModule(name), 334 340 341 m_monitor_ok(false), 342 335 343 p_clk( "p_clk" ), 336 344 p_resetn( "p_resetn" ), … … 496 504 // Allocation for IXR_RSP FSM 497 505 r_ixr_rsp_to_xram_rsp_rok = new sc_signal<bool>[m_trt_lines]; 506 //r_ixr_rsp_to_xram_rsp_no_coherent = new sc_signal<bool>[m_trt_lines]; 498 507 499 508 // Allocation for XRAM_RSP FSM … … 517 526 r_cas_data = new sc_signal<data_t>[nwords]; 518 527 r_cas_rdata = new sc_signal<data_t>[2]; 528 529 // Allocation for ODCCP 530 r_cleanup_data = new sc_signal<data_t>[nwords]; 531 r_cleanup_to_ixr_cmd_data = new sc_signal<data_t>[nwords]; 519 532 520 533 // Allocation for debug … … 631 644 632 645 ///////////////////////////////////////// 646 tmpl(void) ::clear_stats() 647 ///////////////////////////////////////// 648 { 649 m_cpt_cycles = 0; 650 m_cpt_read = 0; 651 m_cpt_read_miss = 0; 652 m_cpt_write = 0; 653 m_cpt_write_miss = 0; 654 m_cpt_write_cells = 0; 655 m_cpt_write_dirty = 0; 656 m_cpt_update = 0; 657 m_cpt_update_mult = 0; 658 m_cpt_inval_brdcast = 0; 659 m_cpt_inval = 0; 660 m_cpt_inval_mult = 0; 661 m_cpt_cleanup = 0; 662 m_cpt_cleanup_data = 0; 663 m_cpt_ll = 0; 664 m_cpt_sc = 0; 665 m_cpt_cas = 0; 666 m_cpt_trt_full = 0; 667 m_cpt_trt_rb = 0; 668 m_cpt_dir_unused = 0; 669 m_cpt_upt_unused = 0; 670 m_cpt_heap_unused = 0; 671 m_cpt_trt_unused = 0; 672 m_cpt_read_fsm_n_dir_lock = 0; 673 m_cpt_read_fsm_dir_lock = 0; 674 m_cpt_read_fsm_dir_used = 0; 675 m_cpt_read_fsm_trt_lock = 0; 676 m_cpt_read_fsm_heap_lock = 0; 677 m_cpt_write_fsm_dir_lock = 0; 678 m_cpt_write_fsm_n_dir_lock = 0; 679 m_cpt_write_fsm_upt_lock = 0; 680 m_cpt_write_fsm_heap_lock = 0; 681 m_cpt_write_fsm_dir_used = 0; 682 m_cpt_write_fsm_trt_lock = 0; 683 m_cpt_cas_fsm_n_dir_lock = 0; 684 m_cpt_cas_fsm_dir_lock = 0; 685 m_cpt_cas_fsm_upt_lock = 0; 686 m_cpt_cas_fsm_heap_lock = 0; 687 m_cpt_cas_fsm_trt_lock = 0; 688 m_cpt_cas_fsm_dir_used = 0; 689 m_cpt_xram_rsp_fsm_n_dir_lock = 0; 690 m_cpt_xram_rsp_fsm_dir_lock = 0; 691 m_cpt_xram_rsp_fsm_trt_lock = 0; 692 m_cpt_xram_rsp_fsm_upt_lock = 0; 693 m_cpt_xram_rsp_fsm_heap_lock = 0; 694 m_cpt_xram_rsp_fsm_dir_used = 0; 695 m_cpt_cleanup_fsm_dir_lock = 0; 696 m_cpt_cleanup_fsm_n_dir_lock = 0; 697 m_cpt_cleanup_fsm_heap_lock = 0; 698 m_cpt_cleanup_fsm_upt_lock = 0; 699 m_cpt_cleanup_fsm_dir_used = 0; 700 m_cpt_ixr_fsm_trt_lock = 0; 701 m_cpt_multi_ack_fsm_upt_lock = 0; 702 } 703 ///////////////////////////////////////// 633 704 tmpl(void) ::print_stats() 634 705 ///////////////////////////////////////// … … 637 708 std::cout 638 709 << "MEM_CACHE " << name() << " / Time = " << m_cpt_cycles << std::endl 639 << "- READ RATE = " << (double) m_cpt_read/m_cpt_cycles << std::endl 640 << "- READ TOTAL = " << m_cpt_read << std::endl 641 << "- READ MISS RATE = " << (double) m_cpt_read_miss/m_cpt_read << std::endl 642 << "- WRITE RATE = " << (double) m_cpt_write/m_cpt_cycles << std::endl 643 << "- WRITE TOTAL = " << m_cpt_write << std::endl 644 << "- WRITE MISS RATE = " << (double) m_cpt_write_miss/m_cpt_write << std::endl 645 << "- WRITE BURST LENGTH = " << (double) m_cpt_write_cells/m_cpt_write << std::endl 646 << "- WRITE BURST TOTAL = " << m_cpt_write_cells << std::endl 647 << "- REQUESTS TRT FULL = " << m_cpt_trt_full << std::endl 648 << "- READ TRT BLOKED HIT = " << m_cpt_trt_rb << std::endl 649 << "- UPDATE RATE = " << (double) m_cpt_update/m_cpt_cycles << std::endl 650 << "- UPDATE ARITY = " << (double) m_cpt_update_mult/m_cpt_update << std::endl 651 << "- INVAL MULTICAST RATE = " << (double)(m_cpt_inval-m_cpt_inval_brdcast) /m_cpt_cycles << std::endl 652 << "- INVAL MULTICAST ARITY= " << (double) m_cpt_inval_mult/ (m_cpt_inval-m_cpt_inval_brdcast) << std::endl 653 << "- INVAL BROADCAST RATE = " << (double) m_cpt_inval_brdcast/m_cpt_cycles << std::endl 654 << "- SAVE DIRTY RATE = " << (double) m_cpt_write_dirty/m_cpt_cycles << std::endl 655 << "- CLEANUP RATE = " << (double) m_cpt_cleanup/m_cpt_cycles << std::endl 656 << "- LL RATE = " << (double) m_cpt_ll/m_cpt_cycles << std::endl 657 << "- SC RATE = " << (double) m_cpt_sc/m_cpt_cycles << std::endl 658 << "- CAS RATE = " << (double) m_cpt_cas/m_cpt_cycles << std::endl; 710 << "- READ RATE = " << (double) m_cpt_read/m_cpt_cycles << std::endl 711 << "- READ TOTAL = " << m_cpt_read << std::endl 712 << "- READ MISS RATE = " << (double) m_cpt_read_miss/m_cpt_read << std::endl 713 << "- WRITE RATE = " << (double) m_cpt_write/m_cpt_cycles << std::endl 714 << "- WRITE TOTAL = " << m_cpt_write << std::endl 715 << "- WRITE MISS RATE = " << (double) m_cpt_write_miss/m_cpt_write << std::endl 716 << "- WRITE BURST LENGTH = " << (double) m_cpt_write_cells/m_cpt_write << std::endl 717 << "- WRITE BURST TOTAL = " << m_cpt_write_cells << std::endl 718 << "- REQUESTS TRT FULL = " << m_cpt_trt_full << std::endl 719 << "- READ TRT BLOKED HIT = " << m_cpt_trt_rb << std::endl 720 << "- UPDATE RATE = " << (double) m_cpt_update/m_cpt_cycles << std::endl 721 << "- UPDATE ARITY = " << (double) m_cpt_update_mult/m_cpt_update << std::endl 722 << "- INVAL MULTICAST RATE = " << (double)(m_cpt_inval-m_cpt_inval_brdcast) /m_cpt_cycles << std::endl 723 << "- INVAL MULTICAST ARITY = " << (double) m_cpt_inval_mult/ (m_cpt_inval-m_cpt_inval_brdcast) << std::endl 724 << "- INVAL BROADCAST RATE = " << (double) m_cpt_inval_brdcast/m_cpt_cycles << std::endl 725 << "- SAVE DIRTY RATE = " << (double) m_cpt_write_dirty/m_cpt_cycles << std::endl 726 << "- CLEANUP RATE = " << (double) m_cpt_cleanup/m_cpt_cycles << std::endl 727 << "- CLEANUP TOTAL = " << (double) m_cpt_cleanup << std::endl 728 << "- CLEANUP WITH DATA RATE = " << (double) m_cpt_cleanup_data/m_cpt_cycles << std::endl 729 << "- CLEANUP WITH DATA TOTAL = " << (double) m_cpt_cleanup_data << std::endl 730 << "- LL RATE = " << (double) m_cpt_ll/m_cpt_cycles << std::endl 731 << "- SC RATE = " << (double) m_cpt_sc/m_cpt_cycles << std::endl 732 << "- CAS RATE = " << (double) m_cpt_cas/m_cpt_cycles << std::endl << std::endl; 733 734 /* << "- WAIT DIR LOCK in READ_FSM = " << (double) m_cpt_read_fsm_dir_lock/m_cpt_read_fsm_n_dir_lock << std::endl 735 << "- NB CYCLES IN DIR LOCK in READ_FSM = " << (double) m_cpt_read_fsm_dir_used/m_cpt_read_fsm_n_dir_lock << std::endl 736 << "- WAIT DIR LOCK in WRITE_FSM = " << (double) m_cpt_write_fsm_dir_lock/m_cpt_write_fsm_n_dir_lock << std::endl 737 << "- NB CYCLES IN DIR LOCK in WRITE_FSM = " << (double) m_cpt_write_fsm_dir_used/m_cpt_write_fsm_n_dir_lock << std::endl 738 << "- WAIT DIR LOCK in XRAM_FSM = " << (double) m_cpt_xram_rsp_fsm_dir_lock/m_cpt_xram_rsp_fsm_n_dir_lock << std::endl 739 << "- NB CYCLES IN DIR LOCK in XRAM_FSM = " << (double) m_cpt_xram_rsp_fsm_dir_used/m_cpt_xram_rsp_fsm_n_dir_lock << std::endl 740 << "- WAIT DIR LOCK in CLEANUP_FSM = " << (double) m_cpt_cleanup_fsm_dir_lock/m_cpt_cleanup_fsm_n_dir_lock << std::endl 741 << "- NB CYCLES IN DIR LOCK in CLEANUP_FSM = " << (double) m_cpt_cleanup_fsm_dir_used/m_cpt_cleanup_fsm_n_dir_lock << std::endl 742 << "- WAIT DIR LOCK in CAS_FSM = " << (double) m_cpt_cas_fsm_dir_lock/m_cpt_cas_fsm_n_dir_lock << std::endl 743 << "- NB CYCLES IN LOCK in CAS_FSM = " << (double) m_cpt_cas_fsm_dir_used/m_cpt_cas_fsm_n_dir_lock << std::endl 744 << "- DIR UNUSED RATE = " << (double) m_cpt_dir_unused/m_cpt_cycles << std::endl << std::endl 745 746 << "- WAIT TRT LOCK in READ_FSM = " << (double) m_cpt_read_fsm_trt_lock/m_cpt_read_fsm_n_trt_lock << std::endl 747 << "- NB CYCLES IN TRT LOCK in READ_FSM = " << (double) m_cpt_read_fsm_trt_used/m_cpt_read_fsm_n_trt_lock << std::endl 748 << "- WAIT TRT LOCK in WRITE_FSM = " << (double) m_cpt_write_fsm_trt_lock/m_cpt_write_fsm_n_trt_lock << std::endl 749 << "- NB CYCLES IN TRT LOCK in WRITE_FSM = " << (double) m_cpt_write_fsm_trt_used/m_cpt_write_fsm_n_trt_lock << std::endl 750 << "- WAIT TRT LOCK in CAS_FSM = " << (double) m_cpt_cas_fsm_trt_lock/m_cpt_cas_fsm_n_trt_lock << std::endl 751 << "- NB CYCLES IN TRT LOCK in CAS_FSM = " << (double) m_cpt_cas_fsm_trt_used/m_cpt_cas_fsm_n_trt_lock << std::endl 752 << "- WAIT TRT LOCK in XRAM_FSM = " << (double) m_cpt_xram_rsp_fsm_trt_lock/m_cpt_xram_rsp_fsm_n_trt_lock << std::endl 753 << "- NB CYCLES IN TRT LOCK in XRAM_FSM = " << (double) m_cpt_xram_rsp_fsm_trt_used/m_cpt_xram_rsp_fsm_n_trt_lock << std::endl 754 << "- WAIT TRT LOCK in IXR_FSM = " << (double) m_cpt_ixr_fsm_trt_lock/m_cpt_ixr_fsm_n_trt_lock << std::endl 755 << "- NB CYCLES IN TRT LOCK in IXR_FSM = " << (double) m_cpt_ixr_fsm_trt_used/m_cpt_ixr_fsm_n_trt_lock << std::endl 756 << "- TRT UNUSED RATE = " << (double) m_cpt_trt_unused/m_cpt_cycles << std::endl << std::endl 757 758 << "- WAIT UPT LOCK in WRITE_FSM = " << (double) m_cpt_write_fsm_upt_lock/m_cpt_write_fsm_n_upt_lock << std::endl 759 << "- NB CYCLES IN UPT LOCK in WRITE_FSM = " << (double) m_cpt_write_fsm_upt_used/m_cpt_write_fsm_n_upt_lock << std::endl 760 << "- WAIT UPT LOCK in XRAM_FSM = " << (double) m_cpt_xram_rsp_fsm_upt_lock/m_cpt_xram_rsp_fsm_n_upt_lock << std::endl 761 << "- NB CYCLES IN UPT LOCK in XRAM_FSM = " << (double) m_cpt_xram_rsp_fsm_upt_used/m_cpt_xram_rsp_fsm_n_upt_lock << std::endl 762 << "- WAIT UPT LOCK in MULTIACK_FSM = " << (double) m_cpt_multi_ack_fsm_upt_lock/m_cpt_multi_ack_fsm_n_upt_lock << std::endl 763 << "- NB CYCLES IN UPT LOCK in MULTIACK_FSM = " << (double) m_cpt_multi_ack_fsm_upt_used/m_cpt_multi_ack_fsm_n_upt_lock << std::endl 764 << "- WAIT UPT LOCK in CLEANUP_FSM = " << (double) m_cpt_cleanup_fsm_upt_lock/m_cpt_cleanup_fsm_n_upt_lock << std::endl 765 << "- NB CYCLES IN UPT LOCK in CLEANUP_FSM = " << (double) m_cpt_cleanup_fsm_upt_used/m_cpt_cleanup_fsm_n_upt_lock << std::endl 766 << "- WAIT UPT LOCK in CAS_FSM = " << (double) m_cpt_cas_fsm_upt_lock/m_cpt_cas_fsm_n_upt_lock << std::endl 767 << "- NB CYCLES IN UPT LOCK in CAS_FSM = " << (double) m_cpt_cas_fsm_upt_used/m_cpt_cas_fsm_n_upt_lock << std::endl 768 << "- UPT UNUSED RATE = " << (double) m_cpt_upt_unused/m_cpt_cycles << std::endl << std::endl 769 770 << "- WAIT HEAP LOCK in READ_FSM = " << (double) m_cpt_read_fsm_heap_lock/m_cpt_read_fsm_n_heap_lock << std::endl 771 << "- NB CYCLES IN HEAP LOCK in READ_FSM = " << (double) m_cpt_read_fsm_heap_used/m_cpt_read_fsm_n_heap_lock << std::endl 772 << "- WAIT HEAP LOCK in WRITE_FSM = " << (double) m_cpt_write_fsm_heap_lock/m_cpt_write_fsm_n_heap_lock << std::endl 773 << "- NB CYCLES IN HEAP LOCK in WRITE_FSM = " << (double) m_cpt_write_fsm_heap_used/m_cpt_write_fsm_n_heap_lock << std::endl 774 << "- WAIT HEAP LOCK in XRAM_FSM = " << (double) m_cpt_xram_rsp_fsm_heap_lock/m_cpt_xram_rsp_fsm_n_heap_lock << std::endl 775 << "- NB CYCLES IN HEAP LOCK in XRAM_FSM = " << (double) m_cpt_xram_rsp_fsm_heap_used/m_cpt_xram_rsp_fsm_n_heap_lock << std::endl 776 << "- WAIT HEAP LOCK in CLEANUP_FSM = " << (double) m_cpt_cleanup_fsm_heap_lock/m_cpt_cleanup_fsm_n_heap_lock << std::endl 777 << "- NB CYCLES IN HEAP LOCK in CLEANUP_FSM = " << (double) m_cpt_cleanup_fsm_heap_used/m_cpt_cleanup_fsm_n_heap_lock << std::endl 778 << "- WAIT HEAP LOCK in CAS_FSM = " << (double) m_cpt_cas_fsm_heap_lock/m_cpt_cas_fsm_n_heap_lock << std::endl 779 << "- NB CYCLES IN HEAP LOCK in CAS_FSM = " << (double) m_cpt_cas_fsm_heap_used/m_cpt_cas_fsm_n_heap_lock << std::endl 780 << "- HEAP UNUSED RATE = " << (double) m_cpt_heap_unused/m_cpt_cycles << std::endl;*/ 659 781 } 660 782 … … 664 786 { 665 787 delete [] r_ixr_rsp_to_xram_rsp_rok; 788 //delete [] r_ixr_rsp_to_xram_rsp_no_coherent; 666 789 667 790 delete [] r_xram_rsp_victim_data; … … 675 798 delete [] r_write_be; 676 799 delete [] r_write_to_cc_send_data; 800 801 delete [] r_cleanup_data; 802 delete [] r_cleanup_to_ixr_cmd_data; 677 803 } 678 804 … … 788 914 { 789 915 r_ixr_rsp_to_xram_rsp_rok[i] = false; 916 //r_ixr_rsp_to_xram_rsp_no_coherent[i] = false; 790 917 } 791 918 … … 808 935 r_tgt_rsp_key_sent = false; 809 936 937 // ODCCP 938 r_cleanup_data_index = 0; 939 r_cleanup_trdid = 0; 940 r_cleanup_pktid = 0; 941 r_cleanup_contains_data = false; 942 r_cleanup_to_ixr_cmd_req = false; 943 r_cleanup_to_ixr_cmd_l1_dirty_ncc = false; 944 r_xram_rsp_to_ixr_cmd_inval_ncc_pending = false; 945 r_cleanup_to_ixr_cmd_srcid = 0; 946 r_cleanup_to_ixr_cmd_trdid = 0; 947 r_cleanup_to_ixr_cmd_pktid = 0; 948 r_cleanup_to_ixr_cmd_nline = 0; 949 for (size_t word = 0; word < m_words; word ++) 950 { 951 r_cleanup_to_ixr_cmd_data[word] = 0; 952 r_cleanup_data[word] = 0; 953 } 954 955 810 956 // Activity counters 811 m_cpt_cycles = 0; 812 m_cpt_read = 0; 813 m_cpt_read_miss = 0; 814 m_cpt_write = 0; 815 m_cpt_write_miss = 0; 816 m_cpt_write_cells = 0; 817 m_cpt_write_dirty = 0; 818 m_cpt_update = 0; 819 m_cpt_update_mult = 0; 820 m_cpt_inval_brdcast = 0; 821 m_cpt_inval = 0; 822 m_cpt_inval_mult = 0; 823 m_cpt_cleanup = 0; 824 m_cpt_ll = 0; 825 m_cpt_sc = 0; 826 m_cpt_cas = 0; 827 m_cpt_trt_full = 0; 828 m_cpt_trt_rb = 0; 957 m_cpt_cycles = 0; 958 m_cpt_read = 0; 959 m_cpt_read_miss = 0; 960 m_cpt_write = 0; 961 m_cpt_write_miss = 0; 962 m_cpt_write_cells = 0; 963 m_cpt_write_dirty = 0; 964 m_cpt_update = 0; 965 m_cpt_update_mult = 0; 966 m_cpt_inval_brdcast = 0; 967 m_cpt_inval = 0; 968 m_cpt_inval_mult = 0; 969 m_cpt_cleanup = 0; 970 m_cpt_cleanup_data = 0; 971 m_cpt_ll = 0; 972 m_cpt_sc = 0; 973 m_cpt_cas = 0; 974 m_cpt_trt_full = 0; 975 m_cpt_trt_rb = 0; 976 m_cpt_dir_unused = 0; 977 m_cpt_upt_unused = 0; 978 m_cpt_heap_unused = 0; 979 m_cpt_trt_unused = 0; 980 m_cpt_read_fsm_n_dir_lock = 0; 981 m_cpt_read_fsm_dir_lock = 0; 982 m_cpt_read_fsm_dir_used = 0; 983 m_cpt_read_fsm_trt_lock = 0; 984 m_cpt_read_fsm_heap_lock = 0; 985 m_cpt_write_fsm_dir_lock = 0; 986 m_cpt_write_fsm_n_dir_lock = 0; 987 m_cpt_write_fsm_upt_lock = 0; 988 m_cpt_write_fsm_heap_lock = 0; 989 m_cpt_write_fsm_dir_used = 0; 990 m_cpt_write_fsm_trt_lock = 0; 991 m_cpt_cas_fsm_n_dir_lock = 0; 992 m_cpt_cas_fsm_dir_lock = 0; 993 m_cpt_cas_fsm_upt_lock = 0; 994 m_cpt_cas_fsm_heap_lock = 0; 995 m_cpt_cas_fsm_trt_lock = 0; 996 m_cpt_cas_fsm_dir_used = 0; 997 m_cpt_xram_rsp_fsm_n_dir_lock = 0; 998 m_cpt_xram_rsp_fsm_dir_lock = 0; 999 m_cpt_xram_rsp_fsm_trt_lock = 0; 1000 m_cpt_xram_rsp_fsm_upt_lock = 0; 1001 m_cpt_xram_rsp_fsm_heap_lock = 0; 1002 m_cpt_xram_rsp_fsm_dir_used = 0; 1003 m_cpt_cleanup_fsm_dir_lock = 0; 1004 m_cpt_cleanup_fsm_n_dir_lock = 0; 1005 m_cpt_cleanup_fsm_heap_lock = 0; 1006 m_cpt_cleanup_fsm_upt_lock = 0; 1007 m_cpt_cleanup_fsm_dir_used = 0; 1008 m_cpt_ixr_fsm_trt_lock = 0; 1009 m_cpt_multi_ack_fsm_upt_lock = 0; 829 1010 830 1011 return; … … 1319 1500 case MULTI_ACK_UPT_LOCK: 1320 1501 { 1502 m_cpt_multi_ack_fsm_upt_lock++; 1321 1503 // get lock to the UPDATE table 1322 if(r_alloc_upt_fsm.read() != ALLOC_UPT_MULTI_ACK) break;1504 if(r_alloc_upt_fsm.read() != ALLOC_UPT_MULTI_ACK) break; 1323 1505 1324 1506 // decrement the number of expected responses 1325 1507 size_t count = 0; 1326 1508 bool valid = m_upt.decrement(r_multi_ack_upt_index.read(), count); 1509 1327 1510 1328 1511 if(not valid) … … 1349 1532 << " entry = " << r_multi_ack_upt_index.read() 1350 1533 << " / rsp_count = " << std::dec << count << std::endl; 1534 m_cpt_multi_ack_fsm_n_upt_lock++; 1351 1535 #endif 1352 1536 break; … … 1874 2058 { 1875 2059 r_read_fsm = READ_DIR_LOCK; 2060 m_cpt_read_fsm_n_dir_lock++; 1876 2061 } 1877 2062 … … 1880 2065 std::cout << " <MEMC " << name() << " READ_DIR_REQ> Requesting DIR lock " << std::endl; 1881 2066 #endif 2067 2068 m_cpt_read_fsm_dir_lock++; 2069 1882 2070 break; 1883 2071 } … … 1981 2169 if(m_monitor_ok) check_monitor( m_cmd_read_addr_fifo.read(), r_read_data[0], true); 1982 2170 1983 // update the cache directory 1984 DirectoryEntry entry; 1985 entry.valid = true; 1986 entry.is_cnt = is_cnt; 1987 entry.dirty = r_read_dirty.read(); 1988 entry.tag = r_read_tag.read(); 1989 entry.lock = r_read_lock.read(); 1990 entry.ptr = r_read_ptr.read(); 1991 1992 if(cached_read) // Cached read => we must update the copies 1993 { 1994 if(!is_cnt) // Not counter mode 1995 { 1996 entry.owner.srcid = m_cmd_read_srcid_fifo.read(); 2171 // update the cache directory 2172 DirectoryEntry entry; 2173 entry.valid = true; 2174 entry.is_cnt = is_cnt; 2175 entry.dirty = r_read_dirty.read(); 2176 entry.tag = r_read_tag.read(); 2177 entry.lock = r_read_lock.read(); 2178 entry.ptr = r_read_ptr.read(); 2179 2180 /*ODCCP*/ // if pktid = 0x9 that means read on no coherent line 2181 if(m_cmd_read_pktid_fifo.read() == 0x9){ 2182 entry.coherent = false; 2183 } 2184 else{ 2185 entry.coherent = true; 2186 } 2187 2188 if(cached_read) // Cached read => we must update the copies 2189 { 2190 if(!is_cnt) // Not counter mode 2191 { 2192 entry.owner.srcid = m_cmd_read_srcid_fifo.read(); 1997 2193 #if L1_MULTI_CACHE 1998 1999 #endif 2000 2001 2002 2003 2004 2005 2194 entry.owner.cache_id = m_cmd_read_pktid_fifo.read(); 2195 #endif 2196 entry.owner.inst = inst_read; 2197 entry.count = r_read_count.read() + 1; 2198 } 2199 else // Counter mode 2200 { 2201 entry.owner.srcid = 0; 2006 2202 #if L1_MULTI_CACHE 2007 2008 #endif 2009 2010 2011 2012 2013 2014 2015 2203 entry.owner.cache_id = 0; 2204 #endif 2205 entry.owner.inst = false; 2206 entry.count = r_read_count.read() + 1; 2207 } 2208 } 2209 else // Uncached read 2210 { 2211 entry.owner.srcid = r_read_copy.read(); 2016 2212 #if L1_MULTI_CACHE 2017 2018 #endif 2019 2020 2021 2213 entry.owner.cache_id = r_read_copy_cache.read(); 2214 #endif 2215 entry.owner.inst = r_read_copy_inst.read(); 2216 entry.count = r_read_count.read(); 2217 } 2022 2218 2023 2219 #if DEBUG_MEMC_READ … … 2033 2229 #endif 2034 2230 2035 m_cache_directory.write(set, way, entry); 2036 r_read_fsm = READ_RSP; 2037 } 2038 break; 2231 if(m_monitor_ok) 2232 { 2233 char buf[80]; 2234 snprintf(buf, 80, "READ_DIR_HIT srcid %d, ins %d", 2235 (int)m_cmd_read_srcid_fifo.read(), 2236 (int)((m_cmd_read_pktid_fifo.read()&0x2)!=0)); 2237 check_monitor(m_cmd_read_addr_fifo.read(), r_read_data[0], true); 2238 } 2239 m_cache_directory.write(set, way, entry); 2240 r_read_fsm = READ_RSP; 2241 } 2242 break; 2039 2243 } 2040 2244 /////////////////// … … 2044 2248 { 2045 2249 r_read_fsm = READ_HEAP_LOCK; 2250 m_cpt_read_fsm_n_heap_lock++; 2046 2251 } 2047 2252 … … 2051 2256 << " Requesting HEAP lock " << std::endl; 2052 2257 #endif 2258 2259 m_cpt_read_fsm_heap_lock++; 2260 2053 2261 break; 2054 2262 } … … 2283 2491 { 2284 2492 size_t index = 0; 2493 size_t index_write = 0; 2285 2494 addr_t addr = (addr_t) m_cmd_read_addr_fifo.read(); 2286 2495 bool hit_read = m_trt.hit_read(m_nline[addr], index); 2287 bool hit_write = m_trt.hit_write(m_nline[addr] );2496 bool hit_write = m_trt.hit_write(m_nline[addr], &index_write); 2288 2497 bool wok = !m_trt.full(index); 2289 2498 … … 2306 2515 << " hit_read = " << hit_read 2307 2516 << " / hit_write = " << hit_write 2517 << " / Index = " << index_write 2308 2518 << " / full = " << !wok << std::endl; 2309 #endif 2310 } 2519 m_cpt_read_fsm_n_trt_lock++; 2520 #endif 2521 } 2522 2523 m_cpt_read_fsm_trt_lock++; 2524 2311 2525 break; 2312 2526 } … … 2533 2747 2534 2748 r_write_fsm = WRITE_DIR_LOCK; 2749 m_cpt_write_fsm_n_dir_lock++; 2535 2750 } 2536 2751 … … 2540 2755 << std::endl; 2541 2756 #endif 2757 2758 m_cpt_write_fsm_dir_lock++; 2542 2759 2543 2760 break; … … 2792 3009 if(wok) r_write_fsm = WRITE_UPT_HEAP_LOCK; 2793 3010 else r_write_fsm = WRITE_WAIT; 2794 } 3011 m_cpt_write_fsm_n_upt_lock++; 3012 } 3013 3014 m_cpt_write_fsm_upt_lock++; 3015 2795 3016 break; 2796 3017 } … … 2808 3029 #endif 2809 3030 r_write_fsm = WRITE_UPT_REQ; 2810 } 3031 m_cpt_write_fsm_n_heap_lock++; 3032 } 3033 3034 m_cpt_write_fsm_heap_lock++; 3035 2811 3036 break; 2812 3037 } … … 3093 3318 m_cpt_trt_full++; 3094 3319 } 3095 } 3320 m_cpt_write_fsm_n_trt_lock++; 3321 } 3322 3323 m_cpt_write_fsm_trt_lock++; 3324 3096 3325 break; 3097 3326 } … … 3212 3441 << " : wok = " << wok << " / index = " << wok_index << std::endl; 3213 3442 #endif 3214 } 3443 m_cpt_write_fsm_n_trt_lock++; 3444 } 3445 3446 m_cpt_write_fsm_trt_lock++; 3447 3215 3448 break; 3216 3449 } … … 3239 3472 nb_copies, 3240 3473 index); 3241 3242 3474 #if DEBUG_MEMC_WRITE 3243 3475 if( m_debug and wok ) … … 3249 3481 if(wok) r_write_fsm = WRITE_BC_DIR_INVAL; 3250 3482 else r_write_fsm = WRITE_WAIT; 3251 } 3483 m_cpt_write_fsm_n_upt_lock++; 3484 } 3485 3486 m_cpt_write_fsm_upt_lock++; 3487 3252 3488 break; 3253 3489 } … … 3382 3618 //////////////////////// 3383 3619 case IXR_CMD_READ_IDLE: 3384 {3385 3620 if (r_write_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_WRITE; 3386 3621 else if(r_cas_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_CAS; 3387 3622 else if(r_xram_rsp_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_XRAM; 3623 else if(r_cleanup_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_CLEANUP_DATA; 3388 3624 else if(r_read_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_READ; 3389 3625 break; 3390 }3391 3626 //////////////////////// 3392 3627 case IXR_CMD_WRITE_IDLE: 3393 { 3394 if (r_cas_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_CAS; 3628 if(r_cas_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_CAS; 3395 3629 else if(r_xram_rsp_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_XRAM; 3630 else if(r_cleanup_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_CLEANUP_DATA; 3396 3631 else if(r_read_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_READ; 3397 3632 else if(r_write_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_WRITE; 3398 3633 break; 3399 }3400 3634 //////////////////////// 3401 3635 case IXR_CMD_CAS_IDLE: 3402 {3403 if (r_xram_rsp_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_XRAM;3636 if(r_xram_rsp_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_XRAM; 3637 else if(r_cleanup_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_CLEANUP_DATA; 3404 3638 else if(r_read_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_READ; 3405 3639 else if(r_write_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_WRITE; 3406 3640 else if(r_cas_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_CAS; 3407 3641 break; 3408 }3409 3642 //////////////////////// 3410 3643 case IXR_CMD_XRAM_IDLE: 3411 {3412 if(r_read_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_READ;3413 else if(r_write_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_WRITE;3644 if(r_cleanup_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_CLEANUP_DATA; 3645 else if(r_read_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_READ; 3646 else if(r_write_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_WRITE; 3414 3647 else if(r_cas_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_CAS; 3415 3648 else if(r_xram_rsp_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_XRAM; 3416 3649 break; 3417 } 3650 //////////////////////// 3651 case IXR_CMD_CLEANUP_IDLE: 3652 if(r_read_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_READ; 3653 else if(r_write_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_WRITE; 3654 else if(r_cas_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_CAS; 3655 else if(r_xram_rsp_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_XRAM; 3656 else if(r_cleanup_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_CLEANUP_DATA; 3657 break; 3418 3658 ////////////////// // send a get from READ FSM 3419 3659 case IXR_CMD_READ: … … 3541 3781 break; 3542 3782 } 3783 3784 //////////////////////// 3785 case IXR_CMD_CLEANUP_DATA: // send a put command to XRAM 3786 if(p_vci_ixr.cmdack) 3787 { 3788 if(r_ixr_cmd_cpt.read() == (m_words - 2)) 3789 { 3790 r_ixr_cmd_cpt = 0; 3791 r_ixr_cmd_fsm = IXR_CMD_CLEANUP_IDLE; 3792 r_cleanup_to_ixr_cmd_req = false; 3793 r_xram_rsp_to_ixr_cmd_inval_ncc_pending = false; 3794 } 3795 else 3796 { 3797 r_ixr_cmd_cpt = r_ixr_cmd_cpt.read() + 2; 3798 } 3799 3800 #if DEBUG_MEMC_IXR_CMD 3801 if(m_debug) 3802 { 3803 std::cout << " <MEMC " << name() << ".IXR_CMD_CLEANUP_DATA> Send a put request to xram" << std::endl; 3804 } 3805 #endif 3806 } 3807 break; 3543 3808 3544 3809 } // end switch r_ixr_cmd_fsm … … 3619 3884 << r_ixr_rsp_trt_index.read() << std::endl; 3620 3885 #endif 3621 } 3886 m_cpt_ixr_fsm_n_trt_lock++; 3887 } 3888 3889 m_cpt_ixr_fsm_trt_lock++; 3890 3622 3891 break; 3623 3892 } … … 3645 3914 { 3646 3915 r_ixr_rsp_to_xram_rsp_rok[r_ixr_rsp_trt_index.read()]=true; 3916 /*if(p_vci_ixr.rpktid.read()&0xF == 0x9) 3917 r_ixr_rsp_to_xram_rsp_no_coherent[r_ixr_rsp_trt_index.read()] = true; 3918 else 3919 r_ixr_rsp_to_xram_rsp_no_coherent[r_ixr_rsp_trt_index.read()] = false;*/ 3647 3920 r_ixr_rsp_fsm = IXR_RSP_IDLE; 3648 3921 } … … 3655 3928 << " / data = " << std::hex << data << std::endl; 3656 3929 #endif 3657 } 3930 m_cpt_ixr_fsm_n_trt_lock++; 3931 } 3932 m_cpt_ixr_fsm_trt_lock++; 3658 3933 break; 3659 3934 } … … 3728 4003 << " Get access to DIR and TRT" << std::endl; 3729 4004 #endif 3730 } 4005 m_cpt_xram_rsp_fsm_n_dir_lock++; 4006 m_cpt_xram_rsp_fsm_n_trt_lock++; 4007 } 4008 m_cpt_xram_rsp_fsm_dir_lock++; 4009 m_cpt_xram_rsp_fsm_trt_lock++; 3731 4010 break; 3732 4011 } … … 3754 4033 r_xram_rsp_victim_copy_cache= victim.owner.cache_id; 3755 4034 #endif 4035 4036 r_xram_rsp_victim_coherent = victim.coherent; 3756 4037 r_xram_rsp_victim_copy_inst = victim.owner.inst; 3757 4038 r_xram_rsp_victim_count = victim.count; … … 3764 4045 r_xram_rsp_victim_dirty = victim.dirty; 3765 4046 4047 3766 4048 if(!r_xram_rsp_trt_buf.rerror) 3767 4049 { 3768 r_xram_rsp_fsm = XRAM_RSP_INVAL_LOCK; 4050 /*ODCCP*/ //if victim is no coherent and there is an inval no coherent pending we wait 4051 if(!victim.coherent and r_xram_rsp_to_ixr_cmd_inval_ncc_pending.read()) 4052 { 4053 r_xram_rsp_fsm = XRAM_RSP_INVAL_WAIT; 4054 } 4055 else 4056 { 4057 r_xram_rsp_fsm = XRAM_RSP_INVAL_LOCK; 4058 } 3769 4059 } 3770 4060 else … … 3829 4119 #endif 3830 4120 } 3831 } 4121 m_cpt_xram_rsp_fsm_n_upt_lock++; 4122 } 4123 4124 m_cpt_xram_rsp_fsm_upt_lock++; 4125 3832 4126 break; 3833 4127 } … … 3892 4186 entry.owner.inst = inst_read; 3893 4187 entry.count = 1; 4188 3894 4189 } 3895 4190 else … … 3902 4197 entry.count = 0; 3903 4198 } 4199 4200 /*ODCCP*/ //if pktid = 0x9 that means line no coherent 4201 if(r_xram_rsp_trt_buf.pktid == 0x9){ 4202 entry.coherent = false; 4203 } 4204 else{ 4205 entry.coherent = true; 4206 } 4207 3904 4208 m_cache_directory.write(set, way, entry); 3905 4209 … … 3950 4254 #endif 3951 4255 3952 // If the victim is not dirty , we don't need another XRAM put transaction,4256 // If the victim is not dirty and coherent or victim's count egal 0 , we don't need another XRAM put transaction, 3953 4257 // and we can erase the TRT entry 3954 if(!r_xram_rsp_victim_dirty.read() ) m_trt.erase(r_xram_rsp_trt_index.read());4258 if(!r_xram_rsp_victim_dirty.read() and (r_xram_rsp_victim_coherent.read() or (r_xram_rsp_victim_count.read() == 0))) m_trt.erase(r_xram_rsp_trt_index.read()); 3955 4259 3956 4260 // Next state 3957 if(r_xram_rsp_victim_dirty.read() ) r_xram_rsp_fsm = XRAM_RSP_TRT_DIRTY;4261 if(r_xram_rsp_victim_dirty.read() or (!r_xram_rsp_victim_coherent.read() and (r_xram_rsp_victim_count.read() == 1))) r_xram_rsp_fsm = XRAM_RSP_TRT_DIRTY; 3958 4262 else if(r_xram_rsp_trt_buf.proc_read) r_xram_rsp_fsm = XRAM_RSP_DIR_RSP; 3959 4263 else if(r_xram_rsp_victim_inval.read()) r_xram_rsp_fsm = XRAM_RSP_INVAL; … … 3987 4291 else if(r_xram_rsp_victim_inval.read()) r_xram_rsp_fsm = XRAM_RSP_INVAL; 3988 4292 else r_xram_rsp_fsm = XRAM_RSP_WRITE_DIRTY; 3989 } 4293 m_cpt_xram_rsp_fsm_n_trt_lock++; 4294 } 4295 4296 m_cpt_xram_rsp_fsm_trt_lock++; 4297 3990 4298 break; 3991 4299 } … … 4009 4317 4010 4318 if(r_xram_rsp_victim_inval) r_xram_rsp_fsm = XRAM_RSP_INVAL; 4011 else if(r_xram_rsp_victim_dirty ) r_xram_rsp_fsm = XRAM_RSP_WRITE_DIRTY;4319 else if(r_xram_rsp_victim_dirty or (!r_xram_rsp_victim_coherent.read() and (r_xram_rsp_victim_count.read() == 1))) r_xram_rsp_fsm = XRAM_RSP_WRITE_DIRTY; 4012 4320 else r_xram_rsp_fsm = XRAM_RSP_IDLE; 4013 4321 … … 4045 4353 r_xram_rsp_next_ptr = r_xram_rsp_victim_ptr.read(); 4046 4354 4047 if(r_xram_rsp_victim_dirty ) r_xram_rsp_fsm = XRAM_RSP_WRITE_DIRTY;4355 if(r_xram_rsp_victim_dirty or (!r_xram_rsp_victim_coherent.read() and (r_xram_rsp_victim_count.read() == 1))) r_xram_rsp_fsm = XRAM_RSP_WRITE_DIRTY; 4048 4356 else if(not_last_multi_req) r_xram_rsp_fsm = XRAM_RSP_HEAP_REQ; 4049 4357 else r_xram_rsp_fsm = XRAM_RSP_IDLE; … … 4061 4369 case XRAM_RSP_WRITE_DIRTY: // send a write request to IXR_CMD FSM 4062 4370 { 4063 if(!r_xram_rsp_to_ixr_cmd_req.read()) 4064 { 4371 if((!r_xram_rsp_to_ixr_cmd_req.read()) and (!r_xram_rsp_to_ixr_cmd_inval_ncc_pending.read())) 4372 { 4373 4065 4374 r_xram_rsp_to_ixr_cmd_req = true; 4066 4375 r_xram_rsp_to_ixr_cmd_nline = r_xram_rsp_victim_nline.read(); … … 4071 4380 } 4072 4381 m_cpt_write_dirty++; 4382 4383 // if victim is no coherent, we dont request a ixr command 4384 if( (!r_xram_rsp_victim_coherent.read()) and (r_xram_rsp_victim_count.read() == 1) ) 4385 { 4386 r_xram_rsp_to_ixr_cmd_inval_ncc_pending = true; // inval no coherent pending 4387 r_xram_rsp_to_ixr_cmd_req = false; 4388 r_xram_rsp_fsm = XRAM_RSP_IDLE; 4389 break; 4390 } 4073 4391 4074 4392 bool multi_req = !r_xram_rsp_victim_is_cnt.read() and r_xram_rsp_victim_inval.read(); … … 4093 4411 { 4094 4412 r_xram_rsp_fsm = XRAM_RSP_HEAP_ERASE; 4413 m_cpt_xram_rsp_fsm_n_heap_lock++; 4095 4414 } 4096 4415 … … 4100 4419 << " Requesting HEAP lock" << std::endl; 4101 4420 #endif 4421 4422 m_cpt_xram_rsp_fsm_heap_lock++; 4423 4102 4424 break; 4103 4425 } … … 4243 4565 4244 4566 uint64_t flit = m_cc_receive_to_cleanup_fifo.read(); 4245 4246 4567 uint32_t srcid = 4247 4568 DspinDhccpParam::dspin_get( … … 4264 4585 DspinDhccpParam::CLEANUP_NLINE_MSB) << 32; 4265 4586 4587 /*ODCCP*/ // Cleanup on no coherent line if 1 4588 r_cleanup_ncc = 4589 DspinDhccpParam::dspin_get( 4590 flit, 4591 DspinDhccpParam::CLEANUP_NCC); 4592 4266 4593 r_cleanup_inst = (type == DspinDhccpParam::TYPE_CLEANUP_INST); 4267 4594 r_cleanup_srcid = srcid; … … 4295 4622 { 4296 4623 if(not m_cc_receive_to_cleanup_fifo.rok()) break; 4624 4297 4625 4298 4626 uint64_t flit = m_cc_receive_to_cleanup_fifo.read(); … … 4300 4628 addr_t nline = r_cleanup_nline.read() | 4301 4629 DspinDhccpParam::dspin_get(flit, DspinDhccpParam::CLEANUP_NLINE_LSB); 4630 4631 bool eop = DspinDhccpParam::dspin_get(flit, DspinDhccpParam::FROM_L1_EOP); 4632 4633 /*ODCCP*/ // if not eop (more than 2 flits) there is a cleanup no coherent with data 4634 if (!eop) 4635 { 4636 r_cleanup_contains_data = true; // this cleanup contains data 4637 r_cleanup_fsm = CLEANUP_GET_DATA; 4638 r_cleanup_data_index = 0; 4639 } 4640 else 4641 { 4642 r_cleanup_contains_data = false; 4643 r_cleanup_fsm = CLEANUP_DIR_REQ; 4644 } 4302 4645 4303 4646 cc_receive_to_cleanup_fifo_get = true; 4304 r_cleanup_nline = nline; 4305 r_cleanup_fsm = CLEANUP_DIR_REQ; 4647 r_cleanup_nline = nline; 4306 4648 4307 4649 #if DEBUG_MEMC_CLEANUP … … 4314 4656 } 4315 4657 4658 /*ODCCP*/ // We save the cleanup's data into a buffer 4659 case CLEANUP_GET_DATA : 4660 { 4661 if(not m_cc_receive_to_cleanup_fifo.rok()) break; 4662 4663 assert (r_cleanup_data_index.read() < m_words and "MEM_CACHE in CLEANUP_GET_DATA : too much flits in cleanup data updt"); 4664 4665 uint64_t flit = m_cc_receive_to_cleanup_fifo.read(); 4666 4667 uint32_t data = 4668 DspinDhccpParam::dspin_get (flit, DspinDhccpParam::CLEANUP_DATA_UPDT); 4669 4670 r_cleanup_data[r_cleanup_data_index.read()] = data; 4671 r_cleanup_data_index = r_cleanup_data_index.read() + 1; 4672 cc_receive_to_cleanup_fifo_get = true; 4673 m_cpt_cleanup_data++; 4674 4675 if (r_cleanup_data_index.read() == m_words - 1) // last flit 4676 { 4677 r_cleanup_fsm = CLEANUP_DIR_REQ; 4678 } 4679 break; 4680 } 4316 4681 ///////////////////// 4317 4682 case CLEANUP_DIR_REQ: // Get the lock to the directory 4318 4683 { 4684 m_cpt_cleanup_fsm_dir_lock++; 4685 // Get the lock to the directory 4319 4686 if(r_alloc_dir_fsm.read() != ALLOC_DIR_CLEANUP) break; 4320 4687 … … 4325 4692 std::cout << " <MEMC " << name() << " CLEANUP_DIR_REQ> Requesting DIR lock" << std::endl; 4326 4693 #endif 4694 4695 m_cpt_cleanup_fsm_n_dir_lock++; 4696 4327 4697 break; 4328 4698 } … … 4341 4711 exit(0); 4342 4712 } 4343 4344 4713 // Read the directory 4345 4714 size_t way = 0; … … 4362 4731 if(entry.valid) // hit : the copy must be cleared 4363 4732 { 4733 if(entry.count < 1) 4734 { 4735 std::cout << "assert on line " << std::hex <<r_cleanup_nline.read() << " | at cycle " << std::dec <<m_cpt_cycles << std::endl; 4736 std::cout << "cleanup with data ? " << r_cleanup_contains_data.read() << " | at cycle " << m_cpt_cycles << std::endl; 4737 std::cout << "cleanup_address = " << std::hex << (r_cleanup_nline.read()*m_words*4) << std::dec << std::endl; 4738 std::cout << "srcid = " << r_cleanup_srcid.read() << std::endl; 4739 std::cout << "inst = " << r_cleanup_inst.read() << std::endl; 4740 std::cout << "inst = " << r_cleanup_inst.read() << std::endl; 4741 } 4364 4742 assert( 4365 4743 (entry.count > 0) and … … 4445 4823 entry.valid = true; 4446 4824 entry.is_cnt = r_cleanup_is_cnt.read(); 4447 entry.dirty = r_cleanup_dirty.read() ;4825 entry.dirty = r_cleanup_dirty.read() or r_cleanup_contains_data.read(); 4448 4826 entry.tag = r_cleanup_tag.read(); 4449 4827 entry.lock = r_cleanup_lock.read(); … … 4456 4834 entry.owner.cache_id = 0; 4457 4835 #endif 4836 /*ODCCP*/ // if cleanup contains data we update the cache data 4837 if (r_cleanup_contains_data.read()) 4838 { 4839 for (size_t word = 0; word < m_words; word ++) 4840 { 4841 m_cache_data.write(way, set, word, r_cleanup_data[word].read(), 0xF); 4842 } 4843 } 4844 4458 4845 4459 4846 m_cache_directory.write(set, way, entry); … … 4484 4871 { 4485 4872 // get the lock to the HEAP directory 4873 m_cpt_cleanup_fsm_heap_lock++; 4486 4874 if(r_alloc_heap_fsm.read() != ALLOC_HEAP_CLEANUP) break; 4487 4875 … … 4497 4885 } 4498 4886 #endif 4887 m_cpt_cleanup_fsm_n_heap_lock++; 4499 4888 break; 4500 4889 } … … 4575 4964 << " / r_cleanup_copy_inst = " << r_cleanup_copy_inst.read() << std::endl 4576 4965 << "heap_entry.owner.srcid = " << heap_entry.owner.srcid 4577 << " / heap_entry.owner.inst = " << heap_entry.owner.inst << std::endl; 4966 << " / heap_entry.owner.inst = " << heap_entry.owner.inst << std::endl 4967 << " / addr = " << std::hex << (r_cleanup_nline.read() *m_words*4) << std::dec << std::endl; 4578 4968 /**/ 4579 4969 … … 4842 5232 // invalidate transaction matching the cleanup 4843 5233 { 5234 m_cpt_cleanup_fsm_upt_lock++; 4844 5235 if(r_alloc_upt_fsm.read() != ALLOC_UPT_CLEANUP) break; 4845 5236 … … 4851 5242 if ( not match_inval ) // no pending inval 4852 5243 { 5244 /*ODCCP*/ // If cleanup is on no coherent line we go to CLEANUP_IXR_REQ 5245 if (r_cleanup_ncc.read()) 5246 { 5247 r_cleanup_fsm = CLEANUP_IXR_REQ; 5248 } 5249 else 5250 { 4853 5251 r_cleanup_fsm = CLEANUP_SEND_CLACK; 5252 } 4854 5253 4855 5254 #if DEBUG_MEMC_CLEANUP … … 4862 5261 << std::endl; 4863 5262 #endif 4864 break; 5263 m_cpt_cleanup_fsm_n_upt_lock++; 5264 break; 4865 5265 } 4866 5266 … … 4908 5308 else // multi inval transaction not completed 4909 5309 { 4910 r_cleanup_fsm = CLEANUP_SEND_CLACK ; 5310 /*ODCCP*/ // If cleanup is on no coherent line we go to CLEANUP_IXR_REQ 5311 if (r_cleanup_ncc.read()) 5312 { 5313 r_cleanup_fsm = CLEANUP_IXR_REQ; 5314 } 5315 else 5316 { 5317 r_cleanup_fsm = CLEANUP_SEND_CLACK; 5318 } 4911 5319 } 4912 5320 … … 4938 5346 if ( r_cleanup_need_rsp.read() ) r_cleanup_fsm = CLEANUP_WRITE_RSP; 4939 5347 else if ( r_cleanup_need_ack.read() ) r_cleanup_fsm = CLEANUP_CONFIG_ACK; 5348 else if ( r_cleanup_ncc.read() ) r_cleanup_fsm = CLEANUP_IXR_REQ; 4940 5349 else r_cleanup_fsm = CLEANUP_SEND_CLACK; 4941 5350 … … 4960 5369 r_cleanup_to_tgt_rsp_pktid = r_cleanup_write_pktid.read(); 4961 5370 4962 r_cleanup_fsm = CLEANUP_SEND_CLACK; 5371 /*ODCCP*/ // If cleanup is on no coherent line we go to CLEANUP_IXR_REQ 5372 if (r_cleanup_ncc.read()) 5373 { 5374 r_cleanup_fsm = CLEANUP_IXR_REQ; 5375 } 5376 else 5377 { 5378 r_cleanup_fsm = CLEANUP_SEND_CLACK; 5379 } 4963 5380 4964 5381 #if DEBUG_MEMC_CLEANUP … … 4977 5394 { 4978 5395 if ( r_cleanup_to_config_ack.read() ) break; 4979 4980 5396 r_cleanup_to_config_ack = true; 4981 5397 r_cleanup_fsm = CLEANUP_SEND_CLACK; … … 4988 5404 break; 4989 5405 } 5406 5407 /*ODCCP*/ 5408 case CLEANUP_IXR_REQ: 5409 { 5410 5411 //Send a request to the ixr to write the data in the XRAM and set an entry in the TRT. 5412 if (r_alloc_trt_fsm.read() == ALLOC_TRT_CLEANUP) 5413 { 5414 if(!r_cleanup_to_ixr_cmd_req.read()) 5415 { 5416 size_t index = 0; 5417 bool hit = m_trt.hit_write(r_cleanup_nline.read(), &index); // we save the index of the matching entry in TRT 5418 if (!hit) 5419 { 5420 std::cout << "assert on line " << r_cleanup_nline.read() << " | at cycle " << std::dec <<m_cpt_cycles << std::endl; 5421 for (int i=0; i<4; i++) m_trt.print(i); 5422 } 5423 assert (hit and "CLEANUP_IXR_REQ found no matching entry in TRT"); 5424 5425 r_cleanup_to_ixr_cmd_req = true; 5426 5427 for(size_t i = 0; i < m_words; i++){ 5428 r_cleanup_to_ixr_cmd_data[i] = r_cleanup_data[i]; 5429 } 5430 5431 r_cleanup_to_ixr_cmd_srcid = r_cleanup_srcid.read(); 5432 r_cleanup_to_ixr_cmd_trdid = index; 5433 r_cleanup_to_ixr_cmd_pktid = r_cleanup_pktid.read(); 5434 r_cleanup_to_ixr_cmd_nline = r_cleanup_nline.read(); 5435 r_cleanup_to_ixr_cmd_l1_dirty_ncc = r_cleanup_contains_data.read(); 5436 r_cleanup_fsm = CLEANUP_SEND_CLACK; 5437 #if DEBUG_MEMC_CLEANUP 5438 if(m_debug) 5439 { 5440 std::cout 5441 << " <MEMC " << name() 5442 << " CLEANUP_IXR_REQ> Send a put request to the ixr:" 5443 << " contains data ? = " << std::dec << r_cleanup_contains_data.read() 5444 << " srcid = " << std::dec << r_cleanup_srcid.read() 5445 << " pktid = " << std::dec << r_cleanup_pktid.read() 5446 << " trdid = " << std::dec << index 5447 << " nline = " << std::hex << r_cleanup_nline.read() << std::dec 5448 << std::endl; 5449 } 5450 #endif 5451 } 5452 else 5453 { 5454 r_cleanup_fsm = CLEANUP_WAIT; 5455 } 5456 } 5457 break; 5458 } 5459 5460 case CLEANUP_WAIT : 5461 { 5462 r_cleanup_fsm = CLEANUP_IXR_REQ; 5463 break; 5464 } 5465 4990 5466 //////////////////////// 4991 5467 case CLEANUP_SEND_CLACK: // acknowledgement to a cleanup command … … 5094 5570 { 5095 5571 r_cas_fsm = CAS_DIR_LOCK; 5572 m_cpt_cas_fsm_n_dir_lock++; 5096 5573 } 5097 5574 … … 5104 5581 } 5105 5582 #endif 5583 5584 m_cpt_cas_fsm_dir_lock++; 5585 5106 5586 break; 5107 5587 } … … 5347 5827 << " / count = " << nb_copies << std::endl; 5348 5828 #endif 5349 } 5829 m_cpt_cas_fsm_n_upt_lock++; 5830 } 5831 5832 m_cpt_cas_fsm_upt_lock++; 5833 5350 5834 break; 5351 5835 } … … 5378 5862 #endif 5379 5863 r_cas_fsm = CAS_UPT_REQ; 5380 } 5864 m_cpt_cas_fsm_n_heap_lock++; 5865 } 5866 5867 m_cpt_cas_fsm_heap_lock++; 5868 5381 5869 break; 5382 5870 } … … 5518 6006 r_cas_fsm = CAS_WAIT; 5519 6007 } 5520 } 6008 m_cpt_cas_fsm_n_trt_lock++; 6009 } 6010 6011 m_cpt_cas_fsm_trt_lock++; 6012 5521 6013 break; 5522 6014 } … … 5583 6075 r_cas_fsm = CAS_WAIT; 5584 6076 } 5585 } 6077 m_cpt_cas_fsm_n_upt_lock++; 6078 } 6079 6080 m_cpt_cas_fsm_upt_lock++; 6081 5586 6082 break; 5587 6083 } … … 5761 6257 r_cas_fsm = CAS_MISS_TRT_SET; 5762 6258 } 5763 } 6259 m_cpt_cas_fsm_n_trt_lock++; 6260 } 6261 6262 m_cpt_cas_fsm_trt_lock++; 6263 5764 6264 break; 5765 6265 } … … 6531 7031 case CC_RECEIVE_CLEANUP_EOP: 6532 7032 { 6533 // write second CLEANUP flit in CC_RECEIVE to CLEANUP fifo 7033 // write second CLEANUP flit in CC_RECEIVE to CLEANUP fifo or more in case of cleanup data (ODCCP) 6534 7034 6535 7035 if(not p_dspin_in.write or not m_cc_receive_to_cleanup_fifo.wok()) 6536 7036 break; 6537 7037 6538 assert(p_dspin_in.eop.read() and7038 /*assert(p_dspin_in.eop.read() and 6539 7039 "VCI_MEM_CACHE ERROR in CC_RECEIVE : " 6540 "CLEANUP command must have two flits"); 7040 "CLEANUP command must have two flits");*/ 6541 7041 6542 7042 cc_receive_to_cleanup_fifo_put = true; 6543 r_cc_receive_fsm = CC_RECEIVE_IDLE; 7043 if(p_dspin_in.eop.read()) 7044 r_cc_receive_fsm = CC_RECEIVE_IDLE; 6544 7045 6545 7046 break; … … 7020 7521 (r_cas_fsm.read() == CAS_BC_UPT_LOCK)) 7021 7522 r_alloc_upt_fsm = ALLOC_UPT_CAS; 7022 7023 7523 else if(r_config_fsm.read() == CONFIG_DIR_UPT_LOCK) 7024 7524 r_alloc_upt_fsm = ALLOC_UPT_CONFIG; 7025 } 7525 else 7526 m_cpt_upt_unused++; 7527 } 7528 else 7529 m_cpt_multi_ack_fsm_upt_used++; 7026 7530 break; 7027 7531 … … 7046 7550 else if(r_multi_ack_fsm.read() == MULTI_ACK_UPT_LOCK) 7047 7551 r_alloc_upt_fsm = ALLOC_UPT_MULTI_ACK; 7048 } 7552 7553 else 7554 m_cpt_upt_unused++; 7555 } 7556 else 7557 m_cpt_write_fsm_upt_used++; 7049 7558 break; 7050 7559 … … 7069 7578 (r_write_fsm.read() == WRITE_BC_UPT_LOCK)) 7070 7579 r_alloc_upt_fsm = ALLOC_UPT_WRITE; 7071 } 7580 7581 else 7582 m_cpt_upt_unused++; 7583 } 7584 else 7585 m_cpt_xram_rsp_fsm_upt_used++; 7072 7586 break; 7073 7587 … … 7093 7607 else if(r_xram_rsp_fsm.read() == XRAM_RSP_INVAL_LOCK) 7094 7608 r_alloc_upt_fsm = ALLOC_UPT_XRAM_RSP; 7095 } 7609 7610 else 7611 m_cpt_upt_unused++; 7612 } 7613 else 7614 m_cpt_cleanup_fsm_upt_used++; 7096 7615 break; 7097 7616 … … 7116 7635 else if(r_cleanup_fsm.read() == CLEANUP_UPT_LOCK) 7117 7636 r_alloc_upt_fsm = ALLOC_UPT_CLEANUP; 7118 } 7637 7638 else 7639 m_cpt_upt_unused++; 7640 } 7641 else 7642 m_cpt_cas_fsm_upt_used++; 7119 7643 break; 7120 7644 … … 7189 7713 else if(r_xram_rsp_fsm.read() == XRAM_RSP_DIR_LOCK) 7190 7714 r_alloc_dir_fsm = ALLOC_DIR_XRAM_RSP; 7191 7715 7192 7716 else if(r_config_fsm.read() == CONFIG_DIR_REQ) 7193 7717 r_alloc_dir_fsm = ALLOC_DIR_CONFIG; 7194 } 7195 break; 7718 7719 else 7720 m_cpt_dir_unused++; 7721 } 7722 else 7723 m_cpt_read_fsm_dir_used++; 7724 break; 7196 7725 7197 7726 ///////////////////// … … 7227 7756 else if(r_read_fsm.read() == READ_DIR_REQ) 7228 7757 r_alloc_dir_fsm = ALLOC_DIR_READ; 7229 } 7230 break; 7758 7759 else 7760 m_cpt_dir_unused++; 7761 } 7762 else 7763 m_cpt_write_fsm_dir_used++; 7764 break; 7231 7765 7232 7766 /////////////////// … … 7263 7797 else if(r_write_fsm.read() == WRITE_DIR_REQ) 7264 7798 r_alloc_dir_fsm = ALLOC_DIR_WRITE; 7265 } 7799 7800 else 7801 m_cpt_dir_unused++; 7802 } 7803 else 7804 m_cpt_cas_fsm_dir_used++; 7266 7805 break; 7267 7806 … … 7287 7826 else if(r_cas_fsm.read() == CAS_DIR_REQ) 7288 7827 r_alloc_dir_fsm = ALLOC_DIR_CAS; 7289 } 7290 break; 7828 7829 else 7830 m_cpt_dir_unused++; 7831 } 7832 else 7833 m_cpt_cleanup_fsm_dir_used++; 7834 break; 7291 7835 7292 7836 //////////////////////// … … 7310 7854 else if(r_cleanup_fsm.read() == CLEANUP_DIR_REQ) 7311 7855 r_alloc_dir_fsm = ALLOC_DIR_CLEANUP; 7312 } 7313 break; 7856 7857 else 7858 m_cpt_dir_unused++; 7859 } 7860 else 7861 m_cpt_xram_rsp_fsm_dir_used++; 7862 break; 7314 7863 7315 7864 } // end switch alloc_dir_fsm … … 7345 7894 (r_ixr_rsp_fsm.read() == IXR_RSP_TRT_READ)) 7346 7895 r_alloc_trt_fsm = ALLOC_TRT_IXR_RSP; 7347 } 7896 7897 else if (r_cleanup_fsm.read() == CLEANUP_IXR_REQ) 7898 r_alloc_trt_fsm = ALLOC_TRT_CLEANUP; 7899 7900 else 7901 m_cpt_trt_unused++; 7902 } 7903 else 7904 m_cpt_read_fsm_trt_used++; 7348 7905 break; 7349 7906 … … 7365 7922 (r_ixr_rsp_fsm.read() == IXR_RSP_TRT_READ)) 7366 7923 r_alloc_trt_fsm = ALLOC_TRT_IXR_RSP; 7924 7925 else if (r_cleanup_fsm.read() == CLEANUP_IXR_REQ) 7926 r_alloc_trt_fsm = ALLOC_TRT_CLEANUP; 7367 7927 7368 7928 else if(r_read_fsm.read() == READ_TRT_LOCK) 7369 7929 r_alloc_trt_fsm = ALLOC_TRT_READ; 7370 } 7930 7931 else 7932 m_cpt_trt_unused++; 7933 } 7934 else 7935 m_cpt_write_fsm_trt_used++; 7371 7936 break; 7372 7937 … … 7384 7949 (r_ixr_rsp_fsm.read() == IXR_RSP_TRT_READ)) 7385 7950 r_alloc_trt_fsm = ALLOC_TRT_IXR_RSP; 7951 7952 else if (r_cleanup_fsm.read() == CLEANUP_IXR_REQ) 7953 r_alloc_trt_fsm = ALLOC_TRT_CLEANUP; 7386 7954 7387 7955 else if(r_read_fsm.read() == READ_TRT_LOCK) … … 7391 7959 (r_write_fsm.read() == WRITE_BC_TRT_LOCK)) 7392 7960 r_alloc_trt_fsm = ALLOC_TRT_WRITE; 7393 } 7961 7962 else 7963 m_cpt_trt_unused++; 7964 } 7965 else 7966 m_cpt_cas_fsm_trt_used++; 7394 7967 break; 7395 7968 … … 7405 7978 (r_ixr_rsp_fsm.read() == IXR_RSP_TRT_READ)) 7406 7979 r_alloc_trt_fsm = ALLOC_TRT_IXR_RSP; 7980 7981 else if (r_cleanup_fsm.read() == CLEANUP_IXR_REQ) 7982 r_alloc_trt_fsm = ALLOC_TRT_CLEANUP; 7407 7983 7408 7984 else if(r_read_fsm.read() == READ_TRT_LOCK) … … 7416 7992 (r_cas_fsm.read() == CAS_BC_TRT_LOCK)) 7417 7993 r_alloc_trt_fsm = ALLOC_TRT_CAS; 7418 } 7994 7995 else 7996 m_cpt_trt_unused++; 7997 } 7998 else 7999 m_cpt_xram_rsp_fsm_trt_used++; 7419 8000 break; 7420 8001 … … 7424 8005 (r_ixr_rsp_fsm.read() != IXR_RSP_TRT_READ)) 7425 8006 { 8007 8008 if (r_cleanup_fsm.read() == CLEANUP_IXR_REQ) 8009 r_alloc_trt_fsm = ALLOC_TRT_CLEANUP; 8010 8011 else if(r_read_fsm.read() == READ_TRT_LOCK) 8012 r_alloc_trt_fsm = ALLOC_TRT_READ; 8013 8014 else if((r_write_fsm.read() == WRITE_MISS_TRT_LOCK) || 8015 (r_write_fsm.read() == WRITE_BC_TRT_LOCK)) 8016 r_alloc_trt_fsm = ALLOC_TRT_WRITE; 8017 8018 else if((r_cas_fsm.read() == CAS_MISS_TRT_LOCK) || 8019 (r_cas_fsm.read() == CAS_BC_TRT_LOCK)) 8020 r_alloc_trt_fsm = ALLOC_TRT_CAS; 8021 8022 else if((r_xram_rsp_fsm.read() == XRAM_RSP_DIR_LOCK) && 8023 (r_alloc_dir_fsm.read() == ALLOC_DIR_XRAM_RSP)) 8024 r_alloc_trt_fsm = ALLOC_TRT_XRAM_RSP; 8025 8026 else 8027 m_cpt_trt_unused++; 8028 } 8029 else 8030 m_cpt_ixr_fsm_trt_used++; 8031 break; 8032 8033 //////////////////////// 8034 case ALLOC_TRT_CLEANUP: 8035 if(r_ixr_rsp_fsm.read() != CLEANUP_IXR_REQ) 8036 { 7426 8037 if(r_read_fsm.read() == READ_TRT_LOCK) 7427 8038 r_alloc_trt_fsm = ALLOC_TRT_READ; … … 7438 8049 (r_alloc_dir_fsm.read() == ALLOC_DIR_XRAM_RSP)) 7439 8050 r_alloc_trt_fsm = ALLOC_TRT_XRAM_RSP; 8051 8052 else if((r_ixr_rsp_fsm.read() == IXR_RSP_TRT_ERASE) || 8053 (r_ixr_rsp_fsm.read() == IXR_RSP_TRT_READ)) 8054 r_alloc_trt_fsm = ALLOC_TRT_IXR_RSP; 7440 8055 } 7441 8056 break; … … 7488 8103 else if(r_config_fsm.read() == CONFIG_HEAP_REQ) 7489 8104 r_alloc_heap_fsm = ALLOC_HEAP_CONFIG; 7490 } 8105 else 8106 m_cpt_heap_unused++; 8107 } 8108 else 8109 m_cpt_read_fsm_heap_used++; 7491 8110 break; 7492 8111 … … 7511 8130 else if(r_read_fsm.read() == READ_HEAP_REQ) 7512 8131 r_alloc_heap_fsm = ALLOC_HEAP_READ; 7513 } 8132 8133 else 8134 m_cpt_heap_unused++; 8135 } 8136 else 8137 m_cpt_write_fsm_heap_used++; 7514 8138 break; 7515 8139 … … 7534 8158 else if(r_write_fsm.read() == WRITE_UPT_HEAP_LOCK) 7535 8159 r_alloc_heap_fsm = ALLOC_HEAP_WRITE; 7536 } 8160 8161 else 8162 m_cpt_heap_unused++; 8163 } 8164 else 8165 m_cpt_cas_fsm_heap_used++; 7537 8166 break; 7538 8167 … … 7558 8187 else if(r_cas_fsm.read() == CAS_UPT_HEAP_LOCK) 7559 8188 r_alloc_heap_fsm = ALLOC_HEAP_CAS; 7560 } 8189 8190 else 8191 m_cpt_heap_unused++; 8192 } 8193 else 8194 m_cpt_cleanup_fsm_heap_used++; 7561 8195 break; 7562 8196 … … 7603 8237 if(r_xram_rsp_fsm.read() == XRAM_RSP_HEAP_REQ) 7604 8238 r_alloc_heap_fsm = ALLOC_HEAP_XRAM_RSP; 7605 } 8239 else 8240 m_cpt_heap_unused++; 8241 } 8242 else 8243 m_cpt_xram_rsp_fsm_heap_used++; 7606 8244 break; 7607 8245 … … 7663 8301 //////////////////////////////////////////////////////////////////////////////////// 7664 8302 8303 /* 8304 if(cc_receive_to_cleanup_fifo_put) 8305 { 8306 if(cc_receive_to_cleanup_fifo_get) 8307 { 8308 m_cc_receive_to_cleanup_fifo.put_and_get( ( (uint64_t)(p_dspin_in.eop.read() & 0x1 ) << 32 ) | p_dspin_in.data.read()); 8309 } 8310 else // TODO PAS METTRE 32 en DUR !!!! 8311 { 8312 m_cc_receive_to_cleanup_fifo.simple_put( ( (uint64_t)(p_dspin_in.eop.read() & 0x1 ) << 32 ) | p_dspin_in.data.read()); 8313 //m_cc_receive_to_cleanup_fifo.simple_put(p_dspin_in.data.read()); 8314 } 8315 } 8316 else 8317 { 8318 if(cc_receive_to_cleanup_fifo_get) 8319 { 8320 m_cc_receive_to_cleanup_fifo.simple_get(); 8321 } 8322 } 8323 */ 7665 8324 m_cc_receive_to_cleanup_fifo.update( cc_receive_to_cleanup_fifo_get, 7666 8325 cc_receive_to_cleanup_fifo_put, 7667 p_dspin_in.data.read() ); 7668 8326 ( (uint64_t)(p_dspin_in.eop.read() & 0x1 ) << 32 ) | p_dspin_in.data.read() ); 7669 8327 //////////////////////////////////////////////////////////////////////////////////// 7670 8328 // CC_RECEIVE to MULTI_ACK FIFO … … 7814 8472 p_vci_ixr.trdid = r_xram_rsp_to_ixr_cmd_trdid.read(); 7815 8473 p_vci_ixr.eop = (r_ixr_cmd_cpt == (m_words-2)); 8474 } 8475 /*ODCCP*/ 8476 else if (r_ixr_cmd_fsm.read() == IXR_CMD_CLEANUP_DATA) 8477 { 8478 p_vci_ixr.cmd = vci_param_ext::CMD_WRITE; 8479 p_vci_ixr.cmdval = true; 8480 p_vci_ixr.address = (addr_t)((r_cleanup_to_ixr_cmd_nline.read() * m_words + 8481 r_ixr_cmd_cpt.read()) * 4); 8482 8483 if(r_cleanup_to_ixr_cmd_l1_dirty_ncc.read()) // if cleanup data contains data, we use cleanup_data buffer (cleanup dirty) 8484 { 8485 p_vci_ixr.wdata = ((wide_data_t)(r_cleanup_to_ixr_cmd_data[r_ixr_cmd_cpt.read()].read()) | 8486 ((wide_data_t)(r_cleanup_to_ixr_cmd_data[r_ixr_cmd_cpt.read() + 1].read()) << 32)); 8487 } 8488 else // if cleanup data doesnt contain data, we use xram_rsp_data buffer (cleanup not dirty) 8489 { 8490 p_vci_ixr.wdata = ((wide_data_t)(r_xram_rsp_to_ixr_cmd_data[r_ixr_cmd_cpt.read()].read()) | 8491 ((wide_data_t)(r_xram_rsp_to_ixr_cmd_data[r_ixr_cmd_cpt.read() + 1].read()) << 32)); 8492 } 8493 8494 p_vci_ixr.trdid = r_cleanup_to_ixr_cmd_trdid.read(); 8495 p_vci_ixr.eop = (r_ixr_cmd_cpt == (m_words - 2)); 7816 8496 } 7817 8497 else
Note: See TracChangeset
for help on using the changeset viewer.