In: Computer Science
Main Memory Size = 232 Bytes
Number of Cache Blocks = 1024 = 210
Block Size = 32 Bytes = 25
Answer a
Number of blocks in Main memory
= Main Memory Size / Block Size
= 232 / 25 = 227
= 134,217,728 blocks
Answer b
Cache is Direct Mapped. So
Block Offset = 10 bits (to access the blocks, number of blocks = 210)
Byte Offset = 5 Bits (to access each byte in selected block, block size = 25)
Tag bits = 32 - 10 - 5 = 17 bits
Main Memory Address = Tag(17) Block(10) Byte(5)
Answer c
0x00001328 = 00000000000000000 0010011001 01000
Block offset = 0010011001 = 153 block
Fully Associative Cache
Number of blocks in Cache = 8 = 23
Blocks Size = 16 Bytes
Main Memory Size = 128 K bytes = 217 which means main memory address = 17 bit
Answer a
Byte offset = 4 bits
Tag Field = 17-4 = 13 bits
Main memory address = Tag(13) Byte(4)
Answer b
Memory is word addressable which means block size = 16 bytes = 4 words where 1 word = 32 bits (4 bytes)
Word offset = 2 bits
Tag Field = 17-2 = 15 bits
Main memory address = Tag(15) Word(2)