93.1k views
4 votes
in a 8-way associative cache of size 512kb, with 32b blocks, what are the tag, index, and offset (in hexadecimal) for the memory address 0xa6b30a1b?

1 Answer

3 votes

Final answer:

The tag for the memory address 0xA6B30A1B in a 512KB, 8-way associative cache with 32B blocks is 0xA6B, the index is 0x358, and the offset is 0x1B.

Step-by-step explanation:

In a 8-way associative cache of size 512KB with 32B blocks, we need to determine the tag, index, and offset for the memory address 0xA6B30A1B. To do this, we first need to calculate the number of sets and the size of each component in the address.

We can start by determining the size of the offset. Since the block size is 32B, the offset will be the number of bits required to address 32 bytes which is 5 bits (since 25 = 32). In hexadecimal, this is represented by the last digit of the address. Therefore, the offset is 1B (the last two hexadecimal digits).

Next, we calculate the number of sets by dividing the cache size by the product of the block size and associativity: (512KB) / (32B * 8) = 2048 sets. The number of bits needed for the index is the log base 2 of the number of sets, which is log2(2048) = 11 bits.

Now, we can convert the 32-bit address into binary form and divide it into tag, index, and offset. The first 32-11-5 = 16 bits will be the tag, the next 11 bits will be the index, and the last 5 bits will be the offset. As we already know our offset is 1B, we only need to extract the index from the remaining address bits after the offset.

To find the index in hexadecimal, we take the portion of the address that corresponds to the index bits, then convert that to hexadecimal. For the address 0xA6B30A1B, the index would be represented by bits 17 to 27. After converting those bits to hexadecimal, we get 0x358 as the index value.

The remaining bits on the left are the tag bits. For our given address, the tag would be 0xA6B.

Therefore, for memory address 0xA6B30A1B:

  • Tag is: 0xA6B
  • Index is: 0x358
  • Offset is: 0x1B
User Robb Schiller
by
8.1k points