Reputation: 696
I've been chugging through my homework and this question keeps haunting me. Am I doing it all wrong?
I've taken the stance that the 'block address' is the part of these 32 bit reference addresses (given in most problems) that do not include the least-significant bits used as the byte offset (the part useful for selecting a word (or byte) within a block.
To demonstrate, say we are using a direct-mapped cache and given a 32 bit reference address such as 0000 0000 0000 0000 1111 1100 0001 1100
and that the tag is 24 bits, the index is 6 bits, and the offset is 2 bits.
My textbook (Computer Organization and Design: MIPS Edition) states that the block a given address maps to in a direct mapped cache is found by (block address) modulo (number of blocks in the cache)
. If I include the offset in this calculation as part of the 'block address' the resulting block I would indicate a hit/miss/store from would be very different than if I hadn't.
Thus, it would put me at ease to know if anyone knew if 'block address' was just another term for 'address' (the entire 32 bit reference) or if it means what I think it means which is the concatenation of the Tag and the Index (nothing more). Anyone know?
Upvotes: 0
Views: 4054
Reputation: 6134
Since mips uses words for addressing all addresses are essentially 30 bits long with 2 additional bits set to 0 (the byte offset at the end). The block-offset is the next 2 bits followed by the block address:
XXXX XXXX XXXX XXXX XXXX XXXX XXXX WW00
00
this is the word-offset, mostly useless in mips as you usually don't use bytesWW
this is the block-offset, used to identify which word to choose (assuming the block is 4 words long)XX..
the block address, this is the direct address of the memory block which contains 4 words and thus 4x4 = 16 bytes.When you talk about the block address you talk about the first 28 bits of the address as the rest are only offsets for other applications.
Tags and indexes only come into play when talking about a cache, at this point you look at the block address (in this case 28 bits) and choose your tag and index from this part only, the offsets are only used after cache access.
Upvotes: 2