//// DO NOT CHANGE ANYTHING BELOW THIS POINT int main(void) { int size; int assoc; int block_size; int i; /* The cache needs to be initialized, but the parameters will be ignored by the mystery caches, as they are hard coded. You can test your geometry paramter discovery routines by calling cache_init() w/ your own size and block size values. */ cache_init(64*1024,16); flush_cache(); /* for (i = 0; i < 17; i++) { if (!access_cache(addr + i)) printf("%lld miss\n", addr + i); else printf("%lld hit\n", addr + i); } for (i = 0; i < 17; i++) { if (!access_cache(addr + i)) printf("%lld miss\n", addr + i); else printf("%lld hit\n", addr + i); } for (i = 17; i < 34; i++) { if (!access_cache(addr + i)) printf("%lld miss\n", addr + i); else printf("%lld hit\n", addr + i); } */ block_size=get_block_size(); size=get_cache_size(block_size); assoc=get_cache_assoc(size); printf("Cache block size: %d bytes\n", block_size); printf("Cache size: %d bytes\n", size); printf("Cache associativity: %d\n", assoc); return EXIT_SUCCESS; }
int main(void) { int size; int assoc; int block_size; cache_init(0,0); block_size=get_block_size(); size=get_cache_size(block_size); assoc=get_cache_assoc(size); printf("Cache block size: %d bytes\n", block_size); printf("Cache size: %d bytes\n", size); printf("Cache associativity: %d\n", assoc); return EXIT_SUCCESS; }
//// DO NOT CHANGE ANYTHING BELOW THIS POINT int main(void) { int size; int assoc; int block_size; /* The cache needs to be initialized, but the parameters will be ignored by the mystery caches, as they are hard coded. You can test your geometry paramter discovery routines by calling cache_init() w/ your own size and block size values. */ cache_init(1,1); block_size=get_block_size(); size=get_cache_size(block_size); assoc=get_cache_assoc(size); printf("Cache block size: %d bytes\n", block_size); printf("Cache size: %d bytes\n", size); printf("Cache associativity: %d\n", assoc); return EXIT_SUCCESS; }