Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture notes Reading: Section 3.4, 3.5, 3.6 Multiplication

Similar presentations


Presentation on theme: "Lecture notes Reading: Section 3.4, 3.5, 3.6 Multiplication"— Presentation transcript:

1 Lecture 12-13 notes Reading: Section 3.4, 3.5, 3.6 Multiplication
Unsigned multiplication Hardware implementation Division Floating point

2 Unisigned shift-add multiplier (version 1)
64-bit Multiplicand reg, 64-bit ALU, 64-bit Product reg, 32-bit multiplier reg Shift Left Multiplicand 64 bits Multiplier Shift Right 64-bit ALU 32 bits Write Product Control 64 bits Multiplier = datapath + control

3 MULTIPLY HARDWARE Version 2
32-bit Multiplicand reg, 32 -bit ALU, 64-bit Product reg, 32-bit Multiplier reg Multiplicand 32 bits Multiplier Shift Right 32-bit ALU 32 bits Shift Right Product Control 64 bits Write

4 What’s going on? Multiplicand stay’s still and product moves right A0
A0 A1 A2 A3 B0 A0 A1 A2 A3 B1 A0 A1 A2 A3 B2 A0 A1 A2 A3 B3 P7 P6 P5 P4 P3 P2 P1 P0 Multiplicand stay’s still and product moves right

5 Multiplier is Negative
Convert to positive->mult->sign conversion Sign extended algorithm: (-13) x (11) (-143)

6 Fast Hardware Use multiple hardware ALUs Parallel binary addition
Binary tree type structured Parallel binary addition

7 Long Divide: Paper & Pencil
1001 Quotient Divisor Dividend – – Remainder Dividend = Quotient x Divisor + Remainder

8 DIVIDE HARDWARE Version 1
64-bit Divisor reg, 64-bit ALU, 64-bit Remainder reg, 32-bit Quotient reg Shift Right Divisor 64 bits Quotient Shift Left 64-bit ALU 32 bits Write Remainder Control 64 bits

9 Initialization: Set 32-bit Quotient reg to 0
Place the divisor in the high half of the 64-bit divisor reg Remainder reg initialized with dividend

10 Binary representation of fraction
( )2 = 1 x x x x 2 0 x x x x 2-4 = (9.5625)10 (0.625) 10 = ( ) 10 = 1 x x x 2-3 = (0.101) 2 2-1 2-2 2-3 2-4 2-5 2-6 0.5 0.25 0.125 0.0625

11 Scientific Notation Issues: Arithmetic (+, -, *, / )
exponent decimal point Sign, magnitude 23 -24 6.02 x x 10 radix (base) Mantissa Sign, magnitude Issues: Arithmetic (+, -, *, / ) Representation, Normal form Range and Precision Rounding Exceptions (e.g., divide by zero, overflow, underflow)

12 IEEE 754 Floating-Point 1 8 23 single precision S E F exponent:
excess 127 binary integer fraction: sign + magnitude, normalized binary significand w/ hidden integer bit: 1.F actual exponent is e = E - 127 0 < E < 255 S E-127 N = (-1) (1.F) 0 = = Magnitude of numbers that can be represented is in the range: -126 127 23 2 (1.0) to 2 (2 - 2 ) which is approximately: -38 38 1.8 x 10 to 3.40 x 10 (integer comparison valid on IEEE Fl.Pt. numbers of same sign!)

13 Example: -0.75 in float point
-0.75=-( )= -(0.11)2 In scientific notation, the value is x 20 normalized scientific notation: -1.12 x 2-1 In single precision: (-1) S x (1 + fraction) x 2 (exponent-127) S = 1 fraction = Exponent = 126 = 1

14 Floating Point Addition Algorithm
Add x=0.5 and y=– in binary (2) x= x 2-1, y= x 2-2. right shift the smaller exponent (y) so that both have same exponent value y= x 2-1 (3) Add the fraction parts: 1.000 x x 2-1 = x 2-1 (4) left shift result to normalize 0.001 x 2-1=1.000 x 2-4 (5) Round (not needed in this example)


Download ppt "Lecture notes Reading: Section 3.4, 3.5, 3.6 Multiplication"

Similar presentations


Ads by Google