Computer Organization
and Architecture
Topic: Division (Restoring
method)
Prerequisites
0 1 1 0
Shifting of Bits(Left or Right)1 - 1 0 ?
Addition - Half Adder
Subtraction - Half Subtractor
2’s Complement - A’+1
Division of unsigned binary integers
Paper Pencil method
Example:
(Dividend)10/ (Divisor) 4 =(Quotient)2; (Remainder)2
Divisor Dividend Quotient 4 10 2
8
Remainder 2
Division of unsigned binary integers
Division of unsigned binary integers is
instructive method. There are two methods:
Restore Method
Non - Restore Method
Flowchart for Unsigned Binary Division
start
nno of bits
M Divisor
A 0
Q Dividend
Shift left AQ
A= A - M
=0 MSB =1
of A
Q[0] = 1
Q[0] = 1 Restore A
n = n-1
Is n = 0 No
Yes
Quotient in Q
Remainder in A
Stop
Flowchart for Unsigned Binary Division
Start
nno of bits
M Divisor
A 0
Q Dividend
Shift left AQ
A= A - M
=0 MSB =1
of A
Q[0] = 1
Q[0] = 1 Restore A
n = n-1
Is n = 0 No
Yes
Quotient in Q
Remainder in A
Stop
Division by Restore Method
11(Dividend)/3(Divisor) 3(Quotient) and 2(Remainder) Start
n M A Q Operation nno of bits
M Divisor
4 00011 (3) 00000 (0) 1011 (11) initialize A 0
Q Dividend
00011 00001 011_ shift left AQ
Shift left AQ
00011 11110 011_ A=A-M
A= A - M
Q[0]=0 And
00011 00001 0110 =0
restore A MSB =1
of A
Q[0] = 0
3 00011 00010 110_ shift left AQ Q[0] = 1 Restore A
00011 11111 110_ A=A-M
n = n-1
Q[0]=0And
00011 00010 1100
restore A
Is n = 0 No
2 00011 00101 100_ shift left AQ
00011 00010 100_ A=A-M Yes
Quotient in Q
00011 00010 1001 Q[0]=1 Remainder in A Add the divisor to
partial product
1 00011 00101 001_ shift left AQ
Stop
00011 00010 001_ A=A-M
00011 00010 (2) 0011 (3) Q[0]=1
Division by Restore Method
11(Dividend)/3(Divisor) 3(Quotient) and 2(Remainder) -M = 11101
n M A Q Operation
4 00011 (3) 00000 (0) 1011 (11) initialize
00011 00001 011_ shift left AQ
00011 11110 011_ A=A-M
Q[0]=0 And
00011 00001 0110
restore A
3 00011 00010 110_ shift left AQ
00011 11111 110_ A=A-M
Q[0]=0And M = 00011
00011 00010 1100 M’ = 11100
restore A
M’+1 = 11101
2 00011 00101 100_ shift left AQ
00011 00010 100_ A=A-M -M = 11101
00011 00010 1001 Q[0]=1
A-M=>A+(-M)
1 00011 00101 001_ shift left AQ
00011 00010 001_ A=A-M
00011 00010 (2) 0011 (3) Q[0]=1
Division by Restore Method
Start
11(Dividend)/3(Divisor) 3(Quotient) and 2(Remainder)
n M A Q Operation nno of bits
M Divisor
4 00011 (3) 00000 (0) 1011 (11) initialize A 0
Q Dividend
00011 00001 011_ shift left AQ
Shift left AQ
00011 11110 011_ A=A-M
A= A - M
Q[0]=0 And
00011 00001 0110
restore A =0 MSB =1
of A
Q[0] = 0
3 00011 00010 110_ shift left AQ Q[0] = 1 Restore A
00011 11111 110_ A=A-M
n = n-1
Q[0]=0And
00011 00010 1100
restore A
Is n = 0 No
2 00011 00101 100_ shift left AQ
00011 00010 100_ A=A-M Yes
Quotient in Q
00011 00010 1001 Q[0]=1 Remainder in A
1 00011 00101 001_ shift left AQ
Stop
00011 00010 001_ A=A-M
00011 00010 (2) 0011 (3) Q[0]=1
Question
• Try dividing 13/4 and 15/4
10