The Problem
Write the code for a program that simulates a cache. Your program will take in the filename of a
trace file as a command line argument.
In this lab we will:
- simulate a direct mapped, fully associative, and set associative caches
- write a README.txt
- interpret our results
Remember, you will be graded on style, syntax, functionality, and correctness.
Getting Started
Log into the computer science server and create a new directory.
- Use
wget
to download the trace file at http://cs.longwood.edu/courses/cmsc201/f17/files/best.trace
- Use
wget
to download a Makefile file at http://cs.longwood.edu/courses/cmsc201/f17/files/Makefile
Trace files contain one memory operation per line. The last number on the line is the number of bytes to read/write (all bytes need to be in the cache to have a
hit).
Implementation
You will need to simulate several different features of a caches:
- Block sizes of at least 8, 16, 32, and 64 bytes
- Sets sizes of at least 8, 16, 32, and 64 cache lines
- Direct mapped caches
- Fully associative caches
- Replacement policy of both Random and LRU
- Cache sizes of at least 1024, 2048, 4096, and 8192 bytes
You will need to output a single file containing tables showing the
hit rate for each of these caches. An example results file can be seen
here. Included in your readme should be an analysis of the results.
Handin
When you are done you may hand in your lab by using the handin
script (lab4).
The lab is due at 11:59pm Nov. 28th 2017.