user644441
user644441

Reputation: 11

Branch Prediction

There is a branch sequence for 10 execution. A mispredicted branch results in a penalty of one stall cycle. How many stall cycles for a static predict not taken scheme.

How about for a one-bit dynamic prediction schemeif the prediction bit is 0?

T N T N T T N T N N

Upvotes: 0

Views: 1883

Answers (1)

Jerry Coffin
Jerry Coffin

Reputation: 490108

[Note this looks like homework, so I'm just posting some guidelines on how things work, rather than directly answering what was asked.]

If all branches are statically predicted as not taken and there's a one-cycle penalty for a mis-predicted branch, then you're going to have a penalty every time a branch is taken (note that this is basically equivalent to having no branch prediction at all).

A one-bit predictor is basically going to just predict that the last action (taken or not) is repeated the next time that branch is encountered. In this case you get a penalty every time there's a transition between taken and not taken.

Upvotes: 1

Related Questions