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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 20:00, serellehunt
Which type of file can be used to import data into a spreadsheet?
Answers: 1
image
Computers and Technology, 23.06.2019 04:00, ittmanny6138
Laire writes a letter to her grandmother, in which she describes an amusement park she visited last week. she adds pictures of that place in her letter. which feature of a word processing program will claire to remove unwanted parts of the pictures?
Answers: 3
image
Computers and Technology, 23.06.2019 07:30, cireland
Write a program that inserts the digits of an integer into an array in originalorderfollowed by reverse order. first, promptthe user to enter a positive integer(> 0). determine the number of digits of the integer. create a dynamically allocated integer arrayof a size twice the number of digits. now insert the digits in original order which will occupy half of the array. then, insert the digits in reverse order. finally, output thedigits in thearray. use at least two functions to organize your program.
Answers: 3
image
Computers and Technology, 23.06.2019 15:00, ryleerose255
Idon’t understand the double8 coding problem. it is java
Answers: 1
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 in other subjects:

Konu
Business, 11.09.2019 06:10
Konu
Business, 11.09.2019 06:10