Search code examples
memorymipsmicroprocessors

How to calculate the address of a final byte within a memory block?


Assuming that there is a processor that has a 4294967296-byte data memory and a single data cache that contains 131072 lines. The cache is a 1-way set associative cache with a 256-byte line size. When the MIPS load byte instruction lb $8,0($4) is executed, CPU register $4 contains the address of the final byte within memory block number 2928610.

Is the the 8-digit hex address contained in register $4 simply calculated as 2928610 in hex? Or is it by taking the number 2928610 and multiplying it by the line size, which is 256 bytes. The result is 745607680, which in hexadecimal is 0xB07BD000 ?


Solution

  • Is the the 8-digit hex address contained in register $4 simply calculated as 2928610 in hex?

    Yes.

    Or is it by taking the number 2928610 and multiplying it by the line size, which is 256 bytes. The result is 745607680, which in hexadecimal is 0xB07BD000?

    Nope, the cache is meant to be transparent to the CPU. If you use a different cache with different line size, it would break all existing programs, which is definitely not a good design.