I have an excerpt from my textbook concerning direct mapped cache that I would like further clarification on, the text reads.....

"Consider the following example: Assume memory consists of 2^14 words, cache has 16 blocks, and each block has 8 words. From this we determine that memory has 2^14/2^13 = 2^11 blocks.

We know that each main memory address requires 14 bits. Of this 14-bit address field, the rightmost 3 bits reflect the word field (we need 3 bits to uniquely identify one of 8 words in a block). We need 4 bits to select a specific block in cache, so the block field consists of the middle 4 bits.

The remaining 7 bits make up the tag field."

My questions are:

Where does the 2^13 come from when they calculated how many blocks in the first paragraph?

How did they go about identifying that the block field should contain 4 bits? Is this because the cache has 16 blocks and 2^4 is 16?

Thank you for your time!

  • $\begingroup$ The arithmetic doesn't make sense. 2^14/2^3=2^11, not 2^13. 2^3 is the eight words (per block). $\endgroup$
    – sh1
    Commented Nov 30, 2016 at 17:50
  • $\begingroup$ 2^13 : Probably a typo, should be 2^3 = 8 words per block. 4bits : Yes, this is because you need 4 address bits to select among 16 blocks. $\endgroup$
    – Grabul
    Commented Nov 30, 2016 at 22:29
  • 3
    $\begingroup$ Possible duplicate of Tag, index and offset of associative cache $\endgroup$
    – Ran G.
    Commented Feb 2, 2018 at 14:17


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.