Answered step by step
Verified Expert Solution
Question
1 Approved Answer
3. (30 pts) Given the below program of the RISC machine with a 32-bit word size, answer the following questions. Assume that #FIRST=0x100 is
3. (30 pts) Given the below program of the RISC machine with a 32-bit word size, answer the following questions. Assume that #FIRST=0x100 is the starting memory address of two consecutive words: 0xDE2B06, 0x63A58. #SECOND=0x500 is the starting memory address of two consecutive words: 0xF2B07, 0x6358. Note RO is dedicated to hold a constant value 0. Instruction LoadByte loads a byte from the memory into the rightmost eight bit positions of a 32-bit processor register and clears the remaining higher-order bits to zero. Assume we do not use stack for storing return address (i.e., PC). a) (15 pts) Show the processor stack contents and the contents of the stack pointer, SP, immediately after each of the following instructions. Assume that [SP]-0x1000 before the execution of the calling program. (i) The 2nd Store instruction in the subroutine. (8 pts) (ii) The last Add instruction in the subroutine. (7 pts) b) (15 pts) What are the contents of R2, R3, R5, R6, and R7 (in hexadecimal) immediately before the instruction "Load R7, (SP)" (3 pts each) R2, #8 R3, #FIRST R4, #SECOND FUNCTION SP, SP, #12 R5, 8(SP) R6,4(SP) R7, (SP) Move Move Move Call FUNCTION: Subtract Store Store Store Move R5, RO LOOP: LoadByte R6, (R3) LoadByte R7, (R4) Branch_if_[R6]-[R7] NEXT Add R5, R5, #1 NEXT: Add R3, R3, #1 Add R4, R4, #1 Subtract R2, R2, #1 Branch if [R2]>[RO] LOOP Move R2, R5 Load Load Load R7, (SP) R6,4(SP) R5, 8(SP) Add SP, SP, #12 Return
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started