I've been trying to understand this mostly incoherent question and I think I've got it.
I was thinking originally that your fundamental error is that bits used to maintain the cache data structure bits are subtracted from the data size; that doesn't make any sense. They are added to the data size.
But then I realized that no, your fundamental error is that you have confused bits with bytes. You are subtracting six bits from 32 bytes to nonsensically get 26, but you should be adding six bits to 32 x 8 bits.
The error that is just plain confusing is that you also seem to have confused the offset into the data block with the data block itself. The data block stores the data. The offset identifies the location of the relevant data within the data block. The offset is part of an effective address, not a cache line!
You also seem to have forgotten about the dirty bit throughout.
So then a single block in my direct map cache would look like this: [tag 5bit][data 32bit]
No. The number of times that 32 appears in this problem has confused you deeply:
- eight 32 bit words is 32 bytes
- five bits can represent 32 possible tags
- If you have 32 tags and 1024 bytes then each tag identifies 32 bytes
That's a lot of 32s and you've confused them terribly.
Start over.
Suppose you want a single line with 8 32 bit words in it, for a total of 32 bytes. What has to be in the single cache line?
- the 32 bytes -- NOT BITS
- a tag identifying where the 32 bytes came from
- one validity bit
- one dirty bit
If we assume that the 32 bytes can only be on 32-byte boundaries, and there are 1024 / 32 = 32 such boundaries, then for the tag we need log2(32) = 5 bits, so the total cache line size would be:
- 32 bytes NOT BITS of data
- 5 bits of tag
- one validity bit
- one dirty bit
Make sense?