Penn ESE534 Spring2014 -- DeHon 1 ESE534: Computer Organization Day 3: February 3, 2014 Arithmetic Work preclass exercise.

Slides:



Advertisements
Similar presentations
Penn ESE534 Spring DeHon 1 ESE534: Computer Organization Day 14: March 19, 2014 Compute 2: Cascades, ALUs, PLAs.
Advertisements

Chapter 4 -- Modular Combinational Logic. Decoders.
L10 – Transistors Logic Math 1 Comp 411 – Spring /22/07 Arithmetic Circuits Didn’t I learn how to do addition in the second grade?
Comparator.
Caltech CS184a Fall DeHon1 CS184a: Computer Architecture (Structures and Organization) Day3: October 2, 2000 Arithmetic and Pipelining.
Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University Arithmetic See: P&H Chapter 3.1-3, C.5-6.
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.
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.
Chapter # 5: Arithmetic Circuits Contemporary Logic Design Randy H
Lecture 8 Arithmetic Logic Circuits
Penn ESE Spring DeHon 1 ESE (ESE534): Computer Organization Day 11: February 14, 2007 Compute 1: LUTs.
Design of Arithmetic Circuits – Adders, Subtractors, BCD adders
Penn ESE Spring DeHon 1 ESE : Computer Organization Day 3: January 17, 2007 Arithmetic and Pipelining.
ECE 301 – Digital Electronics
ECE 301 – Digital Electronics
ECE 301 – Digital Electronics
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.
Lecture # 12 University of Tehran
EECS Components and Design Techniques for Digital Systems Lec 15 – Addition, Subtraction, and Negative Numbers David Culler Electrical Engineering.
1 Bits are just bits (no inherent meaning) — conventions define relationship between bits and numbers Binary numbers (base 2)
Binary Arithmetic Stephen Boyd March 14, Two's Complement Most significant bit represents sign. 0 = positive 1 = negative Positive numbers behave.
CALTECH CS137 Winter DeHon 1 CS137: Electronic Design Automation Day 9: January 30, 2006 Parallel Prefix.
Penn ESE534 Spring DeHon 1 ESE534: Computer Organization Day 9: February 24, 2014 Operator Sharing, Virtualization, Programmable Architectures.
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.
CSE 241 Computer Organization Lecture # 9 Ch. 4 Computer Arithmetic Dr. Tamer Samy Gaafar Dept. of Computer & Systems Engineering.
Nov 10, 2008ECE 561 Lecture 151 Adders. Nov 10, 2008ECE 561 Lecture 152 Adders Basic Ripple Adders Faster Adders Sequential Adders.
Computing Systems Designing a basic ALU.
Computer Organization Department of CSE, SSE Mukka Chapter 6 : ARITHMETIC | Website for students | VTU NOTES.
1 Lecture 12 Time/space trade offs Adders. 2 Time vs. speed: Linear chain 8-input OR function with 2-input gates Gates: 7 Max delay: 7.
Binary Adder DesignSpring Binary Adders. Binary Adder DesignSpring n-bit Addition –Ripple Carry Adder –Conditional Sum Adder –(Carry Lookahead.
1 Arithmetic I Instructor: Mozafar Bag-Mohammadi Ilam University.
COMP541 Arithmetic Circuits
08 ARTH Page 1 ECEn/CS 224 Number Representation and Binary Arithmetic.
Topics covered: Arithmetic CSE243: Introduction to Computer Architecture and Hardware/Software Interface.
Kavita Bala CS 3410, Spring 2014 Computer Science Cornell University.
Caltech CS184 Winter DeHon CS184a: Computer Architecture (Structure and Organization) Day 3: January 10, 2005 Arithmetic and Pipelining.
Computer Architecture Lecture 16 Fasih ur Rehman.
ECE 331 – Digital System Design Multi-bit Adder Circuits, Adder/Subtractor Circuit, and Multiplier Circuit (Lecture #12)
1 IKI20210 Pengantar Organisasi Komputer Kuliah No. 23: Aritmatika 18 Desember 2002 Bobby Nazief Johny Moningka
C-H1 Lecture Adders Half adder. C-H2 Full Adder si is the modulo- 2 sum of ci, xi, yi.
CS 151: Digital Design Chapter 4: Arithmetic Functions and Circuits
1  2004 Morgan Kaufmann Publishers Lets Build a Processor Almost ready to move into chapter 5 and start building a processor First, let’s review Boolean.
Addition, Subtraction, Logic Operations and ALU Design
CHAPTER 2 Digital Combinational Logic/Arithmetic Circuits
CSE 311 Foundations of Computing I Lecture 25 Circuits for FSMs, Carry-Look-Ahead Adders Autumn 2011 CSE 3111.
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.
Addition and multiplication Arithmetic is the most basic thing you can do with a computer, but it’s not as easy as you might expect! These next few lectures.
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.
Penn ESE534 Spring DeHon 1 ESE534: Computer Organization Day 3: January 25, 2010 Arithmetic Work preclass exercise.
MicroProcessors Lec. 4 Dr. Tamer Samy Gaafar. Course Web Page —
Grade School Again: A Parallel Perspective CS Lecture 7.
Caltech CS184 Winter DeHon CS184a: Computer Architecture (Structure and Organization) Day 3: January 13, 2003 Arithmetic and Pipelining.
EE204 L03-ALUHina Anwar Khan EE204 Computer Architecture Lecture 03- ALU.
Addition and multiplication1 Arithmetic is the most basic thing you can do with a computer, but it’s not as easy as you might expect! These next few lectures.
Combinational Circuits
Digital Systems Section 8 Multiplexers. Digital Systems Section 8 Multiplexers.
CSE Winter 2001 – Arithmetic Unit - 1
Lecture 14 Logistics Last lecture Today
Digital Systems Section 12 Binary Adders. Digital Systems Section 12 Binary Adders.
Overview Part 1 – Design Procedure Part 2 – Combinational Logic
Instructor: Mozafar Bag-Mohammadi University of Ilam
Lecture 14 Logistics Last lecture Today
ESE534: Computer Organization
Presentation transcript:

Penn ESE534 Spring DeHon 1 ESE534: Computer Organization Day 3: February 3, 2014 Arithmetic Work preclass exercise

Penn ESE534 Spring DeHon 2 Last Time Boolean logic  computing any finite function Saw gates…and a few properties of logic

Penn ESE534 Spring DeHon 3 Today Addition –organization –parts of design space –parallel prefix –area and time requirements

Penn ESE534 Spring DeHon 4 Why? Start getting a handle on –Complexity Area and time Area-time tradeoffs –Parallelism –Regularity Arithmetic underlies much computation –grounds out complexity

Preclass Penn ESE534 Spring DeHon 5

Circuit 1 Can the delay be reduced? How? To what? Penn ESE534 Spring DeHon 6

Tree Reduce AND Penn ESE534 Spring DeHon 7

Circuit 2 Can the delay be reduced? Penn ESE534 Spring DeHon 8

Circuit 3 Can the delay be reduced? Penn ESE534 Spring DeHon 9

Brute Force Multi-Output AND How big? ~38 here … in general about N 2 /2 Penn ESE534 Spring DeHon 10

Brute Force Multi-Output AND Can we do better? Penn ESE534 Spring DeHon 11

Circuit 4 Can the delay be reduced? Penn ESE534 Spring DeHon 12

Addition Penn ESE534 Spring DeHon 13

Penn ESE534 Spring DeHon 14 C: 00 A: B: S: 0 C: 000 A: B: S: 10 C: 0000 A: B: S: 110 C: A: B: S: 0110 C: A: B: S: C: A: B: S: C: A: B: S: C: A: B: S: C: A: B: S: C: A: B: S: C: A: B: S: Example: Bit Level Addition Addition –Base 2 example –Work together A: B: S: C: 0 A: B: S:

Penn ESE534 Spring DeHon 15 Addition Base 2 A = a n-1 *2 (n-1) +a n-2 *2 (n-2) +... a 1 *2 1 + a 0 *2 0 =  (a i *2 i ) S=A+B What is the function for s i … carry i ? s i = carry i xor a i xor b i carry i = ( a i-1 + b i-1 + carry i-1 )  2 = a i-1 *b i-1 +a i-1 *carry i-1 + b i-1 *carry i-1 = MAJ(a i-1,b i-1,carry i-1 )

Penn ESE534 Spring DeHon 16 Ripple Carry Addition Shown operation of each bit Often convenient to define logic for each bit, then assemble: –bit slice

Penn ESE534 Spring DeHon 17 Ripple Carry Analysis Area: O(N) [6n] Delay: O(N) [2n] What is area and delay for N-bit RA adder? [unit delay gates]

Penn ESE534 Spring DeHon 18 Can we do better? Lower delay?

Penn ESE534 Spring DeHon 19 Leading Question Do we have to wait for the carry to show up to begin doing useful work? –We do have to know the carry to get the right answer. –How many values can the carry take on?

Penn ESE534 Spring DeHon 20 Idea Compute both possible values and select correct result when we know the answer

Penn ESE534 Spring DeHon 21 Preliminary Analysis Delay(RA) --Delay Ripple Adder Delay(RA(n)) = k*n [k=2 this example] Delay(RA(n)) = 2*(k*n/2)=2*DRA(n/2) Delay(P2A) -- Delay Predictive Adder Delay(P2A)=DRA(n/2)+D(mux2) …almost half the delay!

Penn ESE534 Spring DeHon 22 Recurse If something works once, do it again. Use the predictive adder to implement the first half of the addition

Recurse Penn ESE534 Spring DeHon 23

Penn ESE534 Spring DeHon 24 Recurse Redundant (can share) N/4

Penn ESE534 Spring DeHon 25 Recurse If something works once, do it again. Use the predictive adder to implement the first half of the addition Delay(P4A(n))= Delay(RA(n/4)) + D(mux2) + D(mux2) Delay(P4A(n))=Delay(RA(n/4))+2*D(mux2)

Penn ESE534 Spring DeHon 26 Recurse By know we realize we’ve been using the wrong recursion –should be using the Predictive Adder in the recursion Delay(PA(n)) = Delay(PA(n/2)) + D(mux2) –Contrast: Delay(P2A)=DRA(n/2)+D(mux2) Every time cut in half we add a D(mux2). How many times cut in half? Delay(PA(n))=log 2 (n)*D(mux2)+C –C = Delay(PA(1)) if use FA for PA(1), then C=2

Conclude Can perform addition in delay logarithmic in width of operands. Penn ESE534 Spring DeHon 27

Penn ESE534 Spring DeHon 28 Another Way (Parallel Prefix)

Penn ESE534 Spring DeHon 29 CLA Think about each adder bit as a computing a function on the carry in –C[i]=g(c[i-1]) –Particular function f will depend on a[i], b[i] –g=f(a,b)

Penn ESE534 Spring DeHon 30 Functions What are the functions g(c[i-1])? –g(c)=carry(a=0,b=0,c) –g(c)=carry(a=1,b=0,c) –g(c)=carry(a=0,b=1,c) –g(c)=carry(a=1,b=1,c)

Penn ESE534 Spring DeHon 31 Functions What are the functions g(c[i-1])? –g(x)=1 Generate a[i]=b[i]=1 –g(x)=x Propagate a[i] xor b[i]=1 –g(x)=0 Squash a[i]=b[i]=0

Penn ESE534 Spring DeHon 32 Combining Want to combine functions –Compute c[i]=g i (g i-1 (c[i-2])) –Compute compose of two functions What functions will the compose of two of these functions be? –Same as before Propagate, generate, squash

Penn ESE534 Spring DeHon 33 Compose Rules (LSB MSB) GG GP GS PG PP PS SG SP SS [work on board]

Penn ESE534 Spring DeHon 34 Compose Rules (LSB MSB) GG = G GP = G GS = S PG = G PP = P PS = S SG = G SP = S SS = S

Penn ESE534 Spring DeHon 35 Combining Do it again… Combine g[i-3,i-2] and g[i-1,i] What do we get?

Penn ESE534 Spring DeHon 36 Reduce Tree

Penn ESE534 Spring DeHon 37 Reduce Tree Sq=/A*/B Gen=A*B Sq out =Sq 1 +/Gen 1 *Sq 0 Gen out =Gen 1 +/Sq 1 *Gen 0

Penn ESE534 Spring DeHon 38 Reduce Tree Sq=/A*/B Gen=A*B Sq out =Sq 1 +/Gen 1 *Sq 0 Gen out =Gen 1 +/Sq 1 *Gen 0 Delay and Area?

Penn ESE534 Spring DeHon 39 Reduce Tree Sq=/A*/B Gen=A*B Sq out =Sq 1 +/Gen 1 *Sq 0 Gen out =Gen 1 +/Sq 1 *Gen 0 A(Encode)=2 D(Encode)=1 A(Combine)=4 D(Combine)=2 A(Carry)=2 D(Carry)=1

Penn ESE534 Spring DeHon 40 Reduce Tree: Delay? D(Encode)=1 D(Combine)=2 D(Carry)=1 Delay = 1+2log 2 (N)+1

Penn ESE534 Spring DeHon 41 Reduce Tree: Area? A(Encode)=2 A(Combine)=4 A(Carry)=2 Area= 2N+4(N-1)+2

Penn ESE534 Spring DeHon 42 Reduce Tree: Area & Delay Area(N) = 6N-2 Delay(N) = 2log 2 (N)+2

How Relate? Penn ESE534 Spring DeHon 43

Need Penn ESE534 Spring DeHon 44 Need PG[i:0] forall i

Intermediates Can we compute intermediates efficiently? Penn ESE534 Spring DeHon 45

Intermediates Share common terms Penn ESE534 Spring DeHon 46

Penn ESE534 Spring DeHon 47 Reduce Tree While computing PG[N,0] compute many PG[i,j]’s –PG[1,0], PG[3,0], PG[7,0] ….

Penn ESE534 Spring DeHon 48 Prefix Tree While computing PG[N,0] only get –PG[2 n -1,0] How fillin holes?

Penn ESE534 Spring DeHon 49 Prefix Tree Look at Symmetric stage (with respect to middle=PG[N,0] stage) and combine to fillin

Penn ESE534 Spring DeHon 50 Prefix Tree

Penn ESE534 Spring DeHon 51 Prefix Tree

Penn ESE534 Spring DeHon 52 Prefix Tree Bring in Carry and compute each intermediate carry-in

Penn ESE534 Spring DeHon 53 Prefix Tree Note: prefix-tree is same size as reduce tree –Always matched same number of elements in symmetric stage

Parallel Prefix Area and Delay? Roughly twice the area/delay Area= 2N+4N+4N+2N = 12N Delay = 4log 2 (N)+2 Conclude: can add in log time with linear area. Penn ESE534 Spring DeHon 54

Penn ESE534 Spring DeHon 55 Parallel Prefix Important Pattern Applicable any time operation is associative –Or can be made assoc. as in MAJ case Examples of associative functions? –Non-associative? Function Composition is always associative

Penn ESE534 Spring DeHon 56 Note: Constants Matter Watch the constants Asymptotically this Carry-Lookahead Adder (CLA) is great For small adders can be smaller with –fast ripple carry –larger combining than 2-ary tree –mix of techniques …will depend on the technology primitives and cost functions

Penn ESE534 Spring DeHon 57 Two’s Complement positive numbers in binary negative numbers –subtract 1 and invert –(or invert and add 1)

Penn ESE534 Spring DeHon 58 Two’s Complement 2 = = = = = 110

Penn ESE534 Spring DeHon 59 Addition of Negative Numbers? …just works A: 111 B: 001 S: 000 A: 110 B: 001 S: 111 A: 111 B: 010 S: 001 A: 111 B: 110 S: 101

Penn ESE534 Spring DeHon 60 Addition of Negative Numbers? …just works A: 111 B: 001 S: A: 110 B: 001 S: A: 111 B: 010 S: A: 111 B: 110 S: What does addition give (binary bits). Then what is addition saying (in normal integers).

Penn ESE534 Spring DeHon 61 Subtraction Negate the subtracted input and use adder –which is: invert input and add 1 works for both positive and negative input –001  = 111 –111  = 001 –000  = 000 –010  = 110 –110  = 010

Penn ESE534 Spring DeHon 62 Subtraction (add/sub) Note: you can use the “unused” carry input at the LSB to perform the “add 1”

Penn ESE534 Spring DeHon 63 Overflow? Overflow=(A.s==B.s)*(A.s!=S.s) A: 111 B: 001 S: 000 A: 110 B: 001 S: 111 A: 111 B: 010 S: 001 A: 111 B: 110 S: 101 A: 001 B: 001 S: 010 A: 011 B: 001 S: 100 A: 111 B: 100 S: 011

Penn ESE534 Spring DeHon 64 Big Ideas [MSB Ideas] Can build arithmetic out of logic

Penn ESE534 Spring DeHon 65 Big Ideas [MSB-1 Ideas] Associativity Parallel Prefix Can perform addition –in log time –with linear area

Admin HW1 due Wednesday Office Hours Tuesday 4:15pm—5:30pm HW2 out today Reading for Wednesday online Penn ESE534 Spring DeHon 66