Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assume the PIC24FJ64GA002 microcontroller in the following problems. Note that assembly instruction descriptions can be found in Microchips, 16-bit MCU and DSC Programmers Reference Manual

Assume the PIC24FJ64GA002 microcontroller in the following problems. Note that assembly instruction descriptions can be found in Microchips, 16-bit MCU and DSC Programmers Reference Manual

.

image text in transcribed

Problem 3. The listing of an assembly subroutine MySum written for the PIC24FJ64GA002 which recursively computes the sum of the first n integers (1, 2, 3, . . . n) is shown below. At the time the subroutine is called (8) - 0x0010 and (w15) - 0x800 MySum mov.w8, [w15++] mov. W cpo. w bra dec.w rcall add.w bra LE, L3 mysum 2 mov.W 2 mov. W return The subroutine is invoked to compute the sum 1+2+3 as: #0x3, MySum w0 ; argument is passed in wO mov.W rcall Assume FosC is 32 MHz for an instruction cycle time, Tcy, of 62.5 ns (a) Register w15 is the stack pointer. How much stack is used (number of bytes) for a single call to subroutine MySum? What is put in each location of the stack? Explain. (b) The subroutine MySum computes the sum recursively. What is the total amount of data memory (bytes) used to compute the sum of 1+2+3? (c) How long does it take to compute the sum 1+2+3 with this subroutine? (d) Where is the result computed by the subroutine MySum located when it is returned? Problem 3. The listing of an assembly subroutine MySum written for the PIC24FJ64GA002 which recursively computes the sum of the first n integers (1, 2, 3, . . . n) is shown below. At the time the subroutine is called (8) - 0x0010 and (w15) - 0x800 MySum mov.w8, [w15++] mov. W cpo. w bra dec.w rcall add.w bra LE, L3 mysum 2 mov.W 2 mov. W return The subroutine is invoked to compute the sum 1+2+3 as: #0x3, MySum w0 ; argument is passed in wO mov.W rcall Assume FosC is 32 MHz for an instruction cycle time, Tcy, of 62.5 ns (a) Register w15 is the stack pointer. How much stack is used (number of bytes) for a single call to subroutine MySum? What is put in each location of the stack? Explain. (b) The subroutine MySum computes the sum recursively. What is the total amount of data memory (bytes) used to compute the sum of 1+2+3? (c) How long does it take to compute the sum 1+2+3 with this subroutine? (d) Where is the result computed by the subroutine MySum located when it is returned

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Internals A Deep Dive Into How Distributed Data Systems Work

Authors: Alex Petrov

1st Edition

1492040347, 978-1492040347

More Books

Students also viewed these Databases questions

Question

Explain the function and purpose of the Job Level Table.

Answered: 1 week ago