Question: Need help answering questions about cache #includestdio.h> #includestdlib.h> #include #define OFFSET BITS (6) #define SET-INDEX-BITS (5) #define TAG-BITS (64-OFFSET-BITS-SET-INDEX-BITS) #define NWAYS (8) // 64 bytes
Need help answering questions about cache

#includestdio.h> #includestdlib.h> #include #define OFFSET BITS (6) #define SET-INDEX-BITS (5) #define TAG-BITS (64-OFFSET-BITS-SET-INDEX-BITS) #define NWAYS (8) // 64 bytes cache line /1 32 sets // // 8 ways cache. void questions () unsigned answer0; Suppose a machine has a n-way set associative cache. // The characteristics of the cache are defined in line 5-8. // 1) How many bytes of cache does this machine have? answer 0 print f ("Q1: %u ", answer); // 2) For an address 0x40000100, what is the cache set for the address? / Note that the index for the first set is 0, so the answer should /be a number within 0-31 answer0; printf("Q2: %u ", answer); // 3) For an address 0x4000011F, what is the cache set for the address? / Note that the index for the first set is 0, so the answer should /be a number within 0-31. answer = 0; printf("Q3: %u ", answer); 4) Assume that the cache is empty in the begining. After following // addresses are accessed in order, how many cache lines are used /I (to store data) in set 0 11 0x40000100 11 0x40000104 11 0x40000188 /1 0x40000004 11 0x40000008 1 0x80000100 1 0x80000104 11 0x80000004 11 0x80000008 answer E0; printf("Q4: %u ", answer); #includestdio.h> #includestdlib.h> #include #define OFFSET BITS (6) #define SET-INDEX-BITS (5) #define TAG-BITS (64-OFFSET-BITS-SET-INDEX-BITS) #define NWAYS (8) // 64 bytes cache line /1 32 sets // // 8 ways cache. void questions () unsigned answer0; Suppose a machine has a n-way set associative cache. // The characteristics of the cache are defined in line 5-8. // 1) How many bytes of cache does this machine have? answer 0 print f ("Q1: %u ", answer); // 2) For an address 0x40000100, what is the cache set for the address? / Note that the index for the first set is 0, so the answer should /be a number within 0-31 answer0; printf("Q2: %u ", answer); // 3) For an address 0x4000011F, what is the cache set for the address? / Note that the index for the first set is 0, so the answer should /be a number within 0-31. answer = 0; printf("Q3: %u ", answer); 4) Assume that the cache is empty in the begining. After following // addresses are accessed in order, how many cache lines are used /I (to store data) in set 0 11 0x40000100 11 0x40000104 11 0x40000188 /1 0x40000004 11 0x40000008 1 0x80000100 1 0x80000104 11 0x80000004 11 0x80000008 answer E0; printf("Q4: %u ", answer)