/Cache

Shows how a cache uses the address generated by the CPU to calculate the tag, set, and offset.

Primary LanguageC

Cache Calculator

This project shows how a cache uses the address generated by the CPU to calculate the tag, set and offset.

How to compile?

gcc -std=c99 -o cache cache.c -lm

How does it work?

This program takes in 3 arguments

  1. total cache size in bytes
  2. the associativity
  3. the block size in bytes
  4. the name of a text file that contains a series of addresses

The output of the programs will be the specifications of the cache (such as size, number of sets, associativity, total number of blocks, the number of bits used for tag, set, and offset). The programs will then read the address file, which is text file that contains randomly generated 64-bit addresses, and for each address will generate the tag, set, and offset.

Example

Use the address file addresses.txt or generate your own.

./cache 65536 1 256 addresses.txt