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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!