CprE 281: Digital Logic

Similar documents
CprE 281: Digital Logic

CprE 281: Digital Logic

CprE 281: Digital Logic

CprE 281: Digital Logic

Unit 2: Data Storage CS 101, Fall 2018

Number Systems. TA: Mamun. References: Lecture notes of Introduction to Information Technologies (ITEC 1011) by Dr Scott MacKenzie

Introduction to Computer Systems

More on Arrays CS 16: Solving Problems with Computers I Lecture #13

Digital Computers and Machine Representation of Data

Homework 1 graded and returned in class today. Solutions posted online. Request regrades by next class period. Question 10 treated as extra credit

Where are we? Compiler. translating source code (C or Java) Programs to assembly language And linking your code to Library code

Introduction to Computer Systems

CS 121 Digital Logic Design. Chapter 1. Teacher Assistant. Hadeel Al-Ateeq

ECE 20B, Winter Purpose of Course. Introduction to Electrical Engineering, II. Administration

Information Science 1

MACHINE LEVEL REPRESENTATION OF DATA

CS61c Midterm Review (fa06) Number representation and Floating points From your friendly reader

BSM540 Basics of C Language

Recap from Last Time. CSE 2021: Computer Organization. It s All about Numbers! 5/12/2011. Text Pictures Video clips Audio

Physics 2660: Fundamentals of Scientific Computing. Lecture 3 Instructor: Prof. Chris Neu

UNIT 7A Data Representation: Numbers and Text. Digital Data

Announcements. 1. Forms to return today after class:

Digital Fundamentals

CprE 488 Embedded Systems Design. Exam 2 Review

Lecture C1 Data Representation. Computing and Art : Nature, Power, and Limits CC 3.12: Fall 2007

More Examples Using Functions and Command-Line Arguments in C++ CS 16: Solving Problems with Computers I Lecture #6

CSE115 Lab 2 Fall 2016

CSci 4211: Introduction to Computer Networks. Time: Monday and Wednesday 2:30 to 3:45 pm Location: Smith Hall 231 Fall 2018, 3 Credits

Introduction to Informatics

Binary Representations and Arithmetic

BIRLA INSTITUTE OF TECHNOLOGY AND SCIENCE, Pilani Pilani Campus Instruction Division. SECOND SEMESTER Course Handout Part II

Get Started with Blackboard For Instructors

Physics 2660: Fundamentals of Scientific Computing. Lecture 7 Instructor: Prof. Chris Neu

Number Systems Using and Converting Between Decimal, Binary, Octal and Hexadecimal Number Systems

Physics 2660: Fundamentals of Scientific Computing. Lecture 5 Instructor: Prof. Chris Neu

ECE251: Tuesday Aug. 29

Pearson Edexcel Award

Bits. Binary Digits. 0 or 1

Inf2C - Computer Systems Lecture 2 Data Representation

Tutorials. Tutorial every Friday at 11:30 AM in Toldo 204 * discuss the next lab assignment

IBM 370 Basic Data Types

Time: 8:30-10:00 pm (Arrive at 8:15 pm) Location What to bring:

CSCE 206: Structured Programming in C

Pearson Edexcel Award

CSci 4211: Data Communications and Computer Networks. Time: Monday and Wednesday 1 pm to 2:15 pm Location: Vincent Hall 16 Spring 2016, 3 Credits

Digital Fundamentals

Outline. Numerical Analysis Basics. Some Higher-Level Languages. Programming Languages. BASIC and VBA MATLAB

IT 1204 Section 2.0. Data Representation and Arithmetic. 2009, University of Colombo School of Computing 1

Course Syllabus [1/2]

CMPS 10 Introduction to Computer Science Lecture Notes

Introduction to C. Why C? Difference between Python and C C compiler stages Basic syntax in C

Description Hex M E V smallest value > largest denormalized negative infinity number with hex representation 3BB0 ---

Computer Organization and Assembly Language. Lab Session 4

COURSE SYLLABUS FOR. COMP-297 Web Page Design: Adobe Dreamweaver

Today s lecture is all about the System Unit, the Motherboard, and the Central Processing Unit, Oh My!

Programming with Arrays Intro to Pointers CS 16: Solving Problems with Computers I Lecture #11

CIS192 Python Programming. Robert Rand. August 27, 2015

CS 3516: Computer Networks

Chapter 1. Data Storage Pearson Addison-Wesley. All rights reserved

Digital Forensics ITP 375 (3 Units)

Central Washington University Department of Computer Science Course Syllabus

Final Labs and Tutors

MECE336 Microprocessors I

Building a Test Suite

Microprocessor (COM 9323)

Chapter 3 DATA REPRESENTATION

ECE2049: Homework 1. Consider the following code to compute the average of your exam grades: #define NUM_EXAMS (3)

CS101 Lecture 04: Binary Arithmetic

CS 107 Lecture 0: Welcome

Beyond Base 10: Non-decimal Based Number Systems

Introduction to Databases

Encapsulation. Administrative Stuff. September 12, Writing Classes. Quick review of last lecture. Classes. Classes and Objects

Simplifying Square Root Expressions[In Class Version][Algebra 1 Honors].notebook August 26, Homework Assignment. Example 5 Example 6.

CS Introduction to Programming Fall 2016

Digital Circuits ECS 371

ECE2049: Embedded Computing in Engineering Design C Term Spring Lecture #3: Of Integers and Endians (pt. 2)

EEM 232 Digital System I

COMP2611: Computer Organization. Data Representation

ESET 369 Embedded Systems Software, Fall 2017

false, import, new 1 class Lecture2 { 2 3 "Data types, Variables, and Operators" 4

Few reminders and demos

Team 1. Common Questions to all Teams. Team 2. Team 3. CO200-Computer Organization and Architecture - Assignment One

CS 31: Intro to Systems Binary Representation. Kevin Webb Swarthmore College January 27, 2015

Binary Arithmetic CS 64: Computer Organization and Design Logic Lecture #2 Fall 2018

CS 31: Intro to Systems Binary Representation. Kevin Webb Swarthmore College September 6, 2018

Rochester Institute of Technology Golisano College of Computing and Information Sciences Department of Information Sciences and Technologies

A: 90% - 100% B: 80% - <90% C: 70% - <80% D: 60% - <70% F: < 60% Important Dates:

COMP Overview of Tutorial #2

Course Syllabus - CNT 4703 Design and Implementation of Computer Communication Networks Fall 2011

10.1. Unit 10. Signed Representation Systems Binary Arithmetic

CSC 111 Introduction to Computer Science (Section C)

CS251-SE1. Midterm 2. Tuesday 11/1 8:00pm 9:00pm. There are 16 multiple-choice questions and 6 essay questions.

Software Practice 1 Basic Grammar

Marshall University MTH 100 Syllabus

Rui Wang, Assistant professor Dept. of Information and Communication Tongji University.

Floating-point lab deadline moved until Wednesday Today: characters, strings, scanf Characters, strings, scanf questions clicker questions

Lecture (01) Digital Systems and Binary Numbers By: Dr. Ahmed ElShafee

Course overview. Computer Organization and Assembly Languages Yung-Yu Chuang 2006/09/18. with slides by Kip Irvine

Where we are going (today)

Programming Studio #1 ECE 190

Transcription:

CprE 281: Digital Logic Instructor: Alexander Stoytchev http://www.ece.iastate.edu/~alexs/classes/

Binary Numbers CprE 281: Digital Logic Iowa State University, Ames, IA Copyright Alexander Stoytchev

Administrative Stuff This is the official class web page: http://www.ece.iastate.edu/~alexs/classes/2015_fall_281/ If you missed the first lecture, the syllabus and other class materials are posted there.

Administrative Stuff HW1 is out It is due on Monday Aug 31 @ 4pm. Submit it on paper before the start of the lecture

Administrative Stuff The labs and recitations start next week: Section N: Monday 9:00 AM - 11:50 AM (Coover Hall, room 2050) Section P: Monday 12:10 PM - 3:00 PM (Coover Hall, room 2050) Section R: Monday 5:10 PM - 8:00 PM (Coover Hall, room 2050) Section U: Tuesday 11:00 AM - 1:50 PM (Coover Hall, room 2050) Section M: Tuesday 2:10 PM - 5:00 PM (Coover Hall, room 2050) Section J: Wednesday 8:00 AM - 10:50 AM (Coover Hall, room 2050) Section Y: Wednesday 6:10 PM - 9:00 PM (Coover Hall, room 2050) Section Q: Thursday 11:00 AM - 1:50 PM (Coover Hall, room 2050) Section L: Thursday 2:10 PM - 5:00 PM (Coover Hall, room 2050) Section K: Thursday 5:10 PM - 8:00 PM (Coover Hall, room 2050) Section G: Friday 11:00 AM - 1:50 PM (Coover Hall, room 2050) The lab schedule is also posted on the class web page

Labs Next Week Figure 1.5 in the textbook: An FPGA board.

Labs Next Week Please download and read the lab assignment for next week before you go to your lab section. You must print the answer sheet and do the prelab before you go to the lab. The TAs will check your answers at the beginning of the lab.

Did you get the textbook?

The Decimal System [http://www.chompchomp.com/images/irregular011.jpg ]

What number system is this one? [http://freedomhygiene.com/wp-content/themes/branfordmagazine/images/backgrounds/hands_141756.jpg]

The Binary System [ http://divaprojections.blogspot.com/2011/11/alien.html]

Number Systems

Number Systems n-th digit (most significant) 0-th digit (least significant)

Number Systems base power n-th digit (most significant) 0-th digit (least significant)

The Decimal System

The Decimal System

Another Way to Look at This 5 2 4

Another Way to Look at This 10 2 10 1 10 0 5 2 4

Another Way to Look at This 10 2 10 1 10 0 labels boxes 5 2 4 Each box can contain only one digit and has only one label. From right to left, the labels are increasing powers of the base, starting from 0.

Base 7

Base 7 base power

Base 7 base power most significant digit least significant digit

Base 7

Another Way to Look at This 7 2 7 1 7 0 10 2 10 1 10 0 5 2 4 = 2 6 3

Binary Numbers (Base 2)

Binary Numbers (Base 2) base power most significant bit least significant bit

Binary Numbers (Base 2)

Another Example

Powers of 2

What is the value of this binary number? 0 0 1 0 1 1 0 0 0 0 1 0 1 1 0 0 0*2 7 + 0*2 6 + 1*2 5 + 0*2 4 + 1*2 3 + 1*2 2 + 0*2 1 + 0*2 0 0*128 + 0*64 + 1*32 + 0*16 + 1*8 + 1*4 + 0*2 + 0*1 0*128 + 0*64 + 1*32 + 0*16 + 1*8 + 1*4 + 0*2 + 0*1 32+ 8 + 4 = 44 (in decimal)

Another Way to Look at This 2 7 2 6 2 5 2 4 2 3 2 2 2 1 2 0 0 0 1 0 1 1 0 0

Some Terminology A binary digit is called a bit A group of eight bits is called a byte One bit can represent only two possible states, which are denoted with 1 and 0

Relationship Between a Byte and a Bit 1 0 1 0 1 1 1 0

Relationship Between a Byte and a Bit 1 bit 1 0 1 0 1 1 1 0

Relationship Between a Byte and a Bit 1 bit 1 0 1 0 1 1 1 0 8 bits = 1 byte

Bit Permutations 2004 Pearson Addison-Wesley. All rights reserved

Bit Permutations Each permutation can represent a particular item There are 2 N permutations of N bits Therefore, N bits are needed to represent 2 N unique items How many items can be represented by 1 bit? 2 bits? 3 bits? 4 bits? 5 bits? 2 1 = 2 items 2 2 = 4 items 2 3 = 8 items 2 4 = 16 items 2 5 = 32 items 2004 Pearson Addison-Wesley. All rights reserved

What is the maximum number that can be stored in one byte (8 bits)?

What is the maximum number that can be stored in one byte (8 bits)? 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1*2 7 + 1*2 6 + 1*2 5 + 1*2 4 + 1*2 3 + 1*2 2 + 1*2 1 + 1*2 0 1*128 + 1*64 + 1*32 + 1*16 + 1*8 + 1*4 + 1*2 + 1*1 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255 (in decimal) Another way is: 1*2 8 1 = 256 1 = 255

What would happen if we try to add 1 to the largest number that can be stored in one byte (8 bits)? + 1 1 1 1 1 1 1 1 1 ------------------------------- 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Analogy with car odometers

Analogy with car odometers [http://www.hyperocity.com/volvo240/images/volvo/odometerrepair/speedo999999.jpg]

Decimal to Binary Conversion (Using Guessing)

Decimal to Binary Conversion (Using Guessing)

Converting from Decimal to Binary

Converting from Decimal to Binary

[ Figure 1.6 in the textbook ]

Octal System (Base 8)

Binary to Octal Conversion

Binary to Octal Conversion 101110010111 2 =? 8

Binary to Octal Conversion 101110010111 2 =? 8 101 110 010 111

Binary to Octal Conversion 101110010111 2 =? 8 101 110 010 111 5 6 2 7

Binary to Octal Conversion 101110010111 2 =? 8 101 110 010 111 5 6 2 7 Thus, 101110010111 2 = 5627 8

Hexadecimal System (Base 16)

The 16 Hexadecimal Digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F

The 16 Hexadecimal Digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F 10, 11, 12, 13, 14, 15

Hexadecimal to Decimal Conversion

Hexadecimal to Decimal Conversion

Hexadecimal to Decimal Conversion

Binary to Hexadecimal Conversion

Binary to Hexadecimal Conversion

Binary to Hexadecimal Conversion 101110010111 2 =? 16

Binary to Hexadecimal Conversion 101110010111 2 =? 16 1011 1001 0111

Binary to Hexadecimal Conversion 101110010111 2 =? 16 1011 1001 0111 B 9 7

Binary to Hexadecimal Conversion 101110010111 2 =? 16 1011 1001 0111 B 9 7 Thus, 101110010111 2 = B97 16

Decimal to Hexadecimal Conversion

Decimal to Hexadecimal Conversion

Signed integers are more complicated We will talk more about them when we start with Chapter 3 in a couple of weeks.

The story with floats is even more complicated IEEE 754-1985 Standard [http://en.wikipedia.org/wiki/ieee_754]

In the example shown above, the sign is zero so s is +1, the exponent is 124 so e is 3, and the significand m is 1.01 (in binary, which is 1.25 in decimal). The represented number is therefore +1.25 2 3, which is +0.15625. [http://en.wikipedia.org/wiki/ieee_754]

On-line IEEE 754 Converter http://www.h-schmidt.net/floatapplet/ieee754.html More about floating point numbers in Chapter 3.

Storing Characters This requires some convention that maps binary numbers to characters. ASCII table Unicode

ASCII Table

Extended ASCII Codes

The Unicode Character Code http://www.unicode.org/charts/

Egyptian Hieroglyphs http://www.unicode.org/charts/

Close up http://www.unicode.org/charts/

Questions?

THE END