Computers and Technology

Implement the following C code in RISC-V assembly. Part 2: (3 pts) What is the total number of RISC-V instructions needed to execute the function? int fib (int n) { if (n==0) return 0; else if (n==1) return 1; else return fib(n-1) + fib(n-2); } Part 3: (5 pts) For each function call above, show the contents of the stack after the function call is made. Assume the stack pointer is originally at address 0x7c, and follow the register convention of RISC-V (argument, saved, temporary, sp, RET, etc etc). Solution: Problem 7: (9 pts) Part 1: (6 pts) Translate function f into RISC-V assembly language. Assume that the function declaration for function g is: int g (int a, int b); The code for function f is as follows: int f(int a, int b, int c, int d) { return g (g(a, b), c+d); } Part 2: (3 pts) Can we determine the contents of registers: x10 – x14, x8, x1, and sp?

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 12:40, Emilyvite6251
According to the video what are some tasks petroleum engineers perform check all that apply
Answers: 2
image
Computers and Technology, 23.06.2019 22:50, christingle2004
What is an rss reader used for? for creating a user account on a social new site
Answers: 2
image
Computers and Technology, 25.06.2019 06:20, joe7977
If you want to change the speed of a layer's horizontal scrolling, what should you change? a. the x coefficient b. the y coefficient c. the virtual width d. the order of the game's layers select the best answer from the choices provided
Answers: 2
image
Computers and Technology, 25.06.2019 12:30, emily4984
In a paragraph of no less than 125 words, explain what netiquette is and how it improves efficiency and productivity in the workplace.
Answers: 1
Do you know the correct answer?
Implement the following C code in RISC-V assembly. Part 2: (3 pts) What is the total number of RISC-...

Questions in other subjects:

Konu
Mathematics, 02.04.2020 23:08