#ifndef _MYCACHE_H_ #define _MYCACHE_H_ #define ROW_MAJOR_ORDER 1 #define COL_MAJOR_ORDER 2 /* A simple cache simulation program, myCache is designed to allow testing cache hits and misses with a cache based on #define-d parameters. To change these, simply modify the constants in myCache.h */ /* -------------------------------------------------------- ====== Test settings you can/should modify ====== -------------------------------------------------------- */ // If PRINT_CACHE is defined, print the cache hits/misses // If you don't want to print the cache hits/misses, just // comment out the '#define PRINT_CACHE' line below. // ARRAY_WIDTH is The width/length of the MxM test array // For TEST_RUN_MODE, choose ROW_MAJOR_ORDER or // COL_MAJOR_ORDER // Set the number of runs through the test array with // NUM_TESTS //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // Paste settings from README here: //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< //#define PRINT_CACHE #define ARRAY_WIDTH 10000 #define TEST_RUN_MODE ROW_MAJOR_ORDER #define NUM_TESTS 10 //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // These are the cache parameters. You can change any of them except the cache address // length. #define CACHE_ADDRESS_LENGTH 32 // Please leave at 32 so we can keep the type the same #define CACHE_T_BITS 16 // How many bits to interpret as the tag // Note that number_of_tags = 2^CACHE_T_BITS #define CACHE_S_BITS 12 // How many bits to interpret as the set number // Note that number_of_sets = 2^CACHE_S_BITS #define CACHE_ASSOCIATIVITY_E 1 // How many lines/blocks we keep per set // Uncomment this line to get lots of information about the cache setup and action process //#define CACHE_VERBOSE_DEBUG /* -------------------------------------------------------- ====== Test settings you mostly shouldn't modify ====== -------------------------------------------------------- */ // This is the cacheline struct we'll make an array of to form our cache typedef struct cache_line{ int tag; int valid; } cache_line; #endif //_MYCACHE_H_