作者guanrulee (Cobra)
看板Grad-ProbAsk
标题[理工] 计算机组织结构-计算机语言介绍
时间Fri Jun 26 14:33:40 2009
这是关於堆叠指标的问题
Given the following 8 possible solution for a POP or a PUSH operation in a
STACK : 1.Read from Mem(SP), Decrement SP ;
2.Read from Mem(SP), Increment SP ;
3.Decrement SP, Read from Mem(SP) ;
4.Increment SP, Read from Mem(SP) ;
5.Write to Mem(SP), Decrement SP ;
6.Write to Mem(SP), Increment SP ;
7.Decrement SP, Write to Mem(SP) ;
8.Increment SP, Write to Mem(SP) ;
(1) Solution of a PUSH operation for a Last Full stack that grows ascending.
8.Increment SP, Write to Mem(SP) ;
(2) Solution of a POP operation for a Next Empty stack that grows descending.
4.Increment SP, Read from Mem(SP) ;
(3) Solution of a PUSH operation for a Next Empty stack that grows ascending.
6.Write to Mem(SP), Increment SP ;
(4) Solution of a POP operation for a Last Full stack that grows descending.
2.Read from Mem(SP), Increment SP ;
请问这4题题目该如何翻译呢?答案又为何是这4个呢?
stack的存取规则不是PUSH时 SP<-SP-1 Stack(sp)<-data
POP 时 data<-Stack(sp) SP<-SP+1 吗?
题目後面的 ascending descending 为何有两种sp移动的方向呢?
希望高手帮忙解答^^~
--
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 61.228.208.209