Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Consider a 16 bits integer a representing an address in memory (most CPUs now use 64 bit addresses, but the examples would get incredibly tedious
Consider a 16 bits integer a representing an address in memory (most CPUs now use 64 bit addresses, but the examples would get incredibly tedious to write and read if we used 64 bits). In order to determine where in the cache the data stored at address a will be stored, the integer a is divided into three different fields, each of which is represented by some of the bits of a. More specifically, if a=b15b14b13b12b11b1obgbgb7b6b5b4b3b2b.bo then we will call b15b14b13612611610bgbg the tag, 6766656463 the cache index, and b2b1bo the cache block offset. a. [2 marks] Given an address a, write an expression that will return the cache block off- set for a. For instance, if a = 0101101011010111 then your expression would return 111 (that is, the integer 7). Your answer might look something like a &0101010101010101)|| 1010111010111010 (no, this is not the correct answer!) b. [2 marks] Given an address a, write an expression that will return the cache index for a. For instance, if a = 0101101011010111 then your expression would return 11010 (that is, the integer 26). c. [2 marks] Given an address a, write an expression that will return the tag for a. For instance, if a = 0101101011010111 then your expression would return 01011010 (that is, the integer 181). d. [2 marks] Given an address a, write an expression that will return an identical address except that the cache block offset has been set to 000. For instance, if a = 0101101011010111 then your expression would return 01011010110101000. e. 12 marks] Given an address a, write an expression that will return an identical address except that the cache block offset has been set to 101. For instance, if a = 0101101011010111 then your expression would return 01011010110101101. Hint: use your answer from part (d) as a subexpression. f. [2 marks] Given an address a, write an expression that will return an identical address except that the cache index has been set to 01100 . For instance, if a = 0101101011010111 then your expression would return 0101101001100111. Consider a 16 bits integer a representing an address in memory (most CPUs now use 64 bit addresses, but the examples would get incredibly tedious to write and read if we used 64 bits). In order to determine where in the cache the data stored at address a will be stored, the integer a is divided into three different fields, each of which is represented by some of the bits of a. More specifically, if a=b15b14b13b12b11b1obgbgb7b6b5b4b3b2b.bo then we will call b15b14b13612611610bgbg the tag, 6766656463 the cache index, and b2b1bo the cache block offset. a. [2 marks] Given an address a, write an expression that will return the cache block off- set for a. For instance, if a = 0101101011010111 then your expression would return 111 (that is, the integer 7). Your answer might look something like a &0101010101010101)|| 1010111010111010 (no, this is not the correct answer!) b. [2 marks] Given an address a, write an expression that will return the cache index for a. For instance, if a = 0101101011010111 then your expression would return 11010 (that is, the integer 26). c. [2 marks] Given an address a, write an expression that will return the tag for a. For instance, if a = 0101101011010111 then your expression would return 01011010 (that is, the integer 181). d. [2 marks] Given an address a, write an expression that will return an identical address except that the cache block offset has been set to 000. For instance, if a = 0101101011010111 then your expression would return 01011010110101000. e. 12 marks] Given an address a, write an expression that will return an identical address except that the cache block offset has been set to 101. For instance, if a = 0101101011010111 then your expression would return 01011010110101101. Hint: use your answer from part (d) as a subexpression. f. [2 marks] Given an address a, write an expression that will return an identical address except that the cache index has been set to 01100 . For instance, if a = 0101101011010111 then your expression would return 0101101001100111
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started