CPS Computer Architecture Assignment 4: Multiplication, Division, Floating Point
A = 50, B = 11, A*B = IterationStepMultiplier (Mr)Multiplicand (Md)Product (P) 0Initial Values P=P+Md Shift Left Md Shift Right Mr P=P+ Md Shift Left Md Shift Right Mr No Op Shift Left Md Shift Right Mr P=P+ Md Shift Left Md Shift Right Mr No Op Shift Left Md Shift Right Mr No Op Shift Left Md Shift Right Mr
A = 50, B = 11, A/B = IterationStepQuotient (Q)Divisor (D)Remainder (R) 0Initial Values R=R-D R<0 +D, sll Q, Q 0 = Shift Right D R=R-D R<0 +D, sll Q, Q 0 = Shift Right D R=R-D R<0 +D, sll Q, Q 0 = Shift Right D R=R-D R<0 +D, sll Q, Q 0 = Shift Right D R=R-D R>=0 sll Q, Q 0 = Shift Right D R=R-D R<0 +D, sll Q, Q 0 = Shift Right D R=R-D R<0 +D, sll Q, Q 0 = Shift Right D
IEEE 754 single precision format x 10^0 = x 2^0 Normalization : move binary point 5 to the left x 2^5 S = 0 (positive) Fraction = Exponent = = 132 = Final bit pattern: x 10^0 = x 2^0 normalize, move binary point 17 to the left x 2^17 sign = positive, S=0 Fraction: exp = = 144 Final bit pattern:
IEEE 754 double precision format x 10^0 = x 2^0 normalize, move binary point 5 to the left x 2^5 sign = positive, exp = = 1028 Final bit pattern: x 10^0 = x 2^0 normalize, move binary point 17 to the left x 2^17 sign = positive, exp = = 1040 Final bit pattern:
Binary to FP S = 1 Fraction = …00 2 Exponent = = 125 x = (–1) 1 × ( ) × 2 (125 – 127) = (–1) × × 2 -2 = –
FP Multiplication A=0.75, B= , A*B = 0.11*2 0 X * *2 -1 X *2 3 (normalize) 1.Add exponents: -1+3=2 2.Multiply significands × = Normalize result & check for over/underflow × 2 2 (no change) 4.Round and renormalize if necessary × 2 2 (no change) 5.Determine sign: +value × –value –ve – × 2 2 = – x 2 0 = –
8D ) What decimal number does the bit pattern represent if it is an integer? = ) What decimal number does the bit pattern represent if it is an unsigned integer? ) 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 S = 1 Fraction = 01010… Exponent = = 26 x = (–1) 1 × ( … ) × 2 (26 – 127) = –1 × ( ) × = – / /2 2 1/2 4 1/2 20