Binary Addition Binary Multiplication Section 4.5 and 4.7.

Slides:



Advertisements
Similar presentations
ECE2030 Introduction to Computer Engineering Lecture 13: Building Blocks for Combinational Logic (4) Shifters, Multipliers Prof. Hsien-Hsin Sean Lee School.
Advertisements

Combinational Circuits
Full Adder Display. Topics A 1 bit adder with LED display Ripple Adder Signed/Unsigned Subtraction Hardware Implementation of 4-bit adder.
Combinational Circuits. Analysis Diagram Designing Combinational Circuits In general we have to do following steps: 1. Problem description 2. Input/output.
Subtractor/Multiplier Section 4.5 & 4.7. Outline Delay Four Bit Subtractor Multiplier.
Addition and Subtraction. Outline Arithmetic Operations (Section 1.2) – Addition – Subtraction – Multiplication Complements (Section 1.5) – 1’s complement.
Lecture Adders Half adder.
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:
2’s Complement Arithmetic (remember it’s a fixed length system)
James Tam Numerical Representations On The Computer: Negative And Rational Numbers How are negative and rational numbers represented on the computer?
Addition (2). Outline Full Adder 3-Bit Adder 2’s Complement Subtraction.
Henry Hexmoor1 Chapter 5 Arithmetic Functions Arithmetic functions –Operate on binary vectors –Use the same subfunction in each bit position Can design.
1 COMP541 Arithmetic Circuits Montek Singh Mar 20, 2007.
1 Lecture 8: Binary Multiplication & Division Today’s topics:  Addition/Subtraction  Multiplication  Division Reminder: get started early on assignment.
Overview Iterative combinational circuits Binary adders
ECE 301 – Digital Electronics
IT Systems Number Operations EN230-1 Justin Champion C208 –
ENGIN112 L14: Binary Adder Subtractor October 3, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 14 Binary Adders and Subtractors.
Complements: different approaches for representing negative numbers
Addition and Subtraction with Signed- Magnitude Data (Mano, Section 10-2) Basics Seminar, CSc 8215 High Performance Computing (2005 Fall) Mary R. Hudachek-Buswell.
Charles Kime & Thomas Kaminski © 2008 Pearson Education, Inc. (Hyperlinks are active in View Show mode) Chapter 4 – Arithmetic Functions Logic and Computer.
Lecture Objectives: 1)Explain the relationship between addition and subtraction with twos complement numbering systems 2)Explain the concept of numeric.
CS 105 Digital Logic Design
3-1 Chapter 3 - Arithmetic Computer Architecture and Organization by M. Murdocca and V. Heuring © 2007 M. Murdocca and V. Heuring Computer Architecture.
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.
Conversion Between Lengths Positive number pack with leading zeros +18 = = Negative numbers pack with leading ones -18 =
3-1 Chapter 3 - Arithmetic Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Principles of Computer Architecture.
Binary Addition Section 4.5. Binary Addition Example.
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Arithmetic Circuits II Anselmo Lastra.
Chapter 8 Problems Prof. Sin-Min Lee Department of Mathematics and Computer Science.
Chapter 4 – Arithmetic Functions and HDLs Logic and Computer Design Fundamentals.
June 19, 2002Addition and multiplication1 Delays in the ripple carry adder The diagram below shows a 4-bit adder completely drawn out. This is called a.
Topic: Arithmetic Circuits Course: Digital Systems Slide no. 1 Chapter # 5: Arithmetic Circuits.
46 Number Systems Problem: Implement simple pocket calculator Need: Display, adders & subtractors, inputs Display: Seven segment displays Inputs: Switches.
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.
ECE 2110: Introduction to Digital Systems Signed Addition/Subtraction.
Operations on Bits Arithmetic Operations Logic Operations
درس مدارهای منطقی دانشگاه قم مدارهای منطقی محاسباتی تهیه شده توسط حسین امیرخانی مبتنی بر اسلایدهای درس مدارهای منطقی دانشگاه.
CS Data representation 1 Ch. 2.1 Data Representation Unsigned and Signed Integers – representation, addition, subtraction.
DIGITAL CIRCUITS David Kauchak CS52 – Fall 2015.
EE2174: Digital Logic and Lab Professor Shiyan Hu Department of Electrical and Computer Engineering Michigan Technological University CHAPTER 8 Arithmetic.
Combinational Circuits
Sep 29, 2004Subtraction (lvk)1 Negative Numbers and Subtraction The adders we designed can add only non-negative numbers – If we can represent negative.
Topics covered: Arithmetic CSE243: Introduction to Computer Architecture and Hardware/Software Interface.
Unit 7 Number Systems and Bases Presentation 1Binary and Base 10 Presentation 2Adding Binary Numbers Presentation 3Subtracting Binary Numbers Presentation.
COMP541 Arithmetic Circuits
69 Decimal (Base 10) Numbers n Positional system - each digit position has a value n 2534 = 2*1, * *10 + 4*1 n Alternate view: Digit position.
Computer Architecture Lecture 16 Fasih ur Rehman.
Outline Binary Addition 2’s complement Binary Subtraction Half Adder
CS/EE 3700 : Fundamentals of Digital System Design Chris J. Myers Lecture 5: Arithmetic Circuits Chapter 5 (minus 5.3.4)
COMBINATIONAL LOGIC.
Other Arithmetic Functions Section 4-5
IT1004: Data Representation and Organization Negative number representation.
1 Fundamentals of Computer Science Combinational Circuits.
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.
Computer Arthmetic Chapter Four P&H. Data Representation Why do we not encode numbers as strings of ASCII digits inside computers? What is overflow when.
ECE DIGITAL LOGIC LECTURE 15: COMBINATIONAL CIRCUITS Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2015, 10/20/2015.
Integer Operations Computer Organization and Assembly Language: Module 5.
Binary Multiplication Magnitude Comparison Section 4.5, 4.7 and 4.8.
President UniversityErwin SitompulDigital Systems 7/1 Lecture 7 Digital Systems Dr.-Ing. Erwin Sitompul President University
Lecture 7. Subtractor Prof. Taeweon Suh Computer Science & Engineering Korea University COSE221, COMP211 Logic Design.
Logic Design (CE1111 ) Lecture 4 (Chapter 4) Combinational Logic Prepared by Dr. Lamiaa Elshenawy 1.
Arithmetic Circuits I. 2 Iterative Combinational Circuits Like a hierachy, except functional blocks per bit.
Negative Numbers and Subtraction
EE207: Digital Systems I, Semester I 2003/2004
Digital Systems Section 12 Binary Adders. Digital Systems Section 12 Binary Adders.
ECE 331 – Digital System Design
Presentation transcript:

Binary Addition Binary Multiplication Section 4.5 and 4.7

Topics Calculations Examples – Signed Binary Number – Unsigned Binary Number Hardware Implementation Overflow Condition Multiplication

Unsigned Number Decimalb1b (2-bit example)

Unsigned Addition 1+2= Decimalb1b Decimalb1b1 b0b

Unsigned Addition 1+3= Decimalb1b Decimalb1b1 b0b (Carry Out) (Indicates Overflow)

Unsigned Subtraction (1) 1-2= Decimalb1b Decimalb1b1 b0b (1’s complement) (2’s complement)

Unsigned Subtraction (2) 2-1= Decimalb1b Decimalb1b

Summary for Unsigned Addition/Subtraction Overflow can be an issue in unsigned addition Unsigned Subtraction (M-N) – If M≥N, and end carry will be produced. The end carry is discarded. – If M<N, Take the 2’s complement of the sum Place a negative sign in front

Signed Binary Numbers 4-bit binary number – 1 bit is used as a signed bit – -8 to +7 – 2’s complement

Signed Addition (70+80) b7b7 b6b6 b5b5 b4b4 b3b3 b2b2 b1b1 b0b = = = = → → = = ↔-106 (Indicates a negative number) ↔ = =150 Conclusion: There is a problem of overflow Fix: Use the end carry as the sign bit, and let b7 be the extra bit.

Signed Subtraction (70-80) b7b7 b6b6 b5b5 b4b4 b3b3 b2b2 b1b1 b0b = = = = → → = ↔-10 (Indicates a negative number) (No Problem)

Signed Subtraction (-70-80) b7b7 b6b6 b5b5 b4b4 b3b3 b2b2 b1b1 b0b = = = =16+64 (Indicates a positive number! A negative number expected.) → → ↔ = = ↔-150 Conclusion: There is a problem of overflow Fix: Use the end carry as the sign bit, and let b7 be the extra bit.

Observations Given the similarity between addition and subtraction, same hardware can be used. Overflow is an issue that needs to be addressed in the hardware implementation A signed number is not processed any different from an unsigned number. The programmer must interpret the results of addition and subtraction appropriately.

Four-Bit Adder-Subtractor

The Mode Input (1)

The Mode Input (2)

M=0 0 B3B3 B2B2 B1B1 B0B0

M=1 1 2’s complement is generated of B is generated!

Unsigned Addition When two unsigned numbers are added, an overflow is detected from the end carry.

Detect Overflow in Signed Addition Observe 1.The cary into the sign bit 2.The carry out of the sign bit If they are not equal, they indicate an overflow.

Two-Bit Binary Multiplier (multiplicand) (multiplier)

Use an AND gate to multiply A 0 and B 0

Hardware Correlation

A Four-Bit Adder

Four-bit by three-bit Binary Multiplier B3B2B1B0 A2A1A0 0A0B3A0B2A0B1A0B0 A1B3A1B2A1B1A1B0 C14S13S12S11S10 A2B3A2B2A2B1A2B0 C6C5C4C3C2C1C0 S10=A0B1+A1B0 S11=A0B2+A1B1+C1 S12=A0B3+A1B2+C2 S13=0+A1B3+C3 (S1X, where 1 is the first 4-bit adder)

Four-bit by three-bit Binary Multiplier