Search code examples
cachingmipsmemory-address

What information does the cached memory address value contain?


I'm learning about cache, and I learned that for an address in a specific memory, part of it is used as an index and the rest is used as a tag bit.

But in the picture below, how is the memory address 00001 in the picture on the left connected to the 32-bit address in the picture on the right?

enter image description here

Does the 5-bit address in the picture on the left and the 32-bit address on the right mean the same thing?


Solution

  • For the picture on the left, the 5-bit address would decompose like this:

    +-----------------------+
    |  Tag | Index | Offset |
    +-----------------------+
         2     3       0         # bits in each field
    

    So, the tag has 2 bits, the index has 3 bits, and the block size (which determines the number of bits in the byte offset) is either 0 or simply not shown.