Question: 3. (25 points) Consider the following assembly subroutine mysub shown below. Two 8-bit input parameters are passed to the subroutine through registers R12 and R13.
3. (25 points) Consider the following assembly subroutine mysub shown below. Two 8-bit input parameters are passed to the subroutine through registers R12 and R13. The result is returned back to a caller in register R13 Clock Cycles include "msp430 . h" ; #define controlled include file PUBLIC mysub RSEG CODE 7ysub PUSH R10 PUSH R11 R11 R13 #7, CLR SXT 10 R10 12 13 1next : BIT . B #0x01, R12 14 15 16 1kip: RRA.B R12 17 18 19 20 JZ ADD 1skip R13, R11 R13 DEC UNZ BIT . B lnext #0x01, lend R13, R11 R11, R1:3 R11 R10 R12 SUB 23 lend: MOV 24 25 26 27 END POP POP RET A. (15 points) What does this program do? Add code comments (lines 7-26). B. (5 points) Calculate the total number of clock cycles needed to execute mysub. The last column CC gives the execution time in clock cycles for several instructions. Determine clock cycles for other instructions using the information from user manual (4xx devices in angel, Tables 3-14, 3-15, 3-16). Assume that instructions at lines 15 and 22 are executed with probability of 50%. C. (5 points) Assuming that the CPU runs at 8 MHz clock frequency, what is subroutine execution time? What is CPI (cycles per instruction)? What is MIPS rate for this program
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
