Question: CPSC 121 Winter 2, 2019 CPSC 121 Winter 2. 2019 3. [12 marks] Memory, curhing and vitwise actutions You do not need to memorize the

 CPSC 121 Winter 2, 2019 CPSC 121 Winter 2. 2019 3.

CPSC 121 Winter 2, 2019 CPSC 121 Winter 2. 2019 3. [12 marks] Memory, curhing and vitwise actutions You do not need to memorize the information in the following paragraphs in order to answer this question, nor will we ask about it on examinations, but it provides interesting information on the way. which computers work, and motivate the question. Consider a 16 bits int o representing address in Ticist CPUs TH Se 64 hit sicheressers, but thic: cxarnplex child we incredibly textinuas to write and truar if ac sex 64 bits). In order to determine where in the cout the data story at uds will be storyl, the introira is divided into three different fid uch of which is presented by saime of the bits of . More spesifically, if u= h 255656 Once upon il tiep to 1955 ), computers cxsisted (mxly) of it tril processing unit (CPU) that cxccutar instructions, and main T HTY where instructions and datiL WET tard. Instructions and dat ATY in rain rcm Cry LT resexi using their address (think of it like lapartenent mur in il large buildirikor il martxr in i butel). Heyve CPUs kept getting faster zuid faster, while ricory wis getting faster at auch klar tutc. Thus a LT y , and stetext growing, with the result that CPU Sprint indle tinc doing sful wirk, and more and nice time waiting for instructions and cate to arrive from C ory. Caunputer designers then decided that somcthing clearly renderita he donc about this, to for the CPUs appetite for instructions and cinta and prevent it fron spending most of its time twiddling its clectronic thuhs. And thus was born the coche: a small fast memory that sits between the CPU and malo remory. Instructions and data that have been used recently end up lu the cache, with the expectation that they will be used again in the near future at wlucha point the CPU will be able to retrieve the much faster). Thuis of course leads to the question of deciding where lo stare in Lloe cache the instruction or dala sore al given location in memory. The cache location is usually delermuined braxxl on the Lils of the actress where the instructiuni ur ciast is lonxl in NL DULY. Before building CPU, the desiren yun simulation to see how well the cache will perform. how big thov should make it in care sunt carbcs arc faster but will for the CPU to act dat all the way from main memory more often which slow's it dorn), ctc. Thus they need to manipulate the address by ex- tracting some of its bits, or by setting some bits while leaving the other bits unchanged then we will call bubbbbbby, . the fag, b the cache index and the ache Wock orfact 11. 12 marks Giver adres, write an expression lut will return the cachekk ill set for. For instance, if = D1011010110101111 then your expe c ul return 111 that is, the integer 7). Your Craght look unthing like: &:01010101011010101) 1010111010111010 00, this is not the correct answer!) b. [2 markal Given al alles, write all expression that will return the mache inclex for 0. For instarxx!, if u = 0111111111111110111 ten your expresion would turn 11010 (that is, the integer 24). c. [2 marks] Giveni in address, write an expression that will return the tur for. For instancr, if -0101101011010111 then your expression wild turn 01011010 (that is, the intrger 181). d. [2 marks Given an address a wite an expression that will return an identical address except that the cache block offset ho beca wt to 000 For instauce, if a 0101101011010111 then your expression would return 01011010110101000 c. [2 marks] Giver an address , write an expression that will turn an identical address cxccpt that the cache block offsct has been act to 101. For instance, if a 0101101011010111 then your expression would return 01011010110101101. Ilirt: 130 your answer from part id) as a subexpression 1. 12 marks] Giver al address , write an expression that will return a identical address except that the cacbe index has been set to 01100 . For instance, if a = 0101101011010111 then your expression would return 0101101001100111. Most programming languages provide ways to manipulate the bits of Integere signed or unsigned). In this question, we will assume Integers are 16 bits and unsigned. Let of 2 and y be two such integers. . is the sitwist AND operala. y denotes the integer wuxith Lil is the lit lr and will. For me, INNE.ning and we love! Lesignand integers c=101101011010111 and y=101101001010011110, thesky=DOCCIAIODIDOCIDIO. . is the bitwise ON Operator ty termotes the inter while hit is the bit of or the illa bit of For instanin, aing the NILITIG Wulans for :r and is in the previous hullet point,ry-0111101111011111. >>js tbc bitwise wht sbitt operador >> denotes the integer obtained by "deleting the rightrasti vita cifar, and wkling i O bisa ta the left of the mentining bits. For instance, D101101011010111 >> 5 - 0000001011010110 (thic bits 10111 We're recibex!). CPSC 121 Winter 2, 2019 CPSC 121 Winter 2. 2019 3. [12 marks] Memory, curhing and vitwise actutions You do not need to memorize the information in the following paragraphs in order to answer this question, nor will we ask about it on examinations, but it provides interesting information on the way. which computers work, and motivate the question. Consider a 16 bits int o representing address in Ticist CPUs TH Se 64 hit sicheressers, but thic: cxarnplex child we incredibly textinuas to write and truar if ac sex 64 bits). In order to determine where in the cout the data story at uds will be storyl, the introira is divided into three different fid uch of which is presented by saime of the bits of . More spesifically, if u= h 255656 Once upon il tiep to 1955 ), computers cxsisted (mxly) of it tril processing unit (CPU) that cxccutar instructions, and main T HTY where instructions and datiL WET tard. Instructions and dat ATY in rain rcm Cry LT resexi using their address (think of it like lapartenent mur in il large buildirikor il martxr in i butel). Heyve CPUs kept getting faster zuid faster, while ricory wis getting faster at auch klar tutc. Thus a LT y , and stetext growing, with the result that CPU Sprint indle tinc doing sful wirk, and more and nice time waiting for instructions and cate to arrive from C ory. Caunputer designers then decided that somcthing clearly renderita he donc about this, to for the CPUs appetite for instructions and cinta and prevent it fron spending most of its time twiddling its clectronic thuhs. And thus was born the coche: a small fast memory that sits between the CPU and malo remory. Instructions and data that have been used recently end up lu the cache, with the expectation that they will be used again in the near future at wlucha point the CPU will be able to retrieve the much faster). Thuis of course leads to the question of deciding where lo stare in Lloe cache the instruction or dala sore al given location in memory. The cache location is usually delermuined braxxl on the Lils of the actress where the instructiuni ur ciast is lonxl in NL DULY. Before building CPU, the desiren yun simulation to see how well the cache will perform. how big thov should make it in care sunt carbcs arc faster but will for the CPU to act dat all the way from main memory more often which slow's it dorn), ctc. Thus they need to manipulate the address by ex- tracting some of its bits, or by setting some bits while leaving the other bits unchanged then we will call bubbbbbby, . the fag, b the cache index and the ache Wock orfact 11. 12 marks Giver adres, write an expression lut will return the cachekk ill set for. For instance, if = D1011010110101111 then your expe c ul return 111 that is, the integer 7). Your Craght look unthing like: &:01010101011010101) 1010111010111010 00, this is not the correct answer!) b. [2 markal Given al alles, write all expression that will return the mache inclex for 0. For instarxx!, if u = 0111111111111110111 ten your expresion would turn 11010 (that is, the integer 24). c. [2 marks] Giveni in address, write an expression that will return the tur for. For instancr, if -0101101011010111 then your expression wild turn 01011010 (that is, the intrger 181). d. [2 marks Given an address a wite an expression that will return an identical address except that the cache block offset ho beca wt to 000 For instauce, if a 0101101011010111 then your expression would return 01011010110101000 c. [2 marks] Giver an address , write an expression that will turn an identical address cxccpt that the cache block offsct has been act to 101. For instance, if a 0101101011010111 then your expression would return 01011010110101101. Ilirt: 130 your answer from part id) as a subexpression 1. 12 marks] Giver al address , write an expression that will return a identical address except that the cacbe index has been set to 01100 . For instance, if a = 0101101011010111 then your expression would return 0101101001100111. Most programming languages provide ways to manipulate the bits of Integere signed or unsigned). In this question, we will assume Integers are 16 bits and unsigned. Let of 2 and y be two such integers. . is the sitwist AND operala. y denotes the integer wuxith Lil is the lit lr and will. For me, INNE.ning and we love! Lesignand integers c=101101011010111 and y=101101001010011110, thesky=DOCCIAIODIDOCIDIO. . is the bitwise ON Operator ty termotes the inter while hit is the bit of or the illa bit of For instanin, aing the NILITIG Wulans for :r and is in the previous hullet point,ry-0111101111011111. >>js tbc bitwise wht sbitt operador >> denotes the integer obtained by "deleting the rightrasti vita cifar, and wkling i O bisa ta the left of the mentining bits. For instance, D101101011010111 >> 5 - 0000001011010110 (thic bits 10111 We're recibex!)

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!