Division Algorithms

0 downloads 0 Views 494KB Size Report
RESTORING DIVISION FLOWCHART FOR POSITIVE INTEGERS ... In the restoring division, in each step , no ... In fact, a subtraction is done to check the sign ... done and the result is left as it is even if the result is ... Negative; don't restore; X-Y.
Division Algorithms

By Dr. Subarna Shakya

Integer Division

Division Algorithms  

RESTORING DIVISION NONRESTORING DIVISION

ALGORITHM FOR RESTORING DIVISION

RESTORING DIVISION FLOWCHART FOR POSITIVE INTEGERS

RESTORING DIVISION HARDWARE DESIGN

ALGORITHM FOR NONRESTORING DIVISION

A NONRESTORING DIVISION FLOWCHART FOR POSITIVE INTEGERS

SUMMARY 

In the restoring division, in each step , no subtraction is done if the partial remainder is less than the divisor



In fact, a subtraction is done to check the sign of the difference, but the original value is restored by adding the divisor again.



In the nonnon-restoring division, the subtraction is done and the result is left as it is even if the result is negative. It is shift left



In the next step however, the divisor is added to the dividend instead of being subtracted.

Two types of divide faults can occur (Non Non--restoring Division) 1.

2.

Division overflow, which occurs if the divisor is (less than)or equal to the dividend in magnitude (the result will then be greater than or equal to one and be out of range) Division by zero (where the divisor is zero and division cannot be performed)

Comparision Between Restoring and NonNon-restoring Divisions Restoring

NonNon-restoring

Partial remainder X

Partial remainder X

Subtract Divisor XX-Y

Subtract Divisor X X--Y

Check result; XX-Y+Y=X Negative; Restore

Check Result; Negative; don’t restore; XX-Y

Set quotient bit zero

Set quotient bit zero

Shift left, i.e. multiply by 2 2X Subtract divisor 2X2X-Y

Shift left i.e. multiply by 2 2X2X-2Y Since last 2X-2Y+Y 2XQuotient bit is zero, =2X=2X-Y Add divisor