number systems 2.1 information storage why not decimal numbers in computers ? difficult to store...

9
Number Systems • 2.1 Information Storage • Why not decimal numbers in computers ? • Difficult to store • ENIAC (1 st electronic computer) used 10 vacuum tubes • Difficult to transmit • Messy for digital logic functions • Addition, multiplication, etc.

Upload: doris-pitts

Post on 01-Jan-2016

216 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Number Systems 2.1 Information Storage Why not decimal numbers in computers ? Difficult to store ENIAC (1 st electronic computer) used 10 vacuum tubes

Number Systems

• 2.1 Information Storage• Why not decimal numbers in computers ?

• Difficult to store• ENIAC (1st electronic computer) used 10 vacuum

tubes• Difficult to transmit• Messy for digital logic functions

• Addition, multiplication, etc.

Page 2: Number Systems 2.1 Information Storage Why not decimal numbers in computers ? Difficult to store ENIAC (1 st electronic computer) used 10 vacuum tubes

Binary Representations• Electronic Implementation

– Easy to store with bistable elements

– Reliably transmitted on noisy and inaccurate wires

– Straightforward implementation of arithmetic functions

0.0V0.5V

2.8V3.3V

0 1 0

Page 3: Number Systems 2.1 Information Storage Why not decimal numbers in computers ? Difficult to store ENIAC (1 st electronic computer) used 10 vacuum tubes

Binary to Decimal• Multiply positional weights by digits and add

– 1 1 1 1 0– 24 23 22 21 20

– Resulting decimal number represents the value

Page 4: Number Systems 2.1 Information Storage Why not decimal numbers in computers ? Difficult to store ENIAC (1 st electronic computer) used 10 vacuum tubes

Decimal to Binary• Decimal number D to base-2 number X

– Continue dividing D by 2– Take the last quotient and all remainder

– 30 10 -> 11110 2

30

15 -- 0 7 -- 1 3 -- 1 1 -- 1

Page 5: Number Systems 2.1 Information Storage Why not decimal numbers in computers ? Difficult to store ENIAC (1 st electronic computer) used 10 vacuum tubes

Other Number System ?

• base 12• base 16• base 60 ?

– http://en.wikipedia.org/wiki/Sexagesimal

Page 6: Number Systems 2.1 Information Storage Why not decimal numbers in computers ? Difficult to store ENIAC (1 st electronic computer) used 10 vacuum tubes

Bases 2, 8, 16, etc.

3 binary bits into a single octal

4 binary bits into a single hex11110 2

36 8

1E X

• Use characters ‘0’ to ‘9’ and ‘A’ to ‘F’• Write FA1D37B16 in C as 0xFA1D37B

– Or 0xfa1d37b

0 0 00001 1 00012 2 00103 3 00114 4 01005 5 01016 6 01107 7 01118 8 10009 9 1001A 10 1010B 11 1011C 12 1100D 13 1101E 14 1110F 15 1111

HexDecim

al

Binary

Page 7: Number Systems 2.1 Information Storage Why not decimal numbers in computers ? Difficult to store ENIAC (1 st electronic computer) used 10 vacuum tubes

Letters ?

ASCIIbyte/symbol

Unicode2 bytes/symbolhttp://www.unicode.org/charts/

100 0001 101 65 41 A100 0010 102 66 42 B100 0011 103 67 43 C100 0100 104 68 44 D100 0101 105 69 45 E100 0110 106 70 46 F100 0111 107 71 47 G100 1000 110 72 48 H100 1001 111 73 49 I100 1010 112 74 4A J100 1011 113 75 4B K100 1100 114 76 4C L100 1101 115 77 4D M100 1110 116 78 4E N100 1111 117 79 4F O101 0000 120 80 50 P101 0001 121 81 51 Q101 0010 122 82 52 R101 0011 123 83 53 S101 0100 124 84 54 T101 0101 125 85 55 U101 0110 126 86 56 V101 0111 127 87 57 W101 1000 130 88 58 X

101 1001 131 89 59 Y

101 1010 132 90 5A Z

Page 8: Number Systems 2.1 Information Storage Why not decimal numbers in computers ? Difficult to store ENIAC (1 st electronic computer) used 10 vacuum tubes

Machine Words• Machine Has “Word Size”

– Nominal size of integer-valued data• Including addresses

– Most current machines are 32 bits (4 bytes)• Limits addresses to 4GB• Becoming too small for memory-intensive applications

– High-end systems are 64 bits (8 bytes)• Potentially address 1.8 X 1019 bytes

– Machines support multiple data formats• Fractions or multiples of word size• Always integral number of bytes

Page 9: Number Systems 2.1 Information Storage Why not decimal numbers in computers ? Difficult to store ENIAC (1 st electronic computer) used 10 vacuum tubes

Word-Oriented Memory Org.

000000010002000300040005000600070008000900100011

32-bitWords

Bytes Addr.

0012001300140015

64-bitWords

Addr =??

Addr =??

Addr =??

Addr =??

Addr =??

Addr =??

0000

0004

0008

0012

0000

0008

• Addresses Specify Byte Locations– Address of first byte in

word– Addresses of successive

words differ by 4 (32-bit) or 8 (64-bit)