Eng. Mohammed Timraz Electronics & Communication Engineer University of Palestine Faculty of Engineering and Urban planning Software Engineering Department.

Slides:



Advertisements
Similar presentations
Representing Numbers: Integers
Advertisements

Chapter 2: Data Representation
Binary Systems1 DIGITAL LOGIC DESIGN by Dr. Fenghui Yao Tennessee State University Department of Computer Science Nashville, TN.
COE 202: Digital Logic Design Signed Numbers
Chapter 2 : Number System
CS 151 Digital Systems Design Lecture 3 More Number Systems.
2-1 Computer Organization Part Fixed Point Numbers Using only two digits of precision for signed base 10 numbers, the range (interval between lowest.
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.
ECE 301 – Digital Electronics Number Systems and Conversion, Binary Arithmetic, and Representation of Negative Numbers (Lecture #10) The slides included.
ENGIN112 L3: More Number Systems September 8, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 3 More Number Systems.
S. Barua – CPSC 240 CHAPTER 2 BITS, DATA TYPES, & OPERATIONS Topics to be covered are Number systems.
Mantıksal Tasarım – BBM231 M. Önder Efe
Number Systems Lecture 02.
Number Systems Computer Science 210 Computer Organization.
1.6 Signed Binary Numbers.
Dr. Bernard Chen Ph.D. University of Central Arkansas
1 Data Representation Computer Organization Prof. H. Yoon DATA REPRESENTATION Data Types Complements Fixed Point Representations Floating Point Representations.
Data Representation – Binary Numbers
Eng. Mohammed Timraz Electronics & Communication Engineer University of Palestine Faculty of Engineering and Urban planning Software Engineering Department.
Logic and Digital System Design - CS 303
#1 Lec # 2 Winter EECC341 - Shaaban Positional Number Systems A number system consists of an order set of symbols (digits) with relations.
Computer Architecture
Dept. of Computer Science Engineering Islamic Azad University of Mashhad 1 DATA REPRESENTATION Dept. of Computer Science Engineering Islamic Azad University.
Lecture Overview Introduction Positional Numbering System
1 Digital Systems and Binary Numbers EE 208 – Logic Design Chapter 1 Sohaib Majzoub.
ECEN2102 Digital Logic Design Lecture 1 Numbers Systems Abdullah Said Alkalbani University of Buraimi.
Lecture 4: Number Systems (Chapter 3) (1) Data TypesSection3-1 (2) ComplementsSection3-2 (3) Fixed Point RepresentationsSection3-3 (4) Floating Point RepresentationsSection3-4.
CPS120: Introduction to Computer Science Computer Math: Signed Numbers.
Logic Design Dr. Yosry A. Azzam. Binary systems Chapter 1.
Eng. Mohammed Timraz Electronics & Communication Engineer University of Palestine Faculty of Engineering and Urban planning Software Engineering Department.
CE1111 :Digital Logic Design lecture 01 Introduction Dr. Atef Ali Ibrahim.
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 ≤
Figure 1.1 Block diagram of a digital computer. Functional Units.
Eng. Mohammed Timraz Electronics & Communication Engineer University of Palestine Faculty of Engineering and Urban planning Software Engineering Department.
ECE 331 – Digital System Design
Mohammad Amin Kuhail M.Sc. (York, UK) University of Palestine Faculty of Engineering and Urban planning Software Engineering Department Digital Logic Design.
Dr. Ahmed Telba EE208: Logic Design Lecture# 1 Introduction & Number Systems.
CS311-Computer OrganizationInformation RepresentationLecture 03-1 Lecture 3 Information Representation.
Chapter 1  Number Systems Decimal System Binary System Octal System Hexadecimal System  Binary weighted cods Signed number binary order  1’s and 2’s.
Computer Math CPS120 Introduction to Computer Science Lecture 4.
Digital Logic Lecture 3 Binary Arithmetic By Zyad Dwekat The Hashemite University Computer Engineering Department.
SAK Chapter 21 Chapter 2 : Number System 2.1 Decimal, Binary, Octal and Hexadecimal Numbers 2.2 Relation between binary number system with other.
Chapter 1: Binary Systems
NUMBER SYSTEMS AND CODES. CS Digital LogicNumber Systems and Codes2 Outline Number systems –Number notations –Arithmetic –Base conversions –Signed.
CPEN Digital Logic Design Binary Systems Spring 2004 C. Gerousis © Digital Design 3 rd Ed., Mano Prentice Hall.
1 Digital Logic Design Lecture 2 More Number Systems/Complements.
ECE DIGITAL LOGIC LECTURE 3: DIGITAL COMPUTER AND NUMBER SYSTEMS Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2016, 01/19/2016.
ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 8 Dr. Shi Dept. of Electrical and Computer Engineering.
Lecture 1.2 (Chapter 1) Prepared by Dr. Lamiaa Elshenawy
BINARY SYSTEMS ENGR. KASHIF SHAHZAD 1. BINARY NUMBERS 1/2 Internally, information in digital systems is of binary form groups of bits (i.e. binary numbers)
Computer Math CPS120 Introduction to Computer Science Lecture 7.
DATA REPRESENTATION Data Types Complements Fixed Point Representations
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.
Computer Science 210 Computer Organization
Chapter 2 Binary Number Systems.
DATA REPRESENTATION Data Types Complements Fixed Point Representations
Integer Real Numbers Character Boolean Memory Address CPU Data Types
CSE 102 Introduction to Computer Engineering
Overview Introduction Data representation Fixed Point Representation
Data Representation Data Types Complements Fixed Point Representation
Data Representation in Computer Systems
DATA REPRESENTATION Data Types Complements Fixed Point Representations
Digital Systems and Binary Numbers
Chapter 6: Computer Arithmetic
DATA REPRESENTATION Data Types Complements Fixed Point Representations
DATA REPRESENTATION Data Types Complements Fixed Point Representations
Chapter 1 (Part c) Digital Systems and Binary Numbers
Presentation transcript:

Eng. Mohammed Timraz Electronics & Communication Engineer University of Palestine Faculty of Engineering and Urban planning Software Engineering Department Computer System Architecture ESGD2204 Wednesday, 11th march 2009 Lecture 4

Chapter 3 DATA REPRESENTATION

3.1 Data Types 3.2 Complements 3.3 Fixed Point Representations 3.4 Floating Point Representations 3.5 Other Binary Codes 3.6 Error Detection Codes Agenda

Information that a Computer is dealing with * Data - Numeric Data Numbers( Integer, real) - Non-numeric Data Letters, Symbols * Relationship between data elements - Data Structures Linear Lists, Trees, Rings, etc * Program(Instruction) Data Types DATA REPRESENTATION

NUMERIC DATA REPRESENTATION R = 10 Decimal number system,R = 2 Binary R = 8 Octal,R = 16 Hexadecimal Radix point(.) separates the integer portion and the fractional portion Data Numeric data - numbers(integer, real) Non-numeric data - symbols, letters Number System Nonpositional number system - Roman number system Positional number system - Each digit position has a value called a weight associated with it - Decimal, Octal, Hexadecimal, Binary Base (or radix) R number - Uses R distinct symbols for each digit - Example A R = a n-1 a n-2... a 1 a 0.a -1 …a -m - V(A R ) = Data Types DATA REPRESENTATION

WHY POSITIONAL NUMBER SYSTEM IN DIGITAL COMPUTERS ? Major Consideration is the COST and TIME - Cost of building hardware Arithmetic and Logic Unit, CPU, Communications - Time to processing Arithmetic - Addition of Numbers - Table for Addition * Non-positional Number System - Table for addition is infinite --> Impossible to build, very expensive even if it can be built * Positional Number System - Table for Addition is finite --> Physically realizable, but cost wise the smaller the table size, the less expensive --> Binary is favorable to Decimal Binary Addition Table Decimal Addition Table Data Types DATA REPRESENTATION

REPRESENTATION OF NUMBERS POSITIONAL NUMBERS Decimal Binary Octal Hexadecimal A B C D E F Binary, octal, and hexadecimal conversion A F 6 3 Octal Binary Hexa Data Types DATA REPRESENTATION

CONVERSION OF BASES Decimal to Base R number Base R to Decimal Conversion V(A) =  a k  R k A = a n-1 a n-2 a n-3 … a 0. a -1 … a -m (736.4) 8 = 7 x x x x 8 -1 = 7 x x x 1 + 4/8 = (478.5) 10 (110110) 2 =... = (54) 10 ( ) 2 =... = (6.785) 10 (F3) 16 =... = (243) 10 (0.325) 6 =... = ( ) 10 - Separate the number into its integer and fraction parts and convert each part separately. - Convert integer part into the base R number → successive divisions by R and accumulation of the remainders. - Convert fraction part into the base R number → successive multiplications by R and accumulation of integer digits Data Types DATA REPRESENTATION

EXAMPLE Convert to base 2. Integer = Fraction = x x x x (41)10 = (101001)2 (0.6875)10 = (0.1011)2 ( ) 10 = ( ) 2 Convert (63) 10 to base 5: (223) 5 Convert (1863) 10 to base 8: (3507) 8 Convert ( ) 10 to hexadecimal: (0.A3) 16 Exercise Data Types DATA REPRESENTATION

COMPLEMENT OF NUMBERS Two types of complements for base R number system: - R's complement and (R-1)'s complement The (R-1)'s Complement Subtract each digit of a number from (R-1) Example - 9's complement of is 's complement of is (bit by bit complement operation) The R's Complement Add 1 to the low-order digit of its (R-1)'s complement Example - 10's complement of is = 's complement of is = Complements DATA REPRESENTATION

FIXED POINT NUMBERS Binary Fixed-Point Representation X = x n x n-1 x n-2... x 1 x 0. x -1 x x -m Sign Bit(x n ): 0 for positive - 1 for negative Remaining Bits(x n-1 x n-2... x 1 x 0. x -1 x x -m ) Numbers:Fixed Point Numbers and Floating Point Numbers Fixed Point Representations DATA REPRESENTATION

SIGNED NUMBERS Signed magnitude representation Signed 1's complement representation Signed 2's complement representation Example: Represent +9 and -9 in 7 bit-binary number Only one way to represent +9 ==> Three different ways to represent -9: In signed-magnitude: In signed-1's complement: In signed-2's complement: In general, in computers, fixed point numbers are represented either integer part only or fractional part only. Need to be able to represent both positive and negative numbers - Following 3 representations DATA REPRESENTATION

CHARACTERISTICS OF 3 DIFFERENT REPRESENTATIONS Complement Signed magnitude:Complement only the sign bit Signed 1's complement:Complement all the bits including sign bit Signed 2's complement:Take the 2's complement of the number, including its sign bit. Maximum and Minimum Representable Numbers and Representation of Zero X = x n x n-1... x 0. x x -m Signed Magnitude Max: 2 n - 2 -m Min: -(2 n - 2 -m ) Zero: Signed 1’s Complement Max: 2 n - 2 -m Min: -(2 n - 2 -m ) Zero: Fixed Point Representations Signed 2’s Complement Max: 2 n - 2 -m Min: -2 n Zero: DATA REPRESENTATION

2’s COMPLEMENT REPRESENTATION WEIGHTS Signed 2’s complement representation follows a “weight” scheme similar to that of unsigned numbers –Sign bit has negative weight –Other bits have regular weights X = x n x n-1... x 0  V(X) = - x n  2 n +  x i  2 i i = 0  n-1 DATA REPRESENTATION

ARITHMETIC ADDITION: SIGNED MAGNITUDE [1] Compare their signs [2] If two signs are the same, ADD the two magnitudes - Look out for an overflow [3] If not the same, compare the relative magnitudes of the numbers and then SUBTRACT the smaller from the larger --> need a subtractor to add [4] Determine the sign of the result ) > ) > ) > ) > (- 9) -6 + (-9) Overflow or (-9) + (-9) ) (1)0010 overflow Fixed Point Representations DATA REPRESENTATION

ARITHMETIC ADDITION: SIGNED 2’s COMPLEMENT Example (1) Add the two numbers, including their sign bit, and discard any carry out of leftmost (sign) bit - Look out for an overflow overflow ) operands have the same sign and the result sign changes x n-1 y n-1 s’ n-1 + x’ n-1 y’ n-1 s n-1 = c n-1  c n x’ n-1 y’ n-1 s n-1 (c n-1  c n ) x n-1 y n s’ n-1 (c n-1  c n ) Fixed Point Representations DATA REPRESENTATION

ARITHMETIC ADDITION: SIGNED 1’s COMPLEMENT Add the two numbers, including their sign bits. - If there is a carry out of the most significant (sign) bit, the result is incremented by 1 and the carry is discarded (1) 0(1) ) end-around carry (1) ) (1)0010 +) overflow Example not overflow (c n-1  c n ) = 0 (c n-1  c n ) Fixed Point Representations DATA REPRESENTATION