You are on page 1of 5

8/16/2018

Today’s Random Topic: History!


University of Illinois at Urbana-Champaign
Dept. of Electrical and Computer Engineering MIT students created the Big Screw Award,
which is given to “whoever [sic] has screwed
ECE 120: Introduction to Computing over the most students over the past year.”
One professor taught in French to win it.
The rest of my lectures will use this code:

Representations and Bits

Good luck!

ECE 120: Introduction to Computing © 2016 Steven S. Lumetta. All rights reserved. slide 1 ECE 120: Introduction to Computing © 2016 Steven S. Lumetta. All rights reserved. slide 2

Represent One Type of Information with Another Follow These Simple Instructions
We often represent one type of information
with other patterns, physical quantities, and
so forth.
examples
◦ English letters represented by drawn
patterns
◦ colors represented by variations in radio Please do so for the rest of today’s lecture.
signal amplitude
The mapping from one form to another
is called a representation. You thought I was kidding?

ECE 120: Introduction to Computing © 2016 Steven S. Lumetta. All rights reserved. slide 3 ECE 120: Introduction to Computing © 2016 Steven S. Lumetta. All rights reserved. slide 4
8/16/2018

Knowing the Representation May Help You What Do We Need to Make a Representation Useful?

What properties are necessary for


a representation to be useful?
The code above is called a tic-tac-toe code:
each letter (information) is represented by a
drawing (pattern). Hints:
◦ Think about the tic-tac-toe code.
◦ Think about algorithm properties.

ECE 120: Introduction to Computing © 2016 Steven S. Lumetta. All rights reserved. slide 5 ECE 120: Introduction to Computing © 2016 Steven S. Lumetta. All rights reserved. slide 6

First Answer: Representations Must be Well-Defined Some Mappings May Not be Usable by Computers

All users must know the translation in 0 1 2 3 4 5 6 7 8 9


advance. A B C D E F G H I J
K L M N O P Q R S T
Our goal is communication, not obfuscation. U V W X Y Z
If we use 10 digits to represent 26 letters as
shown above, what does “143” mean?
BED? BOX? VYN?
Computers are dumb—they cannot guess.

ECE 120: Introduction to Computing © 2016 Steven S. Lumetta. All rights reserved. slide 7 ECE 120: Introduction to Computing © 2016 Steven S. Lumetta. All rights reserved. slide 8
8/16/2018

Second Answer: Representations Must be Unambiguous But Some Patterns May Represent Nothing

Each pattern must represent In the representation below, the digits


at most one thing. 0, 2, 7, 8, and 9 represent no color.
RED 3

GREEN 4 GREEN 4 GREEN 4 YELLOW 6


GOOD
BLUE 1 BLUE BAD BLUE 1 PURPLE 5

ECE 120: Introduction to Computing © 2016 Steven S. Lumetta. All rights reserved. slide 9 ECE 120: Introduction to Computing © 2016-2017 Steven S. Lumetta. All rights reserved. slide 10

Computers are Based on Electrons Computer Representations are Based on BInary digiTs

In digital systems, electrons are all Vdd Now ask: Vdd


we have to represent information! 1 1
At a given physical location,
What can you ask about electrons? what is the voltage?
(voltage)

(voltage)
How many electrons are in a certain
place? (related closely to voltage) Voltage near Vdd is a “1.”
So… Voltage near 0V is a “0.”
◦ Choose a ground: 0V by definition. 0 0
◦ Pick a higher voltage (called Vdd). 0V The location thus holds a binary 0V
digit, which we call a bit.

ECE 120: Introduction to Computing © 2016 Steven S. Lumetta. All rights reserved. slide 11 ECE 120: Introduction to Computing © 2016 Steven S. Lumetta. All rights reserved. slide 12
8/16/2018

Physical Locations Enable Place Value Represented by What? The Answer is Always “Bits”

Each bit is somewhere on a computer chip. Remember: Vdd


◦ Electrons are all we have inside 1
So using positional / place value is natural. computers.

(voltage)
decimal binary
◦ No decimal, no hexadecimal, no
26 11010 letters, no real numbers, no colors.
sixteens ones
place place
tens ones ◦ ALL computer representations 0
place place eights twos are based on bits. 0V
fours
place place
place
ECE 120: Introduction to Computing © 2016 Steven S. Lumetta. All rights reserved. slide 13 ECE 120: Introduction to Computing © 2016-2017 Steven S. Lumetta. All rights reserved. slide 14

A Question for You: How Many Bits do We Need? We Need One Bit Pattern for Each Possible Thing

How many bits do we need to represent a Trick question: How many bits do we need
whole number in the range… to represent two books?
◦ The Collected Works of Shakespeare
◦ from 0 to 31? ◦ Our textbook by Patt & Patel
◦ 32 different integers
◦ so we need 5 bits (25 = 32 bit patterns) ◦ 2 different books
◦ so we need only 1 bit! (21 = 2 bit patterns)
◦ from 0 to 100?
◦ 101 different integers What matters is the number of things,
◦ so we need 7 bits (27 = 128 bit patterns) not what those things are.

ECE 120: Introduction to Computing © 2016 Steven S. Lumetta. All rights reserved. slide 15 ECE 120: Introduction to Computing © 2016 Steven S. Lumetta. All rights reserved. slide 16
8/16/2018

How Many Bits Do We Need to Represent N Things? Today’s Not-so-Random Topics


Let’s test your understanding (and generalize)! ◦ Layers in a Computer System
How many bits do we need to represent…
◦ a whole number from 1000 to 1100?
101 different integers, so 7 bits (27 = 128) ◦ Representations and Bits
◦ one of 199 flavors of ice cream?
199 different flavors, so 8 bits (28 = 256)
◦ a living person?
7-8 billion people, so 33 bits (233 > 8 billion) ◦ Integer Representations
◦ N things?
𝐥𝐨𝐠 𝟐 𝐍 (ceiling / integer at least as large as
log base 2 of N)

ECE 120: Introduction to Computing © 2016 Steven S. Lumetta. All rights reserved. slide 17 ECE 120: Introduction to Computing © 2016 Steven S. Lumetta. All rights reserved. slide 18

You might also like