CEC 220 Digital Circuit Design Binary Arithmetic & Negative Numbers Monday, January 13 CEC 220 Digital Circuit Design Slide 1 of 14.

Slides:



Advertisements
Similar presentations
ECE 331 – Digital System Design
Advertisements

King Fahd University of Petroleum and Minerals
Assembly Language and Computer Architecture Using C++ and Java
Assembly Language and Computer Architecture Using C++ and Java
Computer ArchitectureFall 2008 © August 25, CS 447 – Computer Architecture Lecture 3 Computer Arithmetic (1)
1 Binary Arithmetic, Subtraction The rules for binary arithmetic are: = 0, carry = = 1, carry = = 1, carry = = 0, carry =
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.
DIGITAL SYSTEMS TCE1111 Representation and Arithmetic Operations with Signed Numbers Week 6 and 7 (Lecture 1 of 2)
Computer ArchitectureFall 2007 © August 29, 2007 Karem Sakallah CS 447 – Computer Architecture.
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.
FIGURES FOR CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION
1 Lecture 2: Number Systems Binary numbers Base conversion Arithmetic Number systems  Sign and magnitude  Ones-complement  Twos-complement Binary-coded.
NEGATIVE BINARY NUMBER – Digital Circuit 1 Choopan Rattanapoka.
Binary Representation - Shortcuts n Negation x + x = 1111…1111 two = -1 (in 2’s complement) Therefore, -x = x + 1 n Sign Extension o Positive numbers :
Computer Organization & Programming Chapter2 Number Representation and Logic Operations.
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.
CSCI-365 Computer Organization Lecture Note: Some slides and/or pictures in the following are adapted from: Computer Organization and Design, Patterson.
Conversion Between Lengths Positive number pack with leading zeros +18 = = Negative numbers pack with leading ones -18 =
Chapter 7 Arithmetic Operations and Circuits Binary Arithmetic Addition –When the sum exceeds 1, carry a 1 over to the next-more-significant column.
BINARY ARITHMETIC Binary arithmetic is essential in all digital computers and in many other types of digital systems.
Binary Arithmetic & Data representation
1 COMS 161 Introduction to Computing Title: Numeric Processing Date: October 29, 2004 Lecture Number: 26.
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION.
+ CS 325: CS Hardware and Software Organization and Architecture Integers and Arithmetic Part 2.
Number Systems. Today Decimal Hexadecimal Binary –Unsigned Binary –1’s Complement Binary –2’s Complement Binary.
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION
Number Systems ELEC 311 Digital Logic and Circuits Dr. Ron Hayne Images Courtesy of Cengage Learning.
ECE 331 – Digital System Design
ECE 301 – Digital Electronics Unsigned and Signed Numbers, Binary Arithmetic of Signed Numbers, and Binary Codes (Lecture #2)
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.
Positional Number Systems
Lecture 2 Binary Values and Number Systems. The number 943 is an example of a number written in positional notation. The relative positions of the digits.
ECE 2110: Introduction to Digital Systems Signed Addition/Subtraction.
1 Arithmetic and Logic Operations Patt and Patel Ch. 2 & 3.
ECE 301 – Digital Electronics Representation of Negative Numbers, Binary Arithmetic of Negative Numbers, and Binary Codes (Lecture #11) The slides included.
Data Representation in Computer Systems. 2 Signed Integer Representation The conversions we have so far presented have involved only positive numbers.
07/12/ Data Representation Two’s Complement & Binary Arithmetic.
Digital Logic Lecture 3 Binary Arithmetic By Zyad Dwekat The Hashemite University Computer Engineering Department.
CEC 220 Digital Circuit Design Binary Codes
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=
CEC 220 Digital Circuit Design Binary Arithmetic & Negative Numbers Fri, Aug 28 CEC 220 Digital Circuit Design Slide 1 of 14.
CEC 220 Digital Circuit Design
Negative binary numbers 1 Computer Architectures M.
ECE 171 Digital Circuits Chapter 2 Binary Arithmetic Herbert G. Mayer, PSU Status 1/14/2016 Copied with Permission from prof. Mark PSU ECE.
CEC 220 Digital Circuit Design Binary Codes Mon, Aug 31 CEC 220 Digital Circuit Design Slide 1 of 14.
CSC 331: DIGITAL LOGIC DESIGN COURSE LECTURER: E. Y. BAAGYERE. CONTACT: LECTURE TIME: 15:40 – 17:45 hrs. VENUE: SP-LAB.
©2010 Cengage Learning SLIDES FOR CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION Click the mouse to move to the next page. Use the ESC key to exit.
ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 8 Dr. Shi Dept. of Electrical and Computer Engineering.
Chapter 8 Computer Arithmetic. 8.1 Unsigned Notation Non-negative notation  It treats every number as either zero or a positive value  Range: 0 to 2.
09/03/20161 Information Representation Two’s Complement & Binary Arithmetic.
Nguyen Le CS147.  2.4 Signed Integer Representation  – Signed Magnitude  – Complement Systems  – Unsigned Versus Signed Numbers.
Lecture No. 4 Computer Logic Design. Negative Number Representation 3 Options –Sign-magnitude –One’s Complement –Two’s Complement  used in computers.
1 Integer Representations V1.0 (22/10/2005). 2 Integer Representations  Unsigned integer  Signed integer  Sign and magnitude  Complements  One’s.
COSC2410: LAB 2 BINARY ARITHMETIC SIGNED NUMBERS FLOATING POINT REPRESENTATION BOOLEAN ALGEBRA 1.
Lecture 4: Digital Systems & Binary Numbers (4)
Unit I From Fundamentals of Logic Design by Roth and Kinney.
Design of Digital Circuits Reading: Binary Numbers
Addition and Subtraction
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION
CHAPTER 9 COMPUTER ARITHMETIC - ALU
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION
Computer Organization and ASSEMBLY LANGUAGE
Data Representation in Computer Systems
ECEG-3202 Computer Architecture and Organization
ECE 331 – Digital System Design
COMS 361 Computer Organization
Two’s Complement & Binary Arithmetic
Presentation transcript:

CEC 220 Digital Circuit Design Binary Arithmetic & Negative Numbers Monday, January 13 CEC 220 Digital Circuit Design Slide 1 of 14

Lecture Outline Monday, January 13 CEC 220 Digital Circuit Design Binary Arithmetic  Addition and subtraction  Multiplication and Division Representation of Negative Numbers  1’s compliment, 2’s complement, and sign & magnitude Slide 2 of 14

Number Systems & Conversions Binary Arithmetic Monday, January 13 CEC 220 Digital Circuit Design Binary Addition An Example of Binary Addition = = = = 0 and carry = = =  Carries Slide 3 of 14

Number Systems & Conversions Binary Arithmetic Monday, January 13 CEC 220 Digital Circuit Design Binary Subtraction An Example of Binary Subtraction = = 1 and borrow = =  = = =  Borrows Slide 4 of 14

Number Systems & Conversions Binary Arithmetic Monday, January 13 CEC 220 Digital Circuit Design Binary Multiplication An Example 0 X 0 = 0 0 X 1 = 1 X 0 = 0 1 X 1 = = X = st Partial sum 2 nd Partial sum Final prod = Slide 5 of 14

Number Systems & Conversions Binary Arithmetic Monday, January 13 CEC 220 Digital Circuit Design Binary Division =  Remainder = 2 10 = = Slide 6 of 14

… Representation of Negative Numbers Monday, January 13 CEC 220 Digital Circuit Design Unsigned Number Signed Number Magnitude MSB LSB … Magnitude MSB LSB Sign Sign bit = 0  Positive Number Sign bit = 1  Negative Number Slide 7 of 14

Representation of Negative Numbers Monday, January 13 CEC 220 Digital Circuit Design Three Representations of signed numbers  Sign & Mag, 1’s Complement, and 2’s Complement All represent positive numbers in the same way How to generate a negative number:  Sign & Mag o Simply change the sign bit  1’s Complement o Simply flip all of the bits  2’s Complement o Simply flip all of the bits and add 1 Easy for us to read Simple to generate a negative Number Easy for computer arithmetic Slide 8 of 14

Representation of Negative Numbers Monday, January 13 CEC 220 Digital Circuit Design Three Representations  Sign & Mag, 1’s Complement, and 2’s Complement +NAll three the Same NSign & Magnitude Positive Integers Negative Integers 1’s Complement ’s Complement Slide 9 of 14

Representation of Negative Numbers Monday, January 13 CEC 220 Digital Circuit Design Addition and Subtraction  Sign and Magnitude o Simple if both numbers have the same sign o More complex if the signs differ o Two different representations of “0” is problematic  1’s Complement o Addition and subtraction not so simple o Two different representations of “0” is problematic  2’s Complement o Both addition and subtraction are simple Slide 10 of 14

Monday, January 13 CEC 220 Digital Circuit Design Graphical Representation of 2’s Complement Numbers  Largest positive number is +(2 n-1 -1)  Largest negative number is -(2 n-1 ) Slide 11 of 14

Representation of Negative Numbers Monday, January 13 CEC 220 Digital Circuit Design 2’s Complement Addition  In 2’s complement addition ignore carry-out from MSB  Overflow occurs if: o Sum of two positive numbers is negative, or o Sum of two negative numbers is positive Ignore Carry out from MSB Overflow Occurred Overflow Occurred Result does NOT fit in the number of bits available Result does NOT fit in the number of bits available Slide 12 of 14

Representation of Negative Numbers Monday, January 13 CEC 220 Digital Circuit Design 2’s Complement Subtraction  Just don’t do it!!  To subtract B from A add A and (-B)  A – B = A + (-B) Overflow is NOT carry !! Carry is NOT overflow !! Overflow is NOT carry !! Carry is NOT overflow !! Slide 13 of 14

Next Lecture Monday, January 13 CEC 220 Digital Circuit Design Extending Numeric Precision Binary Codes Slide 14 of 14