ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 8 Dr. Shi Dept. of Electrical and Computer Engineering.

Slides:



Advertisements
Similar presentations
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:
Advertisements

COE 202: Digital Logic Design Signed Numbers
CS 151 Digital Systems Design Lecture 3 More Number Systems.
Fixed-Point Arithmetics: Part I
1 Binary Arithmetic, Subtraction The rules for binary arithmetic are: = 0, carry = = 1, carry = = 1, carry = = 0, carry =
DIGITAL SYSTEMS TCE1111 Representation and Arithmetic Operations with Signed Numbers Week 6 and 7 (Lecture 1 of 2)
ENGIN112 L14: Binary Adder Subtractor October 3, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 14 Binary Adders and Subtractors.
ENGIN112 L3: More Number Systems September 8, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 3 More Number Systems.
CSE20 Lecture 3 Number Systems: Negative Numbers 1.Sign and Magnitude Representation 2.1’s Complement Representation 3.2’s Complement Representation 1.
9/15/09 - L15 Decoders, Multiplexers Copyright Joanne DeGroat, ECE, OSU1 Binary additon & subtraction.
Chapter 3 Data Representation part2 Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2010.
NEGATIVE BINARY NUMBER – Digital Circuit 1 Choopan Rattanapoka.
Chapter3 Fixed Point Representation Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2009.
Computer Organization & Programming Chapter2 Number Representation and Logic Operations.
Representing Integer Data Book : Chapter ( Subject has no point !! ) A99ACF.
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,
ECEN2102 Digital Logic Design Lecture 1 Numbers Systems Abdullah Said Alkalbani University of Buraimi.
Digital Logic Design Lecture 3 Complements, Number Codes and Registers.
1 COMS 161 Introduction to Computing Title: Numeric Processing Date: October 29, 2004 Lecture Number: 26.
Topic: Arithmetic Circuits Course: Digital Systems Slide no. 1 Chapter # 5: Arithmetic Circuits.
Introduction to Computer Engineering ECE/CS 252, Fall 2010 Prof. Mikko Lipasti Department of Electrical and Computer Engineering University of Wisconsin.
Complement Numbers. Outline  Negative Numbers Representation  Sign-and-magnitude  1s Complement  2s Complement  Comparison of Sign-and-Magnitude.
CPS120: Introduction to Computer Science Computer Math: Signed Numbers.
CSE 241 Computer Organization Lecture # 9 Ch. 4 Computer Arithmetic Dr. Tamer Samy Gaafar Dept. of Computer & Systems Engineering.
Number Systems. Today Decimal Hexadecimal Binary –Unsigned Binary –1’s Complement Binary –2’s Complement Binary.
Engineering 1040: Mechanisms & Electric Circuits Spring 2014 Number Systems.
ECE 301 – Digital Electronics Unsigned and Signed Numbers, Binary Arithmetic of Signed Numbers, and Binary Codes (Lecture #2)
Cosc 2150: Computer Organization Chapter 2 Part 1 Integers addition and subtraction.
Positional Number Systems
ECEN 248 Lab 4: Multiplexer Based Arithmetic Logic Unit
ECE2030 Introduction to Computer Engineering Lecture 2: Number System Prof. Hsien-Hsin Sean Lee School of Electrical and Computer Engineering Georgia Tech.
By Jariya Phongsai A two's-complement system is a system in which negative numbers are represented by the two's complement of the absolute value; this.
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.
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=
Bits, Data types, and Operations: Chapter 2 COMP 2610 Dr. James Money COMP
CEC 220 Digital Circuit Design Binary Arithmetic & Negative Numbers Monday, January 13 CEC 220 Digital Circuit Design Slide 1 of 14.
Introduction * Binary numbers are represented with a separate sign bit along with the magnitude. * For example, in an 8-bit binary number, the MSB is.
CEC 220 Digital Circuit Design Binary Arithmetic & Negative Numbers Fri, Aug 28 CEC 220 Digital Circuit Design Slide 1 of 14.
IT1004: Data Representation and Organization Negative number representation.
Registers and Binary Arithmetic Prof. Sirer CS 316 Cornell University.
1 Digital Logic Design Lecture 2 More Number Systems/Complements.
ECE 171 Digital Circuits Chapter 2 Binary Arithmetic Herbert G. Mayer, PSU Status 1/14/2016 Copied with Permission from prof. Mark PSU ECE.
Two’s and one’s complement arithmetic CLOCK ARITHMETIC.
1 Lecture 14 Binary Adders and Subtractors. 2 Overview °Addition and subtraction of binary data is fundamental Need to determine hardware implementation.
ECE DIGITAL LOGIC LECTURE 3: DIGITAL COMPUTER AND NUMBER SYSTEMS Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2016, 01/19/2016.
In decimal we are quite familiar with placing a “-” sign in front of a number to denote that it is negative The same is true for binary numbers a computer.
Numerical formats What’s the main idea? Want to represent numbers (eg: 45, -12, ) using only bits. We’ve already seen (or you can read in the book)
1 Ethics of Computing MONT 113G, Spring 2012 Session 4 Binary Addition.
MicroProcessors Lec. 4 Dr. Tamer Samy Gaafar. Course Web Page —
09/03/20161 Information Representation Two’s Complement & Binary Arithmetic.
Computer Organization 1 Data Representation Negative Integers.
Lecture No. 4 Computer Logic Design. Negative Number Representation 3 Options –Sign-magnitude –One’s Complement –Two’s Complement  used in computers.
President UniversityErwin SitompulDigital Systems 7/1 Lecture 7 Digital Systems Dr.-Ing. Erwin Sitompul President University
Computer Engineering page 1 Integer arithmetic Depends what you mean by “integer”. Assume at 3-bit string. –Then we define: zero = 000 one = 001 Use zero,
Arithmetic Circuits I. 2 Iterative Combinational Circuits Like a hierachy, except functional blocks per bit.
Binary Addition The simplest arithmetic operation in binary is addition. Adding two single-digit binary numbers is relatively simple, using a form of carrying:
Lecture 4: Digital Systems & Binary Numbers (4)
Cosc 2150: Computer Organization
Negative Binary Numbers
Computer Science 210 Computer Organization
Negative Binary Numbers
Digital Systems Section 8 Multiplexers. Digital Systems Section 8 Multiplexers.
BEE1244 Digital System and Electronics BEE1244 Digital System and Electronic Chapter 2 Number Systems.
Computer Science 210 Computer Organization
Digital Systems Section 12 Binary Adders. Digital Systems Section 12 Binary Adders.
Unit 18: Computational Thinking
COMS 161 Introduction to Computing
ECE 331 – Digital System Design
COMS 361 Computer Organization
Presentation transcript:

ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 8 Dr. Shi Dept. of Electrical and Computer Engineering

SIGNED NUMBERS

How To Represent Signed Numbers Plus and minus sign used for decimal numbers: 25 (or +25), -16, etc..For computers, desirable to represent everything as bits. Three types of signed binary number representations: signed magnitude, 1’s complement, 2’s complement. In each case: left-most bit indicates sign: positive (0) or negative (1). Consider signed magnitude: = Sign bitMagnitude = Sign bitMagnitude

Circular Representation

Two’s Complement Representation (Circular Representation) The two’s complement of a binary number involves inverting all bits and adding 1. 2’s comp of is ’s comp of is For an n bit number N the 2’s complement is 2 n – N. To find negative of 2’s complement number take the 2’s complement = Sign bitMagnitude = Sign bitMagnitude

Two’s Complement Shortcuts  Simply complement each bit and then add 1 to the result.  Finding the 2’s complement of ( ) 2 and of its 2’s complement… N = [N] =

Finite Number Representation  Machines that use 2’s complement arithmetic can represent integers in the range -2 n-1 <= N <= 2 n-1 -1 where n is the number of bits available for representing N. Note that 2 n-1 -1 = ( ) 2 and –2 n-1 = ( ) 2 o For 2’s complement, more negative numbers than positive.

2’s Complement Subtraction  Let’s compute (13) 10 - (5) 10  (13) 10 = +(1101) 2 = (01101) 2  (-5) 10 = -(0101) 2 = (11011) 2  Adding these two 5-bit codes…  Discarding the carry bit, the sign bit is seen to be zero, indicating a correct result carry

2’s Complement Subtraction  Let’s compute (5) 10 – (12) 10  (-12) 10 = -(1100) 2 = (10100) 2  (5) 10 = +(0101) 2 = (00101) 2  Adding these two 5-bit codes…  Here, there is no carry bit and the sign bit is 1 This indicates a negative result, which is what we expect (11001) 2 = -(7)

REALIZATION

Negative Numbers – 2’s Complement = = = FF 16 = = = = = Subtracting a number is the same as: 1.Perform 2’s complement 2.Perform addition If we can augment adder with 2’s complement hardware?

4-bit Subtractor: E = 1 +1 Add A to B’ (one’s complement) plus 1 That is, add A to two’s complement of B D = A - B

Adder- Subtractor Circuit +1 Add A to B’ (one’s complement) plus 1 That is, add A to two’s complement of B D = A - B

Overflow in two’s complement addition  Definition: When two values of the same signs are added:  Result won’t fit in the number of bits provided  Result has the opposite sign. Overflow? C N-1 B N-1 A N-1 Assumes an N-bit adder, with bit N-1 the MSB

Addition cases and overflow OFL

One’s Complement Representation The one’s complement of a binary number involves inverting all bits. 1’s comp of is ’s comp of is For an n bit number N the 1’s complement is (2 n -1) – N. To find negative of 1’s complement number take the 1’s complement = Sign bitMagnitude = Sign bitMagnitude

1’s Complement Addition  Adding using 1’s complement numbers.  For example, suppose we wish to add +(1100) 2 and +(0001) 2.  Let’s compute (12) 10 + (1) 10.  (12) 10 = +(1100) 2 = in 1’s comp.  (1) 10 = +(0001) 2 = in 1’s comp Add carry Final Result Step 1: Add binary numbers Step 2: Add carry to low-order bit Add

1’s Complement Subtraction  Using 1’s complement numbers, subtracting numbers is also easy.  For example, suppose we wish to subtract +(0001) 2 from +(1100) 2.  Let’s compute (12) 10 - (1) 10.  (12) 10 = +(1100) 2 = in 1’s comp.  (-1) 10 = -(0001) 2 = in 1’s comp.

1’s Complement Subtraction Add carry Final Result Step 1: Take 1’s complement of 2 nd operand Step 2: Add binary numbers Step 3: Add carry to low order bit 1’s comp Add