See next subroutine We have to use push and pop registers to

See next subroutine. We have to use push and pop registers to save values and return them back before leaving the subroutine. How many cycle percentage has been added to the subroutine cycles when r1, r2, and r3 has been used? Percentage = # of cycles added/# of cycles for original subroutine ADD R1, R0, R0 ADD R2, R0, R0 ADD R3, R1, R2 MOV PC, LR

Solution

we have to use the PUSH instruction 3 times (for R1,R2 and R3) before the subroutine and 3 more times after the subroutine we have to use POP instruction.

PUSH R1

PUSH R2

PUSH R3

----SUBRUTINE----

POP R1

POP R2

POP R3

So we had added 6 instructions to the code, the percentage is:

Percentage=6/4=1.5 --->150%

 See next subroutine. We have to use push and pop registers to save values and return them back before leaving the subroutine. How many cycle percentage has bee

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site