Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Dont use Li , la and j . it gives me error my rvs version is v 0 . 4 6 . Use eclass DC

Dont use Li, la and j. it gives me error my rvs version is v0.46. Use eclass DC and other basic simple instructions
part a answer example - C1: DC Input an integer:
Ld x29,0(C1)
Ecall x1, x29,5
Question 1)(7.5 Points) There is a piece of C (and its equivalent Matlab) code that we want to convert to
RISC-V. We expect to see a snapshot of your OUT window like the one below. Follow the steps:
A.(0.5 Points) Print to the OUT Window in RVS the following string "Student's number:" followed by your
student number. If your student number is 123456789, the printed line will be:
Student's number: 123456789
B.(0.5 Points) Print the string "Input an integer:" and ask the user for an integer input then store it in x1.
C.(2 Points) Write a code for the label "loop1" that calculates the float values of f1 and f2.
D.(1 Point) Write a code for the label "loop2" that updates the value of x7.
E.(1 Point) Write a code for the label "end" that breaks compiling procedure.
F.(1 Point) Test your code with the integer '5', and print the final value of f2 as the "Result=".
G.(1.5 Point) Write a report based on your code in the report box, and upload both the assembly code
(1Q1_Ans.asm) and a snapshot (1Q1_Snapshot) of the RISC-V OUT window.
C code
for (x7=1; x7 x1; x7++){
for (x8=1; x8 x1+2; x8++){
f7=(double) x7;
f8=(double) x8;
f1= f8/f7;
f2= f1+f2;}
}
Matlab code
for x7=1:1:x1-1
for x8=1:1: x1+1
f1= x8/x7;
f2= f1+f2;
end
end
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems For Advanced Applications 18th International Conference Dasfaa 2013 Wuhan China April 22 25 2013 Proceedings Part 2 Lncs 7826

Authors: Weiyi Meng ,Ling Feng ,Stephane Bressan ,Werner Winiwarter ,Wei Song

2013th Edition

3642374492, 978-3642374494

More Books

Students also viewed these Databases questions

Question

(1) How many levels and factors are there in this example?

Answered: 1 week ago