{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Subroutine Calls - Mallard ECE 290 Computer Engineering I...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Mallard ECE 290: Computer Engineering I - Spring 2007 - Graded Web... https://mallard.cites.uiuc.edu/ECE290/webgrade.cgi?SessionID=mding3... 1 of 2 4/22/2007 8:10 PM Graded WebQuiz: Subroutine Calls You have submitted this WebQuiz 3 times (including this time). You may submit this WebQuiz a total of 10 times and receive full credit. Question #1 To execute a subroutine call, there are 3 steps involved in saving the current program location and moving to the subroutine. Specify these 3 steps (each of a form like PC < -- SP + 1). Notes: 1. Use 'PC' for program counter and use 'SP' for the stack pointer register (rather than e.g. R6). 2. Recall that the stack grows "upward" - i.e., from larger to smaller addresses. CALL 9510 SP < -- SP-1 M[SP] < -- PC PC < -- 9510 At the end of each subroutine, execution returns to the main program. RETURN PC < -- M[SP] SP < -- SP+1 You received a raw score of 100% on this question. Question #2 Given initial register and memory values as shown below. Assume that CALL is a 1-word instruction, containing the opcode and the subroutine address.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}