0% found this document useful (0 votes)
25 views3 pages

Lab Sheet 4

Uploaded by

Aabhusan Aryal
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)
25 views3 pages

Lab Sheet 4

Uploaded by

Aabhusan Aryal
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/ 3

Computer Organization and Architecture– Lab Sheet.

4
IOE, Pulchowk

Lab Sheet- 4

DIVISION OF TWO UNSIGNED INTEGER BINARY NUMBERS

Objective:
To implement restoring division algorithm in digital computer.

When the division is implemented in a digital computer, restoring and non- restoring
algorithms are frequently used. In this lab session we are dealing with first. Here division
process requires controlled subtract-restore operations. Whether the next operation is a
subtraction or restoration, is controlled by the result of the current operation. Consider two
binary numbers A and B. A is the dividend, B the divisor and Q = A / B the quotient. We
assume that Α>Β and B! =0. The flow chart of the algorithm used, is given in figure 4.1.

Let us take examples:

1)
Dividend (Register - A) = 12 Equivalent binary representation is 1100 and
divisor (Register - B) = 4 Equivalent binary representation is 0100.
Subtraction may be achieved by adding 2’s complement of B as we have done in lab 3 and
here it is 1100. Double length dividend is stored in registers AQ.

A Q

Initially 0000 1100


0100
Shift 0001 100
Subtract 1100 count = 0
Set LSB 1101
Restore 0100
0001 1000
Shift 0011 000
Subtract 1100
Set LSB 1111 count = 1
Restore 0100
0011 0000
Shift 0110 000
Subtract 1100 count = 2
Set LSB 0010 0001
Shift 0100 001
Subtract 1100 count = 3
0000 0011

Remainder Quotient

Prof. Dr. Subarna Shakya


Computer Organization and Architecture– Lab Sheet. 4
IOE, Pulchowk

2)
Dividend (Register - A) = 8 Equivalent binary representation is 1000 and
divisor (Register - B) = 3 Equivalent binary representation is 00011.
Subtraction may be achieved by adding 2’s complement of B as we have done in lab 3 and
here it is 11101. Dividend is stored in registers AQ.

A Q

Initially 00000 1000


00011
Shift 00001 000
Subtract 11101 count = 0
Set LSB 11110
Restore 00011
00001 0000
Shift 00010 000
Subtract 11101
Set LSB 11111 count = 1
Restore 00011
00010 0000
Shift 00100 000
Subtract 11101 count = 2
Set LSB 00001 0001
Shift 00010 001
Subtract 11101
Set LSB 11111 count = 3
Restore 00011
00010 0010

Remainder Quotient

Let the number of bits stored in register Q is n Registers AQ is now shifted to the left with
zero insertion into QLSB . Initialize the counter to zero value. And divisor is subtracted by
adding 2’s complement value. If AMSB =1,set QLSB with value 0 and then increment the
counter value by 1.The value of B is added to restore the partial remainder in A to its
previous value. The partial remainder is shifted to the left and process is repeated until count
= n-1 i.e. all quotient bits are formed. While the partial remainder is shifted left, the quotient
bits are also shifted. Finally Quotient is in Q and the final remainder is in A.

Prof. Dr. Subarna Shakya


Computer Organization and Architecture– Lab Sheet. 4
IOE, Pulchowk

The flow chart for restoring division is shown below.

START

Q dividend
Count 0

B divisor
A 0

Left Shift A,Q

A A-B

Yes Q(0) 0
A(MSB) = 1 A A+B
No
Q(0) 1

No
Count = n-1? Count Count +1
Yes
Quotient in Q
END
Remainder in A

Figure 4.1

Prof. Dr. Subarna Shakya

You might also like