(Solved) : 3 25 Points Analyze Assembly Program Consider Following Code Segment Istr String Tested Is Q44131949 . . .
3. (25 points) Analyze assembly program Consider the following code segment. Istr: .string “You will be tested!” Istrf: ;——– – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – .text ; Assemble into program memory. – – – – – – – – – – – – – – – – – – – — – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – RESET: StopWDT: mov.W mov.W mov.W mov.W mov.W sub.W rra.w add.w mov.b mov.b mov.b dec.W dec.W jnz # STACK_END, SP #WDTPWWDTHOLD,&WDTCTL #lstr, R4 #lstrf, R10 R10, R11 R4, R11 R11 #-1, R10 @R4+, R5 (R10), -1(R4) R5, 0(R10) R10 R11 gnext ; (2) Initialize stackpointer ; (5) Stop watchdog timer ; (2) ; (2) ; (1) ; (1) ; (1) ; (1) ; (2) ; (6) ; (4); ; (1) ; (1) ; (2) gnext: jmp $ ; jump to current location ‘$’ (endless loop) A. (20 points) What does this program do? Add code comments. B. (5 points) Calculate the total execution time in seconds (before reaching the infinite loop at the end of the program). The numbers in paranthesis specify the number of clock cycles needed for each instruction to execute. Assume the clock frequency is 2 MHz. How many instructions are executed in this program (before reaching the infinite loop)? Show transcribed image text 3. (25 points) Analyze assembly program Consider the following code segment. Istr: .string “You will be tested!” Istrf: ;——– – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – .text ; Assemble into program memory. – – – – – – – – – – – – – – – – – – – — – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – RESET: StopWDT: mov.W mov.W mov.W mov.W mov.W sub.W rra.w add.w mov.b mov.b mov.b dec.W dec.W jnz # STACK_END, SP #WDTPWWDTHOLD,&WDTCTL #lstr, R4 #lstrf, R10 R10, R11 R4, R11 R11 #-1, R10 @R4+, R5 (R10), -1(R4) R5, 0(R10) R10 R11 gnext ; (2) Initialize stackpointer ; (5) Stop watchdog timer ; (2) ; (2) ; (1) ; (1) ; (1) ; (1) ; (2) ; (6) ; (4); ; (1) ; (1) ; (2) gnext: jmp $ ; jump to current location ‘$’ (endless loop) A. (20 points) What does this program do? Add code comments. B. (5 points) Calculate the total execution time in seconds (before reaching the infinite loop at the end of the program). The numbers in paranthesis specify the number of clock cycles needed for each instruction to execute. Assume the clock frequency is 2 MHz. How many instructions are executed in this program (before reaching the infinite loop)?
Expert Answer
Answer to 3. (25 points) Analyze assembly program Consider the following code segment. Istr: .string “You will be tested!” Istrf: …
OR