Say I have the following memory scheme:
Data bus: 8 bit
Main Memory Store: 256 Byte
Cache Store : 32 Byte
Block Size : 4 Byte
How would I go about listing the assigned bits for tag,offset and block number for location 12?
I think the right answer is 12 is binary is 00001100 since we have 8-bit representation. Then the first 4-bits would be line number and block number and the last 4 would be the offset? Is this correct? If not can anyone explain why?
I got this question wrong on homework and my TA is not responding to my questions.
My line of thinking is that each memory location saved in a cache is made of 3 components, the tag (which is what the cache uses to recognize it), the index (the location in cache that it is stored), the offset(tells the ram which offset hold the value).
Now in tag + index = baselocation and baselocation + offset = the address we want in main mem.
First off to calculate the offset it should 2^b where b = linesize. In direct mapping line size = block size which is 4. So the lower 4 bits are my offset.
Next the index which is the power of 2 that is needed to uniquely address memory. Since the cache total is 32. We need 2^x = 32 which is 5.
Lastly the tag is total# of bits - (offset + index) = -1 because 8 -9 which I know is inherently wrong.
This leads me to my previous answer above for location 12. Since it is 8-bits the lower 4 must be my offset leaving the upper 4 for my tag and index.
Guess that's why I got it wrong. But what is the right answer? And how do you solve these types of problems?