Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 1 ) ( 7 . 5 Points ) There is a piece of C ( and its equivalent Matlab ) code that we want
Question Points There is a piece of C and its equivalent Matlab code that we want to convert to RISCV We expect to see a snapshot of your OUT window like the one below. Follow the steps: A Points Print to the OUT Window in RVS the following string "Student's number:" followed by your student number. If your student number is the printed line will be: Students number: B Points Print the string "Input an integer:" and ask the user for an integer input then store it in x C Points Write a code for the label loop that calculates the integer values of x and x D Point Write a code for the label loop that updates the values of x and x E Point Write a code for the label end that breaks compiling procedure. F Point Test your code with the integer and print the final value of x as the Result G Points Write a report based on your code in the report box, and upload both the assembly code QAns.asm and a snapshot QSnapshot of the RISCV OUT window. C code for x; x x; x for x; x x; x x x x; x x x; x x; Matlab code for x::x for x:: x x x x; x xx; end x x; end RISCV OUT window Question Points There is an algorithm for calculating the GCD greatest common divisor of two numbers that we want to convert to RISCV using recursion. We expect to see a snapshot of your OUT window like the one below. Follow the steps: A Points Print to the OUT Window in RVS the following string "Friday Lab Section". B Point Print characters "Input: and "Input: and ask the user for two integers, one at a time, then store them in x and x respectively. C Points define and initiate auxiliary registers with proper values. D Points Write a code for the label gcd that instantiates a recursive function for calculating the greatest common divisor. E Point Write a code for the label end that breaks compiling procedure. F Point Test your code with integers and and print the final value of GCD as the result. G Points Write a report based on your code in the report box, and upload both the assembly code QAns.asm and a snapshot QSnapshot of the RISCV OUT window. Greatest common divisor algorithm Input must be greater than input: GCD input input If input then return input; Otherwise: return GCD input remainder of input input; Hint: You need a few more registers as auxiliary variables.
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