2. Suppose a computer using direct mapped cache has 220 words of main memory and a cache of 32 blocks, where each cache block contains 16 words. a. How many blocks of main memory are there? b. What is the format of a memory address as seen by the cache, that is, what are the sizes of the tag, block, and word fields? c. To which cache block will the memory reference 0DB6316 map? d. In many computers the cache block size is in the range of 32 to 128 bytes. What would be the main advantages and disadvantages of making the size of the cache blocks larger or smaller within this range

Respuesta :

Answer:

(a) The block size = 16 words (b) the format for the sizes of the tag, block, and word fields are stated below:

Tag Block Offset  

11 bits 5 bits 4 bits

(c)The memory address 0DB63 will map to 22nd block and 3 byte of a block. (d)  The main advantage of the cache is, when the cache block is made larger or bigger then, there are fewer misses. this occur when the data in the block is used.

One of the disadvantage is that if the data is not used before the cache block is removed from the cache, then it is no longer useful. here there is also a larger miss penalty.

Explanation:

Solution

(a)The Cache of 32 blocks and the memory is word addressable  

The main memory size is not stated, so let's consider it as 2^20  

The main memory size = 2^20  

The block size = 16 words  

The Number of blocks = main memory size/ block size = 2^20/16. = 2^16= 64 K words.

(b) The Main memory is 2^20, which says it is 1 M words size and it requires 20 bits  

Now,

From which 32 cache block requires 2^5, 5 bits and block size means offset requires 2^4, 4 bits

Thus, the sizes of the tag, block, and word fields are stated below:

Tag Block Offset  

11 bits 5 bits 4 bits

(c)The hexadecimal address is 0DB63 , its binary equivalent is  

0000 1101 1011 0110 0011  

The tag = ( first 11 bits) = 0000 1101 101  

block = ( next 5 bits ) = 1 0110  

offset = ( next 4 bits ) = 0011  

Therefore, the memory address 0DB63 will map to 22nd block and 3 byte of a block.

(d) The main advantage of the cache is that, when the cache block is made larger or bigger then, there are fewer misses. this occur when the data in the block is used.

One of the disadvantage is that if the data is not used before the cache block is removed from the cache, then it is no longer useful. here there is also a larger miss penalty.

In this exercise we want to use computer and C++ knowledge to write the code correctly, so it is necessary to add the following to the informed code:

(a) The block size = 16 words

(b) Tag Block Offset  

11 bits 5 bits 4 bits

(c)The memory address 0DB63 will map to 22nd block and 3 byte of a block.

(d)  The main advantage of the cache is, when the cache block is made larger or bigger then, there are fewer misses. One of the disadvantage is that if the data is not used before the cache block is removed from the cache, then it is no longer useful.

So analyzing the first question about the code we find that:

(a)The Cache of 32 blocks and the memory is word addressable :

  • The main memory size; [tex]2^{20[/tex]
  • The block size; [tex]16 \ words[/tex]  
  • The Number of blocks = main memory size/ block size: [tex]2^{20}/16 = 2^{16}= 64[/tex]

(b) Says it is 1 M words size and it requires 20 bits. Now, from which 32 cache block requires 2^5, 5 bits and block size means offset requires 2^4, 4 bits. Thus, the sizes of the tag, block, and word fields are stated below:

  • Tag Block Offset  
  • 11 bits 5 bits 4 bits

(c)The hexadecimal address is 0DB63 , its binary equivalent is  

 

  • The tag = ( first 11 bits) = 0000 1101 101  
  • block = ( next 5 bits ) = 1 0110  
  • offset = ( next 4 bits ) = 0011  

Therefore, the memory address 0DB63 will map to 22nd block and 3 byte of a block.

(d) The main favored position or circumstance of the cache happen that, when the cache block is created best or considerable therefore, there happen hardly any misses. this take place when the information in visible form in the block exist secondhand. One of the loss exist that if the data exist not secondhand before the cache block exist detached from the cache, then it exist not any more valuable. in this place there exist in addition to a best miss punishment.

See more about computer at brainly.com/question/950632

ACCESS MORE