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
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