a question on yesterday's lecture...
A student writes:
I'm still a little cloudy about what is happening when the cache's
bookkeeping cache and data cache are being loaded. Let me know if I'm
going about this correctly:
(Assuming cache is initially empty)
Physical Memory is 256B
Cache is 64B (Direct Mapped)
Block size is 8B
---corresponds to 32 Blocks in PM
---corresponds to 8 Blocks in Cache
It takes 5 bits to reference a Block in Physical memory
[7:6]TAG [5:3]Index [2:0]Byte on Block (Physical Address 8bits)
Great! Everything is set up correctly.
Lets say we access 0x17; its not in the cache, so we go to memory
and get the data, but now we put it in the cache so it may be there
when we access it again.
Actually, what we put in the data part of the cache (what I have called
Cache_D) is the data associated with the entire block -- the contents of
memory locations 0x10 to 0x17.
My question is what exactly is going into the Bookkeeping cache
and the data cache: (This is what thought you were saying yesterday)
What goes in the bookkeeping entry of the Tag Store (aka Cache_A) is everything
that is needed to handle the block of memory (0x10 to 0x17). That is:
The tag bits identify which of the four blocks associated with
index bits [5:3] is actually in the cache, in this case: 00.
The valid bit set telling us that we can believe the tag bit
Since it is direct mapped, how many bits do you think you need
for replacement information?
You did not tell me whether the cache was write through or
write back, so I do not know whether there is a dirty bit
Lets say our next access to memory is at 0x17 again. This time
it is in the cache:
The TAG 00 would be in the bookkeeping cache. So does this mean that
the data portion of the cache contains all the data that would
be in Block 00 of Physical Memory or does it just contain the data
that was at 0x17.
<<name withheld to protect the ...>>
What is in the data part is the contents of the whole block of physical memory,
which is block 0x02, not block 0x00. The eight bits of address are:
0 0 0 1 0 1 1 1
I have underlined the bits which specify the block number. The first two
bits 00 identify which of the four blocks is in the cache, the next three
bits 010 provide the index which tells you where to look in the tag store
and data store to find the bookkeeping information and data respectively.