I am confused by the concept of byte offset. In my textbook the examples always show the word aligned byte offset as being two bits but doesn't really explain how they arrive at that value. It says they are word aligned so the offset is 2 bits. This doesn't really make sense to me because I thought words were 32 bits so wouldn't the offset have to be larger than just 2?
Branching off of this, what exactly is the difference between word addressable and byte addressable and how do I calculate their respective offsets?
I have a problem that I am trying to work through that deals with all of these things. I am trying to calculate the tag, set, block offset and byte offset for a direct mapped cache. The data is 32 bits long. The cache is byte addressable and each access returns a single byte. Each line in the cache holds 16 bytes.
Here is what I have so far:
I think there are zero set bits because its direct mapped. I think byte offset is also zero because it returns 1 byte and \$log_2 1=0\$. I think block offset is 4 because each block is 16 bytes and \$log_2 (16) = 4\$
So In this case I think I would have [tag = 28 bits][index = 0 bits][block offset = 4 bits][byte offset = 0 bits] but I'm not sure.
Am I on the right track??