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 06:40
Match the personality traits with their description
Answers: 2
question
Computers and Technology, 22.06.2019 15:10
Consider a direct-mapped cache with 216 words in main memory. the cache has 16 blocks of 8 words each. it is a word-addressable computer (rather than a byte-addressable computer which we normally discuss). (a) how many blocks of main memory are there? (b) what is the format of a memory address as seen by the cache, that is, what are the sizes of the tag, cache block, and block offset fields (if they apply)? (c) to which cache block will the memory reference db6316 map?
Answers: 1
question
Computers and Technology, 23.06.2019 20:50
3.11.3 quiz: comparing and analyzing function typesquestion 4 of 102 pointswhat can you say about the y-values of the two functions f(x) = 3x2-3 andg(x)=2* - 3?
Answers: 2
question
Computers and Technology, 23.06.2019 22:20
What is a programming method that provides for interactive modules to a website?
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
question
Mathematics, 03.03.2021 08:30
question
Mathematics, 03.03.2021 08:30