Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Exercise 6.34 Consider the following high-level function. // C code int f(int n. int k) f int b: bak+2: if (n0) b 10: else b

image text in transcribed
Exercise 6.34 Consider the following high-level function. // C code int f(int n. int k) f int b: bak+2: if (n0) b 10: else b b+ n nf(n-1. k+1): return b +k: 0 CHAPTER SIX Architecture (a) Translate the high-level function f into ARM assembly language. Pay parti- cular attention to properly saving and jestoring registers across function calls and using the ARM preserved register conventions. Clearly comment your code. You can use the ARM MUL instruction. The function starts at instruc- tion address Ox00008100. Keep local variable b in R4. (b) Step through your function from part (a) by hand for the case of f(2. 4). Draw a picture of the stack similar to the one in Figure 6.14, and assume that SP is equal to OxBFF00 100 when f is called. Write the register name and data value stored at each location in the stack and keep track of the stack pointer value (SP). Clearly mark each stack frame. You might also find it useful to keep track of the values in RO, R1, and R4 throughout execution. Assume that when f is called, R.; 0xABCD and LR-, 0x00008010. What is the final value of RO

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

Students also viewed these Databases questions

Question

a. How do you think these stereotypes developed?

Answered: 1 week ago

Question

7. Describe phases of multicultural identity development.

Answered: 1 week ago