Fixed-Point Negative Numbers Two Common Forms: 1.Signed-Magnitude Form 2.Complement Forms Signed-Magnitude Numbers First Digit is Sign Digit, Remaining.

Slides:



Advertisements
Similar presentations
Fixed Point Numbers The binary integer arithmetic you are used to is known by the more general term of Fixed Point arithmetic. Fixed Point means that we.
Advertisements

Lab 10 : Arithmetic Systems : Adder System Layout: Slide #2 Slide #3 Slide #4 Slide #5 Arithmetic Overflow: 2’s Complement Conversions: 8 Bit Adder/Subtractor.
Addition and Subtraction. Outline Arithmetic Operations (Section 1.2) – Addition – Subtraction – Multiplication Complements (Section 1.5) – 1’s complement.
ELEC353 S. al Zahir UBC Sign-Magnitude Representation High order bit is sign: 0 = positive (or zero), 1 = negative Low order bits represent the magnitude:
Computer Engineering (Logic Circuits) Dr. Tamer Samy Gaafar Lec. # 2
COE 202: Digital Logic Design Signed Numbers
Radix Conversion Given a value X represented in source system with radix  s, represent the same number in a destination system with radix  d Consider.
Parallel Adder Recap To add two n-bit numbers together, n full-adders should be cascaded. Each full-adder represents a column in the long addition. The.
King Fahd University of Petroleum and Minerals
Wakerly Section 2.4 and further Addition and Subtraction of Nondecimal Numbers.
CS 151 Digital Systems Design Lecture 3 More Number Systems.
Assembly Language and Computer Architecture Using C++ and Java
Fixed-Point Arithmetics: Part I
Copyright 2008 Koren ECE666/Koren Part.1.1 Israel Koren Spring 2008 UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering Digital Computer.
Assembly Language and Computer Architecture Using C++ and Java
Sistemas Digitais I LESI - 2º ano Lesson 2 - Number Systems U NIVERSIDADE DO M INHO E SCOLA DE E NGENHARIA Prof. João Miguel Fernandes
1 Binary Arithmetic, Subtraction The rules for binary arithmetic are: = 0, carry = = 1, carry = = 1, carry = = 0, carry =
CSCE 211: Digital Logic Design Chin-Tser Huang University of South Carolina.
ENGIN112 L3: More Number Systems September 8, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 3 More Number Systems.
1 Binary Numbers Again Recall that N binary digits (N bits) can represent unsigned integers from 0 to 2 N bits = 0 to 15 8 bits = 0 to bits.
Number Systems Lecture 02.
NEGATIVE BINARY NUMBER – Digital Circuit 1 Choopan Rattanapoka.
Binary Representation and Computer Arithmetic
Binary numbers and arithmetic. ADDITION Addition (decimal)
1 Arithmetic and Logical Operations - Part II. Unsigned Numbers Addition in unsigned numbers is the same regardless of the base. Given a pair of bit sequences.
Coping With the Carry Problem 1. Limit Carry to Small Number of Bits Hybrid Redundant Residue Number Systems 2.Detect the End of Propagation Rather Than.
Data Representation – Binary Numbers
General Fixed Radix Number Systems Nonredundant Positive radix, ß n digits in digit set Vector:
Computer Arithmetic Nizamettin AYDIN
1 Modified from  Modified from 1998 Morgan Kaufmann Publishers Chapter Three: Arithmetic for Computers citation and following credit line is included:
#1 Lec # 2 Winter EECC341 - Shaaban Positional Number Systems A number system consists of an order set of symbols (digits) with relations.
Lecture Overview Introduction Positional Numbering System
Chapter 4 – Arithmetic Functions and HDLs Logic and Computer Design Fundamentals.
07/19/2005 Arithmetic / Logic Unit – ALU Design Presentation F CSE : Introduction to Computer Architecture Slides by Gojko Babić.
Complement Numbers. Outline  Negative Numbers Representation  Sign-and-magnitude  1s Complement  2s Complement  Comparison of Sign-and-Magnitude.
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.
CPS120: Introduction to Computer Science Computer Math: Signed Numbers.
1 Digital Design: Number Systems Credits : Slides adapted from: J.F. Wakerly, Digital Design, 4/e, Prentice Hall, 2006 C.H. Roth, Fundamentals of Logic.
Representation of Data Ma King Man. Reference Text Book: Volume 2 Notes: Chapter 19.
Lecture 4 Last Lecture –Positional Numbering Systems –Converting Between Bases Today’s Topics –Signed Integer Representation Signed magnitude One’s complement.
BR 8/99 Binary Numbers Again Recall than N binary digits (N bits) can represent unsigned integers from 0 to 2 N bits = 0 to 15 8 bits = 0 to 255.
Topic 1 – Number Systems. What is a Number System? A number system consists of an ordered set of symbols (digits) with relations defined for addition,
Fixed & Floating Number Format Dr. Hugh Blanton ENTC 4337/5337.
Sep 29, 2004Subtraction (lvk)1 Negative Numbers and Subtraction The adders we designed can add only non-negative numbers – If we can represent negative.
08 ARTH Page 1 ECEn/CS 224 Number Representation and Binary Arithmetic.
Data Representation in Computer Systems. 2 Signed Integer Representation The conversions we have so far presented have involved only positive numbers.
Digital Logic Lecture 3 Binary Arithmetic By Zyad Dwekat The Hashemite University Computer Engineering Department.
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=
Unconventional Fixed-Radix Number Systems
Chapter 4 Integer Data Representation. Unsigned Integers.
FAMU-FSU College of Engineering 1 Part III The Arithmetic/Logic Unit.
IT1004: Data Representation and Organization Negative number representation.
1 Digital Logic Design Lecture 2 More Number Systems/Complements.
FAMU-FSU College of Engineering 1 Computer Architecture EEL 4713/5764, Spring 2006 Dr. Michael Frank Module #9 – Number Representations.
ECE 171 Digital Circuits Chapter 2 Binary Arithmetic Herbert G. Mayer, PSU Status 1/14/2016 Copied with Permission from prof. Mark PSU ECE.
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.
09/03/20161 Information Representation Two’s Complement & Binary Arithmetic.
General Fixed Radix Number Systems Nonredundant Positive radix, ß n digits in digit set Vector:
DATA REPRESENTATION Data Types Complements Fixed Point Representations
Arithmetic Circuits I. 2 Iterative Combinational Circuits Like a hierachy, except functional blocks per bit.
Choosing RNS Moduli Assume we wish to represent 100, Values Standard Binary  lg 2 (100,000) 10  =   =17 bits RNS(13|11|7|5|3|2), Dynamic.
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.
Negative Numbers and Subtraction
UNIVERSITY OF MASSACHUSETTS Dept
King Fahd University of Petroleum and Minerals
Unconventional Fixed-Radix Number Systems
Data Representation in Computer Systems
Subtraction The arithmetic we did so far was limited to unsigned (positive) integers. Today we’ll consider negative numbers and subtraction. The main problem.
ECE 171 Digital Circuits Chapter 2 Binary Arithmetic
Presentation transcript:

Fixed-Point Negative Numbers Two Common Forms: 1.Signed-Magnitude Form 2.Complement Forms Signed-Magnitude Numbers First Digit is Sign Digit, Remaining n-1 are the Magnitude Convention (binary) –0 is a Positive Sign bit –1 is a Negative Sign bit Convention (non-binary) –0 is a Positive Sign digit –  -1 is a Negative Sign digit Only 2  n-1 Digit Sequences are Utilized

Signed-Magnitude Example Largest Representable Value is:

Signed-Magnitude Example (cont)

Signed-Magnitude Ternary Example Notice that fractional part is infinite in  =10 but finite in  =3

Signed-Magnitude Ternary Bounds Positive Numbers: Negative Numbers: Range:

Signed-Magnitude Comments Two Representations for zero, +0 and –0 Addition of +K and –K is not zero EXAMPLE Disadvantage since algorithm requires comparison of signs and, if different, comparison of magnitudes Yields a Sum of –20 10 !!!!!

Complement Representations Two Types of Complement Representations 1. Radix Complement (binary – 2’s-complement) 2. Diminished-Radix Complement (binary – 1’s-complement) Positive Values Represented Same Way as Signed Magnitude for Both Types Negative Value, -Y, Represented as R-Y Where R is a Constant Obeys the Identity: Advantage is No Decisions Needed Based on Operand Sign Before Operations are Applied

Complement Representation Example If |Y| > X, Then the Answer is R - (Y - X) If X > |Y|, Then the Answer Should be X - Y –But X + (R - Y) = R + (X - Y), Thus R Must be Discarded! Solution is to Choose the Value of R Carefully X is Positive, Y is Negative, Compute X + Y Using Complement Representation

Requirements for Complementation Value, R Select R to Simplify (or Eliminate) Correction for the X > |Y| Case Calculation of Complement of Y or (R-Y) Should be Simple and Fast Definition of Complement for Single Digit, x i Definition of Digit Complement for a Word, X

Complementation Value, R Add Word and Complement Together: Answer to Addition Now Add 1 ulp Therefore, we see that:

Radix-Complement Form The Radix Complement Form is Defined When: Using  k is Convenient Since Storing Result in Register of Length n Causes MSD of 1 to be Discarded due to Finite Register Length Therefore, it is Easy to Compute the Complement of X by: 1.Take the Digit Complement of X 2.Add 1ulp to Complement

Radix-Complement Form (cont) No Correction is Needed When We have Positive X and Negative Y Such That: Since R=  k And  k is discarded Due to Finite Register Length

Radix-Complement Example Since n = m + k  m = 0 Therefore 1 ulp = 2 0 = 1 Given X, the radix complement (2’s complement) is: Range of Positive Numbers is [0000,0111] 2’s Complement of Largest, 0111: In Radix Complement, There is a Single Representation of Zero (0000) and Each Positive Number has Corresponding Negative Number With MSB=1

Radix-Complement Example In Radix Complement, There is a Single Representation of Zero (0000) and Each Positive Number has Corresponding Negative Number With MSB=1 Accounts for 1(zero)+7(pos.)+7(neg.), But Extra Bit Pattern Left One Additional Negative Number, =-8 10,  X  +7 10

Diminished-Radix Complement In Diminished Radix Complement, the Complementation Process is Easier Since the Addition of 1 ulp is Avoided Range of Positive Numbers is: [0000 2, ]=[0 10,7 10 ] 1’s Complement of Largest is = ’s Complement of Zero is Two Representations of Zero! In All Cases MSB is Sign Bit

Comparison of Two’s Complement, One’s Complement and Signed-Magnitude SequenceTwo’s Complement One’s Complement Signed- Magnitude

Signed-Number Arithmetic Signed Magnitude – Only Use Magnitude Digits Carry-out  Overflow

Radix-Complement Arithmetic Radix Complement; In this case 2’s Complement Carry-out Does NOT Mean Overflow

2’s-Complement Overflow If X, Y have opposite signs overflow never occurs whether carry-out exists or not If X, Y have same sign and result sign differs, overflow occurs No Carry-out Carry-out Carry-out, Overflow No Carry-out, Overflow

1’s-Complement Overflow One’s complement – carry-out indicates a correction is needed If X > Y, then answer should be X-Y however; register contains X-Y-ulp since 2 n is carry-out bit, therefore must “correct” by adding 1 ulp

Example of 1’s-Complement Overflow So-called “end-around” carry Need Correction Since Overflow

“End-Around” Carry Design This is “end-around” carry – always add carry-out to LSD Carry-out

Other Number Systems Binary Number Systems are Most Common In terms of building “fast” systems, we should consider: – Negative Radix – Signed Digit – Log (logarithm) – Signed Log – Complex Radix – Mixed Radix – Residue Number Systems

Negative-Radix Fixed-Position Systems Nega-decimal example:

Nega-Decimal Number System Finite Register Length, n=3 digits: Largest Positive Value, X max : Smallest Value, X min : Asymmetric System!!!: 10 times more positive than negative values represented

Nega-Decimal Number System Finite Register Length, n=4 digits: Nega-decimal System Characteristics: Now more Negative Values than Positive Arithmetic Operations Same Regardless of Sign of Number No Signed Digit/Complement Representation Needed Sign of X Determined by Position of First Non-zero Digit

Nega-Binary Number System Negative Radix: How is this Addition Operation Performed????? Example

Nega-Binary Number System w i Values (5) 10 (1+1=4-2) 10 (0+0=0) 10 (4+4=16-8) 10 (0-8=-8) 10 (5-3=2) -10 Carry-out (-3) 10

Nega-Binary Adder Design Individual Adder Cells Produce Two Carry-out Bits Design a Circuit at Gate Level for a 4-Digit Nega-Binary Adder Hint: Cout Functions Should Look Familiar!