Changeset 455 for branches/v5/modules/vci_mem_cache/caba/source/include
- Timestamp:
- Jul 19, 2013, 10:16:17 AM (11 years ago)
- Location:
- branches/v5/modules/vci_mem_cache
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/v5/modules/vci_mem_cache
- Property svn:mergeinfo changed
/trunk/modules/vci_mem_cache merged: 449
- Property svn:mergeinfo changed
-
branches/v5/modules/vci_mem_cache/caba/source/include/mem_cache_directory.h
r440 r455 12 12 // to behave in an unpredicted way. 13 13 // TODO Either remove the mechanism from the mem cache or update its behaviour. 14 14 15 #define L1_MULTI_CACHE 0 15 16 … … 247 248 // The function returns a copy of a (valid or invalid) entry 248 249 ///////////////////////////////////////////////////////////////////// 249 DirectoryEntry read(const addr_t &address, size_t &way)250 DirectoryEntry read(const addr_t &address, size_t &way) 250 251 { 251 252 … … 277 278 // way arguments. 278 279 ///////////////////////////////////////////////////////////////////// 279 void inval( const size_t & set, const size_t &way)280 void inval( const size_t &way, const size_t &set ) 280 281 { 281 282 m_dir_tab[set][way].init(); … … 289 290 // The function returns a copy of a (valid or invalid) entry 290 291 ///////////////////////////////////////////////////////////////////// 291 DirectoryEntry read_neutral(const addr_t &address) 292 DirectoryEntry read_neutral( const addr_t &address, 293 size_t* ret_way, 294 size_t* ret_set ) 292 295 { 293 296 294 297 #define L2 soclib::common::uint32_log2 295 constsize_t set = (size_t)(address >> (L2(m_words) + 2)) & (m_sets - 1);296 consttag_t tag = (tag_t)(address >> (L2(m_sets) + L2(m_words) + 2));298 size_t set = (size_t)(address >> (L2(m_words) + 2)) & (m_sets - 1); 299 tag_t tag = (tag_t)(address >> (L2(m_sets) + L2(m_words) + 2)); 297 300 #undef L2 298 301 299 bool hit = false; 300 for ( size_t i=0 ; i<m_ways ; i++ ) { 301 bool equal = ( m_dir_tab[set][i].tag == tag ); 302 bool valid = m_dir_tab[set][i].valid; 303 hit = equal && valid; 304 if ( hit ) { 305 return DirectoryEntry(m_dir_tab[set][i]); 302 for ( size_t way = 0 ; way < m_ways ; way++ ) 303 { 304 bool equal = ( m_dir_tab[set][way].tag == tag ); 305 bool valid = m_dir_tab[set][way].valid; 306 if ( equal and valid ) 307 { 308 *ret_set = set; 309 *ret_way = way; 310 return DirectoryEntry(m_dir_tab[set][way]); 311 } 306 312 } 307 } 308 return DirectoryEntry(); 313 return DirectoryEntry(); 309 314 } // end read_neutral() 310 315 … … 406 411 void init() 407 412 { 408 for ( size_t set=0 ; set<m_sets ; set++ ) { 409 for ( size_t way=0 ; way<m_ways ; way++ ) { 413 for ( size_t set=0 ; set<m_sets ; set++ ) 414 { 415 for ( size_t way=0 ; way<m_ways ; way++ ) 416 { 410 417 m_dir_tab[set][way].init(); 411 418 m_lru_tab[set][way].init(); … … 688 695 assert((set < m_sets ) && "Cache data error: Trying to read a wrong set" ); 689 696 assert((way < m_ways ) && "Cache data error: Trying to read a wrong way" ); 690 697 691 698 for (uint32_t word=0; word<m_words; word++) 692 699 cache_line[word].write(m_cache_data[way][set][word]); -
branches/v5/modules/vci_mem_cache/caba/source/include/vci_mem_cache.h
r442 r455 69 69 { 70 70 typedef typename vci_param_int::fast_addr_t addr_t; 71 72 71 typedef typename sc_dt::sc_uint<64> wide_data_t; 73 74 typedef uint32_t data_t; 75 typedef uint32_t tag_t; 76 typedef uint32_t be_t; 77 typedef uint32_t copy_t; 72 typedef uint32_t data_t; 73 typedef uint32_t tag_t; 74 typedef uint32_t be_t; 75 typedef uint32_t copy_t; 78 76 79 77 /* States of the TGT_CMD fsm */ … … 396 394 397 395 // debug variables (for each FSM) 398 bool m_debug; 399 bool m_debug_previous_hit; 400 size_t m_debug_previous_count; 396 bool m_debug; 397 bool m_debug_previous_valid; 398 size_t m_debug_previous_count; 399 bool m_debug_previous_dirty; 400 sc_signal<data_t>* m_debug_previous_data; 401 sc_signal<data_t>* m_debug_data; 401 402 402 403 bool m_monitor_ok; … … 482 483 void print_stats(); 483 484 void print_trace(); 484 void c opies_monitor(addr_t addr);485 void cache_monitor(addr_t addr); 485 486 void start_monitor(addr_t addr, addr_t length); 486 487 void stop_monitor(); … … 490 491 void transition(); 491 492 void genMoore(); 492 void check_monitor( const char *buf,addr_t addr, data_t data, bool read);493 void check_monitor(addr_t addr, data_t data, bool read); 493 494 494 495 // Component attributes
Note: See TracChangeset
for help on using the changeset viewer.