Chapter3 Fixed Point Representation Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2009.

Slides:



Advertisements
Similar presentations
CENG536 Computer Engineering department Çankaya University.
Advertisements

Addition and Subtraction. Outline Arithmetic Operations (Section 1.2) – Addition – Subtraction – Multiplication Complements (Section 1.5) – 1’s complement.
Binary Arithmetic Binary addition Binary subtraction
James Tam Numerical Representations On The Computer: Negative And Rational Numbers How are negative and rational numbers represented on the computer? How.
Digital Fundamentals Floyd Chapter 2 Tenth Edition
CS 151 Digital Systems Design Lecture 3 More Number Systems.
Assembly Language and Computer Architecture Using C++ and Java
Number Systems Standard positional representation of numbers:
Assembly Language and Computer Architecture Using C++ and Java
ENGIN112 L3: More Number Systems September 8, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 3 More Number Systems.
Operations on data CHAPTER 4.
School of Computer Science G51CSA 1 Computer Arithmetic.
Chapter 3 Data Representation part2 Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2010.
Binary Representation and Computer Arithmetic
Dr. Bernard Chen Ph.D. University of Central Arkansas
Computer Systems 1 Fundamentals of Computing Negative Binary.
The Binary Number System
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Fundamentals Tenth Edition Floyd.
Simple Data Type Representation and conversion of numbers
Data Representation – Binary Numbers
Computer Arithmetic Nizamettin AYDIN
2-1 Chapter 2 - Data Representation Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Chapter Contents.
NUMBER REPRESENTATION CHAPTER 3 – part 3. ONE’S COMPLEMENT REPRESENTATION CHAPTER 3 – part 3.
Chapter 1 Data Storage(3) Yonsei University 1 st Semester, 2015 Sanghyun Park.
IT253: Computer Organization
Computer Architecture
ECEN2102 Digital Logic Design Lecture 1 Numbers Systems Abdullah Said Alkalbani University of Buraimi.
S. Rawat I.I.T. Kanpur. Floating-point representation IEEE numbers are stored using a kind of scientific notation. ± mantissa * 2 exponent We can represent.
CH09 Computer Arithmetic  CPU combines of ALU and Control Unit, this chapter discusses ALU The Arithmetic and Logic Unit (ALU) Number Systems Integer.
Lecture 5. Topics Sec 1.4 Representing Information as Bit Patterns Representing Text Representing Text Representing Numeric Values Representing Numeric.
ECEG-3202: Computer Architecture and Organization, Dept of ECE, AAU 1 Floating-Point Arithmetic Operations.
ECE 301 – Digital Electronics Unsigned and Signed Numbers, Binary Arithmetic of Signed Numbers, and Binary Codes (Lecture #2)
Fixed and Floating Point Numbers Lesson 3 Ioan Despi.
CSC 221 Computer Organization and Assembly Language
Operations on Bits Arithmetic Operations Logic Operations
Exam1 Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2010.
Chapter 3 Complements Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2009.
Data Representation in Computer Systems. 2 Signed Integer Representation The conversions we have so far presented have involved only positive numbers.
Number Systems & Operations
Digital Fundamentals Tenth Edition Floyd Chapter 2 © 2008 Pearson Education.
IT1004: Data Representation and Organization Negative number representation.
Exam1 Review Dr. Bernard Chen Ph.D. University of Central Arkansas.
Numbers in Computers.
©Brooks/Cole, 2003 Chapter 3 Number Representation.
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.
Chapter 1 Representing Data in a Computer. 1.1 Binary and Hexadecimal Numbers.
Integer Operations Computer Organization and Assembly Language: Module 5.
Lecture No. 4 Computer Logic Design. Negative Number Representation 3 Options –Sign-magnitude –One’s Complement –Two’s Complement  used in computers.
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.
Arithmetic Circuits I. 2 Iterative Combinational Circuits Like a hierachy, except functional blocks per bit.
COSC2410: LAB 2 BINARY ARITHMETIC SIGNED NUMBERS FLOATING POINT REPRESENTATION BOOLEAN ALGEBRA 1.
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.
1 CE 454 Computer Architecture Lecture 4 Ahmed Ezzat The Digital Logic, Ch-3.1.
Floating Point Representations
Prof. Sin-Min Lee Department of Computer Science
Data Representation Data Types Complements Fixed Point Representation
CPS120: Introduction to Computer Science
ECE 331 – Digital System Design
Chapter3 Fixed Point Representation
靜夜思 床前明月光, 疑是地上霜。 舉頭望明月, 低頭思故鄉。 ~ 李白 李商隱.
Presentation transcript:

Chapter3 Fixed Point Representation Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2009

Subtract by Summation Subtraction with complement is done with binary numbers in a similar way. Using two binary numbers X= and Y= We perform X-Y and Y-X

X-Y X= ’s com. of Y= Sum= Answer=

Y-X Y= ’s com. of X= Sum= There’s no end carry: answer is negative (2’s complement of )

How To Represent Signed Numbers Plus and minus signs used for decimal numbers: 25 (or +25), -16, etc.. For computers, it is desirable to represent everything as bits. Three types of signed binary number representations: 1. signed magnitude, 2. 1’s complement, and 3. 2’s complement

1. signed magnitude In each case: left-most bit indicates sign: positive (0) or negative (1). Consider 1. signed magnitude: = Sign bitMagnitude = Sign bitMagnitude

2. One’s Complement Representation The one’s complement of a binary number involves inverting all bits. To find negative of 1’s complement number take the 1’s complement of whole number including the sign bit.To find negative of 1’s complement number take the 1’s complement of whole number including the sign bit = Sign bitMagnitude = Sign bit1’complement

3. Two’s Complement Representation The two’s complement of a binary number involves inverting all bits and adding 1. To find the negative of a signed number take the 2’s the 2’s complement of the positive number including the sign bit = Sign bitMagnitude = Sign bit2’s complement

The rule for addition is add the two numbers, including their sign bits, and discard any carry out of the sign (leftmost) bit position. Numerical examples for addition are shown below. Example: In each of the four cases, the operation performed is always addition, including the sign bits. Only one rule for addition, no separate treatment of subtraction. Negative numbers are always represented in 2’s complement. Sign addition in 2’s complement

Arithmetic Subtraction A subtraction operation can be changed to an addition operation if the sign of the subtrahend is changed. (±A) - (+B) = (±A) + (-B) (±A) - (-B) = (±A) + (+B)

Arithmetic Subtraction Consider the subtraction of (-6) - (-13) = +7. In binary with eight bits this is written as The subtraction is changed to addition by taking the 2’s complement of the subtrahend (-13) to give (+13). In binary this is = Removing the end carry, we obtain the correct answer (+ 7).

Overflow The detection of an overflow after the addition of two binary numbers depends on whether the considered numbers are signed or unsigned. When two unsigned numbers are added, an overflow is detected from the end carry out of the most significant position. In the case of signed numbers, the leftmost bit always represents the sign, and negative numbers are in 2’s complement form. When two signed numbers are added, the sign bit is treated as part of the number and the end carry does not indicate an overflow.

Overflow Overflow example: = =

Overflow An overflow cannot occur after an addition if one number is positive and the other is negative, since adding a positive number to a negative number produces a result that is smaller than the larger of the two original numbers. An overflow may occur if the two numbers added are both either positive or negative.

Floating-Point Representation is represented in floating-point with a fraction and an exponent as follows: Fraction Exponent Scientific notation :  10 +4

Floating-Point Representation Floating point is always interpreted as: m  r e Floating point binary number uses base 2 for the exponent. For example: Binary number Fraction(8 bits) Exponent (6 bits) The fraction has a 0 in the leftmost position to denote positive. m  2 e = + ( ) 2  2 +4

Floating-Point Representation A floating-point number is said to be normalized if the most significant digit of the mantissa is nonzero. For example: (1) 350 is normalized but is not. (2) The 8-bit binary number is not. It can be normalized by shifting to obtain The three shifts multiply the number by 23 = 8. To keep the same value for floating-point number, the exponent must be subtracted by 3.

Floating-Point Representation 32-bit floating point format. Leftmost bit = sign bit (0 positive or 1 negative). Exponent in the next 8 bits. Use a biased representation. Final portion of word (23 bits in this example) is the significand (sometimes called mantissa).

Example Convert the following number;37.75 into floating point format to fit in 32 bit register. Convert the number from decimal into binary Normalize all digits including the fraction to determine the exponent x sign EXP Significant