This cache simulation calculates hit ratio for Direct Mapped, Fully Associative, and Set Associative Caches. It uses FIFO and LRU replacement policy to calculate hit ratio for Fully Associative, and Set Associative
- To compile the code you will need a trace file with 32 bits hex addresses
- Run the code in the environment of choice
-
The program will prompt you to enter the file name that you want to read
-
Enter the name of the file with the extension

-
Next, you will enter the number of bytes in the cache

-
After, you will be prompted to enter the number of bytes in a line/block

-
Next, there will be a menu to select which type of cache you would like to use

-
If direct mapped cache is chosen the program will read the file and create a direct mapped cache
-
Once the file has been added to the cache, the program will output the number of hits, misses, total addresses read, and the hit ratio

-
If fully associative cache is chosen the program will prompt the user to select which replacement policy they would like to use

-
Once a replacement policy is chosen, the program will output the cache and replacement policy chosen. Then the program will read the file. Once the file has been added to the cache, the program will output the number of hits, misses, total addresses read, and the hit ratio

-
If set associative cache is chosen the program will prompt the user to enter the associativity select which replacement policy they would like to use

-
Once the associativity is chosen, the program will ask the user to select which replacement policy they would like to use

-
Once the replacement policy is entered, the program will output the cache and replacement policy chosen. Then the program will read the file. Once the file has been added to the cache, the program will output the number of hits, misses, total addresses read, and the hit ratio
