```CPS3340 - Computer Architecture
Assignment 4: Multiplication,
Division, Floating Point
A = 50, B = 11, A*B =
Iteration
0
1
2
3
4
5
6
Step
Initial Values
1  P=P+Md
Shift Left Md
Shift Right Mr
1 P=P+ Md
Shift Left Md
Shift Right Mr
0  No Op
Shift Left Md
Shift Right Mr
1  P=P+ Md
Shift Left Md
Shift Right Mr
0  No Op
Shift Left Md
Shift Right Mr
0  No Op
Shift Left Md
Multiplier (Mr)
001011
001011
001011
000101
000101
000101
000010
000010
000010
000001
000001
000001
000000
000000
000000
000000
000000
000000
Multiplicand (Md)
000000110010
000000110010
000001100100
000001100100
000001100100
000011001000
000011001000
000011001000
000110010000
000110010000
000110010000
001100100000
001100100000
001100100000
011001000000
011001000000
011001000000
110010000000
Product (P)
000000000000
000000110010
000000110010
000000110010
000010010110
000010010110
000010010110
000010010110
000010010110
000010010110
001000100110
001000100110
001000100110
001000100110
001000100110
001000100110
001000100110
001000100110
A = 50, B = 11, A/B =
Iteration
0
1
2
3
4
5
6
7
Step
Initial Values
R=R-D
R<0  +D, sll Q, Q0=0
Shift Right D
R=R-D
R<0  +D, sll Q, Q0=0
Shift Right D
R=R-D
R<0  +D, sll Q, Q0=0
Shift Right D
R=R-D
R<0  +D, sll Q, Q0=0
Shift Right D
R=R-D
R>=0  sll Q, Q0=1
Shift Right D
R=R-D
R<0  +D, sll Q, Q0=0
Shift Right D
R=R-D
R<0  +D, sll Q, Q0=0
Quotient (Q)
000000
000000
000000
000000
000000
000000
000000
000000
000000
000000
000000
000000
000000
000000
000001
000001
000001
000010
000010
000010
000100
Divisor (D)
001011000000
001011000000
001011000000
000101100000
000101100000
000101100000
000010110000
000010110000
000010110000
000001011000
000001011000
000001011000
000000101100
000000101100
000000101100
000000010110
000000010110
000000010110
000000001011
000000001011
000000001011
Remainder (R)
000000110010
110101110010
000000110010
000000110010
111011010010
000000110010
000000110010
111110000010
000000110010
000000110010
111111011010
000000110010
000000110010
000000000110
000000000110
000000000110
111111110000
000000000110
000000000110
111111111011
000000000110
IEEE 754 single precision format
63.25 x 10^0 = 111111.01 x 2^0
• Normalization : move binary point 5 to the left 1.1111101 x 2^5
• S = 0 (positive)
• Fraction = 1111101
• Exponent = 127 + 5 = 132 = 10000100
Final bit pattern: 0 1000 0100 1111 1010 0000 0000 0000 000
146987.40625 x 10^0 = 100011111000101011.011010 x 2^0
• normalize, move binary point 17 to the left
1.00011111000101011011010 x 2^17
• sign = positive, S=0
• Fraction: 00011111000101011011010
• exp = 127 + 17 = 144
Final bit pattern: 0 1001 0000 0001 1111 0001 0101 1011 010
IEEE 754 double precision format
63.25 x 10^0 = 111111.01 x 2^0
• normalize, move binary point 5 to the left
1.1111101 x 2^5
• sign = positive, exp = 1023 + 5 = 1028
Final bit pattern:
0 100 0000 0100 1111 1010 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
146987.40625 x 10^0 = 100011111000101011.011010 x 2^0
• normalize, move binary point 17 to the left
1.00011111000101011011010 x 2^17
• sign = positive, exp = 1023 + 17 = 1040
Final bit pattern:
0 100 0001 0000 0001 1111 0001 0101 1011 0100 0000 0000 0000 0000 0000 0000 0000
Binary to FP
1 01111101 00100000000000000000000
• S=1
• Fraction = 001000…002
• Exponent = 011111012 = 125
• x = (–1)1 × (1 + 0.0012) × 2(125 – 127)
= (–1) × 1.125 × 2-2
= –0.28125
FP Multiplication
A=0.75, B=-10.125, A*B =
0.11*20 X -1010.001*20
1.10*2-1 X -1.010001*23 (normalize)
1. Add exponents: -1+3=2
2. Multiply significands
1.1000002 × 1.0100012 = 1.1110011 2
3. Normalize result & check for over/underflow
1.11100112 × 22 (no change)
4. Round and renormalize if necessary
1.11100112 × 22 (no change)
5. Determine sign: +value × –value  –ve
–1.11100112 × 22
= – 111.10011 x 20 = –7.5937510
8D28000816
1000 1101 0010 1000 0000 0000 0000 1000
1) What decimal number does the bit pattern represent if it is an integer?
10001101001010000000000000001000
01110010110101111111111111110111
1+
01110010110101111111111111111000 = -1926758392
2) What decimal number does the bit pattern represent if it is an unsigned
integer?
2368208904
3) If the bit pattern is in an instruction register, what MIPS instruction will be
executed?
lw \$t0, 8(\$t1)
4) What decimal number does the bit pattern represent if it
is a floating point number? Use the IEEE 754 standard.
1 00011010 01010000000000000001000
•
•
•
•
1/2
1/2
1/2
S=1
Fraction = 01010…010002
Exponent = 000110102 = 26
x = (–1)1 × (1 + 0.01010…010002) × 2(26 – 127)
2
4
20
= –1 × (1+0.25+0.0625+0.00000095367431640625) × 2-101
= –1.31250095367431640625 / 2101
```