/cache_simulator

A simulator of cache system behavior.

Primary LanguageC

Cache Simulator

Description

  • A program that simulates the behavior of cache memory system.
  • It's a part of the 4th lab of 15-213: Introduction to Computer Systems.
  • The simulator in cache-sim.c takes memory trace generated by valgrind as input, simulates and counts the (hit, miss, evict) behavior of the cache and outputs the total number of (hits, misses and evictions).
  • It can simulate the behavior of cache memory with arbitrary size and associativity selected by the user.
  • The program is partitioned into three sections: (1): parse the command-line options. (2) allocate memory for the cache and initialize it. (3): simulate each memory access in the trace file the print the output.

How to test it?

Run the following commands to get it on your local machine:

  • git clone https://github.com/Eslam-Walid/cache-simulator.git.
  • make.

Use the following command to print a help message of how to use it:

  • ./csim -h.

Files

  • cache-lab.pdf: lab writup.
  • csim.c: contains the main function.
  • cache-sim.c: my implementation of the simulator.
  • traces: directory contains the valgrind memory trace files.
  • csim-ref: reference simulator to compare your results with.
  • test-sim: program comes with lab files to check the correctness of your simulator and evaluate it.