void setArray(int num) {int i;intarray[10];for (i = 0; iarray[i] = compare(num, i);}intcompare(inta, int b) {if (sub(a, b) >= 0)return 1;elsereturn 0;}int sub(int a, int b) {return a–b;}(a)Implement...

void setArray(int num) {int i;intarray[10];for (i = 0; iarray[i] = compare(num, i);}intcompare(inta, int b) {if (sub(a, b) >= 0)return 1;elsereturn 0;}int sub(int a, int b) {return a–b;}(a)Implement the C code snippet in RISC-V assemblylanguage.Use s4 to hold thevariablei.Be sure to handle the stack pointerappropriately. The array isstored onthe stack of thesetArrayfunction. Clearly comment your code.(b)Assume that thesetArrayis the function called. Draw the status of the stack beforecallingsetArrayand during each function call. Indicate stack addresses andnames of registers and variables stored on the stack; mark the location ofsp; andclearly mark each stack frame. Assume thespstarts at0x8000.
Nov 26, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here