Changeset 449 for trunk/modules/vci_mem_cache/caba/source/include
- Timestamp:
- Jul 18, 2013, 5:54:32 PM (11 years ago)
- Location:
- trunk/modules/vci_mem_cache/caba/source/include
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/vci_mem_cache/caba/source/include/mem_cache_directory.h
r434 r449 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]); -
trunk/modules/vci_mem_cache/caba/source/include/vci_mem_cache.h
r439 r449 68 68 { 69 69 typedef typename vci_param_int::fast_addr_t addr_t; 70 71 70 typedef typename sc_dt::sc_uint<64> wide_data_t; 72 73 typedef uint32_t data_t; 74 typedef uint32_t tag_t; 75 typedef uint32_t be_t; 76 typedef uint32_t copy_t; 71 typedef uint32_t data_t; 72 typedef uint32_t tag_t; 73 typedef uint32_t be_t; 74 typedef uint32_t copy_t; 77 75 78 76 /* States of the TGT_CMD fsm */ … … 390 388 391 389 // debug variables (for each FSM) 392 bool m_debug; 393 bool m_debug_previous_hit; 394 size_t m_debug_previous_count; 390 bool m_debug; 391 bool m_debug_previous_valid; 392 size_t m_debug_previous_count; 393 bool m_debug_previous_dirty; 394 sc_signal<data_t>* m_debug_previous_data; 395 sc_signal<data_t>* m_debug_data; 395 396 396 397 bool m_monitor_ok; … … 474 475 void print_stats(); 475 476 void print_trace(); 476 void c opies_monitor(addr_t addr);477 void cache_monitor(addr_t addr); 477 478 void start_monitor(addr_t addr, addr_t length); 478 479 void stop_monitor(); … … 482 483 void transition(); 483 484 void genMoore(); 484 void check_monitor( const char *buf,addr_t addr, data_t data, bool read);485 void check_monitor(addr_t addr, data_t data, bool read); 485 486 486 487 // Component attributes
Note: See TracChangeset
for help on using the changeset viewer.