title: What branch misprediction does the Branch Target Buffer detect?
body: <p>I am currently looking at the various parts of the CPU pipeline which can detect branch mispredictions. I have found these are:</p>
  
  <ol>
  <li>Branch Target Buffer (BPU CLEAR)</li>
  <li>Branch Address Calculator (BA CLEAR)</li>
  <li>Jump Execution Unit (not sure of the signal name here??)</li>
  </ol>
  
  <p>I know what 2 and 3 detect, but I do not understand what misprediction is detected within the BTB. The BAC detects where the BTB has erroneously predicted a branch for a non-branch instruction, where the BTB has failed to detect a branch, or the BTB has mispredicted the target address for a x86 RET instruction. The execution unit evaluates the branch and determines if it was correct.</p>
  
  <p><strong>What type of misprediction is detected at the Branch Target Buffer? What exactly is detected as a misprediction here?</strong></p>
  
  <p>The only clue I could find was this inside Vol 3 of the Intel Developer Manuals (the two BPU CLEAR event counters at the bottom):</p>
  
  <p><img src="https://i.stack.imgur.com/OJEr1.png" alt="enter image description here"></p>
  
  <blockquote>
    <p>BPU predicted a taken branch after incorrectly assuming that it was
    not taken.</p>
  </blockquote>
  
  <p>This seems to imply the prediction is not done "synchronously", but rather "asynchronously", hence the "after incorrectly assuming"??</p>
  
  <p>UPDATE:</p>
  
  <p>Ross, this is the CPU branch circuitry, from the original Intel Patent (hows that for "reading"?):</p>
  
  <p><img src="https://i.stack.imgur.com/2Y3jy.png" alt="enter image description here"></p>
  
  <p>I don't see "Branch Prediction Unit" anywhere? Would it be reasonable that somebody having read this paper would assume that "BPU" is a lazy way of grouping the BTB Circuit, BTB Cache, BAC and RSB together??</p>
  
  <p>So my question still stands, which component raises the BPU CLEAR signal?</p>