This project shows how a cache uses the address generated by the CPU to calculate the tag, set and offset.
gcc -std=c99 -o cache cache.c -lm
This program takes in 3 arguments
- total cache size in bytes
- the associativity
- the block size in bytes
- 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.
Use the address file addresses.txt or generate your own.
./cache 65536 1 256 addresses.txt