Timing for Ripple Carry Adder

Similar documents
Clocked Sequential System Design. Multiply Example

More complicated than addition. Let's look at 3 versions based on grade school algorithm (multiplicand) More time and more area

EECS150 - Digital Design Lecture 13 - Combinational Logic & Arithmetic Circuits Part 3

COMP 303 Computer Architecture Lecture 6

Number Systems and Computer Arithmetic

COMPUTER ARITHMETIC (Part 1)

9 Multiplication and Division

VTU NOTES QUESTION PAPERS NEWS RESULTS FORUMS Arithmetic (a) The four possible cases Carry (b) Truth table x y

Divide: Paper & Pencil

CS 5803 Introduction to High Performance Computer Architecture: Arithmetic Logic Unit. A.R. Hurson 323 CS Building, Missouri S&T

Week 7: Assignment Solutions

Chapter 5 : Computer Arithmetic

Binary Adders. Ripple-Carry Adder

Integer Multiplication. Back to Arithmetic. Integer Multiplication. Example (Fig 4.25)

Tailoring the 32-Bit ALU to MIPS

COMPUTER ARCHITECTURE AND ORGANIZATION. Operation Add Magnitudes Subtract Magnitudes (+A) + ( B) + (A B) (B A) + (A B)

Module 2: Computer Arithmetic

Computer Architecture Set Four. Arithmetic

Operations On Data CHAPTER 4. (Solutions to Odd-Numbered Problems) Review Questions

Fast Arithmetic. Philipp Koehn. 19 October 2016

An instruction set processor consist of two important units: Data Processing Unit (DataPath) Program Control Unit

CS/COE 0447 Example Problems for Exam 2 Spring 2011

At the ith stage: Input: ci is the carry-in Output: si is the sum ci+1 carry-out to (i+1)st state

Computer Organization and Structure. Bing-Yu Chen National Taiwan University

ECE260: Fundamentals of Computer Engineering

COMPUTER ORGANIZATION AND. Edition. The Hardware/Software Interface. Chapter 3. Arithmetic for Computers

9/6/2011. Multiplication. Binary Multipliers The key trick of multiplication is memorizing a digit-to-digit table Everything else was just adding

COMPUTER ORGANIZATION AND DESIGN. 5 th Edition. The Hardware/Software Interface. Chapter 3. Arithmetic for Computers Implementation

Chapter 03: Computer Arithmetic. Lesson 09: Arithmetic using floating point numbers

Arithmetic Logic Unit

AT Arithmetic. Integer addition

Kinds Of Data CHAPTER 3 DATA REPRESENTATION. Numbers Are Different! Positional Number Systems. Text. Numbers. Other

Organisasi Sistem Komputer

Experiment Objectives. 2. Preparation. 3. Tasks. 3.1 Task A: String to Integer Conversion

CPE300: Digital System Architecture and Design

PESIT Bangalore South Campus

Lecture 8: Addition, Multiplication & Division

CHW 261: Logic Design

Chapter 10 - Computer Arithmetic

Arithmetic Processing

Computer Architecture and Organization

carry in carry 1101 carry carry

EE260: Logic Design, Spring n Integer multiplication. n Booth s algorithm. n Integer division. n Restoring, non-restoring

UNIT - I: COMPUTER ARITHMETIC, REGISTER TRANSFER LANGUAGE & MICROOPERATIONS

ECE331: Hardware Organization and Design

361 div.1. Computer Architecture EECS 361 Lecture 7: ALU Design : Division

Chapter 4 Section 2 Operations on Decimals

Multiplication Simple Gradeschool Algorithm for 16 Bits (32 Bit Result)

Chapter 3 Arithmetic for Computers (Part 2)

MIPS Integer ALU Requirements

By, Ajinkya Karande Adarsh Yoga

Chapter 3 Arithmetic for Computers. ELEC 5200/ From P-H slides

UNIT-III COMPUTER ARTHIMETIC

Homework 3. Assigned on 02/15 Due time: midnight on 02/21 (1 WEEK only!) B.2 B.11 B.14 (hint: use multiplexors) CSCI 402: Computer Architectures

NUMBER OPERATIONS. Mahdi Nazm Bojnordi. CS/ECE 3810: Computer Organization. Assistant Professor School of Computing University of Utah

Adding Binary Integers. Part 5. Adding Base 10 Numbers. Adding 2's Complement. Adding Binary Example = 10. Arithmetic Logic Unit

Binary Multiplication

Chapter 5: Computer Arithmetic. In this chapter you will learn about:

Computer Arithmetic Ch 8

Computer Arithmetic Ch 8

x= suppose we want to calculate these large values 1) x= ) x= ) x=3 100 * ) x= ) 7) x=100!

Accuplacer Arithmetic Study Guide

ECE 30 Introduction to Computer Engineering

Learning Objectives. Binary over Decimal. In this chapter you will learn about:

Principles of Computer Architecture. Chapter 3: Arithmetic

EE878 Special Topics in VLSI. Computer Arithmetic for Digital Signal Processing

Integer Multiplication and Division

(+A) + ( B) + (A B) (B A) + (A B) ( A) + (+ B) (A B) + (B A) + (A B) (+ A) (+ B) + (A - B) (B A) + (A B) ( A) ( B) (A B) + (B A) + (A B)

Iterative Division Techniques COMPUTER ARITHMETIC: Lecture Notes # 6. University of Illinois at Chicago

Example 2: Simplify each of the following. Round your answer to the nearest hundredth. a

Numbering systems. Dr Abu Arqoub

Digital Fundamentals. CHAPTER 2 Number Systems, Operations, and Codes

ECEN 468 Advanced Logic Design

Arithmetic Circuits. Design of Digital Circuits 2014 Srdjan Capkun Frank K. Gürkaynak.

EEC 483 Computer Organization


University of Illinois at Chicago. Lecture Notes # 13

Two-Level CLA for 4-bit Adder. Two-Level CLA for 4-bit Adder. Two-Level CLA for 16-bit Adder. A Closer Look at CLA Delay

EE878 Special Topics in VLSI. Computer Arithmetic for Digital Signal Processing

Arithmetic and Bitwise Operations on Binary Data

Topics. 6.1 Number Systems and Radix Conversion 6.2 Fixed-Point Arithmetic 6.3 Seminumeric Aspects of ALU Design 6.4 Floating-Point Arithmetic

Chapter 3: part 3 Binary Subtraction

UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering. Digital Computer Arithmetic ECE 666

Chapter 4 Arithmetic Functions

1. NUMBER SYSTEMS USED IN COMPUTING: THE BINARY NUMBER SYSTEM

The ALU consists of combinational logic. Processes all data in the CPU. ALL von Neuman machines have an ALU loop.

Chapter 5: Computer Arithmetic

EXAMPLE 1. Change each of the following fractions into decimals.

DLD VIDYA SAGAR P. potharajuvidyasagar.wordpress.com. Vignana Bharathi Institute of Technology UNIT 1 DLD P VIDYA SAGAR

UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering. Digital Computer Arithmetic ECE 666

Review: MIPS Organization

Chapter 3: Arithmetic for Computers

Floating-Point Data Representation and Manipulation 198:231 Introduction to Computer Organization Lecture 3

CPS 104 Computer Organization and Programming

In this section we cover the following: State graphs introduction Serial Adder Multiplier Divider STATE GRAPHS FOR CONTROL NETWORKS What are the

Adding Binary Integers. Part 4. Negative Binary. Integers. Adding Base 10 Numbers. Adding Binary Example = 10. Arithmetic Logic Unit

Binary Adders: Half Adders and Full Adders

Chapter 4. Operations on Data

CSE 141 Computer Architecture Summer Session Lecture 3 ALU Part 2 Single Cycle CPU Part 1. Pramod V. Argade

COMPUTER ORGANIZATION AND DESIGN

Transcription:

Timing for Ripple Carry Adder 1

2

3

Look Ahead Method 5

6

7

8

9 Look-Ahead, bits wide

10

11

Multiplication Simple Gradeschool Algorithm for 32 Bits (6 Bit Result) Multiplier Multiplicand AND gates 32 Bit Adder 6 Bit Product Register 12

Multiplication Simple Gradeschool Algorithm for 32 Bits (6 Bit Result) Multiplier Multiplicand Multiplier Register: parallel load (from source), serial output (least significant bit first) on command from control unit AND gates 32 Bit Adder 6 Bit Product Register Multiplication Simple Gradeschool Algorithm for 32 Bits (6 Bit Result) Multiplier Multiplicand Multiplicand Register: constant value for duration of algorithm. Load on command from source AND gates 32 Bit Adder 6 Bit Product Register 13

Multiplication Simple Gradeschool Algorithm for 32 Bits (6 Bit Result) Multiplier Multiplicand AND gates: form row of partial product array. In this case, 32 bits wide AND gates 32 Bit Adder 6 Bit Product Register Multiplication Simple Gradeschool Algorithm for 32 Bits (6 Bit Result) Multiplier Multiplicand 32 Bit Adder: add output of AND gates to running sum that will become product AND gates 32 Bit Adder 6 Bit Product Register 1

Multiplication Simple Gradeschool Algorithm for 32 Bits (6 Bit Result) Multiplier Multiplicand 6 Bit Product Register: contains running sum of rows of partial product array; ends with product of Multiplier, Multiplicand AND gates 32 Bit Adder 6 Bit Product Register Multiplication Simple Gradeschool Algorithm for 32 Bits (6 Bit Result) Multiplier Multiplicand Connection from Adder to the Product Register includes one-bit shift: carry out becomes MSB of Product Register, 32 Adder outputs next 32 bits, and 31 least significant bits, shifted product bits AND gates 32 Bit Adder 6 Bit Product Register 15

Multiplication Simple Gradeschool Algorithm for 32 Bits (6 Bit Result) Step 1: Clear Product Register Clear Counter Load Multiplicand Load Multiplier Step 2: (repeat 32 times) Increment Counter Load Product Register Shift Multiplier Step 3: Done Implement the Modified Gradeschool Multiplication Algorithm Multiplier (32 bits) Zero Detect Multiplicand (32+32 bits) AND gates (6 bits wide) Initial Zero Detect 6 Bit Adder 6 Bit Product Register 16

Biggest Unsigned Binary Multiply 16 Bits 16 Bits 1111111111111111 1111111111111111 ---------------- 1111111111111111 1111111111111111 1111111111111111 1111111111111111 1111111111111111 1111111111111111 1111111111111111 1111111111111111 1111111111111111 1111111111111111 1111111111111111 1111111111111111 1111111111111111 1111111111111111 1111111111111111 1111111111111111 -------------------------------- 11111111111111100000000000000001 Biggest Unsigned Binary Multiply 16 Bits 16 Bits 1111111111111111 1111111111111111 ---------------- 00000000000000001111111111111111 00000000000000011111111111111110 00000000000000111111111111111100 00000000000001111111111111111000 00000000000011111111111111110000 00000000000111111111111111100000 00000000001111111111111111000000 00000000011111111111111110000000 00000000111111111111111100000000 00000001111111111111111000000000 00000011111111111111110000000000 00000111111111111111100000000000 00001111111111111111000000000000 00011111111111111110000000000000 00111111111111111100000000000000 01111111111111111000000000000000 -------------------------------- 11111111111111100000000000000001 17

Implement the Modified Gradeschool Multiplication Algorithm Multiplier (32 bits) Zero Detect Multiplier Register: 32 bits wide; parallel load on start of algorithm, serial shift for remainder of calculation Multiplicand (32+32 bits) AND gates (6 bits wide) 6 Bit Adder 6 Bit Product Register Initial Zero Detect Implement the Modified Gradeschool Multiplication Algorithm Multiplier (32 bits) Zero Detect Zero Detect: Determines when answer is ready when no 1 bits left in the Multiplier register Multiplicand (32+32 bits) AND gates (6 bits wide) 6 Bit Adder 6 Bit Product Register Initial Zero Detect 18

Implement the Modified Gradeschool Multiplication Algorithm Multiplier (32 bits) Zero Detect Multiplicand Register: 6 bits wide; loaded with 32 zeros (in MSBits) and initial input value (32 bits); during multiply calculation shifts to the left Multiplicand (32+32 bits) AND gates (6 bits wide) 6 Bit Adder 6 Bit Product Register Initial Zero Detect Implement the Modified Gradeschool Multiplication Algorithm Multiplier (32 bits) Zero Detect Initial Zero Detect: Check for initial value of zero on input Multiplicand Multiplicand (32+32 bits) AND gates (6 bits wide) 6 Bit Adder 6 Bit Product Register Initial Zero Detect 19

Implement the Modified Gradeschool Multiplication Algorithm Multiplier (32 bits) Zero Detect AND gates: To create expanded rows of partial product array, one row at a time (single bit from Multiplier register) Multiplicand (32+32 bits) AND gates (6 bits wide) 6 Bit Adder 6 Bit Product Register Initial Zero Detect Implement the Modified Gradeschool Multiplication Algorithm Multiplier (32 bits) Zero Detect 6 Bit Adder: Addition across whole product register with entire row of Partial Product Array Multiplicand (32+32 bits) AND gates (6 bits wide) 6 Bit Adder 6 Bit Product Register Initial Zero Detect 20

Implement the Modified Gradeschool Multiplication Algorithm Multiplier (32 bits) Zero Detect 6 Bit Product Register: Result builds from addition of rows of Partial Product Array; process terminates when all remaining rows are zeros. Multiplicand (32+32 bits) AND gates (6 bits wide) 6 Bit Adder 6 Bit Product Register Initial Zero Detect Multiplication Modified Gradeschool Algorithm for 32 Bits (6 Bit Result) Step 1: Clear Product Register Load Multiplicand Load Multiplier Step 2: If MIER = 0 OR MCAND = 0, done Step 3: Load Product Register Shift Multiplier Step : If MIER = 0, then Done else Go to Step 3 21

Newer Multiply Techniques Use More Gates! Very Simple Example 10111001 x 11010111 ---------- 10111001 10111001-10111001-- 00000000--- 10111001---- 00000000----- 10111001------ 10111001------- ---------------- 1001101101011111 22

Partial Product Rows + + + + + + + Result Partial Product Rows + + + + + + + Result 23

CSA CSA CSA CSA CSA CSA CSA CSA CSA CSA CSA CSA CSA CSA CSA CSA CSA CSA CSA CSA CSA Carry Propagate Adder Answer 2

Carry-Save Adder: Minimal Row Reduction Unit (RRU) : 3 rows Output: 2 rows 3-2 RRU Note: Care must be taken to make sure that the significance of the bits is handled properly Row Reduction: any combination of 2 N -1 rows N rows 2 N -1 3 7 15 31 N 2 3 5 25

Row Reduction System 2 Bits 7-3 7-3 7-3 7-3 3-2 CPA 7-3 7-3 Division (Gradeschool) 26

Division Process A is integer (32 bits) B is integer (32 bits) Form A/B to give MQ the quotient ACC the remainder Explicatory Example: bits A is integer ( bits) B is integer ( bits) Form A/B to give MQ the quotient ( bits) ACC the remainder ( bits) 27

A / B : let A = 0111 let B = 0101 Answer should be: 0001 with a remainder: 0010 Grade School Approach 1 0101 0111 0101 0010 28

Grade School Approach Divisor 1 0101 0111 0101 0010 Quotient Dividend Remainder Activity of Divide Divisor ACC Remainder Dividend(MQ) and Quotient Subtractor 29

More General Approach Denominator of initial problem 0101 0000 0111 Start condition: all zeros (ACC) Numerator of initial problem (MQ) Initial conditions: set up registers as shown here, then left-shift the ACC-MQ pair More General Approach 0101 0000 1110 First bit of answer: zero, since 0101 is bigger than 0000, so remember that and then left shift ACC-MQ 30

More General Approach 0101 0001 110x 0 Second bit of answer: zero, since 0101 is bigger than 0001, so remember that and then left shift ACC-MQ More General Approach 0101 0011 10xx 00 Third bit of answer: zero, since 0101 is bigger than 0011, so remember that and then left shift ACC-MQ 31

More General Approach 0101 0111 0xxx 000 Fourth bit of answer: one, since 0101 is smaller than 0111, so replace ACC with 0111 0101 = 0010, and shift only MQ with the 1 bit More General Approach 0101 0010 xxxx 0001 Final result: 0001 with remainder 0010 32

More General Approach (2) 1011 0000 0010 Initial conditions: set up registers as shown here, then left-shift the ACC-MQ pair (Problem here is 2 / 11) More General Approach (2) 1011 0000 0100 First bit of answer: zero, since 1011 is bigger than 0000, so remember that and then left shift ACC-MQ 33

More General Approach (2) 1011 0000 100x 0 Second bit of answer: zero, since 1011 is bigger than 0000, so remember that and then left shift ACC-MQ More General Approach (2) 1011 0001 00xx 00 Third bit of answer: zero, since 1011 is bigger than 0001, so remember that and then left shift ACC-MQ 3

More General Approach (2) 1011 0010 0xxx 000 Fourth bit of answer: zero, since 1011 is bigger than 0010, so remember that, and since last step of algorithm, leave ACC as is and shift only MQ More General Approach (2) 1011 0010 xxxx 0000 Final result: 0000 with remainder 0010 35

More General Approach (3) 0010 0000 1101 Initial conditions: set up registers as shown here, then left-shift the ACC-MQ pair (Problem here is 13 / 2) More General Approach (3) 0010 0001 1010 First bit of answer: zero, since 0010 is bigger than 0001, so remember that and then left shift ACC-MQ 36

More General Approach (3) 0010 0011 010x 0 Second bit of answer: one, since 0010 is less than 0011, so replace ACC with 0011 0010 = 0001, then remember the 1 and left shift ACC-MQ More General Approach (3) 0010 0010 10xx 01 Third bit of answer: one, since 0010 is same as 0010, so replace ACC with 0010 0010 = 0000, remember the 1 and then left shift ACC-MQ 37

More General Approach (3) 0010 0001 0xxx 011 Fourth bit of answer: zero, since 0010 is bigger than 0001, so remember that, and since last step of algorithm, leave ACC as is and shift only MQ More General Approach (3) 0010 0001 xxxx 0110 Final result: 0110 with remainder 0001 38

Division Algorithm Initialization: Divisor (D S ) <= input value Dividend (MQ) <= input value Remainder (ACC) <= zero Count <= zero Note: this algorithm takes advantage of the fact that the MQ register starts with Dividend and ends with Quotient Division Algorithm Step 2: Left shift ACC-MQ pair Step 3: if ACC >= D S then ACC <= ACC D S ; FF <= 1 ; else FF <= 0 ; end if; Count <= Count + 1; 39

Division Algorithm Step : if Last Iteration then left shift MQ-FF; else left shift ACC-MQ-FF; end if; Step 5: if Count < Termination then return to Step 3; else Done; end if; High Speed Division Use High Speed Multiplier Follows Newton-Raphson iteration method Can find correct answer after few iterations 0

High Speed Divide A B High Speed Divide A f B f 0 0 1

High Speed Divide A f B f 0 0 let B = 1 x, then x = 1- B, and let f0 = 1 + x = 2 - B High Speed Divide A f B f 0 0 let B = 1 x, then x = 1 - f 0 = 1 + x = AND : B, and let 2 - B B f0 = (1- x) (1+ x) = 1- x 2 2

3 High Speed Divide 3 2 1 0 3 2 1 0 f f f f f B f f f f f A A B 2 s Comp 2 s Comp 2 s Comp 2 s Comp Answer

Floating Point Arithmetic Addition of Floating Point Numbers 163.75 = 11001100010.1100 = 1.10011000101100 x 2 10 IEEE: 10 + 127 = 137 10 = 10001001 2 so, 0 10001001 10011000101100000000000

Addition of Floating Point Numbers 163.75 = 11001100010.1100 = 1.10011000101100 x 2 10 IEEE: 10 + 127 = 137 10 = 10001001 2 so, 0 10001001 10011000101100000000000 98.0625 = 111110010.0001 = 1.111100100001 x 2 8 IEEE: 8 + 127 = 135 10 = 10000111 2 so, 0 10000111 11110010000100000000000 Addition of Floating Point Numbers Step 1: Determine larger of two numbers by comparing the exponents Number A: 10001001 Number B: 10000111 A B = 00000010 Number A is bigger than Number B by a factor of about (2 2 ) 5

Addition of Floating Point Numbers Step 2: Represent numbers in same format of user s choosing. Choice here is two words (6 bits) with p=56. Note: keep track of fact that this is x 2 10 0000 0001. 1001 1000 1011 0000 0000 0000 0000 0000 0000 0000 0111 1100 1000 0100 0000 0000 0000 0000 Addition of Floating Point Numbers Step 3: do the addition: 0000 0001. 1001 1000 1011 0000 0000 0000 0000 0000 0000 0000 0111 1100 1000 0100 0000 0000 0000 0000 ---------------------------------------------------------------------------- 0000 0010 0001 0101 0011 0100 0000 0000 0000 0000 6

Addition of Floating Point Numbers Step : Post normalize: (restore normalized condition) and adjust exponent 0000 0001 0000 1010 1001 1010 0000 0000 0000 0000 x 2 1 So, final IEEE representation: 0 10001010 00001010100110100000000 Addition of Floating Point Numbers 163.75 = 11001100010.1100 = 1.10011000101100 x 2 10 IEEE: 10 + 127 = 137 10 = 10001001 2 so, 0 10001001 10011000101100000000000-1555.55 = 11000010011.10001100110011001100 = 1.100001001110001100110011001100 x 2 10 IEEE: 10 + 127 = 137 10 = 10001001 2 so, 1 10001001 10000100111000110011001 7

Addition of Floating Point Numbers Step 1: Determine larger of two numbers by comparing the exponents Number A: 10001001 Number B: 10001001 A B = 00000000 Number A is same order of magnitude as Number B; no alignment necessary Addition of Floating Point Numbers Step 2: Represent numbers in same format of user s choosing. Choice here is two words (6 bits) with p=56. Note: keep track of fact that this is x 2 10 0000 0001. 1001 1000 1011 0000 0000 0000 0000 0000 0000 0001. 1000 0100 1110 0011 0011 0011 0011 0000 8

Addition of Floating Point Numbers Step 3: do the addition (in this case, subtraction): 0000 0001. 1001 1000 1011 0000 0000 0000 0000 0000 0000 0001. 1000 0100 1110 0011 0011 0011 0011 0000 ---------------------------------------------------------------------------- 0000 0000 0001 0011 1100 1100 1100 1100 1101 0000 Addition of Floating Point Numbers Step : Post normalize: (restore normalized condition) and adjust exponent 0000 0001 0011 1100 1100 1100 1100 1101 0000 x 2 - So, final IEEE representation: 0 10000101 00111100110011001100110 9