skip instructionseTEACH presentation accessible player instructions

This eTEACH player requires that you have Flash 8 or above installed. If you do not, download the player from Adobe.

The next major heading marks the start of the presentation. Each next lower level heading thereafter marks the beginning of a slide. An audio control button that plays the audio track for the slide follows the contents and notes for each slide in the presentation. Pressing this button after the audio playback toggles pausing and resuming the playback. Before moving off the play audio button, complete listening to the audio track for the slide or pause the audio. Control + Shift + L increases volume. Control + Shift + Q decreases volume.

There is a table of contents for the presentation following the presentation. The table of contents can be used to access sections of the presentation in random order. Type Control + Shift + C to go to the table of contents.

When links to external resources are present in the presentation, a list of these resource links follows the table of contents. When following a link to a resource, you should remember which slide you were on. When you return to the main page, your screen-reader may not return you to that slide. You can use the table of contents or just click through the headings to return to the correct slide.

This presentation contains resources. Click here to proceed immediately to the resource list. A link to resources follows each slide.

If the presentation contains one or more quizzes, a button to take you to each quiz follows the slide at which the quiz is to occur. Each question in the quiz begins with a level three heading. The answer choices will be presented in a list. If your instructor has supplied a hint for the questions, it will follow the answers and is formatted as an anchor. The correct answer to the question follows the list of answers and the hint (if included). The correct answer is also formatted as an anchor.

Chapter 2 - Part 1 - PPT - Mano & Kime - 2nd Ed

Slide 1 Lecture 17: Signed Arithmetic

Lecture 17: Signed Arithmetic

Slide 2 Overview

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

Slide 3 Signed Integers

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 an 2  a2a1a0 where: s = 0 for Positive numbers s = 1 for Negative numbers and ai = 0 or 1 represent the magnitude in some form.

Slide 4 Signed Integer Representations

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

Slide 5 Signed Integer Representation Example

Signed Integer Representation Example r =2, n=3 Number Sign - Mag. 1's Comp. 2's Comp. +3 011 011 011 +2 010 010 010 +1 001 001 001 +0 000 000 000 0 100 111 1 101 110 111 2 110 101 110 3 111 100 101 4 100

Slide 6 Signed-Magnitude Arithmetic

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

Slide 7 Signed-Complement Arithmetic

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.

Slide 8 Signed 2 s Complement Examples

Example 1: 1101 + 0011 0000 Example 2: 1101 1101 - 0011 1101 1010 Signed 2 s Complement Examples

Slide notes

Example 1: Result is 0000. The carry out of the MSB is discarded. Example 2: Complement 0011 to 1101 and add. Result is 1010. The carry out of the MSB is discarded.

Slide 9 Signed 1 s Complement Examples

Example 1: 1101 + 0011 0000 1 0001 Example 2: 1101 1101 - 0011 1100 1001 1 1010 Signed 1 s Complement Examples 1 1

Slide notes

Example 1: Adding, the result is 0000 and the carry from the MSB is 1. This carry is added to the LSB to give final result 0001 Example 2: Take the 1s complement of 0011 to obtain 1100 and add. The result is 1001 and the carry from the MSB is 1. Adding this carry to the LSB, the final result is 1010.

Slide 10 2 s Complement Adder/Subtractor

2 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 C0 For S = 0, add, B is passed through unchanged Adobe Systems

Slide 11 Overflow Detection

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

Slide 12 Binary Multiplication

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 = 0 0 0 a = 1 0 1

Slide 13 Review - Decimal Example: (237 149)10

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. 2 3 7 × 1 4 9 2 1 3 3 9 4 8 - + 3 5 3 1 3 2 3 7 - -

Slide 14 Binary Multiplication Algorithm

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).

Slide 15 Example: (101 x 011) Base 2

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). 1 0 1 × 0 1 1 1 0 1 1 0 1 0 0 0 0 0 1 1 1 1

Slide 16 Multiplier Boolean Equations

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. b1 b0 ´ a1 a0 (a0 . b1) (a0 . b0) + (a1 . b1) (a1 . b0) P3 P2 P1 P0

Slide 17 Multiplier Arrays Using Adders

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

Slide 18 Other Arithmetic Functions

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

Slide 19 Design by Contraction

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

Slide 20 Design by Contraction Example

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. Adobe Systems

Slide 21 Incrementing & Decrementing

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

Slide 22 Zero Fill

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: 11110101 filled to 16 bits MSB end: 0000000011110101 LSB end: 1111010100000000

Slide 23 Sign Extension

Sign Extension Sign Extension maintaining sign bit for a complement representation Copies the MSB of the operand into the new positions Positive operand example - 01110101 extended to 16 bits: 0000000001110101 Negative operand example - 11110101 extended to 16 bits: 1111111111110101 Results in equivalent number in a wider representation

Slide 24 Summary

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

End of slides

Table of Contents

The object immediately following this sentence is the media player.


You need to upgrade your Flash Player.
Please download and install the latest Flash Player.
If you have the latest Flash Player and are still seeing this message, proceed.