Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i#4842 drcachesim unit test: Add cache_fifo unit test #5454

Merged
merged 18 commits into from
May 25, 2022

Conversation

bete0
Copy link
Contributor

@bete0 bete0 commented Apr 8, 2022

Adds unit tests for FIFO cache simulator

Adds a method get_next_way_to_replace() 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.

Adds cache_policy_test_t template for testing multiple cache replacement policies.

Adds get_block_index() method that returns the block index for a given
addr_t address.

Issue: #4842, #5456

This change adds unit tests for clients/drcachesim/simulators/cache_fifo.cpp.

Issue: #4842
This change adds unit tests for clients/drcachesim/simulators/cache_fifo.cpp.

Issue: #4842
When the current access is a hit and the currently accessed 'way' has a
counter of 1, meaning it was the 'first accessed way' before this access,
set the next 'way' as victim. This is because the currently accessed
'way' is no longer the 'first accessed way' and its counter is then
cleared and the next 'way' is a victim.
@bete0 bete0 marked this pull request as ready for review April 15, 2022 21:28
 - Move get_block_index() to caching_device class
 - Call replace_which_way() from get_next_way_to_replace() in cache_fifo
 - Remove update to cache state in cache_fifo
 - Update test cases and expected replaced ways
@derekbruening
Copy link
Contributor

bete0 requested a review from derekbruening

Some prior review comments have no response, and some only partial: e.g., access_and_check_ duplication. None are marked resolved.

clients/drcachesim/simulator/caching_device.h Outdated Show resolved Hide resolved
clients/drcachesim/simulator/caching_device.h Outdated Show resolved Hide resolved
clients/drcachesim/simulator/cache_lru.cpp Outdated Show resolved Hide resolved
clients/drcachesim/simulator/caching_device.cpp Outdated Show resolved Hide resolved
bete0 added 3 commits May 22, 2022 23:00
- Adds comments explaining the difference between
  get_next_way_to_replace() and replace_which_way()
- Calls get_next_way_to_replace() from replace_which_way()
  in caching_device as opposed to other way around
- Makes get_next_way_to_replace() a const
- Updates test cases
@bete0 bete0 requested a review from derekbruening May 23, 2022 11:22
clients/drcachesim/simulator/cache_fifo.cpp Outdated Show resolved Hide resolved
clients/drcachesim/simulator/cache_lru.cpp Outdated Show resolved Hide resolved
clients/drcachesim/simulator/caching_device.cpp Outdated Show resolved Hide resolved
clients/drcachesim/simulator/caching_device.h Outdated Show resolved Hide resolved
  - Change line_idx args to block_idx for consistencny
  - Remove redundant comment
  - Make get_block_index(), compute_tag() and compute_block_idx() const
  - Remove cache_lru_test_t and cache_fifo_test_t since we have
    cache_policy_test_t template
  - Add block_indices_are_identical helper method
  - Update logic in tag comparison loop
  - Update comment in unit_test_cache_fifo_four_way() (s/E/A/)
@bete0 bete0 requested a review from derekbruening May 23, 2022 22:31
  - Add comments to tags_are_different() that a quadratic solution is ok
  - Create a vector that holds test addresses
@bete0 bete0 merged commit a2fece6 into master May 25, 2022
@bete0 bete0 deleted the i4842-cache_fifo_unit_test branch May 25, 2022 00:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants