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 1 +include "msp430 . h" : Adefine controlled include file PUBLIC mysub RSEG CODE mysub: PUSH R10 R11 R11 R13 #7, R10 PUSH CLR 10 12 13 Inext: BIT.B #0x01, R12 14 15 16 1skip: RA.B R12 17 18 19 20 21 lskip R13, R11 ADD R13 R10 lnext DEC BIT.B #0x01, R12 32 SUB 23 lend: NOV 24 25 26 27 END R13, R11 R11, R13 R11 R10 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 m sub. 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
