CS152 / Kubiatowicz Lec4.1 1/30/01©UCB Spring 2001 January 30, 2001 John Kubiatowicz (http.cs.berkeley.edu/~kubitron) lecture slides:

Slides:



Advertisements
Similar presentations
©UCB CPSC 161 Lecture 6 Prof. L.N. Bhuyan
Advertisements

Mohamed Younis CMCS 411, Computer Architecture 1 CMCS Computer Architecture Lecture 7 Arithmetic Logic Unit February 19,
Computer Architecture ECE 361 Lecture 6: ALU Design
1 CONSTRUCTING AN ARITHMETIC LOGIC UNIT CHAPTER 4: PART II.
CS152 / Kubiatowicz Lec4.1 2/10/03©UCB Spring 2003 February 10, 2003 John Kubiatowicz ( lecture slides:
361 design.1 Computer Architecture ECE 361 Lecture 5: The Design Process & ALU Design.
1 Representing Numbers Using Bases Numbers in base 10 are called decimal numbers, they are composed of 10 numerals ( ספרות ) = 9* * *10.
ECE 232 L8.Arithm.1 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers ECE 232 Hardware Organization and Design Lecture 8 Computer.
CS152 / Kubiatowicz Lec4.1 9/8/99©UCB Fall 1999 September 8, 1999 John Kubiatowicz (http.cs.berkeley.edu/~kubitron) lecture slides:
ECE C03 Lecture 61 Lecture 6 Arithmetic Logic Circuits Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
Ceg3420 L6 Cost.1 Fa 1998  UCB CEG3420 Computer Design Lecture 6: Cost and Design Process.
Chapter # 5: Arithmetic Circuits Contemporary Logic Design Randy H
Lecture 8 Arithmetic Logic Circuits
1 Chapter 4: Arithmetic Where we've been: –Performance (seconds, cycles, instructions) –Abstractions: Instruction Set Architecture Assembly Language and.
Computer ArchitectureFall 2008 © August 25, CS 447 – Computer Architecture Lecture 3 Computer Arithmetic (1)
CS 61C L15 Blocks (1) A Carle, Summer 2005 © UCB inst.eecs.berkeley.edu/~cs61c/su05 CS61C : Machine Structures Lecture #15: Combinational Logic Blocks.
Computer ArchitectureFall 2008 © August 20 th, Introduction to Computer Architecture Lecture 2 – Digital Logic Design.
1  1998 Morgan Kaufmann Publishers Chapter Four Arithmetic for Computers.
Chapter 3 Arithmetic for Computers. Arithmetic Where we've been: Abstractions: Instruction Set Architecture Assembly Language and Machine Language What's.
Chapter 5 Arithmetic Logic Functions. Page 2 This Chapter..  We will be looking at multi-valued arithmetic and logic functions  Bitwise AND, OR, EXOR,
CS 61C L15 State & Blocks (1) A Carle, Summer 2006 © UCB inst.eecs.berkeley.edu/~cs61c/su06 CS61C : Machine Structures Lecture #15: State 2 and Blocks.
Arithmetic for Computers
CS 152 Lec 4.1 ©UCB Fall 2002 CS 152: Computer Architecture and Engineering Lecture 4 Cost and Design Randy H. Katz, Instructor Satrajit Chatterjee, Teaching.
1 Bits are just bits (no inherent meaning) — conventions define relationship between bits and numbers Binary numbers (base 2)
1 CS/COE0447 Computer Organization & Assembly Language Chapter 3.
Cs 152 L5 Cost.1 DAP Fa 1997  UCB ECE Computer Architecture Lecture Notes Adders Shantanu Dutt Univ. of Illinois at Chicago Excerpted from.
CS 152 L05 Performance and Design (1)Patterson Fall 2003 © UCB Dave Patterson ( www-inst.eecs.berkeley.edu/~cs152/
CS151B Computer Systems Architecture Winter 2002 TuTh 2-4pm BH
Lecture 2 1 Computer Elements Transistors (computing) –How can they be connected to do something useful? –How do we evaluate how fast a logic block is?
CS1Q Computer Systems Lecture 9 Simon Gay. Lecture 9CS1Q Computer Systems - Simon Gay2 Addition We want to be able to do arithmetic on computers and therefore.
Chapter # 5: Arithmetic Circuits
Chapter 6-1 ALU, Adder and Subtractor
5-1 Programmable and Steering Logic Chapter # 5: Arithmetic Circuits.
Csci 136 Computer Architecture II – Constructing An Arithmetic Logic Unit Xiuzhen Cheng
EEL-4713C Computer Architecture Introduction: the Logic Design Process
COSC 3430 L08 Basic MIPS Architecture.1 COSC 3430 Computer Architecture Lecture 08 Processors Single cycle Datapath PH 3: Sections
CS 152 L04 Logic (1)Patterson Fall 2003 © UCB Dave Patterson ( www-inst.eecs.berkeley.edu/~cs152/ CS152 – Computer.
Computer Organization CS224 Fall 2012 Lesson 22. The Big Picture  The Five Classic Components of a Computer  Chapter 4 Topic: Processor Design Control.
CDA 3101 Fall 2013 Introduction to Computer Organization The Arithmetic Logic Unit (ALU) and MIPS ALU Support 20 September 2013.
Arithmetic.1 2/15 Computer Arithmetic ALU Performance is critical ( App. C5, C6 4 th ed.)
1 Modified from  Modified from 1998 Morgan Kaufmann Publishers Chapter Three: Arithmetic for Computers Section 2 citation and following credit line is.
CS 61C L4.1.2 State (1) K. Meinz, Summer 2004 © UCB CS61C : Machine Structures Lecture State and FSMs Kurt Meinz inst.eecs.berkeley.edu/~cs61c.
1 ELEN 033 Lecture 4 Chapter 4 of Text (COD2E) Chapters 3 and 4 of Goodman and Miller book.
1 IKI20210 Pengantar Organisasi Komputer Kuliah No. 23: Aritmatika 18 Desember 2002 Bobby Nazief Johny Moningka
Addition, Subtraction, Logic Operations and ALU Design
Cpu control.1 2/14 Datapath Components for Lab The Processor! ( th ed)
February 4, 2004 John Kubiatowicz ( lecture slides: CS152 Computer Architecture.
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.
COM181 Computer Hardware Lecture 6: The MIPs CPU.
Lecture #23: Arithmetic Circuits-1 Arithmetic Circuits (Part I) Randy H. Katz University of California, Berkeley Fall 2005.
Computer Arthmetic Chapter Four P&H. Data Representation Why do we not encode numbers as strings of ASCII digits inside computers? What is overflow when.
9/23/2004Comp 120 Fall September Chapter 4 – Arithmetic and its implementation Assignments 5,6 and 7 posted to the class web page.
EE204 L03-ALUHina Anwar Khan EE204 Computer Architecture Lecture 03- ALU.
CS152 / Kubiatowicz Lec4.1 2/5/03©UCB Spring 2003 February 5, 2003 John Kubiatowicz ( lecture slides:
1 CPTR 220 Computer Organization Computer Architecture Assembly Programming.
Computer Arthmetic Chapter Four P&H.
CS152 Computer Architecture and Engineering Lecture 5 Cost and Design
CS352H: Computer Systems Architecture
Morgan Kaufmann Publishers
Processor (I).
Topic 3b Computer Arithmetic: ALU Design
CS152 Computer Architecture and Engineering Lecture 4 Cost and Design
Computer Architecture EECS 361 Lecture 5: The Design Process & ALU Design Just like lat time, I like to start today’s lecture with a recap of our last.
Topic 3b Computer Arithmetic: ALU Design
CS/COE0447 Computer Organization & Assembly Language
Guest Lecturer TA: Shreyas Chand
Computer Architecture EECS 361 Lecture 6: ALU Design
Instructor: Michael Greenbaum
Processor: Datapath and Control
Presentation transcript:

CS152 / Kubiatowicz Lec4.1 1/30/01©UCB Spring 2001 January 30, 2001 John Kubiatowicz (http.cs.berkeley.edu/~kubitron) lecture slides: CS152 Computer Architecture and Engineering Lecture 4 Cost and Design

CS152 / Kubiatowicz Lec4.2 1/30/01©UCB Spring 2001 Overview: Cost and Design °Review from Last Lecture (2 minutes) °Cost and Price (18) °Administrative Matters (3 minutes) °Design process (27 minutes) °Break (5 minutes) °More Design process (15 minutes) °Online notebook (10 minutes)

CS152 / Kubiatowicz Lec4.3 1/30/01©UCB Spring 2001 Year Review: Performance and Technology Trends °Technology Power: 1.2 x 1.2 x 1.2 = 1.7 x / year Feature Size: shrinks 10% / yr. => Switching speed improves 1.2 / yr. Density: improves 1.2x / yr. Die Area: 1.2x / yr. °RISC lesson is to keep the ISA as simple as possible: Shorter design cycle => fully exploit the advancing technology (~3yr) Advanced branch prediction and pipeline techniques Bigger and more sophisticated on-chip caches

CS152 / Kubiatowicz Lec4.4 1/30/01©UCB Spring 2001 Review: General C/L Cell Delay Model °Combinational Cell (symbol) is fully specified by: functional (input -> output) behavior -truth-table, logic equation, VHDL load factor of each input critical propagation delay from each input to each output for each transition -T HL (A, o) = Fixed Internal Delay + Load-dependent-delay x load °Linear model composes Cout Vout A B X Combinational Logic Cell Cout Delay Va -> Vout X X X X X X Ccritical Internal Delay delay per unit load

CS152 / Kubiatowicz Lec4.5 1/30/01©UCB Spring 2001 Review: Characterize a Gate °Input capacitance for each input °For each input-to-output path: For each output transition type (H->L, L->H, H->Z, L->Z... etc.) -Internal delay (ns) -Load dependent delay (ns / fF) °Example: 2-input NAND Gate OutA B For A and B: Input Load (I.L.) = 61 fF For either A -> Out or B -> Out: Tlh = 0.5ns Tlhf = ns / fF Thl = 0.1ns Thlf = ns / fF Delay A -> Out Out: Low -> High Cout 0.5ns Slope = ns / fF

CS152 / Kubiatowicz Lec4.6 1/30/01©UCB Spring 2001 CS152 Logic Elements °NAND2, NAND3, NAND 4 °NOR2, NOR3, NOR4 °INV1x (normal inverter) °INV4x (inverter with large output drive) °D flip flop with negative edge triggered °XOR2 °XNOR2 °PWR: Source of 1’s °GND: Source of 0’s °fast MUXes

CS152 / Kubiatowicz Lec4.7 1/30/01©UCB Spring 2001 Storage Element’s Timing Model °Setup Time: Input must be stable BEFORE the trigger clock edge °Hold Time: Input must REMAIN stable after the trigger clock edge °Clock-to-Q time: Output cannot change instantaneously at the trigger clock edge Similar to delay in logic gates, two components: -Internal Clock-to-Q -Load dependent Clock-to-Q °Typical for class: 1ns Setup, 0.5ns Hold DQ DDon’t Care Clk UnknownQ Setup Hold Clock-to-Q

CS152 / Kubiatowicz Lec4.8 1/30/01©UCB Spring 2001 Clocking Methodology °All storage elements are clocked by the same clock edge °The combination logic block’s: Inputs are updated at each clock tick All outputs MUST be stable before the next clock tick Clk Combination Logic

CS152 / Kubiatowicz Lec4.9 1/30/01©UCB Spring 2001 Critical Path & Cycle Time °Critical path: the slowest path between any two storage devices °Cycle time is a function of the critical path °must be greater than: Clock-to-Q + Longest Path through Combination Logic + Setup Clk

CS152 / Kubiatowicz Lec4.10 1/30/01©UCB Spring 2001 Clock Skew’s Effect on Cycle Time °The worst case scenario for cycle time consideration: The input register sees CLK1 The output register sees CLK2 °Cycle Time - Clock Skew  CLK-to-Q + Longest Delay + Setup  Cycle Time  CLK-to-Q + Longest Delay + Setup + Clock Skew Clk1 Clk2 Clock Skew Clk1Clk2

CS152 / Kubiatowicz Lec4.11 1/30/01©UCB Spring 2001 Tricks to Reduce Cycle Time °Reduce the number of gate levels °Use esoteric/dynamic timing methods °Pay attention to loading °One gate driving many gates is a bad idea °Avoid using a small gate to drive a long wire °Use multiple stages to drive large load A B C D A B C D INV4x Clarge

CS152 / Kubiatowicz Lec4.12 1/30/01©UCB Spring 2001 How to Avoid Hold Time Violation? °Hold time requirement: Input to register must NOT change immediately after the clock tick °This is usually easy to meet in the “edge trigger” clocking scheme °Hold time of most FFs is <= 0 ns °CLK-to-Q + Shortest Delay Path must be greater than Hold Time Clk Combination Logic

CS152 / Kubiatowicz Lec4.13 1/30/01©UCB Spring 2001 Clock Skew’s Effect on Hold Time °The worst case scenario for hold time consideration: The input register sees CLK2 The output register sees CLK1 fast FF2 output must not change input to FF1 for same clock edge °(CLK-to-Q + Shortest Delay Path - Clock Skew) > Hold Time Clk1 Clk2 Clock Skew Clk2 Clk Combination Logic

CS152 / Kubiatowicz Lec4.14 1/30/01©UCB Spring 2001 Defects_per_unit_area * Die_Area   } Integrated Circuit Costs Die Cost is goes roughly with (die area) 3 or (die area) 4 { 1+ Die cost = Wafer cost Dies per Wafer * Die yield Dies per wafer =  * ( Wafer_diam / 2) 2 –  * Wafer_diam – Test dies  Wafer Area Die Area  2 * Die Area Die Area Die Yield = Wafer yield

CS152 / Kubiatowicz Lec4.15 1/30/01©UCB Spring 2001 Die Yield Raw Dice Per Wafer wafer diameterdie area (mm 2 ) ”/15cm ”/20cm ”/25cm die yield23%19%16%12%11%10% typical CMOS process:  =2, wafer yield=90%, defect density=2/cm2, 4 test sites/wafer Good Dice Per Wafer (Before Testing!) 6”/15cm ”/20cm ”/25cm typical cost of an 8”, 4 metal layers, 0.5um CMOS wafer: ~$2000

CS152 / Kubiatowicz Lec4.16 1/30/01©UCB Spring 2001 Real World Examples ChipMetalLineWaferDefectAreaDies/YieldDie Cost layerswidthcost/cm 2 mm 2 wafer 386DX20.90$ %$4 486DX230.80$ %$12 PowerPC $ %$53 HP PA $ %$73 DEC Alpha30.70$ %$149 SuperSPARC30.70$ %$272 Pentium30.80$ %$417 From "Estimating IC Manufacturing Costs,” by Linley Gwennap, Microprocessor Report, August 2, 1993, p. 15

CS152 / Kubiatowicz Lec4.17 1/30/01©UCB Spring 2001 IC cost = Die cost + Testing cost + Packaging cost Final test yield Packaging Cost: depends on pins, heat dissipation Other Costs ChipDie Package Test &Total costpinstypecost Assembly 386DX$4 132QFP$1 $4 $9 486DX2$12 168PGA$11 $12 $35 PowerPC 601$53 304QFP$3 $21 $77 HP PA 7100$73 504PGA$35 $16 $124 DEC Alpha$ PGA$30 $23 $202 SuperSPARC$ PGA$20 $34 $326 Pentium$ PGA$19 $37 $473

CS152 / Kubiatowicz Lec4.18 1/30/01©UCB Spring 2001 Administrative Matters °Review complete: did ok on prob 2 & 3 Problems 1 and 4 more challenging Make sure you look at solutions! (out soon) Average: 73, Std: 13, Low: 49, high: 98 °Read Chapter 4: ALU, Multiply, Divide, FP Mult °Unbroken SPIM is up now. Broken version up soon Get going on your testing methodology! You will be graded on how thorough your testing technique is in addition to whether or not you get the bugs °Sections a bit unbalanced Can we get more people in the 4-6 section?

CS152 / Kubiatowicz Lec4.19 1/30/01©UCB Spring 2001 The Design Process "To Design Is To Represent" Design activity yields description/representation of an object -- Traditional craftsman does not distinguish between the conceptualization and the artifact -- Separation comes about because of complexity -- The concept is captured in one or more representation languages -- This process IS design Design Begins With Requirements -- Functional Capabilities: what it will do -- Performance Characteristics: Speed, Power, Area, Cost,...

CS152 / Kubiatowicz Lec4.20 1/30/01©UCB Spring 2001 Design Process (cont.) Design Finishes As Assembly -- Design understood in terms of components and how they have been assembled -- Top Down decomposition of complex functions (behaviors) into more primitive functions -- bottom-up composition of primitive building blocks into more complex assemblies CPU DatapathControl ALURegsShifter Nand Gate Design is a "creative process," not a simple method

CS152 / Kubiatowicz Lec4.21 1/30/01©UCB Spring 2001 Design Refinement Informal System Requirement Initial Specification Intermediate Specification Final Architectural Description Intermediate Specification of Implementation Final Internal Specification Physical Implementation refinement increasing level of detail

CS152 / Kubiatowicz Lec4.22 1/30/01©UCB Spring 2001 Design as Search Design involves educated guesses and verification -- Given the goals, how should these be prioritized? -- Given alternative design pieces, which should be selected? -- Given design space of components & assemblies, which part will yield the best solution? Feasible (good) choices vs. Optimal choices Problem A Strategy 1Strategy 2 SubProb 1 SubProb2 SubProb3 BB1BB2BB3BBn

CS152 / Kubiatowicz Lec4.23 1/30/01©UCB Spring 2001 Problem: Design a “fast” ALU for the MIPS ISA °Requirements? °Must support the Arithmetic / Logic operations °Tradeoffs of cost and speed based on frequency of occurrence, hardware budget

CS152 / Kubiatowicz Lec4.24 1/30/01©UCB Spring 2001 MIPS ALU requirements °Add, AddU, Sub, SubU, AddI, AddIU => 2’s complement adder/sub with overflow detection °And, Or, AndI, OrI, Xor, Xori, Nor => Logical AND, logical OR, XOR, nor °SLTI, SLTIU (set less than) => 2’s complement adder with inverter, check sign bit of result °ALU from from CS 150 / P&H book chapter 4 supports these ops

CS152 / Kubiatowicz Lec4.25 1/30/01©UCB Spring 2001 MIPS arithmetic instruction format °Signed arith generate overflow, no carry R-type: I-Type: opRsRtRdfunct opRsRtImmed 16 Typeopfunct ADDI10xx ADDIU11xx SLTI12xx SLTIU13xx ANDI14xx ORI15xx XORI16xx LUI17xx Typeopfunct ADD0040 ADDU0041 SUB0042 SUBU0043 AND0044 OR0045 XOR0046 NOR0047 Typeopfunct SLT0052 SLTU0053

CS152 / Kubiatowicz Lec4.26 1/30/01©UCB Spring 2001 Design Trick: divide & conquer °Break the problem into simpler problems, solve them and glue together the solution °Example: assume the immediates have been taken care of before the ALU 10 operations (4 bits) 00add 01addU 02sub 03subU 04and 05or 06xor 07nor 12slt 13sltU

CS152 / Kubiatowicz Lec4.27 1/30/01©UCB Spring 2001 Refined Requirements (1) Functional Specification inputs: 2 x 32-bit operands A, B, 4-bit mode outputs:32-bit result S, 1-bit carry, 1 bit overflow operations:add, addu, sub, subu, and, or, xor, nor, slt, sltU (2) Block Diagram (powerview symbol, VHDL entity) ALU AB m ovf S 32 4 c

CS152 / Kubiatowicz Lec4.28 1/30/01©UCB Spring 2001 Behavioral Representation: VHDL Entity ALU is generic (c_delay: integer := 20 ns; S_delay: integer := 20 ns); port (signal A, B: in vlbit_vector (0 to 31); signal m: in vlbit_vector (0 to 3); signal S: out vlbit_vector (0 to 31); signal c: out vlbit; signal ovf: out vlbit) end ALU;... S <= A + B;

CS152 / Kubiatowicz Lec4.29 1/30/01©UCB Spring 2001 Design Decisions °Simple bit-slice big combinational problem many little combinational problems partition into 2-step problem °Bit slice with carry look-ahead °... ALU bit slice 7-to-2 C/L7 3-to-2 C/L PLD Gates mux CL0CL6

CS152 / Kubiatowicz Lec4.30 1/30/01©UCB Spring 2001 Refined Diagram: bit-slice ALU AB M S 32 4 Ovflw ALU0 a0b0 m cinco s0 ALU31 a31b31 m cinco s31

CS152 / Kubiatowicz Lec4.31 1/30/01©UCB Spring to-2 Combinational Logic °start turning the crank... FunctionInputsOutputsK-Map M0 M1 M2 M3 A B CinS Cout add

CS152 / Kubiatowicz Lec4.32 1/30/01©UCB Spring 2001 Seven plus a MUX ? °Design trick 2: take pieces you know (or can imagine) and try to put them together °Design trick 3: solve part of the problem and extend A B 1-bit Full Adder CarryOut Mux CarryIn Result add and or S-select

CS152 / Kubiatowicz Lec4.33 1/30/01©UCB Spring 2001 Additional operations °A - B = A + (– B) = A + B + 1 form two complement by invert and add one A B 1-bit Full Adder CarryOut Mux CarryIn Result add and or S-select invert Set-less-than? – left as an exercise

CS152 / Kubiatowicz Lec4.34 1/30/01©UCB Spring 2001 Revised Diagram °LSB and MSB need to do a little extra AB M S 32 4 Ovflw ALU0 a0b0 cinco s0 ALU0 a31b31 cinco s31 C/L to produce select, comp, c-in ?

CS152 / Kubiatowicz Lec4.35 1/30/01©UCB Spring 2001 Overflow °Examples: = 10 but... ° = - 9 but... 2’s ComplementBinaryDecimal Decimal – 6 – 4 – 5 7

CS152 / Kubiatowicz Lec4.36 1/30/01©UCB Spring 2001 Overflow Detection °Overflow: the result is too large (or too small) to represent properly Example: - 8  4-bit binary number  7 °When adding operands with different signs, overflow cannot occur! °Overflow occurs when adding: 2 positive numbers and the sum is negative 2 negative numbers and the sum is positive °On your own: Prove you can detect overflow by: Carry into MSB  Carry out of MSB – 6 –4 – 5 7 0

CS152 / Kubiatowicz Lec4.37 1/30/01©UCB Spring 2001 Overflow Detection Logic °Carry into MSB  Carry out of MSB For a N-bit ALU: Overflow = CarryIn[N - 1] XOR CarryOut[N - 1] A0 B0 1-bit ALU Result0 CarryIn0 CarryOut0 A1 B1 1-bit ALU Result1 CarryIn1 CarryOut1 A2 B2 1-bit ALU Result2 CarryIn2 A3 B3 1-bit ALU Result3 CarryIn3 CarryOut3 Overflow XYX XOR Y

CS152 / Kubiatowicz Lec4.38 1/30/01©UCB Spring 2001 More Revised Diagram °LSB and MSB need to do a little extra AB M S 32 4 Ovflw ALU0 a0b0 cinco s0 ALU0 a31b31 cinco s31 C/L to produce select, comp, c-in signed-arith and cin xor co

CS152 / Kubiatowicz Lec4.39 1/30/01©UCB Spring 2001 But What about Performance? °Critical Path of n-bit Rippled-carry adder is n*CP A0 B0 1-bit ALU Result0 CarryIn0 CarryOut0 A1 B1 1-bit ALU Result1 CarryIn1 CarryOut1 A2 B2 1-bit ALU Result2 CarryIn2 CarryOut2 A3 B3 1-bit ALU Result3 CarryIn3 CarryOut3 Design Trick: Throw hardware at it

CS152 / Kubiatowicz Lec4.40 1/30/01©UCB Spring 2001 Carry Look Ahead (Design trick: peek) ABC-out 000“kill” 01C-in“propagate” 10C-in“propagate” 111“generate” G = A and B P = A xor B A0 B0 A1 B1 A2 B2 A3 B3 S S S S G P G P G P G P C0 = Cin C1 = G0 + C0  P0 C2 = G1 + G0  P1 + C0  P0  P1 C3 = G2 + G1  P2 + G0  P1  P2 + C0  P0  P1  P2 G C4 =... P

CS152 / Kubiatowicz Lec4.41 1/30/01©UCB Spring 2001 Plumbing as Carry Lookahead Analogy

CS152 / Kubiatowicz Lec4.42 1/30/01©UCB Spring 2001 Cascaded Carry Look-ahead (16-bit): Abstraction CLACLA 4-bit Adder 4-bit Adder 4-bit Adder C1 = G0 + C0  P0 C2 = G1 + G0  P1 + C0  P0  P1 C3 = G2 + G1  P2 + G0  P1  P2 + C0  P0  P1  P2 G P G0 P0 C4 =... C0

CS152 / Kubiatowicz Lec4.43 1/30/01©UCB Spring nd level Carry, Propagate as Plumbing

CS152 / Kubiatowicz Lec4.44 1/30/01©UCB Spring 2001 Design Trick: Guess (or “Precompute”) n-bit adder CP(2n) = 2*CP(n) n-bit adder 1 0 Cout CP(2n) = CP(n) + CP(mux) Carry-select adder

CS152 / Kubiatowicz Lec4.45 1/30/01©UCB Spring 2001 Carry Skip Adder: reduce worst case delay 4-bit Ripple Adder A0B S P0 P1 P2 P3 4-bit Ripple Adder A4B S P0 P1 P2 P3 Exercise: optimal design uses variable block sizes Just speed up the slowest case for each block

CS152 / Kubiatowicz Lec4.46 1/30/01©UCB Spring 2001 Additional MIPS ALU requirements °Mult, MultU, Div, DivU (next lecture) => Need 32-bit multiply and divide, signed and unsigned °Sll, Srl, Sra (next lecture) => Need left shift, right shift, right shift arithmetic by 0 to 31 bits °Nor (leave as exercise to reader) => logical NOR or use 2 steps: (A OR B) XOR

CS152 / Kubiatowicz Lec4.47 1/30/01©UCB Spring 2001 Elements of the Design Process °Divide and Conquer (e.g., ALU) Formulate a solution in terms of simpler components. Design each of the components (subproblems) °Generate and Test (e.g., ALU) Given a collection of building blocks, look for ways of putting them together that meets requirement °Successive Refinement (e.g., carry lookahead) Solve "most" of the problem (i.e., ignore some constraints or special cases), examine and correct shortcomings. °Formulate High-Level Alternatives (e.g., carry select) Articulate many strategies to "keep in mind" while pursuing any one approach. °Work on the Things you Know How to Do The unknown will become “obvious” as you make progress.

CS152 / Kubiatowicz Lec4.48 1/30/01©UCB Spring 2001 Summary of the Design Process Hierarchical Design to manage complexity Top Down vs. Bottom Up vs. Successive Refinement Importance of Design Representations: Block Diagrams Decomposition into Bit Slices Truth Tables, K-Maps Circuit Diagrams Other Descriptions: state diagrams, timing diagrams, reg xfer,... Optimization Criteria: Gate Count [Package Count] Logic Levels Fan-in/Fan-out Power top down bottom up Area Delay mux design meets at TT CostDesign timePin Out

CS152 / Kubiatowicz Lec4.49 1/30/01©UCB Spring 2001 Why should you keep an design notebook? °Keep track of the design decisions and the reasons behind them Otherwise, it will be hard to debug and/or refine the design Write it down so that can remember in long project: 2 weeks ->2 yrs Others can review notebook to see what happened °Record insights you have on certain aspect of the design as they come up °Record of the different design & debug experiments Memory can fail when very tired °Industry practice: learn from others mistakes

CS152 / Kubiatowicz Lec4.50 1/30/01©UCB Spring 2001 Why do we keep it on-line? °You need to force yourself to take notes Open a window and leave an editor running while you work 1) Acts as reminder to take notes 2) Makes it easy to take notes 1) + 2) => will actually do it °Take advantage of the window system’s “cut and paste” features °It is much easier to read your typing than your writing °Also, paper log books have problems Limited capacity => end up with many books May not have right book with you at time vs. networked screens Can use computer to search files/index files to find what looking for

CS152 / Kubiatowicz Lec4.51 1/30/01©UCB Spring 2001 How should you do it? °Keep it simple DON’T make it so elaborate that you won’t use (fonts, layout,...) °Separate the entries by dates type “ date ” command in another window and cut&paste °Start day with problems going to work on today °Record output of simulation into log with cut&paste; add date May help sort out which version of simulation did what °Record key with cut&paste °Record of what works & doesn’t helps team decide what went wrong after you left °Index: write a one-line summary of what you did at end of each day

CS152 / Kubiatowicz Lec4.52 1/30/01©UCB Spring 2001 On-line Notebook Example °Refer to the handout “Example of On-Line Log Book” on cs 152 home page

CS152 / Kubiatowicz Lec4.53 1/30/01©UCB Spring st page of On-line notebook (Index + Wed. 9/6/95) * Index ============================================================== Wed Sep 6 00:47:28 PDT Created the 32-bit comparator component Thu Sep 7 14:02:21 PDT Tested the comparator Mon Sep 11 12:01:45 PDT Investigated bug found by Bart in comp32 and fixed it + ==================================================================== Wed Sep 6 00:47:28 PDT 1995 Goal: Layout the schematic for a 32-bit comparator I've layed out the schemtatics and made a symbol for the comparator. I named it comp32. The files are ~/wv/proj1/sch/comp32.sch ~/wv/proj1/sch/comp32.sym Wed Sep 6 02:29:22 PDT ==================================================================== Add 1 line index at front of log file at end of each session: date+summary Start with date, time of day + goal Make comments during day, summary of work End with date, time of day (and add 1 line summary at front of file)

CS152 / Kubiatowicz Lec4.54 1/30/01©UCB Spring nd page of On-line notebook (Thursday 9/7/95) + ==================================================================== Thu Sep 7 14:02:21 PDT 1995 Goal: Test the comparator component I've written a command file to test comp32. I've placed it in ~/wv/proj1/diagnostics/comp32.cmd. I ran the command file in viewsim and it looks like the comparator is working fine. I saved the output into a log file called ~/wv/proj1/diagnostics/comp32.log Notified the rest of the group that the comparator is done. Thu Sep 7 16:15:32 PDT ====================================================================

CS152 / Kubiatowicz Lec4.55 1/30/01©UCB Spring rd page of On-line notebook (Monday 9/11/95) + =================================================================== = Mon Sep 11 12:01:45 PDT 1995 Goal: Investigate bug discovered in comp32 and hopefully fix it Bart found a bug in my comparator component. He left the following From Sun Sep 10 01:47: Received: by wayne.manor (NX5.67e/NX3.0S) id AA00334; Sun, 10 Sep 95 01:47: Date: Wed, 10 Sep 95 01:47: From: Bart Simpson To: Subject: [cs152] bug in comp32 Status: R Hey Bruce, I think there's a bug in your comparator. The comparator seems to think that ffffffff and fffffff7 are equal. Can you take a look at this? Bart

CS152 / Kubiatowicz Lec4.56 1/30/01©UCB Spring th page of On-line notebook (9/11/95 contd) I verified the bug. here's a viewsim of the bug as it appeared.. (equal should be 0 instead of 1) SIM>stepsize 10ns SIM>v a_in A[31:0] SIM>v b_in B[31:0] SIM>w a_in b_in equal SIM>a a_in ffffffff\h SIM>a b_in fffffff7\h SIM>sim time = 10.0ns A_IN=FFFFFFFF\H B_IN=FFFFFFF7\H EQUAL=1 Simulation stopped at 10.0ns Ah. I've discovered the bug. I mislabeled the 4th net in the comp32 schematic. I corrected the mistake and re-checked all the other labels, just in case. I re-ran the old diagnostic test file and tested it against the bug Bart found. It seems to be working fine. hopefully there aren’t any more bugs:)

CS152 / Kubiatowicz Lec4.57 1/30/01©UCB Spring th page of On-line notebook (9/11/95 contd) On second inspectation of the whole layout, I think I can remove one level of gates in the design and make it go faster. But who cares! the comparator is not in the critical path right now. the delay through the ALU is dominating the critical path. so unless the ALU gets a lot faster, we can live with a less than optimal comparator. I ed the group that the bug has been fixed Mon Sep 11 14:03:41 PDT ================================================================ ==== Perhaps later critical path changes; what was idea to make compartor faster? Check log book!

CS152 / Kubiatowicz Lec4.58 1/30/01©UCB Spring 2001 Added benefit: cool post-design statistics Sample graph from the Alewife project: For the Communications and Memory Management Unit (CMMU) These statistics came from on-line record of bugs

CS152 / Kubiatowicz Lec4.59 1/30/01©UCB Spring 2001 Lecture Summary °Cost and Price Die size determines chip cost: cost ­ die size (  +1) Cost v. Price: business model of company, pay for engineers R&D must return $8 to $14 for every $1 invester °An Overview of the Design Process Design is an iterative process, multiple approaches to get started Do NOT wait until you know everything before you start °Example: Instruction Set drives the ALU design °On-line Design Notebook Open a window and keep an editor running while you work;cut&paste Refer to the handout as an example Former CS 152 students (and TAs) say they use on-line notebook for programming as well as hardware design; one of most valuable skills