Efficient Computer Arithmetic: Unsigned and Signed Notations, Multiplication, Division, and Optimization
1.01k likes | 1.08k Vues
Learn about unsigned and signed notations, multiplication algorithms, division techniques, and hardware implementation strategies in computer arithmetic. Explore different methods and examples to optimize arithmetic operations efficiently.
Efficient Computer Arithmetic: Unsigned and Signed Notations, Multiplication, Division, and Optimization
E N D
Presentation Transcript
Chapter Outline • Unsigned notations • Signed notations • Binary Coded Decimal • Specialized arithmetic hardware • Floating point numbers • IEEE 754 floating point standard
Unsigned Notations • Unsigned non-negative • Unsigned two’s-complement
Unsigned Notations • Unsigned non-negative • Unsigned two’s-complement
Multiplication • A non-optimal method z = 0 FOR i = 1 TO y DO { z = z + x }
Multiplication • A more typical method
Multiplication • Calculating running totals
Multiplication • Shifting partial results to align sums
Shift-add Multiplication Algorithm C = 0, U = 0;
Example: UV X Y(X = 1101, Y = 1001) C = 0, U = 0 0
RTL Code C 0, U 0, i n
Example: UV X Y(X = 1101, Y = 1001) 0 C 0, U 0, i 4
Optimizing the RTL Code • UV X V • Register Y not needed • One operand is lost
Optimizing the RTL Code C 0, U 0
Example 0 C 0, U 0, i 4
Booth’s Algorithm • Multiplying unsigned 2’s-complement numbers
Example • UV X Y, X = -3 (1101), Y = -5 (1011)
Example • UV X Y, X = -3 (1101), Y = -5 (1011)
Division • A non-optimal method
Division • A more typical method
Division • Shifting results to align remainders
Signed Notations • Signed-magnitude
Signed Notations • Signed-magnitude • Signed-2’s complement
Signed Notations • Signed-magnitude • Signed-2’s complement • Value Signed-magnitude Signed-2’s complement • +3 0 0011 0 0011 • -3 1 0011 1 1101