Question: Write a RISC-V assembly program that calculates a mathematical expression derived from the last 7 digits of your student ID as described below, and prints

Write a RISC-V assembly program that calculates a mathematical expression derived from the last 7 digits of your student ID as described below, and prints the result to console using PrintInt ecall.

The arithmetic expression to be calculated is derived from the last 7 digits of your Student ID. First replace all 0 digits with digit 1. Replacing every second digit with an arithmetic operation according to the following table:

Digit Operation 1 - (sub) 2 * (mul) 3 + (add) 4 - (sub) 5 * (mul) 6 + (add) 7 - (sub) 8 * (mul) 9 + (add)

For example, suppose that the student ID is 21052938 the last seven digits are 1,0,5,2,9,3,8. First, we replace all 0s with 1s and get 1,1,5,2,9,3,8. To obtain the arithmetic expression, we replace digits in positions 2, 4 and 6 with the corresponding arithmetic operations from the table: 1 - 5 * 9 + 8

Please include the mathematical expression derived from your student number and the resultant assembly program in your submission.

Student number: 21378356

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!