A hypothetical computer has 16 MB RAM and has a word size of 32 bits. It has cache memory having 32 blocks having a block size of 64 bits. Show how the main memory address 100110001111101110111100 will be mapped to a cache address, if (i) Direct cache mapping is used (ii) Associative cache mapping is used (iii) Two way set associative cache mapping is used.
Answers
Answered by
13
Given:
Main memory Size = 64 Words
Main Memory word size = 16 bits
Cache Memory Size = 8 Blocks
Cache Memory Block size = 32 bits
⇒1 Block of Cache = 2 Words of RAM
⇒Memory location address 25 is equivalent to Block address 12.
⇒ Total number of possible Blocks in Main Memory = 64/2 = 32 blocks.
Associative Mapping:
The block can be anywhere in the cache.
Direct Mapping:
Size of Cache = 8 blocks
Location of Block 12 in Cache = 12 modulo 8 = 4
2 Way set associative mapping:
Number of blocks in a set = 2
Number of sets = Size of Cache in blocks / Number of blocks in a set
= 8 / 2 = 4
Block 12 will be located anywhere in (12 modulo 4) set, that is set 0.
Main memory Size = 64 Words
Main Memory word size = 16 bits
Cache Memory Size = 8 Blocks
Cache Memory Block size = 32 bits
⇒1 Block of Cache = 2 Words of RAM
⇒Memory location address 25 is equivalent to Block address 12.
⇒ Total number of possible Blocks in Main Memory = 64/2 = 32 blocks.
Associative Mapping:
The block can be anywhere in the cache.
Direct Mapping:
Size of Cache = 8 blocks
Location of Block 12 in Cache = 12 modulo 8 = 4
2 Way set associative mapping:
Number of blocks in a set = 2
Number of sets = Size of Cache in blocks / Number of blocks in a set
= 8 / 2 = 4
Block 12 will be located anywhere in (12 modulo 4) set, that is set 0.
AkashMandal:
hopes this helps
Similar questions