cache confussion

  • Thread starter Thread starter zelnaga
  • Start date Start date
Z

zelnaga

i'm trying to understand how caches work and am a little confussed.

a 16-bit address with a 4-kilobit page has a maximum index of 2^4 and a
total of 4096 offsets. 4096 is equal to 2^(16-4).

but what about a 32-bit address with an eight kilobit page? the
maximum index is 2^8, and there are a total of 8192 offsets, but 8192
doesn't equal 2^(32-8). doesn't it need to?

i ask because i was under the impression that the bits not used to
index were used to represent the offset. yet if the pages are 8
kilobits, then they only need 13 bits - not the 24 bits that 32-8 would
yield...
 
Previously zelnaga said:
i'm trying to understand how caches work and am a little confussed.

First, this is usually done with bytes and niot bits. But it works
with bits as well.
a 16-bit address with a 4-kilobit page has a maximum index of 2^4
and a total of 4096 offsets. 4096 is equal to 2^(16-4).
but what about a 32-bit address with an eight kilobit page? the
maximum index is 2^8,

Assuming by index you mean page number, this would be here in the range
from 1 ... 2^19.
and there are a total of 8192 offsets, but 8192
doesn't equal 2^(32-8). doesn't it need to?

Yes. And it does: 2^(32-19) = 2^13 = 8192
i ask because i was under the impression that the bits not used to
index were used to represent the offset. yet if the pages are 8
kilobits, then they only need 13 bits - not the 24 bits that 32-8 would
yield...

I am puzzled how you come up with that index numbers of yours....

Arno
 
Back
Top