Question: Program in RISC - V . Please ensure the code works in the venus web terminal. In the venus web terminal, sys call code for
Program in RISCV Please ensure the code works in the venus web terminal. In the venus web terminal, sys call code for printing is For printing in hex, it's
Strategy:
Check if the addition produces an overflow
a Overflow just happens when a and b have the same polarity. You can use SLU to set two rds by comparing a to and b to Xor two rds If they are the same, the xor should return a meaning a and b have the same polarity.
b If the sum does not have the same polarity with a and b then overflow occurs.
Once overflows, the sum will be wrong. We need to convert it to a right hex representation in s complement.
a If the wrong sum is ve extend bits of s and put them into an extra register to make the sum as bits bits long.
b If the wrong sum is in ve extend bits of s and bit of and put them into an extra register. The highest bit of the sum register should be turned to These two registers make the sum as bits bits long.
Print both of the two registers in hex
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
