My cache can have 32 address bits with 2 bits for index and 3 bits for byte-offset.

Associativity 2, block size 8.

Of course, the the bits for index says which row of the cache the data is.

But how do I know which block when there are 2 blocks (associativity 2)?

The 3 bits byte-offset only tells which byte within a block and there are 2 blocks.

Is there a comparator that determines which of the blocks has the tag that matches the incoming request for data?

  • \$\begingroup\$ Which/what cache is 'yours'? \$\endgroup\$
    – jippie
    Jan 20, 2013 at 17:48
  • \$\begingroup\$ @jippie It's just a model that I'm counting on the learn MIPS. \$\endgroup\$ Jan 20, 2013 at 23:50

1 Answer 1


Yes, that's exactly what the tag is for. With 2-way associativity, you have two comparators so that you can tell which of the two blocks (if any) contains the data you're looking for. Each tag and each comparator needs to be wide enough to handle all of the address bits left over after you remove the byte-index and cache-index bits. In your case that would be 32 – 3 – 2 = 27 bits.


Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.