1

I know that not taken prediction is always assuming the branch isnt taken so PC keep working normal unless proven wrong that branch is taken so flush all the instructions behind branch in pipeline (assuming the branch is resolved in MEM stage)

but what if the static prediction is always Taken? in my lecture notebook says:

The compiler will try to fill the Delay Slots after each BRANCH command with the jump address commands. In case for a particular BRANCH command it will not be able to fill all of its Delay Slot, then it will push NOP. Of course this processor will flush for BRANCH commands that are NOT TAKEN.

Can I have an easy example with actual instructions list? and also what are delay slots? what the difference between delay slots and NOPS?

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
Mostfa shma
  • 193
  • 1
  • 6
  • https://en.wikipedia.org/wiki/Delay_slot. / [What is the point of delay slots?](https://stackoverflow.com/q/15375084) / [Why is the branch delay slot deprecated or obsolete?](https://stackoverflow.com/q/54724410). If the branch delay slot / slots fully hide branch latency, no prediction is needed. [Is that true if we can always fill the delay slot there is no need for branch prediction?](https://stackoverflow.com/q/34114739) – Peter Cordes May 12 '20 at 00:07
  • @PeterCordes I'm still trying to understand the concept of delay slot, so what happens is a delay slot inserted to that inst after branch that this instruction will be executed no matter if the branch is taken or not? and if it is taken then the inst after the branch will be flushed? – Mostfa shma May 12 '20 at 00:31
  • 1
    The instruction after the branch is always executed, whether the branch is taken or not. – Raymond Chen May 12 '20 at 02:35

0 Answers0