1 CS 151 : Digital Design Chapter 4: Arithmetic Functions and Circuits 4-3 : Binary Subtraction.

Slides:



Advertisements
Similar presentations
Charles Kime & Thomas Kaminski © 2008 Pearson Education, Inc. (Hyperlinks are active in View Show mode) Chapter 4 – Arithmetic Functions Logic and Computer.
Advertisements

Addition and Subtraction. Outline Arithmetic Operations (Section 1.2) – Addition – Subtraction – Multiplication Complements (Section 1.5) – 1’s complement.
CSE 111 Binary Arithmetic Thanks to Dr. Schindler.
Computer Engineering (Logic Circuits) Dr. Tamer Samy Gaafar Lec. # 2
Henry Hexmoor1 Chapter 5 Arithmetic Functions Arithmetic functions –Operate on binary vectors –Use the same subfunction in each bit position Can design.
ECE 331 – Digital System Design
Chapter 1 Binary Systems 1-1. Digital Systems
King Fahd University of Petroleum and Minerals
Overview Iterative combinational circuits Binary adders
CS 151 Digital Systems Design Lecture 3 More Number Systems.
Number Systems Standard positional representation of numbers:
CSCI 232© 2005 JW Ryder1 Bases  = (3 * 10 2 ) + (2 * 10 1 ) + (4 * 10 0 )  = (3 * 8 2 ) + (2 * 8 1 ) + (4 * 8 0 )  = (1 * 2 3 )
Computer ArchitectureFall 2008 © August 25, CS 447 – Computer Architecture Lecture 3 Computer Arithmetic (1)
Overview Iterative combinational circuits Binary adders
VIT UNIVERSITY1 ECE 103 DIGITAL LOGIC DESIGN CHAPTER I NUMBER SYSTEMS AND CODES Reference: M. Morris Mano & Michael D. Ciletti, "Digital Design", Fourth.
Overview Iterative combinational circuits Binary adders
DIGITAL SYSTEMS TCE1111 Representation and Arithmetic Operations with Signed Numbers Week 6 and 7 (Lecture 1 of 2)
ENGIN112 L3: More Number Systems September 8, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 3 More Number Systems.
Computer ArchitectureFall 2007 © August 29, 2007 Karem Sakallah CS 447 – Computer Architecture.
9/15/09 - L15 Decoders, Multiplexers Copyright Joanne DeGroat, ECE, OSU1 Binary additon & subtraction.
Charles Kime & Thomas Kaminski © 2008 Pearson Education, Inc. (Hyperlinks are active in View Show mode) Chapter 4 – Arithmetic Functions Logic and Computer.
Chapter 3 Data Representation part2 Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2010.
1.6 Signed Binary Numbers.
Dr. Bernard Chen Ph.D. University of Central Arkansas
Digital Systems and Binary Numbers
Chapter3 Fixed Point Representation Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2009.
Computer Arithmetic Nizamettin AYDIN
BINARY ARITHMETIC Binary arithmetic is essential in all digital computers and in many other types of digital systems.
#1 Lec # 2 Winter EECC341 - Shaaban Positional Number Systems A number system consists of an order set of symbols (digits) with relations.
ECEN2102 Digital Logic Design Lecture 1 Numbers Systems Abdullah Said Alkalbani University of Buraimi.
Chapter 4 – Arithmetic Functions and HDLs Logic and Computer Design Fundamentals.
Charles Kime & Thomas Kaminski © 2008 Pearson Education, Inc. (Hyperlinks are active in View Show mode) Chapter 4 – Arithmetic Functions Logic and Computer.
Charles Kime & Thomas Kaminski © 2008 Pearson Education, Inc. (Hyperlinks are active in View Show mode) Chapter 4 – Arithmetic Functions Logic and Computer.
Arithmetic Functions and 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.
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.
Week #5 Arithmetic Circuits
ECE 301 – Digital Electronics Unsigned and Signed Numbers, Binary Arithmetic of Signed Numbers, and Binary Codes (Lecture #2)
Charles Kime & Thomas Kaminski © 2004 Pearson Education, Inc. Terms of Use (Hyperlinks are active in View Show mode) Terms of Use Logic and Computer Design.
Operations on Bits Arithmetic Operations Logic Operations
Chapter 3 Complements Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2009.
Charles Kime & Thomas Kaminski © 2004 Pearson Education, Inc. Terms of Use (Hyperlinks are active in View Show mode) Terms of Use Logic and Computer Design.
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.
Bits, Data types, and Operations: Chapter 2 COMP 2610 Dr. James Money COMP
Introduction To Number Systems Binary System M. AL-Towaileb1.
COMBINATIONAL LOGIC.
CPEN Digital Logic Design Binary Systems Spring 2004 C. Gerousis © Digital Design 3 rd Ed., Mano Prentice Hall.
Negative binary numbers 1 Computer Architectures M.
ECE DIGITAL LOGIC LECTURE 3: DIGITAL COMPUTER AND NUMBER SYSTEMS Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2016, 01/19/2016.
Week 1(Number System) Muhammad Ammad uddin Logic Design Lab I (CEN211)
Lecture 4: Digital Systems & Binary Numbers (4)
DIGITAL Logic DESIGN Digital system and binary numbers Lecturer: Ms. Farwah Ahmad.
CPE 201 Digital Design Lecture 3: Digital Systems & Binary Numbers (3)
Cosc 2150: Computer Organization
Digital Systems and Binary Numbers
Dr. Clincy Professor of CS
Dr. Clincy Professor of CS
COMPLEMENTS Complements are used in digital computers for simplifying the subtraction operations and for logical manipulation. There are two types of complements.
Data Representation in Computer Systems
EE207: Digital Systems I, Semester I 2003/2004
Digital Systems and Binary Numbers
Overview Part 1 – Design Procedure Part 2 – Combinational Logic
Dr. Clincy Professor of CS
CPS120: Introduction to Computer Science
Overview Iterative combinational circuits Binary adders
ECE 171 Digital Circuits Chapter 2 Binary Arithmetic
Chapter3 Fixed Point Representation
Presentation transcript:

1 CS 151 : Digital Design Chapter 4: Arithmetic Functions and Circuits 4-3 : Binary Subtraction

CS Unsigned Subtraction Algorithm for performing M - N:  Subtract the subtrahend N from the minuend M  If no end borrow occurs, then M ≥ N, and the result is a non- negative number and correct.  If an end borrow occurs, the N > M and the difference M  N + 2 n is subtracted from 2 n, and a minus sign is appended to the result. Examples:  0111   1101 (  ) 0011 Initial result with 4 bits An end borrow requires correction: subtract from 2 4 = 16 Final result – negative

CS Unsigned Subtraction (continued) 2’s complement of N The subtraction, 2 n  N, is called taking the 2’s complement of N To do both unsigned addition and unsigned subtraction requires: Quite complex! Goal: Shared simpler logic for both addition and subtraction Introduce complements as an approach

CS Complements Two types of complements:  Diminished Radix Complement of N (r  1)’s complement for radix r Defined as (r n    –   1’s complement for radix 2 (2 n   is a binary number represented by n 1’s.  Radix Complement r’s complement for radix r Defined as r n  N 2’s complement in binary 2 n is represented by a binary number that consists of a 1 followed by n 0’s. Subtraction is done by adding the complement of the subtrahend If the result is negative, takes its 2’s complement

CS Binary 1's Complement For r = 2, N = , n = 8 (8 digits): (r n – 1) = = or The 1's complement of is then: – Since the 2 n – 1 factor consists of all 1's and since 1 – 0 = 1 and 1 – 1 = 0, the one's complement is obtained by complementing each individual bit (bitwise NOT). A # with 8 1’s

CS Binary 2's Complement For r = 2, N = , n = 8 (8 digits), we have: (r n ) = or The 2's complement of is then: – Note the result is the 1's complement plus 1, a fact that can be used in designing hardware A 1 followed by 8 0’s

CS Alternate 2 ’ s Complement Method Given: an n-bit binary number, beginning at the least significant bit and proceeding upward:  Copy all least significant 0’s  Copy the first 1  Complement all bits thereafter. 2’s Complement Example:  Copy underlined bits: 100  and complement bits to the left: First 1

CS Subtraction with 2 ’ s Complement For n-digit, unsigned numbers M and N, find M  N in base 2:  Add the 2's complement of the subtrahend N to the minuend M: M + (2 n  N) = M  N + 2 n  If M  N, the sum produces end carry r n which is discarded; from above, M  N remains.  If M < N, the sum does not produce an end carry and, from above, is equal to 2 n  ( N  M ), the 2's complement of ( N  M ).  To obtain the result  (N – M), take the 2's complement of the sum and place a  to its left.

CS Unsigned 2 ’ s Complement Subtraction Example 1 Find – – The carry of 1 indicates that no correction of the result is required. 1 2’s comp

CS Unsigned 2 ’ s Complement Subtraction Example 2 Find – – The carry of 0 indicates that a correction of the result is required. Result = – ( ) 0 2’s comp

CS ’ s Complement Adder/Subtractor Subtraction can be done by addition of the 2's Complement. 1. Complement each bit (1's Complement.) 2. Add 1 to the result. The circuit shown computes A + B and A – B: For S = 1, subtract, the 2’s complement of B is formed by using XORs to form the 1’s comp and adding the 1 applied to C 0. For S = 0, add, B is passed through unchanged