subject

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?

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 11:00
in 2007, floridians died in alcohol-related collisions.a.  501b.  1,051c.  5,015d.  10,839
Answers: 1
question
Computers and Technology, 22.06.2019 12:40
In a response of approximately 50 words, explain why it would be essential for the successful a/v technician to participate in additional coursework, presentations and seminars offered by equipment manufacturers as well as annual conferences attended by colleagues in the industry.
Answers: 1
question
Computers and Technology, 23.06.2019 14:30
Select the correct answer. what does it indicate when a website displays https instead of http? a. the website is secure. b. there is no secure sockets layer. c. the secure sockets layer is hidden. d. the website is not secure.
Answers: 1
question
Computers and Technology, 23.06.2019 19:40
Use a physical stopwatch to record the length of time it takes to run the program. calculate the difference obtained by calls to the method system.currenttimemillis() just before the start of the algorithm and just after the end of the algorithm. calculate the difference obtained by calls to the method system.currenttimemillis() at the start of the program and at the end of the program so that the elapsed time includes the display of the result. use the value returned by the method system.currenttimemillis() just after the end of the algorithm as the elapsed time.
Answers: 3
You know the right answer?
Implement the following C code in RISC-V assembly. Part 2: (3 pts) What is the total number of RISC-...
Questions
question
Mathematics, 05.05.2021 02:40
question
Mathematics, 05.05.2021 02:40
Questions on the website: 13722360