You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While working on a unit test for clients/drcachesim/simulator/cache_fifo.cpp (#5454), I discovered that calling cache_fifo::replace_which_way() right after accessing a cache line (by calling request()) would update the cache state.
For the cache replacement unit tests, we validate the expected way is replaced after an access by first sending a request() and then checking the way to be replaced on the next access matches the expected way as shown below (from #5454):
However calling replace_which_way() changes the state of the FIFO cache by updating the way to be replaced which results in the wrong way to be replaced on the next access.
This is not necessarily a bug in the FIFO cache replacement implementation but makes testing the implementation harder and potentially could result in unexpected behavior if cache_fifo::replace_which_way() is called directly somewhere else.
cache_fifo_test.access_and_check_fifo(ADDRESS_A, 1); // A x X X
cache_fifo_test.access_and_check_fifo(ADDRESS_B, 3); // A B x X
cache_fifo_test.access_and_check_fifo(ADDRESS_C, 1); // A B C x
cache_fifo_test.access_and_check_fifo(ADDRESS_D, 3); // a B C D
The text was updated successfully, but these errors were encountered:
Adds a non-state changing method get_next_way_to_replace() that
just returns the victim 'way' without updating the cache state. This
makes unit testing the FIFO cache replacement policy convenient.
Issue: #5456
Adds get_next_way_to_replace() helper method that just returns the victim way
without a side effect on the cache state. This makes unit testing the cache
replacement policies convenient and avoids unexpected behavior during testing.
Adds cache_policy_test_t class template for testing multiple cache replacement policies.
Adds get_block_index() method that returns the block index for a given address.
Issue: #4842, #5456
While working on a unit test for
clients/drcachesim/simulator/cache_fifo.cpp
(#5454), I discovered that callingcache_fifo::replace_which_way()
right after accessing a cache line (by callingrequest()
) would update the cache state.For the cache replacement unit tests, we validate the expected
way
is replaced after an access by first sending arequest()
and then checking theway
to be replaced on the next access matches the expected way as shown below (from #5454):However calling
replace_which_way()
changes the state of the FIFO cache by updating theway
to be replaced which results in the wrongway
to be replaced on the next access.This is not necessarily a bug in the FIFO cache replacement implementation but makes testing the implementation harder and potentially could result in unexpected behavior if
cache_fifo::replace_which_way()
is called directly somewhere else.Steps to reproduce the behavior:
The text was updated successfully, but these errors were encountered: