[理工] 计组两题 caller/callee 和 设计原则

楼主: clonsey1314 (Clonsey)   2017-12-09 16:18:31
1. 94成大电通
哪一项符合design principle的"simplicity favors regurality"?
(a) Keeping all insturctions in a single size
(b) Always requiring three operands in arithmetic instruction
(c) Keeping the register fields in the same place in each instruction format
(d) Having the same opcode field in the same place in each instruction format
答案: (a) (b) (c)
请问d为什么错? 虽然课本举例的"一致才会简单"是举前3个而已,
但d应该也是符合一致性吧?
2. 104台大资工
In each ISA's calling convention, the set of general purpose registers is
usually divided into caller-save and callee-save two subsets. Which type of procedures could
benefit most from such a register partition?
答案: If general purpose registers is not divided into caller-save and callee-save
subsets, the caller must maintain all the registers allocated to the frequently used local
variables even though the callee don’t have any local variables. That is, if the
callee-procedure has no local variables, it could benefit most from such a register partition.
请问为何是对callee较好? 不是减轻caller的负担吗?
作者: TampaBayRays (光芒今年拿冠军)   2017-12-09 16:21:00
我记得第一题老师上课的时候是说这个就算是不好的指令集也要遵守所以不算
作者: TMDTMD2487 (ㄚ冰)   2017-12-09 16:27:00
第一个问题的d, 是无法改变的规格, 不然你不能解码op放在那随便但一定是要固定的不然无法解码第二个的意思是说如果callee没有local变量那对整体效能会比较好因为就不需要把caller的存到stack上述比较好就是跟caller存相比之下这里benefit是针对整个执行的效率吧op的一致不是为了更好的ISA设计 是因为他不能不一致四个设计原则基本上就是说,照这样设计比较好可是OP一致是必要的,感觉上就是不太能说是因为这四个原则才变成如此
楼主: clonsey1314 (Clonsey)   2017-12-09 17:11:00
原来如此,感恩!

Links booklink

Contact Us: admin [ a t ] ucptt.com