Question
Translate the following JAVA program into a RISC-V assembly program. import java.util.Scanner; public class LExC { public static void main(String[] args) { int t0 =
Translate the following JAVA program into a RISC-V assembly program.
import java.util.Scanner;
public class LExC { public static void main(String[] args) { int t0 = (new Scanner(System.in).nextInt()); int t1 = (new Scanner(System.in).nextInt()); for (int i=t0; i>0; i-- ) { int result = calc(t0,t1 - i); System.out.print(result); } } public static int calc(int number1, int number2) { if(number2 == 0) return 0; return calc(number1, number2/2) + 1; } }
please note we need to translate those into assembly. which the format is something like :
addi x5,x0,5
addi x6,x0,6
etc
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started