0% found this document useful (0 votes)
228 views12 pages

9-Division (Restoring and Non-Restoring) - 02-Aug-2018 - Reference Material I - Division Algorithm

The document describes the restoring division algorithm, which uses successive subtraction to divide one number by another. It works by repeatedly subtracting the divisor from the dividend, tracking the number of subtractions in the quotient and the remaining value in the remainder. An example calculation of 11 divided by 3 is shown step-by-step, with the quotient being 3 and remainder being 2 after shifting and subtracting values in the dividend, divisor, and an accumulator register.

Uploaded by

Kunal Thakore
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
228 views12 pages

9-Division (Restoring and Non-Restoring) - 02-Aug-2018 - Reference Material I - Division Algorithm

The document describes the restoring division algorithm, which uses successive subtraction to divide one number by another. It works by repeatedly subtracting the divisor from the dividend, tracking the number of subtractions in the quotient and the remaining value in the remainder. An example calculation of 11 divided by 3 is shown step-by-step, with the quotient being 3 and remainder being 2 after shifting and subtracting values in the dividend, divisor, and an accumulator register.

Uploaded by

Kunal Thakore
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Division Algorithm

Dr.K.R.Jothi
Associate Professor
SCOPE
Division using Successive Subtraction

• Implemented on computer systems by repeatedly


subtracting the divisor from the dividend

• Counting the number of times that the divisor can be


subtracted from the dividend before the dividend
becomes smaller than the divisor
Division 15 with 5

• Subtract repeatedly from 15, getting 10, 5, and 0 as


intermediate results

• The quotient, 3, is the number of subtractions that


had to be performed before the intermediate result
became less than the dividend
Division Algorithm
• Restoring Division Algorithm
• Non-Restoring Division Algorithm
Restoring Division Algorithm Start

Example: (11) / (3) = 3 (quotient) and 2 (reminder) Q <- Dividend


Q (Dividend) M (Divisor) M <- Divisor
1011 0011 A <- 0
-M = 1 1 1 0 1
Tracing Table n <- no. of bits
n M A Q Action / Comment
An…A1
Left Shift AQ

A=A-M

=0 A[n] =1
=?
Q[0] = 0
Q[0] = 1
Restore A

n = n -1

No
Is n = 0 ?
Yes
Quotient in Q
Reminder in A

Stop
Restoring Division Algorithm Start

Example: (11) / (3) = 3 (quotient) and 2 (reminder) Q <- Dividend


Q (Dividend) M (Divisor) M <- Divisor
1011 0011 A <- 0
-M = 1 1 1 0 1
Tracing Table n <- no. of bits
n M A Q Action / Comment
An…A1
Left Shift AQ
4 00011 00000 1011 Initialization
A=A-M

=0 A[n] =1
=?
Q[0] = 0
Q[0] = 1
Restore A

n = n -1

No
Is n = 0 ?
Yes
Quotient in Q
Reminder in A

Stop
Restoring Division Algorithm Start

Example: (11) / (3) = 3 (quotient) and 2 (reminder) Q <- Dividend


Q (Dividend) M (Divisor) M <- Divisor
1011 0011 A <- 0
-M = 1 1 1 0 1
Tracing Table n <- no. of bits
n M A Q Action / Comment
An…A1
Left Shift AQ
4 00011 00000 1011 Initialization
A=A-M
00001 011? Left Shift AQ

11110 011? A = A – M (00001 + 11101) =0 A[n] =1


0110 Q[0] = 0 =?
00001 Restore A Q[0] = 0
Q[0] = 1
Restore A

n = n -1

No
Is n = 0 ?
Yes
Quotient in Q
Reminder in A

Stop
Restoring Division Algorithm Start

Example: (11) / (3) = 3 (quotient) and 2 (reminder) Q <- Dividend


Q (Dividend) M (Divisor) M <- Divisor
1011 0011 A <- 0
-M = 1 1 1 0 1
Tracing Table n <- no. of bits
n M A Q Action / Comment
An…A1
Left Shift AQ
4 00011 00000 1011 Initialization
A=A-M
00001 011? Left Shift AQ

11110 011? A = A – M (00001 + 11101) =0 A[n] =1


0110 Q[0] = 0 =?
00001 Restore A Q[0] = 0
Q[0] = 1
3 00010 110? Left Shift AQ Restore A
11111 110? A=A–M

00010 1100 Q[0] = 0, Restore A


n = n -1

No
Is n = 0 ?
Yes
Quotient in Q
Reminder in A

Stop
Restoring Division Algorithm Start

Example: (11) / (3) = 3 (quotient) and 2 (reminder) Q <- Dividend


Q (Dividend) M (Divisor) M <- Divisor
1011 0011 A <- 0
-M = 1 1 1 0 1
Tracing Table n <- no. of bits
n M A Q Action / Comment
An…A1
Left Shift AQ
4 00011 00000 1011 Initialization
A=A-M
00001 011? Left Shift AQ

11110 011? A = A – M (00001 + 11101) =0 A[n] =1


0110 Q[0] = 0 =?
00001 Restore A Q[0] = 0
Q[0] = 1
3 00010 110? Left Shift AQ Restore A
11111 110? A=A–M

00010 1100 Q[0] = 0, Restore A


n = n -1

2 00101 100? Left Shift AQ No


Is n = 0 ?
00010 100? A=A-M
1001 Q[0] = 1 Yes
Quotient in Q
1 00101 001? Left Shift AQ
Reminder in A
00010 001? A=A-M
0011 Q[0] = 1 Stop
0 Quotient is 0011 (3) & Reminder is 00010 (2)
Non-Restoring Division Algorithm Start

Example: (11) / (3) = 3 (quotient) and 2 (reminder) Q <- Dividend


Q (Dividend) M (Divisor) M <- Divisor
1011 0011 A <- 0
-M = 1 1 1 0 1
Tracing Table n <- no. of bits
n M A Q Action / Comment =0 Sign bit =1
An…A1 of A ?
Shift Left AQ Shift Left AQ
A=A-M A=A+M

=0 Sign bit =1
of A =?
Q[0] = 1 Q[0] = 0

n = n -1

No Is n = 0 ?
Sign bit
Yes A=A+M
of A =?
Quotient in Q
Reminder in A
Stop
Non-Restoring Division Algorithm Start

Example: (11) / (3) = 3 (quotient) and 2 (reminder) Q <- Dividend


Q (Dividend) M (Divisor) M <- Divisor
1011 0011 A <- 0
-M = 1 1 1 0 1
Tracing Table n <- no. of bits
n M A Q Action / Comment =0 Sign bit =1
An…A1 of A ?
4 00011 00000 0011 Initialization Shift Left AQ Shift Left AQ
A=A-M A=A+M
00000 011? Shift Left AQ
11110 A= A – M
0110 Q[0] = 0 =0 Sign bit =1
3 11100 110? Shift Left AQ of A =?
11111 A= A +M
1100 Q[0] = 0
Q[0] = 1 Q[0] = 0
2 11111 100? Shift Left AQ
00010 A=A+M
10 01 Q[0] = 1 n = n -1
1 00101 001? Shift Left AQ
00010 A=A–M No
0011 Q[0] = 1
Is n = 0 ?
0 Sign bit
Yes A=A+M
of A =?
Quotient in Q
Quotient is 0011 (3) & Reminder is 00010 (2)
Reminder in A
Stop
Exercise
Divide 14 by 3

You might also like