Simulate the behavior of a cache and report the number of hits, misses, and evictions given the cache's specifications
- Takes the cache's specifications (number of set bits, the number of block bits, the associativity) and the directory of a file that contains memory accesses (trace files) from the command line
- Trace files are contained in the p3cache/traces directory
- L represents a data load, S represents a data store, and M represents a data modify. L and S can both either result in a hit, a miss, or an eviction. M can result in either two hits, a miss and a hit, or a miss, an evict, and a hit.
- The second argument in each line is represents a 32-bit memory address.
- Reports the number of hits, misses, and evictions from each trace file.
- Run this command
git clone https://github.com/HarrisonD123/Cache-Simulator.git - In the the project directory, run this command in the terminal:
make - To run the program, enter
./csimin the terminal along with the number of set bits (-s), set associativity (-E), number of block bits (-b), and the trace file directory (-t):- A cache has 2^s sets and a 2^b block size
- The last b bits of the given memory address are the block bits, and the s bits before them are the set bits. The rest of the bits at the front are the tag bits.
- EX:
./csim -s 3 -E 2 -b 4 -t dave.trace
- To see test cases for each trace file, run
./csim-test