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.
Binary Representations Electronic Implementation – Easy to store with bistable elements – Reliably transmitted on noisy and inaccurate wires – Straightforward implementation of arithmetic functions 0.0V 0.5V 2.8V 3.3V 010
Binary to Decimal Multiply positional weights by digits and add – – – Resulting decimal number represents the value
Decimal to Binary Decimal number D to base-2 number X – Continue dividing D by 2 – Take the last quotient and all remainder – >
Other Number System ? base 12 base 16 base 60 ? –
Bases 2, 8, 16, etc. 3 binary bits into a single octal 4 binary bits into a single hex E X Use characters ‘0’ to ‘9’ and ‘A’ to ‘F’ Write FA1D37B 16 in C as 0xFA1D37B – Or 0xfa1d37b A B C D E F Hex Decimal Binary
Letters ? ASCII byte/symbol Unicode 2 bytes/symbol g/charts/ A B C D E F G H I AJ BK CL DM EN FO P Q R S T U V W X Y AZ
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 bytes – Machines support multiple data formats Fractions or multiples of word size Always integral number of bytes
Word-Oriented Memory Org bit Words BytesAddr bit Words Addr = ?? Addr = ?? Addr = ?? Addr = ?? Addr = ?? Addr = ?? Addresses Specify Byte Locations – Address of first byte in word – Addresses of successive words differ by 4 (32-bit) or 8 (64-bit)