-2

My wording for this question might not be specific enough, but here's a little more context...

When looking for a block in cache, the controller selects the set first. Then does it, 1) Test all valid bits in selected set and "return" a cache miss if any valid bits are not set to 1 or 2) Find the line with a matching tag bit and THEN check the valid bit for just that line.

I understand everything else relating to this process. I'm just a little confused on what comes first, finding the line or testing valid bit(s). Thanks in advance!

  • There may be implementations that do either, or might even check them in parallel... Does it really matter? – twalberg Mar 05 '14 at 21:15
  • I would think it would, take for example if you were searching for a specific block and the valid bit of a line in the same set was 0 but the valid bit for the line with your block is 1. You would see a cache miss if both have to be valid or a cache hit if only the specific target line had to be valid – carterwilliamson Mar 05 '14 at 21:18
  • Why would a 0 valid bit on a line you're not interested in matter? – twalberg Mar 05 '14 at 21:23
  • I guess that's the root of my question, does the controller test the valid bits for all lines or just the one line. Assuming they are all lines of the same set. – carterwilliamson Mar 05 '14 at 21:25
  • An implementation could either 1) find the right line then check if it's valid or 2) find all valid lines and see if the right line is among them, or 3) find all valid lines and the right line in parallel and see if the two results intersect. The end result would be the same, and the choice the implementers made isn't generally documented in publicly available documentation. – twalberg Mar 05 '14 at 21:28
  • You should write that as an answer so I can accept it, thank you very much! – carterwilliamson Mar 05 '14 at 21:32

1 Answers1

0

An implementation could either 1) find the right line then check if it's valid or 2) find all valid lines and see if the right line is among them, or 3) find all valid lines and the right line in parallel and see if the two results intersect. There may even be other approaches, like considering the valid bit to be an extra bit in the tag and searching for that augmented tag... The end result would be the same, and the specific choice the implementers made isn't generally documented in publicly available documentation, but may be available in design documentation, if they can be persuaded to reveal it.

twalberg
  • 59,951
  • 11
  • 89
  • 84