title: Cache and memory
body: <p>First of all, this is not language tag spam, but this question not specific to one language in particulary and I think that this stackexchange site is the most appropriated for my question.</p>
  
  <p>I'm working on cache and memory, trying to understand how it works.
  What I don't understand is this sentence (in bold, not in the picture) :</p>
  
  <blockquote>
    <p>In the MIPS architecture, since words are aligned to multiples of four
    bytes, <strong>the least significant two bits are ignored</strong> when selecting a
    word in the block.</p>
  </blockquote>
  
  <p>So let's say I have this two adresses :</p>
  
  <pre><code>    [1........0]10
      [1........0]00
           ^
           |
     same 30 bits for boths [31-12] for the tag and [11-2] for the index (see figure below)
  </code></pre>
  
  <p>As I understand the first one will result in a MISS (I assume that the initial cache is empty). So one slot in the cache will be filled with the data located in this memory adress.</p>
  
  <p>Now, we took the second one, since it has the same 30 bits, it will result in a HIT in the cache because we access the same slot (because of the same 10 bits) and the 20 bits of the adress are equals to the 20 bits stored in the Tag field.</p>
  
  <p>So in result, we'll have the data located at the memory <code>[1........0]10</code> and not <code>[1........0]00</code> which is wrong !</p>
  
  <p>So I assume this has to do with the sentence I quote above. Can anyone explain me why my reasoning is wrong ? </p>
  
  <p>The cache in figure : </p>
  
  <p><img src="https://i.stack.imgur.com/5pgJp.jpg" alt="enter image description here"></p>