Binary Adders. Ripple-Carry Adder

Similar documents
COMP 303 Computer Architecture Lecture 6

By, Ajinkya Karande Adarsh Yoga

Timing for Ripple Carry Adder

Number Systems and Computer Arithmetic

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

ECE 341 Midterm Exam

Week 7: Assignment Solutions

Figure 1: Verilog used to generate divider

Lecture Topics. Announcements. Today: Integer Arithmetic (P&H ) Next: continued. Consulting hours. Introduction to Sim. Milestone #1 (due 1/26)

Structure of Computer Systems

PESIT Bangalore South Campus

Tailoring the 32-Bit ALU to MIPS

COMPUTER ARITHMETIC (Part 1)

TSEA44 - Design for FPGAs

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

Introduction to Field Programmable Gate Arrays

Outline. Introduction to Structured VLSI Design. Signed and Unsigned Integers. 8 bit Signed/Unsigned Integers

Chapter 4 Arithmetic Functions

CHAPTER V NUMBER SYSTEMS AND ARITHMETIC

Arithmetic Processing

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

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

Introduction to Digital Logic Missouri S&T University CPE 2210 Multipliers/Dividers

DC57 COMPUTER ORGANIZATION JUNE 2013

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

Computer Architecture and Organization

ECE 341 Midterm Exam

Arithmetic and Logical Operations

Chapter 3: part 3 Binary Subtraction

BUILDING BLOCKS OF A BASIC MICROPROCESSOR. Part 1 PowerPoint Format of Lecture 3 of Book

Lecture Topics. Announcements. Today: Integer Arithmetic (P&H ) Next: The MIPS ISA (P&H ) Consulting hours. Milestone #1 (due 1/26)

Digital Logic & Computer Design CS Professor Dan Moldovan Spring 2010

Chapter 5 : Computer Arithmetic

Outline. EEL-4713 Computer Architecture Multipliers and shifters. Deriving requirements of ALU. MIPS arithmetic instructions

Chapter 5. Digital Design and Computer Architecture, 2 nd Edition. David Money Harris and Sarah L. Harris. Chapter 5 <1>


CPE300: Digital System Architecture and Design

carry in carry 1101 carry carry

BINARY SYSTEM. Binary system is used in digital systems because it is:

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

SUBROUTINE NESTING AND THE PROCESSOR STACK:-

Principles of Computer Architecture. Chapter 3: Arithmetic

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

Fast Arithmetic. Philipp Koehn. 19 October 2016

Computer Arithmetic Multiplication & Shift Chapter 3.4 EEC170 FQ 2005

Digital Circuit Design and Language. Datapath Design. Chang, Ik Joon Kyunghee University

Number Systems and Their Representations

Arithmetic Operations

Clocked Sequential System Design. Multiply Example

Hardware Description Languages M E 2202 Tutorial Sheet

Binary Arithmetic. Daniel Sanchez Computer Science & Artificial Intelligence Lab M.I.T.

INF2270 Spring Philipp Häfliger. Lecture 4: Signed Binaries and Arithmetic

Arithmetic Logic Unit

CHAPTER 6 ARITHMETIC, LOGIC INSTRUCTIONS, AND PROGRAMS

Chapter 4. The Processor

EEC 483 Computer Organization

9 Multiplication and Division

Microcomputers. Outline. Number Systems and Digital Logic Review

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

Digital Design with FPGAs. By Neeraj Kulkarni

EE 109 Unit 6 Binary Arithmetic

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

IT T35 Digital system desigm y - ii /s - iii

Chapter 10 Binary Arithmetics

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

CS 64 Week 1 Lecture 1. Kyle Dewey

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

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

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

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

REGISTER TRANSFER LANGUAGE

Integer Multiplication and Division

CHW 261: Logic Design

Arithmetic Logic Unit. Digital Computer Design

ECE 341. Lecture # 6

Arithmetic for Computers

University of Illinois at Chicago. Lecture Notes # 13

Lecture 6: Signed Numbers & Arithmetic Circuits. BCD (Binary Coded Decimal) Points Addressed in this Lecture

UNIT-III REGISTER TRANSFER LANGUAGE AND DESIGN OF CONTROL UNIT

ECE331: Hardware Organization and Design

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

Lecture 19: Arithmetic Modules 14-1

Computer Organization

DIGITAL ELECTRONICS. P41l 3 HOURS

R a) Simplify the logic functions from binary to seven segment display code converter (8M) b) Simplify the following using Tabular method

High speed Integrated Circuit Hardware Description Language), RTL (Register transfer level). Abstract:

ECE 2030B 1:00pm Computer Engineering Spring problems, 5 pages Exam Two 10 March 2010

D I G I T A L C I R C U I T S E E

Lecture 8: Addition, Multiplication & Division

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

Review from last time. CS152 Computer Architecture and Engineering Lecture 6. Verilog (finish) Multiply, Divide, Shift

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

Chapter 4. The Processor

Chapter 5: Computer Arithmetic

AT Arithmetic. Integer addition

CS/COE 0447 Example Problems for Exam 2 Spring 2011

Semester Transition Point. EE 109 Unit 11 Binary Arithmetic. Binary Arithmetic ARITHMETIC

Review of Last lecture. Review ALU Design. Designing a Multiplier Shifter Design Review. Booth s algorithm. Today s Outline

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

Learning Outcomes. Spiral 2-2. Digital System Design DATAPATH COMPONENTS

Transcription:

Ripple-Carry Adder Binary Adders x n y n x y x y c n FA c n - c 2 FA c FA c s n MSB position Longest delay (Critical-path delay): d c(n) = n d carry = 2n gate delays d s(n-) = (n-) d carry +d sum = 2n gate delays s s LSB position

c + x i y i c i c i x i y i i s i c i x i y i s i = x i y i c i (a) Truth table c i + = x i y i + x i c i + y i c i (b) Karnaugh maps x i y i s i c i Full adder c i + (c) Circuit 2

Implement an adder with small look-up tables (LUT) 3

Fast-carry logic in FPGAs The fast-carry logic is about a magnitude faster than the delay through a regular logic LUT. x n y n x y x y c n FCL c n - c 2 FCL c FCL c x n y n x y x y c c n c 2 XOR XOR XOR s n- s 4 s

Instruction Pipelining Instruction pipeline for a RISC Instruction fetch Instruction decode and register fetch Execution and address calculation Memory access ResultW rite back IF ID EX MEM WB Total latency: Total delay time from instruction fetch to result write back to a register Throughput (maximum frequency, registered performance): Number of results (instructions) per second 5

Instruction Pipelining (continued) Instruction number Clock number 2 3 4 5 6 7 8 9 Instruction i IF ID EX MEM WB Instruction i+ IF ID EX MEM WB Instruction i+2 IF ID EX MEM WB Instruction i+3 IF ID EX MEM WB Instruction i+4 IF ID EX MEM WB Instruction i+5 IF ID EX MEM WB 6

Arithmetic Pipelining Pipelined adders Pipelining principle can be applied to FPGA designs at little or no additional cost since each logic element contains a flip-flop, which is otherwise unused. An arithmetic operation is broken into small primitive operations. The result of each primitive operations is saved in registers after each pipeline stage. If one part of the data is not processed at a pipeline stage, this part of data should still be saved after the pipeline stage. 7

Pipelined adder 8

Modulo Adders Building block of RNS-DSP design Modulo operation is performed by (a) an extra adder or (b) a ROM look-up table. Compute (x + y) mod M where b is the number of bits of the inputs and output. The inputs x and y are modulo M numbers. 9

Multiplication and Division by 2 k Multiplication by 2 k can be implemented by shifting the bits of the operand to the left by k. Division by 2 k can be implemented by shifting the bits of the operand to the right by k. For signed numbers, it is necessary to preserve the sign. This is done by shifting the bits to the right and filling from the left with the value of the sign bit.

Binary Multipliers Multiplication of unsigned numbers by hand Multiplicand M Multiplier Q (4) () Product P (54) Multiplication of unsigned numbers

Multiplication for implementation in hardware Multiplicand M Multiplier Q (4) () Partial product + Partial product + Partial product 2 + Product P (54) Multiplication of unsigned numbers 2

Multiplier designs Serial/parallel multiplier 2N-bit adder or N-bit adder + shift registers Serial/serial multiplier One carry-save adder + shift registers Serial/parallel multiplier using carry-save adders Parallel/parallel multiplier (array multiplier) Array multiplier with N 2 full adders Fast array multiplier for FPGAs Multiplier blocks 3

Serial/parallel multiplier with a 2N-bit adder Shift register for Multiplicant Shift register for Multiplier AND gates 2N-bit adder Register for Partial Product 4

Serial/parallel multiplier with an N-bit adder Register for Multiplicant Shift register for Multiplier AND gates N-bit adder Shift register for Partial Product Product 5

Carry-save adder a b Full adder Sum bit Carry-out Y D Q Q y s Y 2 D Q y 2 Clock Q Reset 6

Serial/parallel multiplier using carry-save adders Multiplier B n- B n-2...b Multiplicant A n- A n-2...a B n- B n-2...b A n- A n-2... A shift & & & FA D FA D... FA D D D D 7

Array multiplier with N 2 full adders 8

Fast array multiplier for FPGAs 9

Multiplier blocks A 2Nx2N multiplier can be defined in terms of an NxN multiplier block. P = Y X = (Y 2 2 N +Y ) (X 2 2 N +X ) = Y 2 X 2 2 2N + (Y 2 X +Y X 2 ) 2 N + Y X Indices 2 and indicate the most significant and least significant N-bit halves, respectively. 2

Binary Dividers Division Division is the most complex operation among the 4 basic arithmetic operations. Let N denote numerator and D denominator, two results are produced: the quotient Q and the remainder R: N / D = Q + R / D 2

In division, each quotient bit is determined in a sequential trial-and-error procedure. (In multiplication, all partial products can be produced parallel.) Result should be constrained: Q N and R D For signed numbers, R and N are assumed to have the same sign. 22

23

Linear Convergence Division Algorithms Restoring divider a trial-and-error method translated directly from the pencil-and-paper method The main disadvantage of the restoring divider is that we need two steps, subtract and add (i.e., restore), to determine one quotient bit. 24

Restoring divider 25

26

27

Nonperforming divider If the denominator is larger than the remainder, we do not perform the subtraction. A temporary remainder value is tested before the remainder register is updated. Note that the following VHDL code describes a combinational circuit. t := r d; IF t >= THEN r := t; --temporary remainder value -- Nonperforming test -- Update remainder q := q * 2 + ; -- Shift left and add ELSE q :=q * 2; END IF; -- Shift left 28

Comparison of nonperforming divider with restoring divider 29

Nonrestoring divider It does not increase the critical path. Always perform the subtraction. If the remainder is negative, perform an addition of d k /2 in the next step, instead of the restoring addition of d k in the present step and the subtraction of d k /2 in the next step. The quotient bit can be positive or negative, i.e., q k =, but not zero. This is a signed-digit representation. The negative ones can be saved in the quotient register as zeros. 3

The signed-digit representation should be converted to 2 s complement representation. For example: q SD = is saved as in the quotient register. To convert: (positive ones) (negative ones) alternatively: 2 * + + Correct remainder if r < : r := r + D and q := q. 3

Fast Divider Design Division through multiplication with reciprocal of denominator The reciprocal can be computed via a look-up table for small bit width. One can use Newton Algorithm to compute the reciprocal. f(x) = /x D x = /D x k+ = x k f(x k ) / f (x k ) With f(x) = /x D, we have f (x) = /x 2. x k+ = x k (2 D x k ) 32

33

34

Division by Convergence Both numerator N and denominator D are multiplied by approximation factors f k. The 2 multiplications can be computed in parallel. After a sufficient number of iterations k (quadratic convergence), DΠ f k and NΠ f k Q Algorithm: ) Normalize N and D such that D is close to. 2) Initialize x = N and t = D. 3) Repeat the following loop until x k shows the desired precision. f k = 2 t k x k+ = x k f k t k+ = t k f k 35

36