Chapter 7 Representing Information Digitally Monday, October 28, 13
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
“Bits of Theory/Bytes of Practice”-- A.K. Dewdney
Logic is the foundation of both reasoning and computing. By associating true with presence & false with absence, we can use the physical world [signals] to model the logical world (symbols), and vice-versa. This [is the Fundamental Principle of] Information Technology.
-- p. 195, Ch. 8, FIT5
Monday, October 28, 13
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Fundament Principle of IT
Logic is the foundation of both reasoning and computing.
Web Field Trip Logic Gates: Logical AND (http://hyperphysics.phy-astr.gsu.edu/hbase/electronic/and.html)
=> Nine Rungs of the IT Inferno (http://ix.cs.uoregon.edu/~michaelh/110/inferno.html)
Monday, October 28, 13
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Digitizing Information
• represent information with digits• Digit: 0 .. 9 (Decimal Digit)• Digitizing: use whole numbers as symbols
• BIT: 0 .. 1 (BInary digiT)• Hex Digit: 0 .. 9, A .. F
Monday, October 28, 13
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Fundamental Information Representation
• Computers: combine the physical (actual) world with the logical (virtual) world
• Representation => from signal to symbol
• Physical world: the most fundamental form of information is presence or absence– P/A, On/Off, 1/0, T/F
Monday, October 28, 13
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Fundamental Information Representation
• In the logical world, concepts of true (T) and false (F) are important
• Logic: foundation of reasoning• Logic: foundation of computing• The physical world (machines) can
represent the logical world by associating “true” with the Presence of a phenomenon and “false” with its Absence
Monday, October 28, 13
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
The PandA Representation• PandA: the code used for two bits of
physical information:
– Presence – Absence
Monday, October 28, 13
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
The PandA Representation
• The presence or absence can be viewed as “true” or “false”
• Such a formulation is said to be discrete vs. continuous
• Signals are continuous• Symbols are discrete
Monday, October 28, 13
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
A Binary System• The PandA encoding
has two bits: present & absent
• Two bits make binary• There is no law that
says on means “present” or off means “absent”– convention– interpretation
Monday, October 28, 13
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Bits Form Symbols
• The PandA unit is a bit“binary digit”
• Bit sequences can be interpreted as numbers or other information
• Groups of bits can represent symbols– (eg) ASCII Character Code
Monday, October 28, 13
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Bits in Computer Memory
• Memory is arranged inside a computer in a very long sequence of bits
• Memory locations are electronic (RAM)
• Bits are stored as Presence/Absence
• Symbolic representation: 1/0
Monday, October 28, 13
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Sidewalk Memory
• sidewalk: strip of concrete with lines across it forming squares
• presence of a stone: 1• absence of a stone: 0
=> sidewalk: a sequence of bits
Monday, October 28, 13
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Sidewalk Memory
Monday, October 28, 13
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
10
10
00 1 0
Sidewalk Memory
Monday, October 28, 13
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Sidewalk Memory
• To write a 1: put a stone on a square
• To write a 0: sweep the sidewalk square clean
Monday, October 28, 13
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Alternative PandA Encodings
• There is no limit to the ways to encode two physical states
• “One if by land, Two if by sea.”– Paul Revere Code– Binary
• Git, Whoa!– Conestoga Code– Binary
Monday, October 28, 13
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Encoding Information w/ Bit Patterns
• bit patterns of length 1:=> encode 2 symbols
• bit patterns of length 2:=> encode 4 symbols
• bit patterns of length 3:=> encode 8 symbols. . .
• bit patterns of length n:=> 2n symbols
• adding 1 bit doubles number of patterns
Monday, October 28, 13
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Bit Patterns of Length 4 = One Hex Digit
Monday, October 28, 13
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Hex Digits Explained
• hexadecimal digits are base-16 numbers (24 = 16)
• using bit patterns is tedious & error prone
1111 1111 1001 1000 1110 0010 1010 1101• one hex digit = 4 bits
=> shorthand representation
F F 9 8 E 2 A D
Monday, October 28, 13
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Hex to Bits and Back Again
• Easy to translate between hex and binary
– 0010 1011 1010 1101 2 B A D
– F A B 41111 1010 1011 0100
Monday, October 28, 13
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Digitizing Numbers using Binary
• The two earliest uses of PandA were to:– Encode numbers– Encode keyboard characters
• Same principles apply to sound, images, video, etc.
Monday, October 28, 13
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Decimal Numbers, Place Values
• numbers use a place value representation • each “place” represents a power of 10• (binary numbers use powers of 2)• 1,010 in decimal:
Monday, October 28, 13
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Binary Numbers, Place Values
• 10102= (1 × 8) + (0 × 4) + (1 × 2) + (0 × 1)= 1010
Monday, October 28, 13
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Binary Numbers, Place Values
1,01010 = 0011 1111 00102
Monday, October 28, 13
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Digitizing Text
• The number of bits determines the number of symbols that can be represented – bit patterns of length n
=> 2n symbols• The more symbols you want encoded, the
more bits you need
Monday, October 28, 13
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Digitizing Text (Characters)
• To represent 95 distinct symbols • uppercase, lowercase, digits, punctuation,
etc.• we need 7 bits
– 26 = 64 symbols– 27 = 128 symbols
• plus additional characters=> ASCII-8 Character Code– 28 = 256 symbols
Monday, October 28, 13
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Extended ASCII: An 8-Bit Code
• Handling other languages is solved in two ways: – ASCII-8– Unicode-16
• IBM named 8-bit sequence a byte• ASCII-8: One Byte/One Character• RAM: one memory location = 4 Bytes
Monday, October 28, 13
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Why “Byte”?
• IBM was building a supercomputer, called Stretch
• They needed a word for a quantity of memory between a bit and a word
• A word of computer memory is currently 32 bits
Monday, October 28, 13
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Why “Byte”?
• Then, why not bite?
• The ‘i’ to a ‘y’ was done so that someone couldn’t accidentally change ‘byte’ to ‘bit’ by the dropping the ‘e’ ”– bite bit (the meaning changes)– byte byt (what’s a byt?)
Monday, October 28, 13