EECS 150 - Components and Design Techniques for Digital Systems Lec 16 – Arithmetic II (Multiplication) David Culler Electrical Engineering and Computer.

Slides:



Advertisements
Similar presentations
ECE2030 Introduction to Computer Engineering Lecture 13: Building Blocks for Combinational Logic (4) Shifters, Multipliers Prof. Hsien-Hsin Sean Lee School.
Advertisements

Introduction So far, we have studied the basic skills of designing combinational and sequential logic using schematic and Verilog-HDL Now, we are going.
Datorteknik ArithmeticCircuits bild 1 Computer arithmetic Somet things you should know about digital arithmetic: Principles Architecture Design.
Fast Adders See: P&H Chapter 3.1-3, C Goals: serial to parallel conversion time vs. space tradeoffs design choices.
Fast Adders See: P&H Chapter 3.1-3, C Goals: serial to parallel conversion time vs. space tradeoffs design choices.
Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University Arithmetic See: P&H Chapter 3.1-3, C.5-6.
Henry Hexmoor1 Chapter 5 Arithmetic Functions Arithmetic functions –Operate on binary vectors –Use the same subfunction in each bit position Can design.
ECE 331 – Digital System Design
EECS Components and Design Techniques for Digital Systems Lec 17 – Addition, Subtraction, and Negative Numbers David Culler Electrical Engineering.
1 CS 140 Lecture 14 Standard Combinational Modules Professor CK Cheng CSE Dept. UC San Diego Some slides from Harris and Harris.
Copyright 2008 Koren ECE666/Koren Part.6b.1 Israel Koren Spring 2008 UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering Digital Computer.
EECS Components and Design Techniques for Digital Systems Lec 18 – Arithmetic II (Multiplication) David Culler Electrical Engineering and Computer.
Chapter 6 Arithmetic. Addition Carry in Carry out
ECE C03 Lecture 61 Lecture 6 Arithmetic Logic Circuits Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
UNIVERSITY OF MASSACHUSETTS Dept
Chapter # 5: Arithmetic Circuits Contemporary Logic Design Randy H
Lecture 8 Arithmetic Logic Circuits
1 EECS Components and Design Techniques for Digital Systems Lec 21 – RTL Design Optimization 11/16/2004 David Culler Electrical Engineering and Computer.
Contemporary Logic Design Arithmetic Circuits © R.H. Katz Lecture #24: Arithmetic Circuits -1 Arithmetic Circuits (Part II) Randy H. Katz University of.
ECE 301 – Digital Electronics
ECE 301 – Digital Electronics
Copyright 2008 Koren ECE666/Koren Part.6a.1 Israel Koren Spring 2008 UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering Digital Computer.
Spring 2002EECS150 - Lec10-cl1 Page 1 EECS150 - Digital Design Lecture 10 - Combinational Logic Circuits Part 1 Feburary 26, 2002 John Wawrzynek.
ENGIN112 L14: Binary Adder Subtractor October 3, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 14 Binary Adders and Subtractors.
Datapath Functional Units Adapted from David Harris of Harvey Mudd College.
Chapter 5 Arithmetic Logic Functions. Page 2 This Chapter..  We will be looking at multi-valued arithmetic and logic functions  Bitwise AND, OR, EXOR,
Charles Kime & Thomas Kaminski © 2008 Pearson Education, Inc. (Hyperlinks are active in View Show mode) Chapter 4 – Arithmetic Functions Logic and Computer.
EECS Components and Design Techniques for Digital Systems Lec 15 – Addition, Subtraction, and Negative Numbers David Culler Electrical Engineering.
ECE 4110– Sequential Logic Design
Aug Shift Operations Source: David Harris. Aug Shifter Implementation Regular layout, can be compact, use transmission gates to avoid threshold.
Chapter 6-2 Multiplier Multiplier Next Lecture Divider
Digital Arithmetic and Arithmetic Circuits
Digital Integrated Circuits Chpt. 5Lec /29/2006 CSE477 VLSI Digital Circuits Fall 2002 Lecture 21: Multiplier Design Mary Jane Irwin (
ECE 645 – Computer Arithmetic Lecture 7: Tree and Array Multipliers ECE 645—Computer Arithmetic 3/18/08.
Chapter 4 – Arithmetic Functions and HDLs Logic and Computer Design Fundamentals.
Chapter # 5: Arithmetic Circuits
Chapter 6-1 ALU, Adder and Subtractor
5-1 Programmable and Steering Logic Chapter # 5: Arithmetic Circuits.
Spring 2002EECS150 - Lec12-cl3 Page 1 EECS150 - Digital Design Lecture 12 - Combinational Logic Circuits Part 3 March 4, 2002 John Wawrzynek.
Advanced VLSI Design Unit 05: Datapath Units. Slide 2 Outline  Adders  Comparators  Shifters  Multi-input Adders  Multipliers.
EKT 221/4 DIGITAL ELECTRONICS II  Registers, Micro-operations and Implementations - Part3.
COE 202: Digital Logic Design Combinational Circuits Part 2 KFUPM Courtesy of Dr. Ahmad Almulhem.
Spring C:160/55:132 Page 1 Lecture 19 - Computer Arithmetic March 30, 2004 Sukumar Ghosh.
CDA 3101 Fall 2013 Introduction to Computer Organization The Arithmetic Logic Unit (ALU) and MIPS ALU Support 20 September 2013.
Half Adder & Full Adder Patrick Marshall. Intro Adding binary digits Half adder Full adder Parallel adder (ripple carry) Arithmetic overflow.
EE2174: Digital Logic and Lab Professor Shiyan Hu Department of Electrical and Computer Engineering Michigan Technological University CHAPTER 8 Arithmetic.
1 Arithmetic I Instructor: Mozafar Bag-Mohammadi Ilam University.
Lecture 4. Adder & Subtractor Prof. Taeweon Suh Computer Science Education Korea University 2010 R&E Computer System Education & Research.
COMP541 Arithmetic Circuits
ECE 645 – Computer Arithmetic Lecture 6: Multi-Operand Addition ECE 645—Computer Arithmetic 3/5/08.
Topics covered: Arithmetic CSE243: Introduction to Computer Architecture and Hardware/Software Interface.
ECE 331 – Digital System Design Multi-bit Adder Circuits, Adder/Subtractor Circuit, and Multiplier Circuit (Lecture #12)
CS/EE 3700 : Fundamentals of Digital System Design Chris J. Myers Lecture 5: Arithmetic Circuits Chapter 5 (minus 5.3.4)
CPEN Digital System Design
Addition, Subtraction, Logic Operations and ALU Design
1 Fundamentals of Computer Science Combinational Circuits.
ECE/CS 552: Arithmetic I Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes partially based on set created by Mark Hill.
1 Lecture 14 Binary Adders and Subtractors. 2 Overview °Addition and subtraction of binary data is fundamental Need to determine hardware implementation.
Lecture #23: Arithmetic Circuits-1 Arithmetic Circuits (Part I) Randy H. Katz University of California, Berkeley Fall 2005.
Integer Multiplication and Division COE 301 Computer Organization Dr. Muhamed Mudawar College of Computer Sciences and Engineering King Fahd University.
Reconfigurable Computing - Options in Circuit Design John Morris Chung-Ang University The University of Auckland ‘Iolanthe’ at 13 knots on Cockburn Sound,
ETE 204 – Digital Electronics Combinational Logic Design Single-bit and Multiple-bit Adder Circuits [Lecture: 9] Instructor: Sajib Roy Lecturer, ETE,ULAB.
Full Adder Truth Table Conjugate Symmetry A B C CARRY SUM
Combinational Circuits
Somet things you should know about digital arithmetic:
ECE 331 – Digital System Design
Unsigned Multiplication
CS 140 Lecture 14 Standard Combinational Modules
CSE 140 Lecture 14 Standard Combinational Modules
Number Representation
Presentation transcript:

EECS Components and Design Techniques for Digital Systems Lec 16 – Arithmetic II (Multiplication) David Culler Electrical Engineering and Computer Sciences University of California, Berkeley

Overview Review of Addition Overflow Multiplication Further adder optimizations for multiplication CLA in the large – parallel prefix

Review Circuit design for unsigned addition –Full adder per bit slice –Delay limited by Carry Propagation »Ripple is algorithmically slow, but wires are short Carry select –Simple, resource-intensive –Excellent layout Carry look-ahead –Excellent asymptotic behavior –Great at the board level, but wire length effects are significant on chip Digital number systems –How to represent negative numbers –Simple operations –Clean algorithmic properties 2s complement is most widely used –Circuit for unsigned arithmetic –Subtract by complement and carry in –Overflow when cin xor cout of sign-bit is 1

Computer Number Systems Positional notation –D n-1 D n-2 …D 0 represents D n-1 B n-1 + D n-2 B n-2 + …+ D 0 B 0 where D i  { 0, …, B-1 } 2s Complement –D n-1 D n-2 …D 0 represents: - D n-1 2 n-1 + D n-2 2 n-2 + …+ D –MSB has negative weight

2s Complement Overflow Add two positive numbers to get a negative number or two negative numbers to get a positive number = -8! = +7! How can you tell an overflow occurred ?

2s comp. Overflow Detection Overflow No overflow Overflow occurs when carry in to sign does not equal carry out

2s Complement Adder/Subtractor A - B = A + (-B) = A + B + 1

Adders on the Xilinx Virtex Dedicated carry logic provides fast arithmetic carry capability for high- speed arithmetic functions. The Virtex-E CLB supports two separate carry chains, one per Slice. The height of the carry chains is two bits per CLB. The arithmetic logic includes an XOR gate and AND gate that allows a 2- bit full adder to be implemented within a slice. Cin to Cout delay = 0.1ns, versus 0.4ns for F to X delay. How do we map a 2-bit adder to one slice?

Time / Space (resource) Trade-offs Carry select and CLA utilize more silicon to reduce time. Can we use more time to reduce silicon? How few FAs does it take to do addition?

Bit-serial Adder Addition of 2 n-bit numbers: –takes n clock cycles, –uses 1 FF, 1 FA cell, plus registers –the bit streams may come from or go to other circuits, therefore the registers may be optional. Requires controller –What does the FSM look like? Implemented? Final carry out? A, B, and R held in shift- registers. Shift right once per clock cycle. Reset is asserted by controller. lsb

Discussion What is sign extension and why does it work? Where is addition used in the project? Where might you want more powerful arithmetic operations?

Announcements Reading: 5.8 (4 pages!) Digital Design in the news – from UCB –UC Berkeley is among six universities to be part of the program started by IBM Corp. and Google Inc. on college campuses to promote computer-programming techniques for clusters of processors known as "clouds". Cloud computing allows computers in remote data centers to run parallel, increasing their processing power. Each company will spend between $20 million and $25 million for hardware, software and services that can be used by computer-science professors and students.IBM CorpGoogle Inc.

Basic concept of multiplication multiplicand multiplier 1101 (13) 1011 (11) * (143) Partial products product of 2 n-bit numbers is an 2n-bit number –sum of n n-bit partial products unsigned

Combinational Multiplier: accumulation of partial products A0 B0 A0 B0 A1 B1 A1 B0 A0 B1 A2 B2 A2 B0 A1 B1 A0 B2 A3 B3 A2 B0 A2 B1 A1 B2 A0 B3 A3 B1 A2 B2 A1 B3 A3 B2 A2 B3 A3 B3 S6 S5 S4 S3S2 S1S0 S7

Array Multiplier Each row: n-bit adder with AND gates What is the critical path? Generates all n partial products simultaneously.

“Shift and Add” Multiplier Sums each partial product, one at a time. In binary, each partial product is shifted versions of A or 0. Control Algorithm: 1. P  0, A  multiplicand, B  multiplier 2. If LSB of B==1 then add A to P else add 0 3. Shift [P][B] right 1 4. Repeat steps 2 and 3 n-1 times. 5. [P][B] has product. Cost  n,  = n clock cycles. What is the critical path for determining the min clock period?

Carry-save Addition Speeding up multiplication is a matter of speeding up the summing of the partial products. “Carry-save” addition can help. Carry-save addition passes (saves) the carries to the output, rather than propagating them. Example: sum three numbers, 3 10 = 0011, 2 10 = 0010, 3 10 = c 0100 = 4 10 s 0001 = c 0010 = 2 10 s 0110 = = 8 10 carry-save add carry-propagate add In general, carry-save addition takes in 3 numbers and produces 2. Whereas, carry-propagate takes 2 and produces 1. With this technique, we can avoid carry propagation until final addition

Carry-save Circuits When adding sets of numbers, carry-save can be used on all but the final sum. Standard adder (carry propagate) is used for final sum.

Array Mult. using Carry-save Addition Fast carry- propagate adder

Another Representation Building block: full adder + and 4 x 4 array of building blocks Add CPA

Carry-save Addition CSA is associative and commutative. For example: (((X 0 + X 1 ) + X 2 ) + X 3 ) = ((X 0 + X 1 ) +( X 2 + X 3 )) A balanced tree can be used to reduce the logic delay. This structure is the basis of the Wallace Tree Multiplier. Partial products are summed with the CSA tree. Fast CPA (ex: CLA) is used for final sum. Multiplier delay  log 3/2 N + log 2 N

Signed Multiplier Signed Multiplication: Remember for 2’s complement numbers MSB has negative weight: ex: -6 = = = = -6 Therefore for multiplication: a) subtract final partial product b) sign-extend partial products Modifications to shift & add circuit: a) adder/subtractor b) sign-extender on P shifter register

Signed multiplication multiplicand multiplier 1101 (-3) 1011 (-5) * (15) product of 2 n-bit numbers is an 2n-bit number –sum of n n-bit partial products 1111 Note: 2s complement Sign extension (-3) (-6) -(-24)

Signed Array Multiplier b3 0b2 0b1 0b0 0 P7 P6 P5 P4 a0 0 a1 0 a2 0 a3 0 P0 P1 P2 P3 Implicit Sign extension

“Shift and Add” Signed Multiplier Signed extend partial product at each stage Final step is a subtract

Carry Look-ahead Adders In general, for n-bit addition best we can achieve is delay  log(n) How do we arrange this? (think trees) First, reformulate basic adder stage: carry “kill” k i = a i ’ b i ’ carry “propagate” p i = a i  b i carry “generate” g i = a i b i c i+1 = g i + p i c i s i = p i  c i a b c i c i+1 s

Carry Look-ahead Adders – in blocks “Group” propagate and generate signals: P true if the group as a whole propagates a carry to c out G true if the group as a whole generates a carry Group P and G can be generated hierarchically. pipi gigi p i+1 g i+1 p i+k g i+k P = p i p i+1 … p i+k G = g i+k + p i+k g i+k-1 + … + (p i+1 p i+2 … p i+k )g i c in c out C out = G + PC in

Carry Look-ahead Adders a0a0 b0b0 a1a1 b1b1 a2a2 b2b2 a a3a3 b3b3 a4a4 b4b4 a5a5 b5b5 b c 3 = G a + P a c 0 PaPa GaGa PbPb GbGb a6a6 b6b6 a7a7 b7b7 a8a8 b8b8 c c 6 = G b + P b c 3 PcPc GcGc P = P a P b P c G = G c + P c G b + P b P c G a c 9 = G + Pc 0 c0c0 9-bit Example of hierarchically generated P and G signals:

Parallel Prefix (generalizing CLA) Compute all the prefixes F i = F i-1 op F i-2 op … op F 0 Assume associative and commutative BA BA x BAx Ax

c0c0 a0a0 b0b0 s0s0 a1a1 b1b1 s1s1 c1c1 a2a2 b2b2 s2s2 a3a3 b3b3 s3s3 c3c3 c2c2 c0c0 c0c0 a4a4 b4b4 s4s4 a5a5 b5b5 s5s5 c5c5 a6a6 b6b6 s6s6 a7a7 b7b7 s7s7 c7c7 c6c6 c0c0 c4c4 c0c0 c8c8 p,g P,G c in c out P,G P a,G a P b,G b P = P a P b G = G b + G a P b C out = G + c in P aiai bibi sisi p,g cici c i+1 p = a  b g = ab s = p  c i c i+1 = g + c i p 8-bit Carry Look- ahead Adder

Summary 2 complement number systems –Algebraic and corresponding bit manipulations –Overflow detection –Signficance of “sign bit” -2 n-1 Carry look ahead is form a parallel prefix Time / Space tradeoffs –Bit serial adder Binary Multiplication algorithm –Array multiplier –Serial multiply (with bit parallel adder) Signed multiplication –Sign extend multipicand –Sign bit of multiplier treated as subtract