Question: give me example of risc - v code that The do _ sub function takes as argument two integers in registers and does the following:

give me example of risc-v code that "The do_sub function takes as argument two integers in registers and does the following:
1. Subtract the second integer from the first without using the 'sub*' or 'add*' RISC-
V instructions. You may however use addi to adjust the stack pointer. You should
take the 2's complement of the second integer, and then call do_add. Note: to take
the 2's complement you should use 'nor', 'ori', and a call to do_add, thus there will
be two calls to do_add!
2. Return the result in a register. If there is an arithmetic overflow, return an error
condition identifying that an overflow occurred in another register."

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 Programming Questions!