Professional Documents
Culture Documents
EEE105 S1Y1617 Lect 09 PDF
EEE105 S1Y1617 Lect 09 PDF
Q = dividend/quotient register
Definition of terms
Division (1/5)
shift A and Q
subtract M from A, and place the answer back in A
if the sign of A is 1, set q0 to 0 and add M back to A
(restore A); otherwise set q0 to 1
repeat n times
Division (2/5)
Division (3/5)
if A < 0
Division (4/5)
procedure
Division (5/5)
10
11 1000
- 11
10
4-bit example
M = 00112 = 310
Q = 10002 = 810
using long-hand division
Details
0
0
1
1
S
0
1
1
0000
A
0001
1101
1110
0011
0001
0010
1101
1111
0011
0010
M
0011
0000
0000
0000
000_
0000
000_
1000
Q
Shift
Subtract
Set q0
Restore
Shift
Subtract
Set q0
Restore
second cycle
first cycle
initial configuration
0
1
0
0
1
1
0010
quotient
remainder
0010
0001
001_
000_
0100
1101
0001
0010
1101
1111
0011
0010
Shift
Subtract
Set q0
Shift
Subtract
Set q0
Restore
fourth cycle
third cycle
10
0
1
1
0
0
remainder
0010
1101
1111
0011
0010
S
0
1
1
1
0
1
1
0
0
M
0011
0000
A
0001
1101
1110
1100
0011
1111
1110
0011
0001
quotient
0010
001_
0001
0000
000_
0000
000_
1000
Q
000_
Shift
Subtract
Set q0
Restore remainder
Shift
Subtract
Set q0
Shift
Add
Set q0
Shift
Add
Set q0
fourth cycle
third cycle
second cycle
first cycle
initial configuration
Non-restoring Division
11
12
Examples (contd)
13
Y 1Y 2
X 1 . X 2 X 3 X 4 X 5 X 6 X 7 10
14
mantissa (M)
23
exponent (E)
1
sign
(S)
implied 1
15
mantissa (M)
52
exponent (E)
11
1
sign
(S)
16
17
add/subtract
multiply
divide
square root
remainder and compare
floating-point operations
18
rounding modes
invalid operation
division by zero
overflow resulting E becomes more than max(E)
underflow resulting E becomes less than 0
inexact result is rounded off to fit into format
19
20
implied 1 is
included
M2 = 00000100101000100101001
M2 = 10010100010010100101000 becomes
1. Compare exponents
2. If one exponent is smaller, its mantissa must
be shifted right by the difference between the
exponents
Example: If E1 = 100 and E2 = 95, M2 must
be shifted 5 steps to the right
21
22
23
24
0.001000
0.001111
0.001
0.001
truncation
25
0.001000
0.001001
0.010001
0.001
0.001
0.011
26
27
0.001101
0.010011
0.001100
0.010100
3 bits
0.010101
28
Floating-Point Adder
29
References