Question: Write a short RISC-V assembly program that defines the following four numbers 6000, 6245, 10000, 10245 (all 10-base) in an array of double integers) in

Write a short RISC-V assembly program that defines the following four numbers 6000, 6245, 10000, 10245 (all 10-base) in an array of double integers) in the memory using the DD directive. Your program adds 1 to each of these numbers and prints them with ecall. You do this without a loop, by repeating (cut-paste and edit) the statements that do the storing and adding. Use registers t0, t1, etc to store all the intermediate results if you need. Remember t0, t1 etc, are the nicknames of registers x5, x6, etc as you can see on the second page of the Green Card.

Hints

To create an array named ARR of of 4 elements ARR: DD 6000, 6245, 10000, 10245 as the first line (after the comment header) of your code. This will have the effect of initializing the memory with these numbers, and defining ARR as a constant whose value is the address of the first element of the array. Directive DD stands for define double. To read a value from the second element of the array use something like ld t1, 8(t0) as we did in class. Remember the memory is addressed in bytes and that a doubleword has eight bytes.

Style

Your program should include a header that with your name, section, today's date and a very brief description of what the program does (no more than 2 lines). Name the program prplus1.asm. Near the top of you program you should have a comment that indicates what register is used for what purpose like: ;; t0 -> address of ARR ;; t1 -> address of ARR[i] ;; t2 -> ARR[i] Most lines of code should have a very brief explanation of what they do as a comment. Preferably as Java or C code. (like sum = ARR[2] + 1). All instructions should start at the same column. Use a tab (the key next to Q on the keyboard) to do this consistently. Labels should start on the first column.

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!