Compsci 001 3.1 Today’s topics l Binary Numbers  Brookshear 1.1-1.6 l Slides from Prof. Marti Hearst of UC Berkeley SIMS l Upcoming  Networks Interactive.

Slides:



Advertisements
Similar presentations
Data Representation COE 202 Digital Logic Design Dr. Aiman El-Maleh
Advertisements

The Binary Numbering Systems
Chapter 4: The Building Blocks: Binary Numbers, Boolean Logic, and Gates Invitation to Computer Science, Java Version, Third Edition.
Computer Organization Boolean Logic and the CPU i206 Fall 2010 John Chuang Some slides adapted from Marti Hearst, Brian Hayes, or Glenn Brookshear.
Chapter 4: The Building Blocks: Binary Numbers, Boolean Logic, and Gates Invitation to Computer Science, C++ Version, Third Edition.
Digital Fundamentals Floyd Chapter 2 Tenth Edition
Chapter 4: The Building Blocks: Binary Numbers, Boolean Logic, and Gates Invitation to Computer Science, C++ Version, Third & Fourth Edition Spring 2008:
Connecting with Computer Science, 2e
1 Foundations of Software Design Lecture 1: Course Overview Intro to Binary and Boolean Marti Hearst SIMS, University of California at Berkeley.
Chapter 4: The Building Blocks: Binary Numbers, Boolean Logic, and Gates Invitation to Computer Science, C++ Version, Third Edition.
Chapter 1 Data Storage. 2 Chapter 1: Data Storage 1.1 Bits and Their Storage 1.2 Main Memory 1.3 Mass Storage 1.4 Representing Information as Bit Patterns.
Chapter 4: The Building Blocks: Binary Numbers, Boolean Logic, and Gates Invitation to Computer Science, C++ Version, Fourth Edition.
Binary Numbers.
CISC1400: Binary Numbers & Computer Fall 2011, Dr. Zhang 1.
Connecting with Computer Science 2 Objectives Learn why numbering systems are important to understand Refresh your knowledge of powers of numbers Learn.
1 Survey of Computer Science CSCI 110, Spring 2011 Lecture 16 Digital Circuits, binary Numbers.
(2.1) Fundamentals  Terms for magnitudes – logarithms and logarithmic graphs  Digital representations – Binary numbers – Text – Analog information 
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Fundamentals Tenth Edition Floyd.
Compsci Today’s topics l Binary Numbers  Brookshear l Computer Architecture  Notes from David A. Patterson and John L. Hennessy, Computer.
Lecture 5.
CompSci Today’s topics Networks & the Internet Basic HTML ä The basis for web pages ä “Almost” programming Data Representation Upcoming ä Connections.
Representing text Each of different symbol on the text (alphabet letter) is assigned a unique bit patterns the text is then representing as.
Computers Organization & Assembly Language
Binary Numbers.
Foundations of Computer Science Computing …it is all about Data Representation, Storage, Processing, and Communication of Data 10/4/20151CS 112 – Foundations.
Pengantar Teknologi Informasi dan Ilmu Komputer Information Technology and Data Representation PTIIK- UB.
Lecture 5. Topics Sec 1.4 Representing Information as Bit Patterns Representing Text Representing Text Representing Numeric Values Representing Numeric.
1 i206: Lecture 2: Computer Architecture, Binary Encodings, and Data Representation Marti Hearst Spring 2012.
Chapter 1: Data Storage.
CCE-EDUSAT SESSION FOR COMPUTER FUNDAMENTALS Date: Session III Topic: Number Systems Faculty: Anita Kanavalli Department of CSE M S Ramaiah.
CompSci Today’s topics Networks & the Internet Basic HTML ä The basis for web pages ä CSS Data Representation Upcoming ä Connections ä Algorithms.
Compsci Today’s topics l Binary Numbers  Brookshear l Slides from Prof. Marti Hearst of UC Berkeley SIMS l Upcoming  Networks Interactive.
Chapter 1 Data Storage © 2007 Pearson Addison-Wesley. All rights reserved.
Chapter 1 Data Storage © 2007 Pearson Addison-Wesley. All rights reserved.
Data Representation, Number Systems and Base Conversions
Copyright © 2015 Pearson Education, Inc. Chapter 1: Data Storage.
1 Ethics of Computing MONT 113G, Spring 2012 Session 1 Digital Circuits, binary Numbers Course webpage:
Data Storage © 2007 Pearson Addison-Wesley. All rights reserved.
Digital Fundamentals Tenth Edition Floyd Chapter 2 © 2008 Pearson Education.
Data Storage © 2007 Pearson Addison-Wesley. All rights reserved.
Chapter 1 Data Storage © 2007 Pearson Addison-Wesley. All rights reserved.
Understanding Computers
CHAPTER 3 BINARY NUMBER SYSTEM. Computers are electronic machines which operate using binary logic. These devices use two different values to represent.
Number Systems. The position of each digit in a weighted number system is assigned a weight based on the base or radix of the system. The radix of decimal.
CompSci 100e 10.1 Binary Digits (Bits) l Yes or No l On or Off l One or Zero l
Chapter 1: Data Storage.
Computer Science: An Overview Eleventh Edition
Understanding binary Understanding Computers.
3 – Boolean Logic and Logic Gates 4 – Binary Numbers
Invitation to Computer Science, C++ Version, Fourth Edition
Everything is a number Everything in a computer memory and on storages is a number. Number  Number Characters  Number by ASCII code Sounds  Number.
Fundamentals & Ethics of Information Systems IS 201
University of Gujrat Department of Computer Science
Invitation to Computer Science, Java Version, Third Edition
Invitation to Computer Science, C++ Version, Third Edition
Chapter 1 Data Storage.
Ch2: Data Representation
The Building Blocks: Binary Numbers, Boolean Logic, and Gates
Chapter 2 Data Representation.
How Computers Store Data
COMS 161 Introduction to Computing
UNIT – 3 & 4. Data Representation and Internal
Presentation transcript:

Compsci Today’s topics l Binary Numbers  Brookshear l Slides from Prof. Marti Hearst of UC Berkeley SIMS l Upcoming  Networks Interactive Introduction to Graph Theory Kearns, Michael. "Economics, Computer Science, and Policy." Issues in Science and Technology, Winter  Problem Solving

Compsci Digital Computers l What are computers made up of?  Lowest level of abstraction: atoms  Higher level: transistors l Transistors  Invented in 1951 at Bell Labs  An electronic switch  Building block for all modern electronics  Transistors are packaged as Integrated Circuits (ICs)  40 million transistors in 1 IC

Compsci Binary Digits (Bits) l Yes or No l On or Off l One or Zero l

Compsci More on binary l Byte  A sequence of bits  8 bits = 1 byte  2 bytes = 1 word (sometimes 4 or 8 bytes) l Powers of two l How do binary numbers work?

Compsci Data Encoding l Text: Each character (letter, punctuation, etc.) is assigned a unique bit pattern.  ASCII: Uses patterns of 7-bits to represent most symbols used in written English text  Unicode: Uses patterns of 16-bits to represent the major symbols used in languages world side  ISO standard: Uses patterns of 32-bits to represent most symbols used in languages world wide l Numbers: Uses bits to represent a number in base two l Limitations of computer representations of numeric values  Overflow – happens when a value is too big to be represented  Truncation – happens when a value is between two representable values

Compsci Images, Sound, & Compression l Images  Store as bit map: define each pixel RGB Luminance and chrominance  Vector techniques Scalable TrueType and PostScript l Audio  Sampling l Compression  Lossless: Huffman, LZW, GIF  Lossy: JPEG, MPEG, MP3

Compsci Decimal (Base 10) Numbers l Each digit in a decimal number is chosen from ten symbols: { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 } l The position (right to left) of each digit represents a power of ten. l Example: Consider the decimal number   position: = 2     10 0

Compsci Binary (Base 2) Numbers l Each digit in a binary number is chosen from two symbols: { 0, 1 } l The position (right to left) of each digit represents a power of two. l Example: Convert binary number 1101 to decimal   position: = 1     2 0 =1     1= = 13

Compsci Powers of Two DecimalBinaryPower of

Compsci Famous Powers of Two Images from

Compsci Other Number Systems Images from

Compsci Binary Addition Images from Also: = 1 with a carry of 1

Compsci Adding Binary Numbers l = ( 1    2 0 ) + ( 1   2 0 ) = ( 1    1 ) + ( 1   1 ) l Add like terms: There is one 4, one 2, one 1 = 1    1 = 111

Compsci Adding Binary Numbers 1 1  carry l = ( 1    2 0 ) + (1    2 0 ) = ( 1    1 ) + (1    1 ) l Add like terms: There are two 4s, two 2s, one 1 = 2    1 = 1     1 = 1101 l BinaryNumber Applet

Compsci Converting Decimal to Binary Decimal Binary   conversion   0 = 0  = 1  = 1   = 2+1 = 1   = 1    = 4+1 = 1    = 4+2 = 1    = = 1    = 1     2 0

Compsci Converting Decimal to Binary l Repeated division by two until the quotient is zero l Example: Convert decimal number 54 to binary  1  0  1  0 Binary representation of 54 is remainder

Compsci Converting Decimal to Binary l 1 32 = 0 plus 1 thirty-two l 6 8s = 1 32 plus 1 sixteen l 3 16s = 3 16 plus 0 eights l 13 4s = 6 8s plus 1 four l 27 2s = 13 4s plus 1 two l 54 = 27 2s plus 0 ones  1  0  1  0 l Subtracting highest power of two l 1s in positions 5,4,2, = = = = 0 

Compsci Problems l Convert to decimal representation l Add the binary numbers and and express their sum in binary representation l Convert 77 to binary representation

Compsci Solutions l Convert to decimal representation = 1        2 0 = 1        1 = = 88 l Add the binary numbers and and express their sum in binary representation

Compsci Solutions l Convert 77 to binary representation  1  0  1  0  1 Binary representation of 77 is

Compsci Boolean Logic l AND, OR, NOT, NOR, NAND, XOR l Each operator has a set of rules for combining two binary inputs  These rules are defined in a Truth Table  (This term is from the field of Logic) l Each implemented in an electronic device called a gate  Gates operate on inputs of 0’s and 1’s  These are more basic than operations like addition  Gates are used to build up circuits that Compute addition, subtraction, etc Store values to be used later Translate values from one format to another

Compsci Truth Tables Images from

Compsci In-Class Questions 1. How many different bit patterns can be formed if each must consist of exactly 6 bits? 2. Represent the bit pattern in hexadecimal notation. 3. Translate each of the following binary representations into its equivalent base ten representation Translate 231 in decimal to binary