Re: [问题]100台联大

楼主: ccpz (OoOoOo)   2017-05-10 21:57:04
※ 引述《SODAred043 (魔力洪)》之铭言:
: 100年计概 第八题
: Assume a computer uses pipelining of 9 stages.
: Each stage demands 3 clock cycles to finish its task.
: How many clock cycles are need to execute 11 independent instructions?
: A.33
: B.297
: C.57
: D.19
: E.none of the above
: 小弟觉得是11个指令排一排进去所以选A
: 可是老师说会先做完9个指令,再做剩下两个所以选C
: 听完还是不太懂为什么中间会空这么长的一段 想请教板上的大家
: 谢谢><
你应该想成一个 instruction 只要 3 clock 吧?
这里通常都是说一个 instruction 要经过 9步骤才执行完毕
https://goo.gl/Joa3mE
像这张图,一到指令要经过读取,解码,执行,写回
而且每个 stage 同个时间只能执行一个 instruction
所以第一个 instruction 做第二个 stage 时,第一个 stage 空着,
他就可以先做第二个 instruction
图示就是这样:
1,1,1,1,1,1,1,1,1 (instruction 1 经过 9 个 stage, 每个 3 clock, 27 clock 完成)
2,2,2,2,2,2,2,2,2 (instruction 2 在 clock=4 时就可以开始做. 31 clock 完成)
所以最后就是 27+(11-1)*3=57
作者: SODAred043 (魔力洪)   2017-05-10 23:59:00
懂了懂了 谢谢大大的详细解说

Links booklink

Contact Us: admin [ a t ] ucptt.com