Computer Arithmetic thuộc Chapter 9 của Bài giảng Computer Organization and Architecture tập trung trình bày các vấn đề cơ bản về Arithmetic & Logic Unit; ALU Inputs and Outputs; Integer Representation; Sign-Magnitude;...
Trang 1William Stallings
Computer Organization and Architecture
6th Edition
Chapter 9
Computer Arithmetic
Trang 2Arithmetic & Logic Unit
• Does the calculations
• Everything else in the computer is there to service this unit
• Handles integers
• May handle floating point (real) numbers
• May be separate FPU (maths coprocessor)
• May be on chip separate FPU (486DX +)
Trang 3ALU Inputs and Outputs
Trang 8Geometric Depiction of Twos Complement Integers
Trang 9Negation Special Case 1
Trang 10Negation Special Case 2
Trang 12Conversion Between Lengths
Trang 13Addition and Subtraction
Trang 14Hardware for Addition and Subtraction
Trang 17Unsigned Binary Multiplication
Trang 18Execution of Example
Trang 19Flowchart for Unsigned Binary Multiplication
Trang 20Multiplying Negative Numbers
Trang 21Booth’s Algorithm
Trang 22Example of Booth’s Algorithm
Trang 23• More complex than multiplication
• Negative numbers are really bad!
• Based on long division
Trang 24Division of Unsigned Binary Integers
1011
00001101 10010011 1011
001110 1011
1011 100
Quotient Dividend
Remainder
Partial
Remainders
Divisor
Trang 25Flowchart for Unsigned Binary Division
Trang 28Floating Point Examples
Trang 29Signs for Floating Point
Trang 30• FP numbers are usually normalized
• i.e. exponent is adjusted so that leading bit (MSB) of mantissa is 1
Trang 32Expressible Numbers
Trang 33Density of Floating Point Numbers
Trang 35IEEE 754 Formats
Trang 37FP Addition & Subtraction Flowchart
Trang 39Floating Point Multiplication
Trang 40Floating Point Division
Trang 41Required Reading
• Stallings Chapter 9
• IEEE 754 on IEEE Web site