9/15/09 - L15 Decoders, Multiplexers Copyright 2009 - Joanne DeGroat, ECE, OSU1 Binary additon & subtraction.

Slides:



Advertisements
Similar presentations
Combinational Circuits. Analysis Diagram Designing Combinational Circuits In general we have to do following steps: 1. Problem description 2. Input/output.
Advertisements

EET 1131 Unit 7 Arithmetic Operations and Circuits
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.
Number Bases Informatics INFO I101 February 9, 2004 John C. Paolillo, Instructor.
CSE 111 Binary Arithmetic Thanks to Dr. Schindler.
Computer Engineering (Logic Circuits) Dr. Tamer Samy Gaafar Lec. # 2
2’s Complement Arithmetic (remember it’s a fixed length system)
ECE 331 – Digital System Design
CS 151 Digital Systems Design Lecture 3 More Number Systems.
Computer ArchitectureFall 2008 © August 25, CS 447 – Computer Architecture Lecture 3 Computer Arithmetic (1)
1 COMP541 Arithmetic Circuits Montek Singh Mar 20, 2007.
Number Representation (1) Fall 2005 Lecture 12: Number Representation Integers and Computer Arithmetic.
Overview Iterative combinational circuits Binary adders
ECE 301 – Digital Electronics
1 CSE-221 Digital Logic Design (DLD) Lecture-1: Digital Systems & Number Systems.
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.
Charles Kime & Thomas Kaminski © 2008 Pearson Education, Inc. (Hyperlinks are active in View Show mode) Chapter 4 – Arithmetic Functions Logic and Computer.
Part 2: DESIGN CIRCUIT. LOGIC CIRCUIT DESIGN x y z F F = x + y’z x y z F Truth Table Boolean Function.
Data Representation – Chapter 3 Sections 3-2, 3-3, 3-4.
School of Computer Science G51CSA 1 Computer Arithmetic.
Chapter 3 Data Representation part2 Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2010.
9/15/09 - L15 Decoders, Multiplexers Copyright Joanne DeGroat, ECE, OSU1 Decoders and Multiplexers.
Computer Systems 1 Fundamentals of Computing Negative Binary.
Chapter3 Fixed Point Representation Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2009.
Computer Arithmetic Nizamettin AYDIN
Digital Arithmetic and Arithmetic Circuits
Chapter 4 – Arithmetic Functions and HDLs Logic and Computer Design Fundamentals.
Complement Numbers. Outline  Negative Numbers Representation  Sign-and-magnitude  1s Complement  2s Complement  Comparison of Sign-and-Magnitude.
CSE 241 Computer Organization Lecture # 9 Ch. 4 Computer Arithmetic Dr. Tamer Samy Gaafar Dept. of Computer & Systems Engineering.
ECE 301 – Digital Electronics Unsigned and Signed Numbers, Binary Arithmetic of Signed Numbers, and Binary Codes (Lecture #2)
9/15/09 - L15 Decoders, Multiplexers Copyright Joanne DeGroat, ECE, OSU1 Decoders and Multiplexer Circuits.
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
Number Systems Binary to Decimal Octal to Decimal Hexadecimal to Decimal Binary to Octal Binary to Hexadecimal Two’s Complement.
ECE 331 – Digital System Design Representation and Binary Arithmetic of Negative Numbers and Binary Codes (Lecture #10) The slides included herein were.
9/15/09 - L15 Decoders, Multiplexers Copyright Joanne DeGroat, ECE, OSU1 Decoders and Multiplexer Circuits.
Combinational Circuits
ECE 301 – Digital Electronics Representation of Negative Numbers, Binary Arithmetic of Negative Numbers, and Binary Codes (Lecture #11) The slides included.
1 Positive numbers are well understood An n-bit number represents numbers from 0 to 2 n -1 n+m bits can be used to represent n-bit integer and m-bit fraction.
Data Representation in Computer Systems. 2 Signed Integer Representation The conversions we have so far presented have involved only positive numbers.
MIPS ALU. Building from the adder to ALU ALU – Arithmetic Logic Unit, does the major calculations in the computer, including – Add – And – Or – Sub –
COMP541 Arithmetic Circuits
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.
CHAPTER 2 Digital Combinational Logic/Arithmetic Circuits
IT1004: Data Representation and Organization Negative number representation.
Registers and Binary Arithmetic Prof. Sirer CS 316 Cornell University.
Introduction to Digital Electronics Lecture 2: Number Systems.
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.
1 CS 151 : Digital Design Chapter 4: Arithmetic Functions and Circuits 4-3 : Binary Subtraction.
MIPS ALU. Exercise – Design a selector? I need a circuit that takes two input bits, a and b, and a selector bit s. The function is that if s=0, f=a. if.
MicroProcessors Lec. 4 Dr. Tamer Samy Gaafar. Course Web Page —
Lecture 2: 8/29/2002CS149D Fall CS149D Elements of Computer Science Ayman Abdel-Hamid Department of Computer Science Old Dominion University Lecture.
President UniversityErwin SitompulDigital Systems 7/1 Lecture 7 Digital Systems Dr.-Ing. Erwin Sitompul President University
Arithmetic Circuits I. 2 Iterative Combinational Circuits Like a hierachy, except functional blocks per bit.
Lecture 4: Digital Systems & Binary Numbers (4)
Addition and Subtraction
Binary Arithmetic Binary arithmetic is essential in all digital computers and in many other types of digital systems. Addition, Subtraction, Multiplication,
Digital Systems Section 8 Multiplexers. Digital Systems Section 8 Multiplexers.
Incrementing and Decrementing
Digital Systems Section 12 Binary Adders. Digital Systems Section 12 Binary Adders.
Unit 18: Computational Thinking
L25 – Datapath ALU.
Overview Part 1 – Design Procedure Part 2 – Combinational Logic
Presentation transcript:

9/15/09 - L15 Decoders, Multiplexers Copyright Joanne DeGroat, ECE, OSU1 Binary additon & subtraction

9/15/09 - L15 Decoders, Multiplexers Copyright Joanne DeGroat, ECE, OSU2 Class 18 – Subtraction  Binary Addition and Subtraction  Subtraction circuits  Incrementer, Decrementer  Material from section 4-3 and 4-4 of text

Binary Subtraction  Have previously looked at the subtraction operation. A quick review.  Just like subtraction in any other base Minuend Subtrahand Difference  And when a borrow is needed. Note that the borrow gives us 2 in the current bit position. . 9/15/09 - L15 Decoders, Multiplexers Copyright Joanne DeGroat, ECE, OSU3

And a full example  And more ripple - 9/15/09 - L15 Decoders, Multiplexers Copyright Joanne DeGroat, ECE, OSU4

In General  When there is no borrow into the msb position, then the subtrahend in not larger than the minuend and the result is positive and correct.  If a borrow into the msb does occur, then the subtrahend is larger than the minuend. This was seen back in lecture 2. 9/15/09 - L15 Decoders, Multiplexers Copyright Joanne DeGroat, ECE, OSU5

Consider  Now do the operation 4 – 6  Correct difference is -2 or  Different because 2 n was brought in and made the operation M-N+2 n 9/15/09 - L15 Decoders, Multiplexers Copyright Joanne DeGroat, ECE, OSU6

Desired  Actual desired magnitude is N-M  To get this need to do 2 n – (M-N+2)= N-M  Doing the subtraction from 2 n gives the correct result. 9/15/09 - L15 Decoders, Multiplexers Copyright Joanne DeGroat, ECE, OSU7

Two’s compliment  But how do you represent a minus sign electronically in a computer?  How can you represent it such that arithmetic operations are manageable?  There are two types of compliments for each number base system. Have the r’s complement Have the (r-1)’s complement  For base 2 have 2’s complement and 1’s complement 9/15/09 - L15 Decoders, Multiplexers Copyright Joanne DeGroat, ECE, OSU8

1’s Complement  1’s complement of N is defined as (2 n -1)-N. If n=4 have (2 n -1) being = 1111  So for n=4 would subtract any 4-bit binary number from  This is just inverting each bit.  Example: 1’s compliment of  is /15/09 - L15 Decoders, Multiplexers Copyright Joanne DeGroat, ECE, OSU9

2’s complement  The 2’s complement is defined as 2 n -N  Can be done by subtraction of N from 2 n or adding 1 to the 1’s complement of a number.  For 6 = 0110 The 1’s complement is 1001 The 2’s complement is /15/09 - L15 Decoders, Multiplexers Copyright Joanne DeGroat, ECE, OSU10

Operation with 2’s complement  Add 4 and -6  Will use the 2’s complement of -6 or  And taking the 2’s complement of 1110 get = /15/09 - L15 Decoders, Multiplexers Copyright Joanne DeGroat, ECE, OSU11

A 2’s complement table for 4 bits  Listing the values represented. 9/15/09 - L15 Decoders, Multiplexers Copyright Joanne DeGroat, ECE, OSU12

A circuit that does +/-  A general adder subtractor  OP=0 for addition/ =1 for subtraction 9/15/09 - L15 Decoders, Multiplexers Copyright Joanne DeGroat, ECE, OSU13

Another number format  Signed magnitude – use the MSB to indicate the sign. The remaining bits indicate the magnitude. 9/15/09 - L15 Decoders, Multiplexers Copyright Joanne DeGroat, ECE, OSU14

Overflow  When adding 2 n-bit numbers it is possilbe to get a n+1 bit result if there is a carry out.  On paper it is easy just add another bit.  In 2’s complement add a msb 0 for a positive or a msb 1 for a negative.  In a computer the number of bits that can be used is fixed. 9/15/09 - L15 Decoders, Multiplexers Copyright Joanne DeGroat, ECE, OSU15

Overflow indication.  In 8-bit 2’s complement notation the range that can be represented is -127 to  Then the operation to add +70 to +80 is Carries  Also look at the addition of -70 and -80 9/15/09 - L15 Decoders, Multiplexers Copyright Joanne DeGroat, ECE, OSU16

The other addition  The addition of -70 and -80 Carries  The rule – if the carry into the msb position differs from the carry out from the msb position then an overflow has occurred.  The circuit . 9/15/09 - L15 Decoders, Multiplexers Copyright Joanne DeGroat, ECE, OSU17

Class 18 assignment  Covered sections 4-3 through 4-4  Problems for hand in none  Problems for practice 4-3, 4, 5, 6, 7, 8,16  Reading for next class: sections 5-1, 5-2 9/15/09 - L15 Decoders, Multiplexers Copyright Joanne DeGroat, ECE, OSU18