Let's say, I have a cache with:
- 2^32 bytes of memory
- 2048 blocks (of 16 bytes each)
Now I'm trying to figure out how much bits each field will contain.
One block is 16 bytes (16 * 8 = 128 bits). The block also contains 1 dirty bit and 1 valid bit. I know that since there are 2048 (=2^11) blocks, and the whole block contains 16 bytes (=2^4) the tag-field will be 4 + 11 + 1 (valid) + 1 (dirty) = 17 bits. So the whole size of 1 block will be 17 + 128 bits. Is this right?
And if so, where do I need the given 2^32 bytes of memory, and what is the difference with the direct-mapped cache in comparison to counting the 4-way-set-associative cache fields?
I hope someone can help me, thanks in advance!