90 likes | 293 Views
CPS3340 - Computer Architecture. Assignment 4: Multiplication, Division, Floating Point. A = 50, B = 11, A*B = . A = 50, B = 11, A/B = . 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
E N D
CPS3340 - Computer Architecture Assignment 4: Multiplication, Division, Floating Point
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) • Add exponents: -1+3=2 • Multiply significands 1.1000002 × 1.0100012 = 1.1110011 2 • Normalize result & check for over/underflow 1.11100112 × 22 (no change) • Round and renormalize if necessary 1.11100112 × 22 (no change) • Determine sign: +value × –value –ve –1.11100112 × 22 = – 111.10011 x 20 = –7.5937510
8D28000816 • 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 • S = 1 • Fraction = 01010…010002 • Exponent = 000110102 = 26 • x = (–1)1 × (1 + 0.01010…010002) × 2(26 – 127) = –1 × (1+0.25+0.0625+0.00000095367431640625) × 2-101 = –1.31250095367431640625 / 2101 1/22 1/24 1/220