Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computing Machinery Chapter 6: Computer Arithmetic.

Similar presentations


Presentation on theme: "Computing Machinery Chapter 6: Computer Arithmetic."— Presentation transcript:

1 Computing Machinery Chapter 6: Computer Arithmetic

2 Integer Representations 0000000000000000000000000000000 = +0 0000000000000000000000000000001 = +1 0000000000000000000000000000010 = +2 : 0111111111111111111111111111111 = +2,147,483,647 1000000000000000000000000000000 = -0 1000000000000000000000000000001 = -1 1000000000000000000000000000010 = -2 1111111111111111111111111111111 = -2,147,483,647

3 Magnitudes of Binary Encoded Base Positions

4 Two's Complement 1. Generate the magnitude of the value in binary 2. Invert each bit of the binary number (0 becomes 1 and 1 becomes 0), called 1's complement 3. Add one (1) to the one's complement to produce the two's complement. (Ignore any overflow.) 34/2 = 17 remainder 0 _ _ _ _ _ _ _ 0 17/2 = 8 remainder 1 _ _ _ _ _ _ 1 0 8/2 = 4 remainder 0 _ _ _ _ _ 0 1 0 4/2 = 2 remainder 0 _ _ _ _ 0 0 1 0 2/2 = 1 remainder 0 _ _ _ 0 0 0 1 0 1/2 = 0 remainder 1 _ _ 1 0 0 0 1 0 0/2 = 0 remainder 0 _ 0 1 0 0 0 1 0 0/2 = 0 remainder 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 <- magnitude of -34 1 1 0 1 1 1 0 1 <- one's complement + 1 1 1 0 1 1 1 1 0 <- two's complement Example: -34 in two's complement

5 Converting Between Binary, Octal, and Hexadecimal binary octal hexadecimal decimal 0000 0 0 0 0001 1 1 1 0010 2 2 2 0011 3 3 3 0100 4 4 4 0101 5 5 5 0110 6 6 6 0111 7 7 7 100010 8 8 100111 9 9 101012 A 10 101113 B 11 110014 C 12 110115 D 13 111016 E 14 111117 F 15 01001100100111011111 1 1 4 4 7 3 7 0100 1100 1001 1101 1111 4 C 9 D F

6 Integer Addition and Subtraction

7 Finite Represenation in Two's Complement

8 IEEE Single-Precision Floating Point

9 IEEE Representation of 

10 IEEE Special Values

11 Integer Multiplication (Unsigned)

12 Integer Multiplication Hardware

13 Integer Multiplication (signed) standard Booth's Recoding Booth's recoding reduces the number of computations, which reduces the amount of hardware and time required to perform a multiplication

14 Booth's Multiplication 3 0011 M -M = 1101 x 7 0111 Q A Q Q -1 N 0 0 0 0 0 1 1 1 0 4 +1 1 0 1 1 1 0 1 0 1 1 1 0 1 1 1 0 1 0 1 1 1 3 1 1 1 1 0 1 0 1 1 2 1 1 1 1 1 0 1 0 1 1 +0 0 1 1 0 0 1 0 1 0 1 0 1 0 0 0 1 0 1 0 1 0 0 00010101 = 21

15 Integer Division rebuilding the dividend, Q recurrence relation for bitwise integer division with remainder

16 Integer Division (restoring)

17 Integer Division (non-restoring) reformulating the recurrence relation restoring test can be done once at the end of the division

18 Booth's Integer Division

19 IEEE Floating-Point Multiplication

20 POWER2 Floating-Point Unit (FPU) Architecture http://www-03.ibm.com/servers/eserver/pseries/hardware/whitepapers/power/fpu.html The IBM POWER2 Floating-Point Unit is a hardware implementation of arithmetic operations on IEEE format floating-point numbers. "The FPU receives two instructions from the instruction cache unit (ICU). These two instructions go through a predecode stage where the FPU discards non-floating- point instructions. The MAF unit performs all of the floating-point arithmetic instructions, such as the multiply-add fused operation, as well as all floating-point store operations."

21 http://www-03.ibm.com/servers/eserver/pseries/hardware/whitepapers/power/fpu.html FPU Arithmetic Unit


Download ppt "Computing Machinery Chapter 6: Computer Arithmetic."

Similar presentations


Ads by Google