分支预测
有一个执行10次的分支序列。错误预测的分支会导致一个停顿周期的惩罚。未采用静态预测的方案有多少停顿周期。
如果预测位为 0,那么对于一位动态预测方案怎么样?
TNTNTTNTNN
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
[注意,这看起来像家庭作业,所以我只是发布一些关于事情如何工作的指南,而不是直接回答所问的问题。]
如果所有分支都被静态预测为未采用,并且错误预测会受到一个周期的惩罚分支,那么每次采用分支时都会受到惩罚(请注意,这基本上相当于根本没有分支预测)。
一位预测器基本上只是预测下次遇到该分支时会重复上一个操作(无论是否采取)。在这种情况下,每次在采取和未采取之间进行转换时,您都会受到处罚。
[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.