binary numbers
play

Binary Numbers 723 Binary Numbers 723 = 7x100 + 2x10 + 3x1 Binary - PowerPoint PPT Presentation

Binary Numbers 723 Binary Numbers 723 = 7x100 + 2x10 + 3x1 Binary Numbers 723 = 7x100 + 2x10 + 3x1 = 7x10 2 + 2x10 1 + 3x10 0 Binary Numbers 5349 = 5x10 3 + 3x10 2 + 4x10 1 + 9x10 0 Binary Numbers Why base 10? Binary Numbers 257 (base 8)


  1. Binary Numbers 723

  2. Binary Numbers 723 = 7x100 + 2x10 + 3x1

  3. Binary Numbers 723 = 7x100 + 2x10 + 3x1 = 7x10 2 + 2x10 1 + 3x10 0

  4. Binary Numbers 5349 = 5x10 3 + 3x10 2 + 4x10 1 + 9x10 0

  5. Binary Numbers Why base 10?

  6. Binary Numbers 257 (base 8) 2x8 2 + 5x8 1 + 7x8 0 2x64 + 5x8 + 7x1 175 (base 10)

  7. Binary Numbers 0110 (base 2) 0x2 3 + 1x2 2 + 1x2 1 + 0x2 0 0x8 + 1x4 + 1x2 + 0x1 6 (base 10)

  8. Binary Numbers 2 1 2 0 00 0 01 1 10 2 max value = 2 2 -1 11 3 2-bit binary number

  9. Binary Numbers 000 0 001 1 010 2 011 3 100 4 101 5 110 6 111 7 max value = 2 3 -1 3-bit binary number

  10. Binary Numbers 0000 0 0001 1 0010 2 0011 3 0100 4 0101 5 0110 6 0111 7 1000 8 1001 9 1010 10 1011 11 1100 12 1101 13 1110 14 max value = 2 4 -1 1111 15 4-bit binary number

  11. Binary Numbers (why?) reliability!

  12. Binary Numbers (why?) 9 9 9 9 8 8 8 8 7 7 7 7 6 6 6 6 5 5 5 5 4 4 4 4 3 3 3 3 2 2 2 2 1 1 1 1 0 0 0 0 0 4 6 7

  13. Binary Numbers (why?) 9 9 8 8 7 7 6 6 5 5 4 4 3 3 2 2 1 1 0 0 0 1

  14. Binary Numbers How do we encode negative numbers?

  15. Binary Numbers use left-most bit to represent sign 0 = “+” 1 = “-”

  16. Binary Numbers sign 2 1 2 0 000 0 001 1 010 2 011 3 100 101 110 111 3-bit signed binary number

  17. Binary Numbers sign 2 1 2 0 000 0 001 1 010 2 011 3 100 -0 ??? 101 -1 110 -2 111 -3 3-bit signed binary number

  18. Binary Numbers (two’s complement) 1. start with an unsigned 4-bit binary number where left- most bit is 0 • 0110 = 6

  19. Binary Numbers (two’s complement) 1. start with an unsigned 4-bit binary number where left- most bit is 0 • 0110 = 6 2. complement your binary number (flip bits) • 1001

  20. Binary Numbers (two’s complement) 1. start with an unsigned 4-bit binary number where left- most bit is 0 • 0110 = 6 2. complement your binary number (flip bits) • 1001 3. add one to your binary number • 1010 = -6

  21. Binary Numbers (two’s complement) positive complement +1 negative 0 000 0 1 001 -1 2 010 -2 3 011 -3 3-bit signed binary number

  22. Binary Numbers (two’s complement) positive complement +1 negative 0 000 0 1 001 110 111 -1 2 010 -2 3 011 -3 3-bit signed binary number

  23. Binary Numbers (two’s complement) positive complement +1 negative 0 000 0 1 001 110 111 -1 2 010 101 110 -2 3 011 -3 3-bit signed binary number

  24. Binary Numbers (two’s complement) positive complement +1 negative 0 000 0 1 001 110 111 -1 2 010 101 110 -2 3 011 100 101 -3 3-bit signed binary number

  25. Binary Numbers (two’s complement) positive complement +1 negative 0 000 111 0 1 001 110 111 -1 2 010 101 110 -2 3 011 100 101 -3 3-bit signed binary number

  26. Binary Numbers (two’s complement) positive complement +1 negative !!! 0 000 111 000 0 1 001 110 111 -1 2 010 101 110 -2 3 011 100 101 -3 3-bit signed binary number

  27. Binary Numbers (two’s complement) positive complement +1 negative 0 000 111 000 0 1 001 110 111 -1 2 010 101 110 -2 3 011 100 101 -3 we lost a number?

  28. Binary Numbers (two’s complement) positive complement +1 negative 0 000 111 000 0 1 001 110 111 -1 2 010 101 110 -2 3 011 100 101 -3 100 we lost a number?

  29. Binary Numbers (two’s complement) complement -1 100

  30. Binary Numbers (two’s complement) 010 -2 complement -1 011 -1 011 100 100 101 +1 110 +2

  31. Binary Numbers (two’s complement) complement -1 100 011 100

  32. Binary Numbers (two’s complement) complement -1 4 100 011 100

  33. Binary Numbers (two’s complement) positive complement +1 negative 0 000 111 000 0 1 001 110 111 -1 2 010 101 110 -2 3 011 100 101 -3 100 -4 n-bit unsigned binary numbers: 0...2 n -1

  34. Binary Numbers (two’s complement) positive complement +1 negative 0 000 111 000 0 1 001 110 111 -1 2 010 101 110 -2 3 011 100 101 -3 100 -4 n-bit signed binary numbers: -2 n-1 ... 2 n-1 -1

  35. Binary Numbers (two’s complement) 0010 2 0010 2 + ---- + - 0100 4 summing unsigned binary numbers is easy

  36. Binary Numbers (two’s complement) 0010 2 1010 -2 + ---- + - 1100 0 ? summing signed binary numbers

  37. Binary Numbers (two’s complement) 0011 3 1011 -3 + ---- + - 1110 0 ? summing signed binary numbers

  38. Binary Numbers (two’s complement) 0010 -> 1101 -> 1110 0010 2 -2 + ---- + - 0 summing signed (2‘s complement) binary numbers

  39. Binary Numbers (two’s complement) 0010 -> 1101 -> 1110 0010 2 1110 -2 + ---- + - 0000 0 summing signed (2‘s complement) binary numbers

  40. Binary Numbers (two’s complement) 0011 -> 1100 -> 1101 0011 3 -3 + ---- + - 0 summing signed (2‘s complement) binary numbers

  41. Binary Numbers (two’s complement) 0011 -> 1100 -> 1101 0011 3 1101 -3 + ---- + - 0000 0 summing signed (2‘s complement) binary numbers

  42. Binary Numbers (decoding two’s complement) 0111 = ? 4-bit signed (two’s complement) binary number

  43. Binary Numbers (decoding two’s complement) 0111 = 7 4-bit signed (two’s complement) binary number

  44. Binary Numbers (decoding two’s complement) 1011 = ? 4-bit signed (two’s complement) binary number

  45. Binary Numbers (decoding two’s complement) subtract 1 1011 1010 4-bit signed (two’s complement) binary number

  46. Binary Numbers (decoding two’s complement) subtract 1 complement 1011 1010 0101 4-bit signed (two’s complement) binary number

  47. Binary Numbers (decoding two’s complement) subtract 1 complement 1011 1010 0101 5 4-bit signed (two’s complement) binary number

  48. Binary Numbers (decoding two’s complement) 1011 = -5 4-bit signed (two’s complement) binary number

  49. Binary Numbers How do we encode fractional numbers?

  50. Binary Numbers ± mantissa x base ± exponent

  51. Boolean Logic (variables) 1 = True 0 = False

  52. Boolean Logic (truth tables) a b a and b 1 1 1 1 0 0 0 1 0 0 0 0 a and b

  53. Boolean Logic (truth tables) a b a or b 1 1 1 1 0 1 0 1 1 0 0 0 a or b

  54. Boolean Logic (truth tables) a not a 1 0 0 1 not a

  55. Boolean Logic (truth tables) input output (boolean variable) (boolean variable) a , b a and b a or b not a

  56. Gates a b a and b 1 1 1 1 0 0 0 1 0 0 0 0 a a and b ⋅ b

  57. Gates a b a or b 1 1 1 1 0 1 0 1 1 0 0 0 a a or b + b

  58. Gates a not a 1 0 0 1 a not a

  59. Building Gates (transistors) power power input input 0 1

  60. Building Gates (transistors) power 0 0

  61. Building Gates (transistors) power 0 0 0

  62. Building Gates (transistors) power 0 1

  63. Building Gates (transistors) power 0 1 0

  64. Building Gates (transistors) power 1 0

  65. Building Gates (transistors) power 1 0 0

  66. Building Gates (transistors) power 1 1

  67. Building Gates (transistors) power 1 1 1

  68. Building Gates (transistors) power power power power 1 0 1 0 1 1 0 0 0 1 0 0

  69. Building Gates (transistors) power power power power 1 0 1 0 1 1 0 0 0 1 0 0 AND gate

  70. Building Gates (transistors) 0 1 OR gate

  71. Building Gates (transistors) power 0 1 1 OR gate

  72. Building Gates (transistors) power 1 1 1 OR gate

  73. Building Gates (transistors) power 0 0 0 OR gate

  74. Building Gates (transistors) power 1 resistor 0 junk NOT gate

  75. Building Gates (transistors) power 0 resistor 1 junk NOT gate

Recommend


More recommend