Question: Task 1 : Binary Integer Long Division The C code below implements a long - division algorithm for binary integers. int division ( int dividend,
Task : Binary Integer Long Division
The C code below implements a longdivision algorithm for binary integers.
int divisionint dividend, int divisor int sign quotient ; Determine the sign of the result if dividend sign sign; dividend dividend; if divisor sign sign; divisor divisor; We produce a bit result int remainder ; for int i ; i ; i Intermediate result left shift by remainder ; Append the next bit in the dividend remainder remainder dividend i & ; if remainder divisor remainder divisor; Append to the corresponding bit in quotient quotient quotient i; if sign quotient quotient; return quotient;
Your task is to write equivalent assembly code as follows:
dividend: word divisor: word global start start: R: stores the quotient MOV R # your code starts here your code ends here end: B end
Your implementation must:
Load dividend from the label named dividend
Load divisor from a label named divisor
Put the quotient inside R
You may assume:
The dividend, divisor, and quotient are signed bit integers
The divisor is nonzero
We do not care about the remainder
Testing Instructions
You can find the template tasks for task Please directly implement your code in this template and submit. To support automated grading, please carefully note the following requirements:
You must implement your code within the designated area, ie between your code starts here and your code ends here. You are allowed to write anything you see fit within this area, including additional subroutines. Anything written outside the area will be removed by the autograder.
Your submission must not modify the existing instructions and labels in the template.
Your submission must use the same filename tasks as the template.
You need to come up with your own test cases to explore the functionality of your code. The tester will automatically change the dividend and divisor numbers in your code for grading.
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
