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.

Slides:



Advertisements
Similar presentations
Charles Kime & Thomas Kaminski © 2004 Pearson Education, Inc. Terms of Use (Hyperlinks are active in View Show mode) Terms of Use Chapter 7 – Registers.
Advertisements

Charles Kime & Thomas Kaminski © 2008 Pearson Education, Inc. (Hyperlinks are active in View Show mode) Chapter 4 – Arithmetic Functions Logic and Computer.
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:
Overview Iterative combinational circuits Binary adders
Charles Kime & Thomas Kaminski © 2004 Pearson Education, Inc. Terms of Use (Hyperlinks are active in View Show mode) Terms of Use Verilog Part 2 – Chapter.
Henry Hexmoor1 Chapter 5 Arithmetic Functions Arithmetic functions –Operate on binary vectors –Use the same subfunction in each bit position Can design.
Overview Iterative combinational circuits Binary adders
Assembly Language and Computer Architecture Using C++ and Java
Assembly Language and Computer Architecture Using C++ and Java
Chapter # 5: Arithmetic Circuits Contemporary Logic Design Randy H
Computer ArchitectureFall 2008 © August 25, CS 447 – Computer Architecture Lecture 3 Computer Arithmetic (1)
Charles Kime & Thomas Kaminski © 2004 Pearson Education, Inc. Terms of Use (Hyperlinks are active in View Show mode) Terms of Use Chapter 3 – Combinational.
CSCE 211: Digital Logic Design Chin-Tser Huang University of South Carolina.
Overview Iterative combinational circuits Binary adders
ECE 331 – Digital System Design
ECE 301 – Digital Electronics
Overview Iterative combinational circuits Binary adders
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.
Charles Kime & Thomas Kaminski © 2008 Pearson Education, Inc. (Hyperlinks are active in View Show mode) Chapter 4 – Arithmetic Functions Logic and Computer.
NEGATIVE BINARY NUMBER – Digital Circuit 1 Choopan Rattanapoka.
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.
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.
Computer Arithmetic Nizamettin AYDIN
1 Modified from  Modified from 1998 Morgan Kaufmann Publishers Chapter Three: Arithmetic for Computers citation and following credit line is included:
#1 Lec # 2 Winter EECC341 - Shaaban Positional Number Systems A number system consists of an order set of symbols (digits) with relations.
Charles Kime & Thomas Kaminski © 2004 Pearson Education, Inc. Terms of Use (Hyperlinks are active in View Show mode) Terms of Use Chapter 2 – Combinational.
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.
Chapter # 5: Arithmetic Circuits
Charles Kime & Thomas Kaminski © 2008 Pearson Education, Inc. (Hyperlinks are active in View Show mode) Chapter 4 – Arithmetic Functions Logic and Computer.
Topic: Arithmetic Circuits Course: Digital Systems Slide no. 1 Chapter # 5: Arithmetic Circuits.
Arithmetic Functions and Circuits
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.
Oct. 18, 2007SYSC 2001* - Fall SYSC2001-Ch9.ppt1 See Stallings Chapter 9 Computer Arithmetic.
Charles Kime & Thomas Kaminski © 2004 Pearson Education, Inc. Terms of Use (Hyperlinks are active in View Show mode) Terms of Use ECE/CS 352: Digital Systems.
Operations on Bits Arithmetic Operations Logic Operations
1 KU College of Engineering Elec 204: Digital Systems Design Lecture 11 Binary Adder/Subtractor.
Charles Kime & Thomas Kaminski © 2004 Pearson Education, Inc. Terms of Use (Hyperlinks are active in View Show mode) Terms of Use ECE/CS 352: Digital Systems.
Charles Kime & Thomas Kaminski © 2004 Pearson Education, Inc. Terms of Use (Hyperlinks are active in View Show mode) Terms of Use ECE/CS 352: Digital Systems.
Charles Kime & Thomas Kaminski © 2004 Pearson Education, Inc. Terms of Use (Hyperlinks are active in View Show mode) Terms of Use ECE/CS 352: Digital Systems.
Charles Kime & Thomas Kaminski © 2008 Pearson Education, Inc. (Hyperlinks are active in View Show mode) Chapter 7 – Registers and Register Transfers Part.
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.
EE2174: Digital Logic and Lab Professor Shiyan Hu Department of Electrical and Computer Engineering Michigan Technological University CHAPTER 8 Arithmetic.
Charles Kime & Thomas Kaminski © 2004 Pearson Education, Inc. Terms of Use (Hyperlinks are active in View Show mode) Terms of Use Verilog Part 3 – Chapter.
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.
08 ARTH Page 1 ECEn/CS 224 Number Representation and Binary Arithmetic.
Charles Kime & Thomas Kaminski © 2004 Pearson Education, Inc. Terms of Use (Hyperlinks are active in View Show mode) Terms of Use ECE/CS 352: Digital Systems.
Topics covered: Arithmetic CSE243: Introduction to Computer Architecture and Hardware/Software Interface.
Digital Logic Lecture 3 Binary Arithmetic By Zyad Dwekat The Hashemite University Computer Engineering Department.
CS 151: Digital Design Chapter 4: Arithmetic Functions and Circuits
CPEN Digital System Design
ECE 171 Digital Circuits Chapter 2 Binary Arithmetic Herbert G. Mayer, PSU Status 1/14/2016 Copied with Permission from prof. Mark PSU ECE.
1 CS 151 : Digital Design Chapter 4: Arithmetic Functions and Circuits 4-3 : Binary Subtraction.
Integer Operations Computer Organization and Assembly Language: Module 5.
MicroProcessors Lec. 4 Dr. Tamer Samy Gaafar. Course Web Page —
President UniversityErwin SitompulDigital Systems 7/1 Lecture 7 Digital Systems Dr.-Ing. Erwin Sitompul President University
Charles Kime & Thomas Kaminski © 2004 Pearson Education, Inc. Terms of Use (Hyperlinks are active in View Show mode) Terms of Use ECE/CS 352: Digital Systems.
Lecture 3 – Binary Arithmetic
Lecture 2 Topics Binary Arithmetic (Unsigned binary operands)
EE207: Digital Systems I, Semester I 2003/2004
Lecture 26 – Hardwired and Microprogrammed Control
Digital Systems Section 12 Binary Adders. Digital Systems Section 12 Binary Adders.
Overview Part 1 - Registers, Microoperations and Implementations
Overview Part 1 – Design Procedure Part 2 – Combinational Logic
Instructor: Alexander Stoytchev
Overview Iterative combinational circuits Binary adders
ECE 352 Digital System Fundamentals
Binary Adder/Subtractor
Lecture 4 – Binary Logic and Logic Gates
Presentation transcript:

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 Fundamentals Lecture 17: Signed Arithmetic

Chapter 5 2 Overview  Signed Integers Sign-magnitude Complement representations  Binary adder-subtractors Signed binary addition and subtraction  Overflow  Binary multiplication  Other arithmetic functions Design by contraction

Chapter 5 3 Signed Integers  Positive numbers and zero: Use unsigned n-digit, radix r numbers  Negative numbers: Need a sign bit (+ or -) By convention, the MSB is the sign bit: s a n–2  a 2 a 1 a 0 where: s = 0 for Positive numbers s = 1 for Negative numbers and a i = 0 or 1 represent the magnitude in some form.

Chapter 5 4 Signed Integer Representations  Signed-Magnitude – here the n – 1 digits are interpreted as a positive magnitude.  Signed-Complement – here the digits are interpreted as the rest of the complement of the number. Signed 1's Complement  Uses 1's Complement Arithmetic Signed 2's Complement  Uses 2's Complement Arithmetic

Chapter 5 5 Signed Integer Representation Example  r =2, n=3

Chapter 5 6 Signed-Magnitude Arithmetic  Algorithm is covered in the book  Awkward Complex rules for correction  Not covered in detail You are not expected to know this You are expected to know that it is possible  Instead, use complement-based representations One’s complement Two’s complement

Chapter 5 7 Signed-Complement Arithmetic  Addition: Use conventional unsigned adder Sign bit is produced correctly, except Overflow can occur:  If the sign bits were the same for both numbers and the sign of the result is different, an overflow has occurred.  Subtraction: Form the complement of the number you are subtracting and follow the rules for addition.

Chapter 5 8  Example 1:  Example 2:  Signed 2’s Complement Examples

Chapter 5 9  Example 1:  Example 2:  Signed 1’s Complement Examples 1 1

Chapter ’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 Invert B with XOR Add 1 by setting C 0  For S = 0, add, B is passed through unchanged

Chapter 5 11 Overflow Detection  Overflow occurs if n + 1 bits are required to contain the result from an n-bit addition or subtraction  Unsigned addition > 7: => 1011 Carry out from MSB indicates unsigned overflow  Signed addition = 5 > 4: = 101 =? –3 < 0  Sum of two positive numbers should not be negative : = 011 > 0  Sum of two negative numbers should not be positive

Chapter 5 12 Binary Multiplication  The binary digit multiplication table is trivial:  This is simply the Boolean AND function.  Form larger products the same way we form larger products in base 10. (a × b) b = 0 b = 1 a = a = 1 0 1

Chapter 5 13 Review - Decimal Example: (237 × 149) 10  Partial products are: 237 × 9, 237 × 4, and 237 × 1  Note that the partial product summation for n digit, base 10 numbers requires adding up to n digits (with carries).  Note also n × m digit multiply generates up to an m + n digit result ×

Chapter 5 14 Binary Multiplication Algorithm  We execute radix 2 multiplication by: Computing partial products, and Justifying and summing the partial products. (same as decimal)  To compute partial products: Multiply the row of multiplicand digits by each multiplier digit, one at a time. With binary numbers, partial products are very simple! They are either:  all zero (if the multiplier digit is zero), or  the same as the multiplicand (if the multiplier digit is one).

Chapter 5 15 Example: (101 x 011) Base 2  Partial products are: 101 × 1, 101 × 1, and 101 × 0  Note that the partial product summation for n digit, base 2 numbers requires adding up to n digits (with carries) in a column.  Note also n × m digit multiply generates up to an m + n digit result (same as decimal). 101 ×

Chapter 5 16 Multiplier Boolean Equations  An n × m “block” multiplier forms partial products.  Example: 2 × 2 – The logic equations for each partial-product binary digit are shown below:  We need to "add" the columns to get the product bits P0, P1, P2, and P3.  Note that some columns may generate carries. b1b1 b0b0  a1a1 a0a0 (a 0  b1)b1)  b0)b0) + (a 1  b1)b1)  b0)b0) P3P3 P2P2 P1P1 P 0

Chapter 5 17 Multiplier Arrays Using Adders  An implementation of the 2 × 2 multiplier array is shown: C 0 C 3 HA C 2 C 1 A 0 A 1 B 1 B 0 B 1 B 0

Chapter 5 18 Other Arithmetic Functions  Convenient to design the functional blocks by contraction - removal of redundancy from circuit to which input fixing has been applied  Functions Incrementing Decrementing Zero Fill and Extension

Chapter 5 19 Design by Contraction  Contraction is a technique for simplifying the logic in a functional block to implement a different function The new function must be realizable from the original function by applying rudimentary functions to its inputs  Contracted version specialized for a fixed input Logic can be much simpler

Chapter 5 20 Design by Contraction Example  Contraction of a ripple carry adder to incrementer for n = 3 Set B = 001 The middle cell can be repeated to make an incrementer with n > 3.

Chapter 5 21 Incrementing & Decrementing  Incrementing Adding a fixed value to an arithmetic variable Fixed value is often 1, called counting (up) Examples: A + 1, B + 4 Functional block is called incrementer  Decrementing Subtracting a fixed value from an arithmetic variable Fixed value is often 1, called counting (down) Examples: A  1, B  4 Functional block is called decrementer

Chapter 5 22 Zero Fill  Zero fill - filling an m-bit operand with 0s to become an n-bit operand with n > m  Filling usually is applied to the MSB end of the operand, but can also be done on the LSB end  Example: filled to 16 bits MSB end: LSB end:

Chapter 5 23 Sign Extension  Sign Extension – maintaining sign bit for a complement representation Copies the MSB of the operand into the new positions Positive operand example extended to 16 bits: Negative operand example extended to 16 bits:  Results in equivalent number in a wider representation

Chapter 5 24 Summary  Signed Integers Sign-magnitude Complement representations  Binary adder-subtractors Signed binary addition and subtraction  Overflow  Binary multiplication  Other arithmetic functions Design by contraction

Chapter 5 25 Terms of Use  © 2004 by Pearson Education,Inc. All rights reserved.  The following terms of use apply in addition to the standard Pearson Education Legal Notice.Legal Notice  Permission is given to incorporate these materials into classroom presentations and handouts only to instructors adopting Logic and Computer Design Fundamentals as the course text.  Permission is granted to the instructors adopting the book to post these materials on a protected website or protected ftp site in original or modified form. All other website or ftp postings, including those offering the materials for a fee, are prohibited.  You may not remove or in any way alter this Terms of Use notice or any trademark, copyright, or other proprietary notice, including the copyright watermark on each slide.  Return to Title Page Return to Title Page