// Albert Coba 1727 // Shawn Nematbakhsh 8551 // // cs161 as3: This program is a cache simulator. It takes data from an input file specified // on the command line and then simulates the data in the file with each value corresponding to // an address. 40 different caches are simulated of varying size/associativity/replacement // policies. // number of caches to use for debugging, set lower to get a quick test result #define NUM_CACHES 40 #include #include #include #include "block.h" int main(int argc,char **argv) { // if fine name isn't passed in if(argc != 2) { // print error and quit cout << "Usage: as3 input_file\n"; return 0; } cout << "Execution will take about 20 seconds, please wait...\n"; // for loop counter int i; // the input file ifstream infile(argv[1]); // data from input file, read one at a time int read; // caches block caches[NUM_CACHES]; // initialize the caches to have varying sizes and replacement policies for(i=0;i19)); // while there is data to be read while(infile >> read) { // put the data in each cache, and set the "way" assiciativity different // for each for(i=0;i