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

binary numbers
SMART_READER_LITE
LIVE PREVIEW

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)


slide-1
SLIDE 1

Binary Numbers

723

slide-2
SLIDE 2

Binary Numbers

723 = 7x100 + 2x10 + 3x1

slide-3
SLIDE 3

Binary Numbers

723 = 7x100 + 2x10 + 3x1 = 7x102 + 2x101 + 3x100

slide-4
SLIDE 4

5349 = 5x103 + 3x102 + 4x101 + 9x100

Binary Numbers

slide-5
SLIDE 5

Why base 10? Binary Numbers

slide-6
SLIDE 6

257 (base 8) 2x82 + 5x81 + 7x80 2x64 + 5x8 + 7x1 175 (base 10)

Binary Numbers

slide-7
SLIDE 7

0110 (base 2) 0x23 + 1x22 + 1x21 + 0x20 0x8 + 1x4 + 1x2 + 0x1 6 (base 10)

Binary Numbers

slide-8
SLIDE 8

2-bit binary number

00 0 01 1 10 2 11 3

2120

max value = 22 -1

Binary Numbers

slide-9
SLIDE 9

3-bit binary number

000 0 001 1 010 2 011 3 100 4 101 5 110 6 111 7 max value = 23 -1

Binary Numbers

slide-10
SLIDE 10

4-bit binary number

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 1111 15

max value = 24 -1

Binary Numbers

slide-11
SLIDE 11

reliability! Binary Numbers (why?)

slide-12
SLIDE 12

9 8 7 6 5 4 3 2 1 9 8 7 6 5 4 3 2 1 9 8 7 6 5 4 3 2 1 9 8 7 6 5 4 3 2 1

4 6 7 Binary Numbers (why?)

slide-13
SLIDE 13

9 8 7 6 5 4 3 2 1 9 8 7 6 5 4 3 2 1

1 Binary Numbers (why?)

slide-14
SLIDE 14

Binary Numbers How do we encode negative numbers?

slide-15
SLIDE 15

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

slide-16
SLIDE 16

3-bit signed binary number

000 0 001 1 010 2 011 3 100 101 110 111

sign 2120

Binary Numbers

slide-17
SLIDE 17

3-bit signed binary number

000 0 001 1 010 2 011 3 100 -0 101 -1 110 -2 111 -3

sign 2120

??? Binary Numbers

slide-18
SLIDE 18

Binary Numbers (two’s complement)

  • 1. start with an unsigned 4-bit binary number where left-

most bit is 0

  • 0110 = 6
slide-19
SLIDE 19
  • 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

Binary Numbers (two’s complement)

slide-20
SLIDE 20
  • 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

Binary Numbers (two’s complement)

slide-21
SLIDE 21

3-bit signed binary number

0 000 0 1 001 -1 2 010 -2 3 011 -3

positive negative complement +1

Binary Numbers (two’s complement)

slide-22
SLIDE 22

3-bit signed binary number

0 000 0 1 001 110 111 -1 2 010 -2 3 011 -3

positive negative complement +1

Binary Numbers (two’s complement)

slide-23
SLIDE 23

3-bit signed binary number

0 000 0 1 001 110 111 -1 2 010 101 110 -2 3 011 -3

positive negative complement +1

Binary Numbers (two’s complement)

slide-24
SLIDE 24

3-bit signed binary number

0 000 0 1 001 110 111 -1 2 010 101 110 -2 3 011 100 101 -3

positive negative complement +1

Binary Numbers (two’s complement)

slide-25
SLIDE 25

3-bit signed binary number

0 000 111 0 1 001 110 111 -1 2 010 101 110 -2 3 011 100 101 -3

positive negative complement +1

Binary Numbers (two’s complement)

slide-26
SLIDE 26

3-bit signed binary number

0 000 111 000 0 1 001 110 111 -1 2 010 101 110 -2 3 011 100 101 -3

positive negative

!!!

complement +1

Binary Numbers (two’s complement)

slide-27
SLIDE 27

we lost a number?

0 000 111 000 0 1 001 110 111 -1 2 010 101 110 -2 3 011 100 101 -3

positive negative complement +1

Binary Numbers (two’s complement)

slide-28
SLIDE 28

we lost a number?

0 000 111 000 0 1 001 110 111 -1 2 010 101 110 -2 3 011 100 101 -3 100

positive negative complement +1

Binary Numbers (two’s complement)

slide-29
SLIDE 29

100

complement

  • 1

Binary Numbers (two’s complement)

slide-30
SLIDE 30

011 100

complement

  • 1

010 011 100 101 110

  • 1

+1 +2

  • 2

Binary Numbers (two’s complement)

slide-31
SLIDE 31

100 011 100

complement

  • 1

Binary Numbers (two’s complement)

slide-32
SLIDE 32

4 100 011 100

complement

  • 1

Binary Numbers (two’s complement)

slide-33
SLIDE 33

0 000 111 000 0 1 001 110 111 -1 2 010 101 110 -2 3 011 100 101 -3 100 -4

positive negative complement +1

n-bit unsigned binary numbers: 0...2n-1 Binary Numbers (two’s complement)

slide-34
SLIDE 34

0 000 111 000 0 1 001 110 111 -1 2 010 101 110 -2 3 011 100 101 -3 100 -4

positive negative complement +1

n-bit signed binary numbers: -2n-1... 2n-1-1 Binary Numbers (two’s complement)

slide-35
SLIDE 35

0010 0010 + ---- 0100

summing unsigned binary numbers is easy

2 2 + - 4

Binary Numbers (two’s complement)

slide-36
SLIDE 36

summing signed binary numbers

0010 1010 + ---- 1100 2

  • 2

+ - ?

Binary Numbers (two’s complement)

slide-37
SLIDE 37

summing signed binary numbers

0011 1011 + ---- 1110 3

  • 3

+ - ?

Binary Numbers (two’s complement)

slide-38
SLIDE 38

summing signed (2‘s complement) binary numbers

0010 + ---- 2

  • 2

+ -

0010 -> 1101 -> 1110

Binary Numbers (two’s complement)

slide-39
SLIDE 39

summing signed (2‘s complement) binary numbers

0010 1110 + ---- 0000 2

  • 2

+ -

0010 -> 1101 -> 1110

Binary Numbers (two’s complement)

slide-40
SLIDE 40

0011 + ---- 3

  • 3

+ -

0011 -> 1100 -> 1101

summing signed (2‘s complement) binary numbers Binary Numbers (two’s complement)

slide-41
SLIDE 41

0011 1101 + ---- 0000 3

  • 3

+ -

0011 -> 1100 -> 1101

summing signed (2‘s complement) binary numbers Binary Numbers (two’s complement)

slide-42
SLIDE 42

Binary Numbers (decoding two’s complement) 4-bit signed (two’s complement) binary number

0111 = ?

slide-43
SLIDE 43

4-bit signed (two’s complement) binary number

0111 = 7

Binary Numbers (decoding two’s complement)

slide-44
SLIDE 44

4-bit signed (two’s complement) binary number

1011 = ?

Binary Numbers (decoding two’s complement)

slide-45
SLIDE 45

4-bit signed (two’s complement) binary number

subtract 1

1011 1010

Binary Numbers (decoding two’s complement)

slide-46
SLIDE 46

4-bit signed (two’s complement) binary number

subtract 1

1011 1010 0101

complement

Binary Numbers (decoding two’s complement)

slide-47
SLIDE 47

4-bit signed (two’s complement) binary number

subtract 1

1011 1010 0101 5

complement

Binary Numbers (decoding two’s complement)

slide-48
SLIDE 48

4-bit signed (two’s complement) binary number

1011 = -5

Binary Numbers (decoding two’s complement)

slide-49
SLIDE 49

Binary Numbers How do we encode fractional numbers?

slide-50
SLIDE 50

Binary Numbers ± mantissa x base ± exponent

slide-51
SLIDE 51

Boolean Logic (variables) 1 = True 0 = False

slide-52
SLIDE 52

a and b Boolean Logic (truth tables)

a b a and b

1 1 1 1 1

slide-53
SLIDE 53

a or b

a b a or b

1 1 1 1 1 1 1

Boolean Logic (truth tables)

slide-54
SLIDE 54

not a

a not a

1 1

Boolean Logic (truth tables)

slide-55
SLIDE 55
  • utput

(boolean variable)

a and b a or b not a input

(boolean variable)

a, b Boolean Logic (truth tables)

slide-56
SLIDE 56

a and b

Gates

a b a and b

1 1 1 1 1

a b

slide-57
SLIDE 57

a b a or b

1 1 1 1 1 1 1

a or b a b

+

Gates

slide-58
SLIDE 58

not a a not a

1 1

a

Gates

slide-59
SLIDE 59

Building Gates (transistors)

input power input power

1

slide-60
SLIDE 60

power

Building Gates (transistors)

slide-61
SLIDE 61

Building Gates (transistors)

power

slide-62
SLIDE 62

1 power

Building Gates (transistors)

slide-63
SLIDE 63

Building Gates (transistors)

1 power

slide-64
SLIDE 64

1 power

Building Gates (transistors)

slide-65
SLIDE 65

Building Gates (transistors)

1 power

slide-66
SLIDE 66

1 1 power

Building Gates (transistors)

slide-67
SLIDE 67

power 1

Building Gates (transistors)

1 1

slide-68
SLIDE 68

power 1 power 1 power 1 1 power 1

Building Gates (transistors)

slide-69
SLIDE 69

AND gate Building Gates (transistors)

power 1 power 1 power 1 1 power 1

slide-70
SLIDE 70

OR gate

1

Building Gates (transistors)

slide-71
SLIDE 71

OR gate

1 power 1

Building Gates (transistors)

slide-72
SLIDE 72

OR gate

1 1 power 1

Building Gates (transistors)

slide-73
SLIDE 73

OR gate

power

Building Gates (transistors)

slide-74
SLIDE 74

NOT gate

power

1

junk

resistor

Building Gates (transistors)

slide-75
SLIDE 75

NOT gate

1 power junk

resistor

Building Gates (transistors)