Lecture 1 Binary Representation Topics Terminology Base 10, Hex, binary Fractions Base-r to decimal Unsigned Integers Signed magnitude Two’s complement.

Slides:



Advertisements
Similar presentations
Number Bases Informatics INFO I101 February 9, 2004 John C. Paolillo, Instructor.
Advertisements

DATA REPRESENTATION CONVERSION.
Chapter 2 : Number System
CSC /703 CTI/DePaul1 CSC-255 Lecture 3 Text and Numerical Storage (Chapter 1 from Brookshear) Modified by Ufuk Verun from Jim Janossy © 2002, DePaul.
Assembly Language and Computer Architecture Using C++ and Java
Assembly Language and Computer Architecture Using C++ and Java
Computer ArchitectureFall 2008 © August 25, CS 447 – Computer Architecture Lecture 3 Computer Arithmetic (1)
CSCE 211: Digital Logic Design Chin-Tser Huang University of South Carolina.
ECE 331 – Digital System Design
VIT UNIVERSITY1 ECE 103 DIGITAL LOGIC DESIGN CHAPTER I NUMBER SYSTEMS AND CODES Reference: M. Morris Mano & Michael D. Ciletti, "Digital Design", Fourth.
Data Representation in Computers
1 CSE-221 Digital Logic Design (DLD) Lecture-1: Digital Systems & Number Systems.
S. Barua – CPSC 240 CHAPTER 2 BITS, DATA TYPES, & OPERATIONS Topics to be covered are Number systems.
EE 261 – Introduction to Logic Circuits
FIGURES FOR CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION
Number Systems Lecture 02.
CS 105 Digital Logic Design
Introduction to Computing Systems from bits & gates to C & beyond Chapter 2 Bits, Data Types & Operations Integer Representation Floating-point Representation.
Dr. Bernard Chen Ph.D. University of Central Arkansas
Simple Data Type Representation and conversion of numbers
ES 244: Digital Logic Design Chapter 1 Chapter 1: Introduction Uchechukwu Ofoegbu Temple University.
Data Representation – Binary Numbers
Digital Design: From Gates to Intelligent Machines
Click to edit Master title style Click to edit Master text styles –Second level Third level –Fourth level »Fifth level 1 Today’s Topics How information.
1 Modified from  Modified from 1998 Morgan Kaufmann Publishers Chapter Three: Arithmetic for Computers citation and following credit line is included:
Logic and Digital System Design - CS 303
IT253: Computer Organization
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION.
Introduction to Computer Engineering ECE/CS 252, Fall 2010 Prof. Mikko Lipasti Department of Electrical and Computer Engineering University of Wisconsin.
Information Representation. Digital Hardware Systems Digital Systems Digital vs. Analog Waveforms Analog: values vary over a broad range continuously.
مدار منطقي مظفر بگ محمدي Course Structure & Grading Homework: 25% Midterm: 30% Final:50% There is 5% extra! ( =105!) Textbook:
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION
Lecture 4 Last Lecture –Positional Numbering Systems –Converting Between Bases Today’s Topics –Signed Integer Representation Signed magnitude One’s complement.
CE1111 :Digital Logic Design lecture 01 Introduction Dr. Atef Ali Ibrahim.
ECEN 301Discussion #19 – Binary Numbers1 Numbered Moses 1:33,35,37 33 And worlds without number have I created; and I also created them for mine own purpose;
1 DLD Lecture 18 Recap. 2 Recap °Number System/Inter-conversion, Complements °Boolean Algebra °More Logic Functions: NAND, NOR, XOR °Minimization with.
Number Systems ELEC 311 Digital Logic and Circuits Dr. Ron Hayne Images Courtesy of Cengage Learning.
IKI Data Types & Representations Bobby Nazief Semester-I The materials on these slides are adopted from those in CS231’s Lecture Notes.
Computer Arithmetic and the Arithmetic Unit Lesson 2 - Ioan Despi.
Number systems, Operations, and Codes
Lecture 2 Binary Values and Number Systems. The number 943 is an example of a number written in positional notation. The relative positions of the digits.
Kavita Bala CS 3410, Spring 2014 Computer Science Cornell University.
SAK Chapter 21 Chapter 2 : Number System 2.1 Decimal, Binary, Octal and Hexadecimal Numbers 2.2 Relation between binary number system with other.
CEC 220 Digital Circuit Design Binary Codes
Lecture 2 Binary Arithmetic Topics Terminology Fractions Base-r to decimal Unsigned Integers Signed magnitude Two’s complement August 26, 2003 CSCE 211.
School of Computer and Communication Engineering, UniMAP Mohd ridzuan mohd nor DKT 122/3 - DIGITAL SYSTEM I Chapter.
Lecture 3 Combinational Circuits
Introduction To Number Systems Binary System M. AL-Towaileb1.
Orange Coast College Business Division Computer Science Department CS 116- Computer Architecture Logic Design: Part 1.
Chapter 1: Binary Systems
1 Digital Logic Design Lecture 2 More Number Systems/Complements.
Lecture 2 Number Representation, Overflow and Logic Topics Adders Math Behind Excess-3 Overflow Unsigned, signed-magnitude Two’s Complement Gray Code Boolean.
CSC 331: DIGITAL LOGIC DESIGN COURSE LECTURER: E. Y. BAAGYERE. CONTACT: LECTURE TIME: 15:40 – 17:45 hrs. VENUE: SP-LAB.
©2010 Cengage Learning SLIDES FOR CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION Click the mouse to move to the next page. Use the ESC key to exit.
Chapter 1 Representing Data in a Computer. 1.1 Binary and Hexadecimal Numbers.
Lecture 2: 8/29/2002CS149D Fall CS149D Elements of Computer Science Ayman Abdel-Hamid Department of Computer Science Old Dominion University Lecture.
Logic Design (CE1111 ) Lecture 4 (Chapter 4) Combinational Logic Prepared by Dr. Lamiaa Elshenawy 1.
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.
Dr. ClincyLecture 2 Slide 1 CS Chapter 2 (1 of 5) Dr. Clincy Professor of CS Note: Do not study chapter 2’s appendix (the topics will be covered.
Unit 1 Introduction Number Systems and Conversion.
Integer Real Numbers Character Boolean Memory Address CPU Data Types
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION
CHAPTER 1 : INTRODUCTION
Digital Arithmetic Wen-Hung Liao, Ph.D..
CSE 102 Introduction to Computer Engineering
Number Systems.
Data Representation in Computer Systems
Chapter 1 Introduction.
Presentation transcript:

Lecture 1 Binary Representation Topics Terminology Base 10, Hex, binary Fractions Base-r to decimal Unsigned Integers Signed magnitude Two’s complement August 24, 2015 CSCE 211H Digital Design

– 2 – CSCE 211H Fall 2015 Overview Readings Chapter 1 Overview of Course Analog vs Digital Conversion Base-r to decimal Conversion decimal to Base-r Conversion of Fractions base-r  decimal Unsigned Arithmetic Signed Magnitude Two’s Complement Excess-1023

Click to edit Master subtitle style Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 1 Introduction

– 4 – CSCE 211H Fall 2015 Course Outcomes 1.Represent numbers and perform arithmetic in bases 2, 8, and 16 2.Encode symbols and numbers in binary codes 3.Add and subtract using 2’s complement code 4.Evaluate and simplify logical functions using Boolean algebra 5.Represent logical functions in Canonical form and with Gates 6.Analyze and design combinatorial 7.Simplify combinatorial circuits using Karnaugh 8.Implement functions with NAND-NAND and NOR-NOR logic 9.Analyze and design modular combinatorial logic circuits containing decoders, multiplexers, demultiplexers, 7-segments display decoders and adders 10.Use the concepts of state and state transition for analysis and design of sequential circuits 11.Use the functionality of flip-flops for analysis and design of sequential circuits 12.Software-hardware co-design (Arduino)

– 5 – CSCE 211H Fall 2015 Comp. Arch. Quantitative Approach - H&P Chapter 1: Figure1.1 Performance Growth since 1978

– 6 – CSCE 211H Fall 2015 Analog vs digital: Why Binary

– 7 – CSCE 211H Fall 2015 Other bases Binary = Base 2 Binary = Base 2 Hexadecimal = Base 16 Hexadecimal = Base 16 Octal = Base 8 Octal = Base 8 Notations Notations Subscript In C Conversions between bases Conversions between bases

– 8 – CSCE 211H Fall 2015 Note that the number one less than 2 n consists of n 1’s (for example, 2 4 – 1 = 1111 = 15 and 2 5 – 1 = = 31).

– 9 – CSCE 211H Fall 2015 Base-r to Decimal Conversions Converting base-r to decimal by definition d n d n-1 d n-2 …d 2 d 1 d 0 (base r) = d n r n + d n-1 r n-1 … d 2 r 2 +d 1 r 1 + d 0 r 0 Example 4F0C 16 = 4* F* * C*16 0 4F0C 16 = 4* F* * C*16 0 = 4* * *1 = =20236

– 10 – CSCE 211H Fall 2015 Decimal to Base-r Conversion Repeated division algorithm Justification: d n d n-1 d n-2 …d 2 d 1 d 0 = d n r n + d n-1 r n-1 … d 2 r 2 +d 1 r 1 + d 0 r 0 Dividing each side by r yields (d n d n-1 d n-2 …d 2 d 1 d 0 ) / r = d n r n-1 + d n-1 r n-2 … d 2 r 1 +d 1 r 0 + d 0 r -1 So d 0 is the remainder of the first division ((q 1 ) / r = d n r n-2 + d n-1 r n-3 … d 3 r 1 +d 2 r 0 + d 1 r -1 So d 1 is the remainder of the next division and d 2 is the remainder of the next division …

– 11 – CSCE 211H Fall 2015 Decimal to Base-r Conversion Example Repeated division algorithm Example Convert 4343 to hex 4343/16 = 271 remainder = 7 271/16 = 16 remainder = /16 = 16 remainder = 15 16/16 = 1 remainder = 0 16/16 = 1 remainder = 0 1/16 = 0 remainder = 1 1/16 = 0 remainder = 1 So = 10F7 16 To check the answer convert back to decimal 10F7 = 1* *16 + 7*1 = = 4343

– 12 – CSCE 211H Fall 2015 Hex to Binary One hex digit = four binary digits Example 3FAC = (spaces just for readability) 3FAC = (spaces just for readability) Binary to hex four binary digits  one hex digit (group from right!!!)Example = = = 2 D 3A

– 13 – CSCE 211H Fall 2015 Hex to Decimal Fractions.d -1 d -2 d -3 …d –(n-2) d –(n-1) d -n = d -1 r -1 + d -2 r -2 …d -(n-1) r -(n-1) +d 1 r -n Example.1EF 16 = 1* E* F* EF 16 = 1* E* F*16 -3 = 1* * *2.4414e-4 = … (probably close but not right) = … (probably close but not right)

– 14 – CSCE 211H Fall 2015 Example: Hex Fractions to decimal Convert.3FA to decimal.3FA 16 = 3* F* A* FA 16 = 3* F* A*16 -3 = 3* * * (1/4096) =

– 15 – CSCE 211H Fall 2015 Decimal Fractions to hex.d -1 d -2 d -3 …d –(n-2) d –(n-1) d -n = d -1 r -1 + d -2 r -2 …d -(n-1) r -(n-1) +d 1 r -n Multiplication by r yields r *(.d -1 r -1 + d -2 r -2 …d -(n-1) r -(n-1) +d 1 r -n ) = d -1 r 0 + d -2 r -1 …d -(n-1) r -(n-2) +d 1 r -(n-1) Whole number part = d -1 r 0 Multiplying again by r yields d -2 r 0 as the whole number part … till fraction = 0

– 16 – CSCE 211H Fall 2015 Example Decimal Fraction to hex By repeated multiplication

– 17 – CSCE 211H Fall 2015 Unsigned integers What is the binary representation of the biggest integer representable using n-bits(n binary digits)? What is its value in decimal? Special cases 8 bits 16 bits 16 bits 32 bits 32 bits

– 18 – CSCE 211H Fall 2015 Arithmetic with Binary Numbers x x 101 Problems with 8 bit operations

– 19 – CSCE 211H Fall 2015

– 20 – CSCE 211H Fall 2015 Signed integers How do we represent? Signed-magnitude Excess representations w bits  0 <= unsigned_value < 2 w In excess-B we subtract the bias (B) to get the value. In excess-B we subtract the bias (B) to get the value. example example

– 21 – CSCE 211H Fall 2015 Complement Representations of Signed integers One’s complement Two’s complement

– 22 – CSCE 211H Fall 2015 Two’s Complement Operation One’s complement + 1 or Find rightmost 1, complement all bits to the left of it. Examples

– 23 – CSCE 211H Fall 2015 Two’s Complement Representation Consider a two’s complement binary number d n d n-1 d n-2 …d 2 d 1 d 0 If d n, the sign bit = 0 the number is positive and its magnitude is given by the other bits. If d n, the sign bit = 1 the number is negative and take its two’s complement to get the magnitude. Weighted Sum Interpretation … n-1 2 n-2 n -2 n-1

– 24 – CSCE 211H Fall 2015 Two’s Complement Representation Consider a two’s complement binary number d n d n-1 d n-2 …d 2 d 1 d 0 If d n, the sign bit = 0 the number is positive and its magnitude is given by the other bits. If d n, the sign bit = 1 the number is negative and take its two’s complement to get the magnitude. Weighted Sum 0 1 Example = 1 2 … n-1 2 n-2 n -2 n-1

– 25 – CSCE 211H Fall 2015 Two’s Complement Representation What is the 2’s complement representation in 16 bits of –5? +7?-1?0-2

– 26 – CSCE 211H Fall 2015

– 27 – CSCE 211H Fall 2015 Arithmetic with Signed Integers Signed Magnitude Addition if the signs are the same add the magnitude if the signs are different subtract the smaller from the larger and use the sign of the larger if the signs are different subtract the smaller from the larger and use the sign of the largerSubtraction? Two’s complement Just add signs take care of themselves

– 28 – CSCE 211H Fall 2015 Overflow in Two’s Complement

– 29 – CSCE 211H Fall 2015

– 30 – CSCE 211H Fall 2015 Binary Code Decimal Floating point – IEEE 754

– 31 – CSCE 211H Fall 2015 Representations of Characters

– 32 – CSCE 211H Fall 2015

– 33 – CSCE 211H Fall 2015 ASCII Message on the Wall Princeton CS Building West Wall Bricks This brick pattern is located on the west wall of the Computer Science building, and dates back to 1989, when the building was constructed. The pattern is read top to bottom and consists of five 7-bit ASCII values. The vertical lines to the left and right are "framing" bits. (Table 1.8 page 18 previous slide) x x x x x x x x x x This pattern asks _________?

– 34 – CSCE 211H Fall 2015

– 35 – CSCE 211H Fall 2015 Basic Gates ANDORNOT

– 36 – CSCE 211H Fall 2015 Basic Gates NANDNORXOR

– 37 – CSCE 211H Fall 2015 Half Adder Circuit; Full Adder

– 38 – CSCE 211H Fall 2015 Homework Due at the start of class Wednesday Page *a, b,f 2.2h 3.3b 4.4b 5.5a, 5c 6.7a,b 7.Convert to hex and then to binary 8.Convert to hex, rounding to 6 hex digits after the “decimal” point.