Compile the RISC-V assembly code for the following C code. Assume that k and mare passed in x8 and x9 respectively. Assume that result returned in x8. This function does not have to make sense, it is a test on your knowledge of writing nested/recursive routines. Compile the assembly code for the following C code. int func (unsigned int m, unsigned int k){ if (k <= 0) return 4; else if (m <=2) return k; else return 2m + 4*func(m-1, k-2) + 6*func(m, k-13); Part 2 (6 marks) How many RISC-V instructions does it take to implement the C code from Part 1? If the variables m and k are initialized to 10 and 10 what is the total number of RISC-V instructions that is executed to complete the loop?

Solved
Show answers

Ask an AI advisor a question