Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How would I do this? 1.1 Integer Division Write RISC-V code to implement this function: int intdiv(int numer, int denom); This will return the largest

image text in transcribedHow would I do this?

1.1 Integer Division Write RISC-V code to implement this function: int intdiv(int numer, int denom); This will return the largest integer r such that r x denom 0 and that denom > 0. If either of these conditions is not true, then "crash. Here's hacky way to force a "crash in the interpreter: crash: beq x0, x0, 1 This represents a misaligned branch offset and will cause the interpreter to stop and display an error. So to cause a crash, branch or jump to the label crash. Use the pattern of the two parameters, one local variable as a framework for your function. Use only the a0 and al registers during your computation, and put the result of the division in the al register. Load a variable from memory (from the stack) before you modify it, and save it back to memory after you modify it, as is shown in the example code we looked at in class. This means that local variables must have stack space. Function parameters don't need to go in memory: pass the first function parameter through ao and the second parameter through al. 1.1 Integer Division Write RISC-V code to implement this function: int intdiv(int numer, int denom); This will return the largest integer r such that r x denom 0 and that denom > 0. If either of these conditions is not true, then "crash. Here's hacky way to force a "crash in the interpreter: crash: beq x0, x0, 1 This represents a misaligned branch offset and will cause the interpreter to stop and display an error. So to cause a crash, branch or jump to the label crash. Use the pattern of the two parameters, one local variable as a framework for your function. Use only the a0 and al registers during your computation, and put the result of the division in the al register. Load a variable from memory (from the stack) before you modify it, and save it back to memory after you modify it, as is shown in the example code we looked at in class. This means that local variables must have stack space. Function parameters don't need to go in memory: pass the first function parameter through ao and the second parameter through al

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database 101

Authors: Guy Kawasaki

1st Edition

0938151525, 978-0938151524

More Books

Students also viewed these Databases questions

Question

The paleolithic age human life, short write up ?

Answered: 1 week ago

Question

What is the Definition for Third Normal Form?

Answered: 1 week ago

Question

Provide two examples of a One-To-Many relationship.

Answered: 1 week ago