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

Need help answering questions about cache #includestdio.h> #includestdlib.h> #include #define OFFSET BITS

#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)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!