1 / 12

CPU Data Types

CPU Data Types. Chapter 3. Integer Real Numbers Character Boolean Memory Address. Integer. Integer Whole numbers No decimal places Unsigned integers Use entire by ( 8 or 6 bits) for number Lowest number is zero (0) Signed integers Use high order bit for + or – sign

Télécharger la présentation

CPU Data Types

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. CPU Data Types Chapter 3 Integer Real Numbers Character Boolean Memory Address

  2. Integer • Integer • Whole numbers • No decimal places • Unsigned integers • Use entire by ( 8 or 6 bits) for number • Lowest number is zero (0) • Signed integers • Use high order bit for + or – sign • Octal machines have 5 bits for number (out of 6) Excess notation • Hex machines have 7 bit for number (out of 8) Excess notation

  3. Unsigned Signed 32168421-----63 Not counted: used for sign168421-----31 Integer Octal 6 BIT number X X X X X X Weight value 32 16 8 4 2 1 All positions = “1” (“ON”) 1 1 1 1 1 1

  4. Unsigned Signed 1286432168421-----255 Not counted: used for sign6432168421-----127 Integer Hexadecimal 8 BIT number X X X X X X X X Weight value 128 64 32 16 8 4 2 1 All positions = “1” (“ON”) 1 1 1 1 1 1 1 1

  5. Arithmetic Operations Addition Subtraction Multiplication Division

  6. Addition Add two numbers Decimal Binary Binary bit weights 6 0110 1 + 2 + 8 = 1110+ 5 0101 ---- ------- 1110 10112

  7. Subtraction Subtract two numbers Decimal Binary Binary bit weights 6 0110 1 + 0 + 0 + 0 = 110- 5 - 0101 * ---- ------- 110 00002 ? 1 2 3 4 0110-0101 ------- Borrow 1 from2s positionadd to 1s position 0101-0101 ------- Subtract 2s position 0101-0101 -------00 Subtract 1s position 0101-0101 -------0 5 6 7 Answer is: 6- 5----- 0 Subtract 4s position 0101-0101 -------000 Subtract 8s position0101-0101 -------0000

  8. Complements • Binary numbering scheme • Ones (1) become zero (0) • Zeros (0) become ones (1) Octal Hexadecimal 0 000 = 111 0000 = 11111 001 = 110 0001 = 1110 2 010 = 101 0010 = 11013 011 = 100 0011 = 11004 100 = 011 0100 = 10115 101 = 010 0101 = 10106 110 = 001 0110 = 10017 111 = 000 0111 = 10008 1000 = 0111 9 1001 = 0110A 1010 = 0101 B 1011 = 0100 C 1100 = 0011D 1101 = 0010E 1110 = 0001 F 1111 = 0000

  9. Two’s Complement Computers MULTIPLY, SUBTRACT and DIVIDE by ADDITION • Binary numbering scheme • Used to work with negative numbers • Ones (1) become zero (0) • Zeros (0) become ones (1) • Data is signed if: • Variable data type was defined as signed in the program • The number is converted in the program • The computer does a Subtract or Divide • Formula for conversion • Original binary number • Compliment the number • Ones to Zeros • Zeros to Ones • Add binary one to lowest position • High order carry's are discarded

  10. Two’s Complement Add two numbers Decimal Binary Binary bit weights 6 0110 1 + 2 + 8 = 1110+ 5 0101 ---- ------- 1110 10112

  11. Two’s Complement Subtract two numbers Decimal Binary Binary bit weights 1 1 6 0110 1 + 0 + 0 + 0 = 110- 5 +1011 * ---- ------- 110 00012 * Two’s Compliment of 5 5 = 0101 Original Compliment 1010Add one 1 --------Two’s compliment 1011

  12. Summary Computers do Subtraction And Division Using AdditionandTwo’s Compliment

More Related