Part a The instruction below pushes register R4 on the stack
Part a) The instruction below pushes register R4 on the stack. The values of R4 and SP prior to the push operation are shown below.
... ; R4=0xAB12, SP=100
push.w R4
1) What is the value of SP after the push instruction executes?
2) At what address is R4 pushed in the stack? Show the content of each address that the value occupies.
3) Is there any wasted memory that’s reserved on the stack?
Part b) Repeat the questions above for the case where the push instruction does a byte operation, that is: (push.b R4).
Solution
the operation of the stack is last in first out
1.after a push operation the stack location is increased by 1
so SP contents after push r4 will be102 since we are pushing a word contains two bytes so SP increments by 2
2.100-12 101-AB
3. yes thre is waste of memory because half filled
b. SP increments by 1 SP=101
R4=100-byte stored in R4
