Assoc. Prof. Dr. Ahmet Turan ÖZCERİT.  The base of numbers  Conversion between number bases  Arithmetic operations on different bases You will learn:

Slides:



Advertisements
Similar presentations
ECE 331 – Digital System Design
Advertisements

Data Representation COE 202 Digital Logic Design Dr. Aiman El-Maleh
Representing Numbers: Integers
DATA REPRESENTATION CONVERSION.
CS 151 Digital Systems Design Lecture 3 More Number Systems.
CSCI 232© 2005 JW Ryder1 Bases  = (3 * 10 2 ) + (2 * 10 1 ) + (4 * 10 0 )  = (3 * 8 2 ) + (2 * 8 1 ) + (4 * 8 0 )  = (1 * 2 3 )
ECE 301 – Digital Electronics Course Introduction, Number Systems, Conversion between Bases, and Basic Binary Arithmetic (Lecture #1)
ECE 331 – Digital System Design
ECE 301 – Digital Electronics Number Systems and Conversion, Binary Arithmetic, and Representation of Negative Numbers (Lecture #10) The slides included.
Mathematics with Binary. Question  Below is a binary string  Which is the least significant bit (LSB)?  Which is the most significant bit (MSB)? 0.
DIGITAL SYSTEMS TCE1111 Representation and Arithmetic Operations with Signed Numbers Week 6 and 7 (Lecture 1 of 2)
ENGIN112 L3: More Number Systems September 8, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 3 More Number Systems.
COE 202: Digital Logic Design Number Systems Part 1
Binary Number Systems.
Digital Systems and Binary Numbers
The Binary Number System
Data Representation Number Systems.
ACOE1611 Data Representation and Numbering Systems Dr. Costas Kyriacou and Dr. Konstantinos Tatas.
Numbering systems.
Data Representation – Binary Numbers
EKT 121 / 4 ELEKTRONIK DIGIT 1 CHAPTER 1 : INTRODUCTION.
Numbering Systems CS208.
Binary Arithmetic & Data representation
Dale & Lewis Chapter 3 Data Representation. Data and computers Everything inside a computer is stored as patterns of 0s and 1s Numbers, text, audio, video,
Chapter 2 Number Systems + Codes. Overview Objective: To use positional number systems To convert decimals to binary integers To convert binary integers.
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION.
Number Systems. Why binary numbers? Digital systems process information in binary form. That is using 0s and 1s (LOW and HIGH, 0v and 5v). Digital designer.
CSE 241 Computer Organization Lecture # 9 Ch. 4 Computer Arithmetic Dr. Tamer Samy Gaafar Dept. of Computer & Systems Engineering.
Logic Design Dr. Yosry A. Azzam. Binary systems Chapter 1.
Data Representation Dr. Ahmed El-Bialy Dr. Sahar Fawzy.
Representation of Data Ma King Man. Reference Text Book: Volume 2 Notes: Chapter 19.
مدار منطقي مظفر بگ محمدي Course Structure & Grading Homework: 25% Midterm: 30% Final:50% There is 5% extra! ( =105!) Textbook:
Lecture 4 Last Lecture –Positional Numbering Systems –Converting Between Bases Today’s Topics –Signed Integer Representation Signed magnitude One’s complement.
Computer Number Systems. d n-1 d n-2 d n d 2-m d 1-m d -m Conventional Radix Number r is the radixd i is a digit d i Є {0, 1, ….., r – 1 } -m ≤
ECE 331 – Digital System Design
Dr. Ahmed Telba EE208: Logic Design Lecture# 1 Introduction & Number Systems.
ECE2030 Introduction to Computer Engineering Lecture 2: Number System Prof. Hsien-Hsin Sean Lee School of Electrical and Computer Engineering Georgia Tech.
Number Systems and Logic Prepared by Dr P Marais (Modified by D Burford)
Positional Number Systems Decimal, Binary, Octal and Hexadecimal Numbers Wakerly Section
AEEE2031 Data Representation and Numbering Systems.
CDP ECE Spring 2000 ECE 291 Spring 2000 Lecture 2: Number Systems & x86 Instructions Constantine D. Polychronopoulos Professor, ECE Office: 463.
Tutorial: ITI1100 Dewan Tanvir Ahmed SITE, UofO
Data Representation in Computer Systems. 2 Signed Integer Representation The conversions we have so far presented have involved only positive numbers.
WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)
Digital Representations ME 4611 Binary Representation Only two states (0 and 1) Easy to implement electronically %0= (0) 10 %1= (1) 10 %10= (2) 10 %11=
Assoc. Prof. Dr. Ahmet Turan ÖZCERİT.  The necessity and advantages of coding  The variety of coding systems You will learn: 2.
IT1004: Data Representation and Organization Negative number representation.
ECE 3110: Introduction to Digital Systems Number Systems.
1 Digital Logic Design Lecture 2 More Number Systems/Complements.
© Prepared By: Razif Razali 1 CHAPTER TWO TCS1023 NUMBERING SYSTEM.
ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 8 Dr. Shi Dept. of Electrical and Computer Engineering.
ECE 2110: Introduction to Digital Systems Number Systems: conversions.
ECE 2110: Introduction to Digital Systems Number Systems: conversions.
Prepared By: Norakmar Binti Mohd Nadzari CHAPTER 2 ARITHMETIC AND LOGIC UNIT.
CPE 201 Digital Design Lecture 3: Digital Systems & Binary Numbers (3)
Addition and Subtraction
Positional Number Systems Decimal, Binary, Octal and Hexadecimal Numbers Wakerly Section
Integer Real Numbers Character Boolean Memory Address CPU Data Types
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION
CHAPTER 1 : INTRODUCTION
Chapter 3 Data Representation
IT 0213: INTRODUCTION TO COMPUTER ARCHITECTURE
University of Gujrat Department of Computer Science
Principles & Applications
Data Representation in Computer Systems
Numbering System TODAY AND TOMORROW 11th Edition
Digital Logic Design (ECEg3141) 2. Number systems, operations & codes 1.
Digital Electronics and Microprocessors
ECE 301 – Digital Electronics
CPS120: Introduction to Computer Science
Presentation transcript:

Assoc. Prof. Dr. Ahmet Turan ÖZCERİT

 The base of numbers  Conversion between number bases  Arithmetic operations on different bases You will learn: 2

He/She can define the term of number bases 3  Computers use a number base other than base-10, namely binary  Each data used and stored in computer represented in binary numbers  Binary numbers are not easy to do arithmetic operations, so we use hex and octal numbers for the sake of simplicity  All characters, images, audio and video samples are also presented in binary numbers  Computers use a number base other than base-10, namely binary  Each data used and stored in computer represented in binary numbers  Binary numbers are not easy to do arithmetic operations, so we use hex and octal numbers for the sake of simplicity  All characters, images, audio and video samples are also presented in binary numbers

He/She can define the term of number bases 4  N: Digit value  d: Number digit  R: Number radix(base)  N=d n R n + d n-1 R n-1 + …+ d 2 R 2 + d 1 R 1 +d 0 R 0 (for integers)  N=d n R n +d n-1 R n-1 +…+d 1 R 1 +d 0 R 0, d 1 R -1 + d 2 R -2 +…+ d n R -n (for real numbers)  The number of digits in the R-based number system is R, the largest digit is R-1, and the least digit is 0.  The largest number for n-digit is R n -1 and the number of different value for n-digit is R n  N: Digit value  d: Number digit  R: Number radix(base)  N=d n R n + d n-1 R n-1 + …+ d 2 R 2 + d 1 R 1 +d 0 R 0 (for integers)  N=d n R n +d n-1 R n-1 +…+d 1 R 1 +d 0 R 0, d 1 R -1 + d 2 R -2 +…+ d n R -n (for real numbers)  The number of digits in the R-based number system is R, the largest digit is R-1, and the least digit is 0.  The largest number for n-digit is R n -1 and the number of different value for n-digit is R n

He/She can make operation on binary numbers 5  The largest digit in binary system R-1 => 2-1 => 1  The least digit in binary system is 0  Each radix in binary number systems is called BIT (BInary DigiT).  The most significant bit (MSB)  The binary number general form: B= d n 2 n + d n-1 2 n-1 + ……. + d d d 0 2 0, d d d n 2 -n  The largest digit in binary system R-1 => 2-1 => 1  The least digit in binary system is 0  Each radix in binary number systems is called BIT (BInary DigiT).  The most significant bit (MSB)  The binary number general form: B= d n 2 n + d n-1 2 n-1 + ……. + d d d 0 2 0, d d d n 2 -n Binary SystemDecimal System

He/She can make operation on binary numbers 6  What is binary value of following binary number: B= 1*2 8 +0*2 7 +1* * * * * * *2 0 B= B=  What is binary value of following binary number: , 1101 B= 1*2 8 +0*2 7 +1*2 6 +1*2 5 +0*2 4 +1*2 3 +1*2 2 +0*2 1 +1*2 0, 1* * * *2 -4 B= B= 365,  What is binary value of following binary number: B= 1*2 8 +0*2 7 +1* * * * * * *2 0 B= B=  What is binary value of following binary number: , 1101 B= 1*2 8 +0*2 7 +1*2 6 +1*2 5 +0*2 4 +1*2 3 +1*2 2 +0*2 1 +1*2 0, 1* * * *2 -4 B= B= 365,

He/She can make operation on octal numbers 7 Octal numbers are used to present binary numbers with 3-digit format The digits used in Octal Systems: 0, 1, 2, 3, 4, 5, 6, 7 O= d n 8 n + d n-1 8 n-1 + ……. + d d d 0 8 0, d d d n 8 -n Octal numbers are used to present binary numbers with 3-digit format The digits used in Octal Systems: 0, 1, 2, 3, 4, 5, 6, 7 O= d n 8 n + d n-1 8 n-1 + ……. + d d d 0 8 0, d d d n 8 -n BinaryOctal

He/She can make operation on hex numbers 8 Hex numbers are used to present binary numbers with 4-digit format The digits used in Octal Systems: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F O= d n 16 n + d n-1 16 n-1 + ……. + d d d , d d d n 16 -n Hex numbers are used to present binary numbers with 4-digit format The digits used in Octal Systems: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F O= d n 16 n + d n-1 16 n-1 + ……. + d d d , d d d n 16 -n BinaryHex BinaryHex A 1011B 1100C 1101D 1110E 1111F

He/She can convert number bases each other 9  The steps of converting of 117,86 10 decimal number into a binary number  First, the integer part of the number is resolved then real part  The steps of converting of 117,86 10 decimal number into a binary number  First, the integer part of the number is resolved then real part DivisionRemainderResult 117/2 =581B 0 =1 58/2 = 29 0B 1 =0 29/2 =141B 2 =1 14/2 =70B 3 =0 7/2 =31B 4 =1 3/2 =1 1B 5 =1 1/2 =0 1B 6 =1 MultiplyIntegerResult 0.86*2=1.72 1b 1 =1 0.72*2=1.44 1b 2 =1 0.44*2=0.88 0b 3 =0 0.88*2=1.76 1b 4 =1 0.76*2=1.52 1b 5 =1 0.52*2=1.04 1b 6 =1 0.04*2=0.08 0b 7 =0 (117,86) 10 = ( , ….) 2

He/She can convert number bases each other 10  Convert a real decimal number (0,513) 10 into an octal number OperationMultiplyIntegerResult 0.513* o 0 = * o 1 = * o 2 = * o 3 = * o 4 =1 (0,513) 10 ≅ (0,40651) 8

He/She can convert number bases each other 11  Convert a decimal number (214) 10 into a hex number OperationDivisionRemainderResult 214/16136O 0 =6 13/16013O 1 =D (214) 10 = (D6) 16  Convert a decimal number (423) 10 into a hex number OperationDivisionRemainderResult 423/16267O 0 =7 26/16110O 1 =A 1  1O 2 =1 (423) 10 = (1A7) 16

He/She can convert number bases each other 12  Convert a binary number (100.01) 2 into a decimal number = 1* * *2 0, 0* *2 -2 = 1* , 0 + 1* ¼ = , = (4,25) 10  Convert a binary number (100.01) 2 into a decimal number = 1* * *2 0, 0* *2 -2 = 1* , 0 + 1* ¼ = , = (4,25) 10

He/She can convert number bases each other 13  Converting a binary number ( ) 2 into an octal number For integer part; start from just after the dot towards to the leftmost digit and combine 3-bits as a group. Fill zeros if the group is less than 3-bit For real part; start from just after the dot towards to the rightmost digit and combine 3-bits as a group. Fill zeros if the group is less than 3-bit  Converting a binary number ( ) 2 into an octal number For integer part; start from just after the dot towards to the leftmost digit and combine 3-bits as a group. Fill zeros if the group is less than 3-bit For real part; start from just after the dot towards to the rightmost digit and combine 3-bits as a group. Fill zeros if the group is less than 3-bit

He/She can convert number bases each other 14  Converting a binary number ( ) 2 into a hex number For integer part; start from just after the dot towards to the leftmost digit and combine 4-bit as a group. Fill zeros if the group is less than 4-bit For real part; start from just after the dot towards to the rightmost digit and combine 4-bit as a group. Fill zeros if the group is less than 4-bit.C E  Converting a binary number ( ) 2 into a hex number For integer part; start from just after the dot towards to the leftmost digit and combine 4-bit as a group. Fill zeros if the group is less than 4-bit For real part; start from just after the dot towards to the rightmost digit and combine 4-bit as a group. Fill zeros if the group is less than 4-bit.C E

He/She can convert number bases each other 15  Converting an Octal number into a binary number Convert each digit into its 3-bit binary counterpart.  Example ( ) 8 =( ) 2  Converting an octal number into a decimal number Multiply each digit’s value by radix and sum all terms  Example (372.2) 8 = 3x x x x8 -1 = 3x64 + 7x8 + 2x1 +2x0.125 =(250.25) 10  Converting an Octal number into a binary number Convert each digit into its 3-bit binary counterpart.  Example ( ) 8 =( ) 2  Converting an octal number into a decimal number Multiply each digit’s value by radix and sum all terms  Example (372.2) 8 = 3x x x x8 -1 = 3x64 + 7x8 + 2x1 +2x0.125 =(250.25) 10

He/She can convert number bases each other 16  Converting an Octal number into a hex number Step1. Convert each digit into its 3-bit binary counterpart. Step2. Compose 4-bit groups Step3. Convert 4-bit into hex counterpart Integer part group direction. Real part group direction  Example (5431) 8 = ( ? ) 16 Step1. ( ) 2 Step Step3. B 1 9 (5431) 8 = (B19) 16  Converting an Octal number into a hex number Step1. Convert each digit into its 3-bit binary counterpart. Step2. Compose 4-bit groups Step3. Convert 4-bit into hex counterpart Integer part group direction. Real part group direction  Example (5431) 8 = ( ? ) 16 Step1. ( ) 2 Step Step3. B 1 9 (5431) 8 = (B19) 16

He/She can convert number bases each other 17  Converting an hex number into a binary number Convert each digit into its 4-bit binary counterpart.  Example ( ) 16 =( ) 2  Converting an hex number into a decimal number Multiply each digit’s value by radix and sum all terms  Example (372) 16 = 3x x x16 0 = 3x256+ 7x16 + 2x1 = = (881) 10  Converting an hex number into a binary number Convert each digit into its 4-bit binary counterpart.  Example ( ) 16 =( ) 2  Converting an hex number into a decimal number Multiply each digit’s value by radix and sum all terms  Example (372) 16 = 3x x x16 0 = 3x256+ 7x16 + 2x1 = = (881) 10

He/She can convert number bases each other 18  Converting an Hex number into a Octal number Step1. Convert each digit into its 4-bit binary counterpart. Step2. Compose 3-bit groups Step3. Convert 3-bit into octal counterpart Integer part group direction. Real part group direction  Example (E0CA) 16 = ( ? ) 8 Step1. ( ) 2 Step2. ( ) 2 Step3. ( ) 8 (E0CA) 16 = (160312) 8  Converting an Hex number into a Octal number Step1. Convert each digit into its 4-bit binary counterpart. Step2. Compose 3-bit groups Step3. Convert 3-bit into octal counterpart Integer part group direction. Real part group direction  Example (E0CA) 16 = ( ? ) 8 Step1. ( ) 2 Step2. ( ) 2 Step3. ( ) 8 (E0CA) 16 = (160312) 8

He/She can do arithmetic operations on various radix 19  0+0 =0  1+0 =1  1+1 =0 Carry=  0+0 =0  1+0 =1  1+1 =0 Carry= Carry

He/She can do arithmetic operations on various radix 20  0-0 =0  1-0 =1  1-1 =0  0-1 =1 borrow=  0-0 =0  1-0 =1  1-1 =0  0-1 =1 borrow=

He/She can do arithmetic operations on various radix 21 In digital electronics, it is easier to create adder than subtractor unit. M-N can be redefined as M+( r complement of N) N can be negated by 1’s complement but 1’s complement contain both +0 and -0. STEP-1: Convert subtraction operation into addition by using r complement STEP-2: a. If an extra carry is obtained at the end, discard it and the number is assumed as positive. b. If no carry is obtained, apply r complement to result and add 1 In digital electronics, it is easier to create adder than subtractor unit. M-N can be redefined as M+( r complement of N) N can be negated by 1’s complement but 1’s complement contain both +0 and -0. STEP-1: Convert subtraction operation into addition by using r complement STEP-2: a. If an extra carry is obtained at the end, discard it and the number is assumed as positive. b. If no carry is obtained, apply r complement to result and add 1

He/She can do arithmetic operations on various radix 22 Example with extra carry: N can also be negated by 2’s complement (1’s complement+1) M= , N= M-N=? M-N = M+(-N) = M+ (2’s complement of N) = M+ (1’s complement+1) 2 1’s Complement of N= ( ) 2 2s complement of N (1’s complement of N + 1) = ( ) MSB is discarded, the result= ( ) 2

He/She can do arithmetic operations on various radix 23 Example without extra carry: M= (68) 10 N = (84) 10 M-N =? for 2’s complement 1’s complement of N= ( ) 2’s complement of N (1’s complement of N + 1) = ( ) No carry (-16) 10 1s comp ( ) 2 (-16) 10

He/She can do arithmetic operations on various radix

He/She can do arithmetic operations on various radix 25