Number Systems Decimal (Base 10) –10 digits (0,1,2,3,4,5,6,7,8,9) Binary (Base 2) –2 digits (0,1) Digits are often called bits (binary digits) Hexadecimal.

Slides:



Advertisements
Similar presentations
Representing Numbers: Integers
Advertisements

HEXADECIMAL NUMBERS Code
Chapter 1 Digital Systems and Numbers System
CHAPTER 2 Number Systems, Operations, and Codes
Digital Fundamentals Floyd Chapter 2 Tenth Edition
Data Representation Computer Organization &
Data Representation COE 205
Binary Representation
Assembly Language and Computer Architecture Using C++ and Java
Number Systems Decimal (Base 10) Binary (Base 2) Hexadecimal (Base 16)
CSCE 211: Digital Logic Design Chin-Tser Huang University of South Carolina.
Data Representation ICS 233
VIT UNIVERSITY1 ECE 103 DIGITAL LOGIC DESIGN CHAPTER I NUMBER SYSTEMS AND CODES Reference: M. Morris Mano & Michael D. Ciletti, "Digital Design", Fourth.
Digital Fundamentals Floyd Chapter 2 Tenth Edition
DIGITAL SYSTEMS TCE1111 Representation and Arithmetic Operations with Signed Numbers Week 6 and 7 (Lecture 1 of 2)
S. Barua – CPSC 240 CHAPTER 2 BITS, DATA TYPES, & OPERATIONS Topics to be covered are Number systems.
Number System and Codes
Information Representation and Number Systems BIL- 223 Logic Circuit Design Ege University Department of Computer Engineering.
EE 261 – Introduction to Logic Circuits
1 Lecture 2: Number Systems Binary numbers Base conversion Arithmetic Number systems  Sign and magnitude  Ones-complement  Twos-complement Binary-coded.
Digital Logic Chapter 2 Number Conversions Digital Systems by Tocci.
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Fundamentals Tenth Edition Floyd.
ACOE1611 Data Representation and Numbering Systems Dr. Costas Kyriacou and Dr. Konstantinos Tatas.
Computers Organization & Assembly Language
EKT 121 / 4 ELEKTRONIK DIGIT 1 CHAPTER 1 : INTRODUCTION.
Digital Systems and Logic Design
#1 Lec # 2 Winter EECC341 - Shaaban Positional Number Systems A number system consists of an order set of symbols (digits) with relations.
1 Digital Systems and Binary Numbers EE 208 – Logic Design Chapter 1 Sohaib Majzoub.
EE2174: Digital Logic and Lab Professor Shiyan Hu Department of Electrical and Computer Engineering Michigan Technological University CHAPTER 2 Number.
Lec 3: Data Representation Computer Organization & Assembly Language Programming.
Number Systems Spring Semester 2013Programming and Data Structure1.
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION.
Information Representation. Digital Hardware Systems Digital Systems Digital vs. Analog Waveforms Analog: values vary over a broad range continuously.
Data Representation Dr. Ahmed El-Bialy Dr. Sahar Fawzy.
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.
Number Systems and Codes. CS2100 Number Systems and Codes 2 NUMBER SYSTEMS & CODES Information Representations Number Systems Base Conversion Negative.
1 EENG 2710 Chapter 1 Number Systems and Codes. 2 Chapter 1 Homework 1.1c, 1.2c, 1.3c, 1.4e, 1.5e, 1.6c, 1.7e, 1.8a, 1.9a, 1.10b, 1.13a, 1.19.
ECE 301 – Digital Electronics Unsigned and Signed Numbers, Binary Arithmetic of Signed Numbers, and Binary Codes (Lecture #2)
Summer 2012ETE Digital Electronics1 Binary Arithmetic of Signed Binary Numbers.
Number systems, Operations, and Codes
Coding of Information Assign a unique string of binary digits to each piece of information There are many standard coding groups –Decimal Codes (BCD –
Number Systems Decimal (Base 10) –10 digits (0,1,2,3,4,5,6,7,8,9) Binary (Base 2) –2 digits (0,1) Digits are often called bits (binary digits) Hexadecimal.
ECE 331 – Digital System Design Representation and Binary Arithmetic of Negative Numbers and Binary Codes (Lecture #10) The slides included herein were.
Computer Math CPS120 Introduction to Computer Science Lecture 4.
AEEE2031 Data Representation and Numbering Systems.
Tutorial: ITI1100 Dewan Tanvir Ahmed SITE, UofO
Ahmad Almulhem, KFUPM 2009 COE 202: Digital Logic Design Number Systems Part 4 Dr. Ahmad Almulhem ahmadsm AT kfupm Phone: Office:
Introduction to Microprocessors Chapter 2. Decimal or Base 10 Numbers  Have ten different digits (0-9)  It is a weighted number system. Each position.
WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)
Digital Fundamentals Tenth Edition Floyd Chapter 2 © 2008 Pearson Education.
ECE 2110: Introduction to Digital Systems
Data Representation COE 301 Computer Organization Dr. Muhamed Mudawar
ECE 3110: Introduction to Digital Systems Signed Number Conversions and operations.
CS151 Introduction to Digital Design Chapter 1: Digital Systems and Information Lecture 2 1Created by: Ms.Amany AlSaleh.
Computer Math CPS120 Introduction to Computer Science Lecture 7.
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.
Digital logic COMP214  Lecture 2 Dr. Sarah M.Eljack Chapter 1 1.
Data Representation COE 301 Computer Organization Prof. Muhamed Mudawar College of Computer Sciences and Engineering King Fahd University of Petroleum.
N 3-1 Data Types  Binary information is stored in memory or processor registers  Registers contain either data or control information l Data are numbers.
Number Systems Decimal (Base 10) –10 digits (0,1,2,3,4,5,6,7,8,9) Binary (Base 2) –2 digits (0,1) Digits are often called bits (binary digits) Hexadecimal.
Lec 3: Data Representation
CS2100 Computer Organisation
Data Representation.
CHAPTER 1 : INTRODUCTION
TAO1221 COMPUTER ARCHITECTURE AND ORGANIZATION LAB 6
Numbering System TODAY AND TOMORROW 11th Edition
Number Systems Rayat Shikshan Sanstha’s
Number Systems Rayat Shikshan Sanstha’s
ECE 331 – Digital System Design
Presentation transcript:

Number Systems Decimal (Base 10) –10 digits (0,1,2,3,4,5,6,7,8,9) Binary (Base 2) –2 digits (0,1) Digits are often called bits (binary digits) Hexadecimal (Base 16) –16 digits (0-9,A,B,C,D,E,F) Often referred to as Hex

Number Systems

Positional Notation Each digit is weighted by the base(r) to the positional power N = d n-1 d n-2 …d 0.d 1 d 2 …d m = (d n-1 x r n-1 ) + (d n-2 x r n-1 ) + … + (d 0 1 x r 0 ) + (d 1 x r 1 ) + (d 2 x r 2 ) + … (d m x r m ) Example : (8 x 10 2 ) + (7 x 10 1 ) + (2 x 10 0 ) + (6 x ) + (4 x ) Example: = ? Example :12A 16 = ?

Positional Notation (Solutions to Example Problems) = 8x x x x x10 -2 »

Positional Notation (Solutions to Example Problems) = 1x x x x x2 -1 = = Note that positional notation can be used to convert from binary to its equivalent decimal value

Positional Notation (Solutions to Example Problems) 12A 16 = 1x x Ax16 0 = =

Powers of Bases 2 -3 = = = = = = 16 = = = 256 = = = 4096 = = = = = = = = 1024 = 1Kb 2 9 = = 1,048,576 = 1Mb 2 10 = = 1,073,741,824 = 1Gb 2 11 = = 4096

Determining What Base is being Used Subscripts AB9 16 Your textbook puts the subscripts in parentheses AB9 (16) Prefix Symbols (None)874%1011$AB9 Postfix Symbols AB9H If I am only working with one base there is no need to add a symbol.

Conversion from Base R to Decimal Use Positional Notation % = ? 10 $3A94 = ? 10

Conversion from Binary to Decimal Use Positional Notation % = ? 10 % = 1x x x x x x2 0 = =

Conversion from Hexadecimal to Decimal $3A94 = ? 10 $3A94 = 3x Ax x x16 0 = =15996

Conversion from Decimal to Base R Use Successive Division –Repeatedly divide by the desired base until 0 is reached –Save the remainders as the final answer –The first remainder is the LSB (least significant bit); the last remainder is the MSB (Most significant bit) = ? 2 = = ? 16 = 1B5 16

Conversion from Decimal to Binary Use Successive Division –Repeatedly divide by the desired base until 0 is reached –Save the remainders as the final answer –The first remainder is the LSB (least significant bit); the last remainder is the MSB (Most significant bit) = ? / 2 = 218 remainder / 2 = 109 remainder / 2 = 54 remainder 1 54 / 2 = 27 remainder 0 27 / 2 = 13 remainder 1 13 / 2 = 6 remainder 1 6 / 2 = 3 remainder 0 3 / 2 = 1 remainder 1 1 / 2 = 0 remainder 1 =

Conversion from Decimal to Hexadecimal = ? / 16 = 27 remainder 5 27 / 16 = 1 remainder 11 (11=B) 1 / 16 = 0 remainder = 1B5 16

Conversion from Binary to Hex Starting at the LSB working left, group the bits by 4s. Padding of 0s can occur on the most significant group. Convert each group of 4 into the equivalent HEX value. % = $? = $1BAC

Conversion from Hex to Binary Convert each HEX digit to the equivalent 4-bit binary grouping. $A73 = %? = %

Conversion of Fractions Conversion from decimal to binary requires multiplying by the desired base (2) = ? 2 =

Addition/Subtraction of Binary Numbers The carry out has a weight equal to the base (in this case 16). The digit that left is the excess (Base – sum).

Addition/Subtraction of Hex Numbers $3A +$28 $62 The carry out has a weight equal to the base (in this case 16). The digit that left is the excess (Base – sum).

Signed Number Representation Three ways to represent signed numbers –Sign-Magnitude –1s Complement –2s Complement

Sign-Magnitude For an N-bit word, the most significant bit is the sign bit; the remaining bits represent the magnitude 0110 = = -6 Addition/subtraction of numbers can result in overflow (errors) – (Due to fixed number of bits); two values for zero Range for n bits: -(2 n-1 –1) through (2 n-1 –1)

1s Complement ’ = (2 n-1 –1) –P (where P is the magnitude of the number)Negative numbers = N’ = (2 n-1 –1) –P (where P is the magnitude of the number) –For a 5-bit system, -7 = –For a 5-bit system, -7 = Range for n bits:-(2 n-1 –1) through (2 n-1 –1)

2s Complement 2 n – PNegative Numbers = N* = 2 n – P (where P is the magnitude of the number) (where P is the magnitude of the number) –For a 5-bit system, -7 = Another way to form 2s complement representation is to complement P and add 1 Range for n bits: -(2 n-1 ) through (2 n-1 –1)

Numbers Represented with 4-bit Fixed Digit Representation

Summary of Signed Number Representations Sign Magnitude – has two values for 0 - errors in addition of negative and positive numbers 1s complement – two values for 0 - additional hardware needed to compensate for this 2s Complement – representation of choice

Unsigned/Signed Overflow You can detect unsigned overflow if there is a carryout of the MSB. You can detect signed overflow if the sum of two positive numbers is a negative number or if the sum of two negative numbers is a positive number. An overflow never occurs in an addition of a negative and a positive number.

Codes Decimal Codes –BCD (Binary Coded Decimal) Weighted Codes (8421, 2421, etc…) ASCII Codes –ASCII ( American Standard Code for Information Interchange ) –Unicode Standard Unit Distance Codes –Gray Error Detection Codes –Parity Bit Error Correction Codes –Hamming Code

BCD Codes (Decimal Codes) Coded Representations for the the 10 decimal digits Requires 4 bits (2 3 < 10 <2 4 ) Only use 10 combinations of 16 possible combinations (30 billion different coding schemes available)

BCD Codes (Decimal Codes) Weighted Code –8421 code Most common Default The corresponding decimal digit is determined by adding the weights associated with the 1s in the code group. **** The BCD representation is NOT the binary equivalent of the decimal number ***** – = –2421, 5421,7536, etc… codes The weights associated with the bits in each code group are given by the name of the code

BCD Codes (Decimal Codes) Nonweighted Codes –2-out-of-5 Actually weighted except for the digit 0 Used by the post office for scanning bar codes for zip codes Has error detection properties

Unit Distance Codes Important when converting analog to digital Only one bit changes between successive integers Gray Code is most popular example –Table 2.9 in Givone Book gives bit values (pg 45)

Alphanumeric Codes Used to encode Alphabetic and numeric information ASCII – 7-bit Code (Table 2.10 of Givone – pg. 47) Unicode – 16-bit Code

How Much Memory? Memory is purchased in bits – –How many bits do I need if I want to distinguish between 8 colors? –How many bits do I need if I want to represent 16 million different colors?

How Much Memory? How many bits do I need if I want to distinguish between 8 colors? 2 x-1 < 8 <= 2 x x = 3 (3 bits are needed) How many bits do I need if I want to represent 16 million different colors? 2 x-1 < 16 million <= 2 x 16M = 1Mx16 = 2 20 x2 4 = 2 24 x = 24 (24 bits are needed)

What do you need to know? Powers of 2, 16 Conversions of Hex, Binary to Decimal Conversions of Decimal to Hex, Binary Conversions of Hex to Binary, Binary to Hex Signed Number Representations Addition of Signed Numbers, Overflows Codes (BCD, Gray) Number of bits needed?