Comp 11
Comp 11
Comp 11
1 1 0 1 0
0111000000
01110
011100
10001
010110
10001
001010
0010100
10001
000110
Quotient = Q
Dividend = A
5 bits of A < B, quotient has 5 bits
6 bits of A B
Shift right B and subtract; enter 1 in Q
6 bits of remainder B
Shift right B and subtract; enter 1 in Q
Remainder < B, enter 0 in Q; shift right B
Remainder B
Shift right B and subtract; enter 1 in Q
Remainder < B, enter 0 in Q
Final remainder: 000110
Dividend in AQ
Divisor in B
Shl EAQ
QS AS + BS
SC n 1
=0
AB
EA A + B
DVF 1
=0
A<B
EA A + B
DVF 0
AB
=1
Qn 1
A<B =0
EA A + B
SC SC 1
SC
END
(Divide Overflow)
=1
AA+ B + 1
EA A + B + 1
EA A + B + 1
=1
=0
END (Quotient in Q, Remainder in A)
Divisor B = 10001
B + 1 = 01111
Comment
Dividend:
Shl EAQ
Add B + 1
E=1
Set Qn = 1
Shl EAQ
Add B + 1
E=1
Set Qn = 1
Shl EAQ
Add B + 1
E = 0, leave Qn = 0
Add B
1
1
0
1
1
0
0
SC
01110
11100
01111
01011
01011
10110
01111
00101
00101
01010
01111
11001
10001
00000
00000
00001
00010
00011
00110
00110
Divisor B = 10001
B + 1 = 01111
Comment
Restore remainder
Shl EAQ
Add B + 1
E=1
Set Qn = 1
Shl EAQ
Add B + 1
E = 0, leave Qn = 0
1
0
01010
10100
01111
00011
00011
00110
01111
1
1
0
0
Add B
Restore remainder
Neglect E
Remainder in A:
Quotient in Q
10101
10001
00110
SC
2
01100
01101
11010
11010
11010
00110
11010
1.
2.
3.
Divisor M
Dividend A, Q
Shift A, Q left 1 bit position
If M and A have the same signs, perform A A M;
otherwise, A A + M
The preceding operation is successful if the sign of A is the
same before and after the operation
1.
2.
4.
5.
Comment
Initial value
Shl AQ
Add
Restore
Shl AQ
Add
A
0000
0000
1101
1101
0000
0001
1101
1110
Q
0111
1110
SC
4
1110
1100
Comment
Restore
Shl AQ
Add
Set Q0 = 1
Shl AQ
Add
Restore
SC
0001
0011
1101
0000
0000
0001
1101
1110
0001
1100
1000
1001
0010
0010
Signof
andand
Mand
are
different
so,
A Aare
+M
Signs
Sign
Sign
ofofA
divisor
AA
before
before
and
dividend
after
after
the
the
are
operation
operation
different
are
Answer:
different,
same, so
quotient
so
setrestore
Q0==1110
1the (-2),
valueremainder
of A
= 0001 (+1)
= Q = 13
= A = 169
Subtract first test value 01
Answer positive; let q1 = 1
Bring down next pair
Subtract second test value 0q101
Answer positive; let q2 = 1
Bring down next pair
Subtract third test value 00q1q201
Answer negative; let q3 = 0
Restore partial remainder
Bring down next pair
Subtract fourth test value 000q1q2q301
Answer positive (zero); let q4 = 1
Problems
Perform signed-magnitude division and
twos complement division on 139 and -21
Perform signed-magnitude division and
twos complement division on 328 and 35
Find the square root of 256
Find the square root of 39
References
Text Book
M.
M.
Mano,
Computer
System
Architecture, Prentice-Hall,2004
W. Stallings, Computer organization and
architecture, Prentice-Hall,2000