1 / 24

CHAPTER 9 COMPUTER ARITHMETIC - ALU

CHAPTER 9 COMPUTER ARITHMETIC - ALU. CSNB123 coMPUTER oRGANIZATION. Expected Course Outcome. Overview. ALU. Part of the computer that do the arithmetic and logical operation on data Simple digital logic devices that can; S tore binary digits Perform simple BOOLEAN logic operations.

calla
Download Presentation

CHAPTER 9 COMPUTER ARITHMETIC - ALU

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CHAPTER 9 COMPUTER ARITHMETIC - ALU CSNB123 coMPUTERoRGANIZATION Systems and Networking

  2. Expected Course Outcome Systems and Networking

  3. Overview Systems and Networking

  4. ALU • Part of the computer that do the arithmetic and logical operation on data • Simple digital logic devices that can; • Store binary digits • Perform simple BOOLEAN logic operations CPU Registers Arithmetic Logic Unit (ALU) Internal CPU Interconnection Control Unit Systems and Networking

  5. ALU Interconnection Systems and Networking

  6. ALU and Registers CPU Registers Arithmetic Logic Unit (ALU) Internal CPU Interconnection Control Unit Systems and Networking

  7. Integer Representation • Computer - logic circuits - operate on information; 0 and 1  two values electrical signals – bit • How to represent negative value in binary? • Sign-magnitude representation • Twos complements representation Systems and Networking

  8. Sign Magnitude Representation Systems and Networking

  9. Sign-magnitude Representation • Ways of presenting -ve and +ve integers • The most significant (leftmost) bits in the word as a sign bit • Example: if the sign bit is 0 then the number is +ve, vice versa • Hence sign magnitude representation employed sign bit Systems and Networking

  10. Sign-magnitude Representation (Cont.) Example • +18 = 00010010 • -18 =10010010 • Rarely used • Drawbacks; • Addition/subtraction require a consideration of both the signs of the numbers and their relative magnitudes to carry out the required operation • 2 representation of 0; • +010= 00000000 • -010= 10000000 Systems and Networking

  11. Twos complements representation Systems and Networking

  12. Twos Complements Representation • Used the most significant bit (MSB) as a sign bit (similar to sign magnitude) • Differs – the other bits are interpreted • Example: +3 = 00000011 +2 = 00000010 +1 = 00000001 +0 = 00000000 Systems and Networking

  13. Twos Complements Representation (Cont.) • Negative – sign bit = 1 • Example: • -1 = 11111111 • -2 = 11111110 • -3 = 11111101 Systems and Networking

  14. Twos Complements Representation (Cont.) • Steps for negative integers. Example: -3 +3 = 00000011 11111100 1 11111101 Step 1: Take +ve value Step 2: Boolean Complement Step 3: Add 1 to LSB Result Systems and Networking

  15. Twos Complements Representation (Cont.) • Example: 11110000 11110000 00001111 1 00010000 00010000 = 16 -16 Step 1: Take value Step 2: Boolean Complement Step 3: Add 1 to LSB Result Convert into decimal Put –ve sign Systems and Networking

  16. Twos Complements Representation – Special Case • Example: 0, consider an 8-bit representation 0 11111111 1 100000000 Step 1: Take value Step 2: Boolean Complement Step 3: Add 1 to LSB Result 1 carry out at most significant bit (MSB) - Ignored hence -0 = 0 Systems and Networking

  17. Twos Complements Representation – Range of Numbers • 8-bit 2s complement • +127 = 0111 1111 • -127 = 1000 0000 • 16-bit 2s complement • +32767 = 01111111 11111111 • -32767 = 10000000 00000000 Systems and Networking

  18. Twos Complements Representation – Conversion between lengths Positive Negative Pack with leading ones 8-bits +18 = 11101110 16-bits -18 = 11111111 11101110 • Pack with leading zeros • 8-bits • +18 = 00010010 • 16-bits • -18 = 00000000 00010010 Systems and Networking

  19. Twos Complements Representation - Operations • Addition • Subtraction Systems and Networking

  20. Twos Complements Representation - Operations Addition • Addition follows as if the two numbers were unsigned integers (positive or zero) • Overflow – result is larger than word • ALU provide signals Systems and Networking

  21. Twos Complements Representation - Operations Subtraction • Do subtraction via addition Systems and Networking

  22. Twos Complements Representation - Operations • OVERFLOW RULE If two numbers are added, and they BOTH are POSITIVE or BOTH NEGATIVE, Then OVERFLOW occurs if and only if the RESULT has the OPPOSITE SIGN Systems and Networking

  23. Additional Reference • William Stallings, Computer Organization and Architecture: Designing for Performance, 8th. Edition, Prentice-Hall Inc., 2010 Systems and Networking

  24. This teaching material is belongs to Systems and Networking Department College of Information Technology UniversitiTenagaNasional (UNITEN) Malaysia 2014 Systems and Networking

More Related