Question

Why does the value of R13 decrease by 4 for each register that is POPped, but...

Why does the value of R13 decrease by 4 for each register that is POPped, but the value

of R15 increase by 4 at the end of the execution of the POP instruction in our ARM

microcontroller?

Homework Answers

Answer #1

R13 is stack pointer and R15 is program counter. R13, stack pointer points to last occupied stack address. After ecxecution of POP, the contents which are saved in stack beacuase of Pushing have to be restored. Usually 5 contents r0,r1,r2,r3,r4,r5 are pushed in stack and in the process stack point is increased by 5 and they have to be restored on popping. Hence, current stack pointer should be decreased by 4 to get the pushed contents.

On executing POP instruction after restoring contents, program control has to be transfered to the next instruction, Hence program counter R15 gets increased by 4.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
I. What value will be in register r2 after execution of the following instructions? Show your...
I. What value will be in register r2 after execution of the following instructions? Show your work with the register values after executing each instruction. MOV r2, #0x0 LDR r1, =0xCF MOVS r1, r1, LSR #1 ADC r2, r2, #0 MOVS r1, r1, LSR #1 ADC r2, r2, #0 II. Assume a 32 bit register holds a data of four bytes as B3B2B1B0. Write a sequence of ARM instruction that takes this data as input and swaps the bytes 0...
4) If variable A=0x05 & register B=0x10, and you compare the variables with the instruction (a>=b),...
4) If variable A=0x05 & register B=0x10, and you compare the variables with the instruction (a>=b), what's the contents of A, B after the comparison: a) 05, 10 b) 15, 05 c) F1, 00 d) F1, 10 e) 15, 00 5) In the instruction above, what's the value of the N, Z conditions after the execution: a) 0,0 b) 1,0 c) 0,1 d) 1,1 e) 0,0 6) If A = 0xAB, and you execute a shift right instruction A=A>, what...
VII. After execution of the following instructions what value will be in register r2? Trace the...
VII. After execution of the following instructions what value will be in register r2? Trace the program and write the value of the registers at each line to receive full credit. LDR r12, =0xA4000000 LDR r0, =0x2D STR r0, [r12, #-4]! LDR r0, =0x5E STR r0, [r12, #-4]! LDR r0, =0xD5 STR r0, [r12, #-4]! LDMIA r12!, {r0-r2} SUB r2, #0x68 VIII. Write a simple ARM assembly program to divide a 32 bit positive number stored in r0 by a...
Given with the code of an 8051, how does a JZ instruction work? Why is it...
Given with the code of an 8051, how does a JZ instruction work? Why is it essential to add CPL A before and after the JZ instruction? ORG 0000H MAIN: CLR A INPUT: CALL DELAY MOV A, P2 CPL A ; complement the content of the register Accumulator JZ INPUT ; jump to INPUT if no switch is pressed CPL A; complement the content of the register Accumulator MOV P1, A CALL ROTATE ROTATE: RL A MOV P1, A CALL...
1. Why does an increase in reserve requirements cause a decrease in the money supply? 2....
1. Why does an increase in reserve requirements cause a decrease in the money supply? 2. Why does a decrease in reserve requirements cause an increase in money supply?
Why does a monopolist's marginal revenue decrease as output increase?
Why does a monopolist's marginal revenue decrease as output increase?
Why does an increase in altitude result in a decrease of thrust for a turbojet engine?
Why does an increase in altitude result in a decrease of thrust for a turbojet engine?
Why is it that a decrease in the discount rate does not normally lead to an...
Why is it that a decrease in the discount rate does not normally lead to an increase in borrowed reserves (discount loans)? Use the supply and demand analysis of the market for reserves to explain.
Does the pH increase, decrease, or remain the same on addition of each of the following?...
Does the pH increase, decrease, or remain the same on addition of each of the following? (i) NaNO2 to a solution of HNO2, (ii) HCl to a solution of NaC2H3O2 A. (i) decrease, (ii) increase B. (i) increase, (ii) increase C. (i) decrease, (ii) decrease D. (i) increase, (ii) decrease Pls explain the answers for me.
Define marginal productivity and does it increase or decrease as more labor is hired and why
Define marginal productivity and does it increase or decrease as more labor is hired and why