1 Optimizations and Tradeoffs We now know how to build digital circuits –How can we build better circuits? Let’s consider two important design criteria.

Slides:



Advertisements
Similar presentations
Digital Circuits.
Advertisements

Based on slides by: Charles Kime & Thomas Kaminski © 2004 Pearson Education, Inc. ECE/CS 352: Digital System Fundamentals Lecture 8 – Systematic Simplification.
ECE 3110: Introduction to Digital Systems Simplifying Sum of Products using Karnaugh Maps.
ECE C03 Lecture 21 Lecture 2 Two Level Minimization Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 6 Dr. Shi Dept. of Electrical and Computer Engineering.
Gate-Level Minimization. Digital Circuits The Map Method The complexity of the digital logic gates the complexity of the algebraic expression.
Chapter 2 – Combinational Logic Circuits Part 1 – Gate Circuits and Boolean Equations Logic and Computer Design Fundamentals.
Digital Design – Optimizations and Tradeoffs
Karnaugh Maps for Simplification
Give qualifications of instructors: DAP
EET 1131 Unit 5 Boolean Algebra and Reduction Techniques
Computer Engineering (Logic Circuits) (Karnaugh Map)
بهينه سازي با نقشة کارنو Karnaugh Map. 2  Method of graphically representing the truth table that helps visualize adjacencies 2-variable K-map 3-variable.
Logic gate level Part 3: minimizing circuits. Improving circuit efficiency Efficiency of combinatorial circuit depends on number & arrangement of its.
IKI a-Simplification of Boolean Functions Bobby Nazief Semester-I The materials on these slides are adopted from those in CS231’s Lecture.
Overview Part 2 – Circuit Optimization 2-4 Two-Level Optimization
EEE324 Digital Electronics Ian McCrumRoom 5B18, Lecture 4: Boolean Algebra.
KU College of Engineering Elec 204: Digital Systems Design
BOOLEAN ALGEBRA Saras M. Srivastava PGT (Computer Science)
Boolean Algebra and Digital Circuits
B-1 Appendix B - Reduction of Digital Logic Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Principles.
1 Simplification of Boolean Functions:  An implementation of a Boolean Function requires the use of logic gates.  A smaller number of gates, with each.
Department of Computer Engineering
CHAPTER 1 INTRODUCTION TO DIGITAL LOGIC. K-Map (1)  Karnaugh Mapping is used to minimize the number of logic gates that are required in a digital circuit.
9/15/09 - L7 Two Level Circuit Optimization Copyright Joanne DeGroat, ECE, OSU1 Two Level Circuit Optimiztion An easier way to generate a minimal.
1 Digital Logic Design Week 5 Simplifying logic expressions.
1 © 2015 B. Wilkinson Modification date: January 1, 2015 Designing combinational circuits Logic circuits whose outputs are dependent upon the values placed.
Optimization Algorithm
Charles Kime & Thomas Kaminski © 2008 Pearson Education, Inc. Circuit Optimization Logic and Computer Design Fundamentals.
UM EECS 270 Spring 2011 – Taken from Dr.Karem Sakallah Logic Synthesis: From Specs to Circuits Implementation Styles –Random –Regular Optimization Criteria.
Computer Engineering (Logic Circuits) (Karnaugh Map)
Chapter3: Gate-Level Minimization Part 1 Origionally By Reham S. Al-Majed Imam Muhammad Bin Saud University.
CHAPTER 3: PRINCIPLES OF COMBINATIONAL LOGIC
Lecture 4 Nand, Nor Gates, CS147 Circuit Minimization and
LOGIC GATES & BOOLEAN ALGEBRA
Unit 1 Minimization Techniques and Logic Gates. Introduction to Digital Systems Analog devices and systems process time-varying signals that can take.
CS1Q Computer Systems Lecture 7
Ahmad Almulhem, KFUPM 2010 COE 202: Digital Logic Design Combinational Logic Part 3 Dr. Ahmad Almulhem ahmadsm AT kfupm Phone: Office:
February 2, 2004CS 2311 Karnaugh maps Last time we saw applications of Boolean logic to circuit design. – The basic Boolean operations are AND, OR and.
June 17, 2002Basic circuit analysis and design1 Example K-map simplification Let’s consider simplifying f(x,y,z) = xy + y’z + xz. First, you should convert.
1 BOOLEAN ALGEBRA Basic mathematics for the study of logic design is Boolean Algebra Basic laws of Boolean Algebra will be implemented as switching devices.
Karnaugh Maps (K-Maps)
Lecture 11 Combinational Design Procedure
CS231 Boolean Algebra1 Summary so far So far: – A bunch of Boolean algebra trickery for simplifying expressions and circuits – The algebra guarantees us.
LOGIC CIRCUITLOGIC CIRCUIT. Goal To understand how digital a computer can work, at the lowest level. To understand what is possible and the limitations.
June 12, 2002© Howard Huang1 Karnaugh maps Last time we saw applications of Boolean logic to circuit design. – The basic Boolean operations are.
BOOLEAN ALGEBRA AND LOGIC SIMPLIFICATION
CHAPTER 1 INTRODUCTION TO DIGITAL LOGIC
EE2420 – Digital Logic Summer II 2013 Hassan Salamy Ingram School of Engineering Texas State University Set 5: Karnaugh Maps.
1 Gate Level Minimization EE 208 – Logic Design Chapter 3 Sohaib Majzoub.
Digital Logic (Karnaugh Map). Karnaugh Maps Karnaugh maps (K-maps) are graphical representations of boolean functions. One map cell corresponds to a row.
Standard & Canonical Forms COE 202 Digital Logic Design Dr. Aiman El-Maleh College of Computer Sciences and Engineering King Fahd University of Petroleum.
ECE 301 – Digital Electronics Minimizing Boolean Expressions using K-maps, The Minimal Cover, and Incompletely Specified Boolean Functions (Lecture #6)
Based on slides by:Charles Kime & Thomas Kaminski © 2004 Pearson Education, Inc. ECE/CS 352: Digital System Fundamentals Lecture 7 – Karnaugh Maps.
Mu.com.lec 9. Overview Gates, latches, memories and other logic components are used to design computer systems and their subsystems Good understanding.
Digital Systems Design 1 Signal Expressions Multiply out: F = ((X + Y)  Z) + (X  Y  Z) = (X  Z) + (Y  Z) + (X  Y  Z)
CE1110: Digital Logic Design Gate Level Minimization Karnaugh Maps (K-Maps)
Lecture 4 Nand, Nor Gates, CS147 Circuit Minimization and
Computer Organisation
CS 352 Introduction to Logic Design
ECE 2110: Introduction to Digital Systems
Lecture 5 Dr. Nermin Hamza.
Digital Logic and Design
Optimized Implementation of Logic Function
COE 202: Digital Logic Design Combinational Logic Part 3
Overview Part 2 – Circuit Optimization
Karnaugh maps Last time we saw applications of Boolean logic to circuit design. The basic Boolean operations are AND, OR and NOT. These operations can.
ECE 352 Digital System Fundamentals
Laws & Rules of Boolean Algebra
Circuit Simplification and
Presentation transcript:

1 Optimizations and Tradeoffs We now know how to build digital circuits –How can we build better circuits? Let’s consider two important design criteria –Delay – the time from inputs changing to new correct stable output –Size – the number of transistors –For quick estimation, assume Every gate has delay of “1 gate-delay” Every gate input requires 2 transistors Ignore inverters 16 transistors 2 gate-delays F1 w x y w x y F1 = wxy + wxy’ (a) 4 transistors 1 gate-delay F2 F2 = wx (b) w x si = wx(y+y’) = wx Transforming F1 to F2 represents an optimization: Better in all criteria of interest z e (c) (t r t ors) F1 F delay (gate-delays) size (transistors)

2 Optimizations and Tradeoffs Tradeoff –Improves some, but worsens other, criteria of interest z e Transforming G1 to G2 represents a tradeoff: Some criteria better, others worse. 14 transistors 2 gate-delays 12 transistors 3 gate-delays G1 G2 w w x y z x w y z G1 = wx + wy + zG2 = w(x+y) + z G1 G delay (gate-delays) size (transistors)

3 Optimizations and Tradeoffs We obviously prefer optimizations, but often must accept tradeoffs –You can’t build a car that is the most comfortable, and has the best fuel efficiency, and is the fastest – you have to give up something to gain other things. si z e ansis si delay z e si delay z e Optimizations Tradeoffs All criteria of interest are improved (or at least kept the same) Some criteria of interest are improved, while others are worsened size

4 Combinational Logic Optimization and Tradeoffs Two-level size optimization using algebraic methods –Goal: circuit with only two levels (ORed AND gates), with minimum transistors Though transistors getting cheaper (Moore’s Law), they still cost something Define problem algebraically –Sum-of-products yields two levels F = abc + abc’ is sum-of-products; G = w(xy + z) is not. –Transform sum-of-products equation to have fewest literals and terms Each literal and term translates to a gate input, each of which translates to about 2 transistors (see Ch. 2) Ignore inverters for simplicity F = xyz + xyz’ + x’y’z’ + x’y’z F = xy(z + z’) + x’y’(z + z’) F = xy*1 + x’y’*1 F = xy + x’y’ 0 1 x’ y’ n x’ 0 1 m m n n F 0 1 y m y x x F x y y’ m n 4 literals + 2 terms = 6 gate inputs 6 gate inputs = 12 transistors Note: Assuming 4-transistor 2-input AND/OR circuits; in reality, only NAND/NOR are so efficient. Example

5 Algebraic Two-Level Size Minimization Previous example showed common algebraic minimization method –(Multiply out to sum-of-products, then) –Apply following as much possible ab + ab’ = a(b + b’) = a*1 = a “Combining terms to eliminate a variable” –(Formally called the “Uniting theorem”) –Duplicating a term sometimes helps Note that doesn’t change function –c + d = c + d + d = c + d + d + d + d... –Sometimes after combining terms, can combine resulting terms F = xyz + xyz’ + x’y’z’ + x’y’z F = xy(z + z’) + x’y’(z + z’) F = xy*1 + x’y’*1 F = xy + x’y’ F = x’y’z’ + x’y’z + x’yz F = x’y’z’ + x’y’z + x’y’z + x’yz F = x’y’(z+z’) + x’z(y’+y) F = x’y’ + x’z G = xy’z’ + xy’z + xyz + xyz’ G = xy’(z’+z) + xy(z+z’) G = xy’ + xy (now do again) G = x(y’+y) G = x a a a

6 Karnaugh Maps for Two-Level Size Minimization Easy to miss “seeing” possible opportunities to combine terms Karnaugh Maps (K-maps) –Graphical method to help us find opportunities to combine terms –Minterms differing in one variable are adjacent in the map –Can clearly see opportunities to combine terms – look for adjacent 1s For F, clearly two opportunities Top left circle is shorthand for x’y’z’+x’y’z = x’y’(z’+z) = x’y’(1) = x’y’ Draw circle, write term that has all the literals except the one that changes in the circle –Circle xy, x=1 & y=1 in both cells of the circle, but z changes (z=1 in one cell, 0 in the other) Minimized function: OR the final terms F = x’y’z + xyz + xyz’ + x’y’z’ F yz x 1 x’y’ F yz x xy x’y’z’ x’y’z x’yzx’yz’ xy’z’xy’zxyz xyz’ F yz x 1 Notice not in binary order Treat left & right as adjacent too 11 F = x’y’ + xy Easier than all that algebra: F = xyz + xyz’ + x’y’z’ + x’y’z F = xy(z + z’) + x’y’(z + z’) F = xy*1 + x’y’*1 F = xy + x’y’ K-map a a a

7 K-maps Four adjacent 1s means two variables can be eliminated –Makes intuitive sense – those two variables appear in all combinations, so one must be true –Draw one big circle – shorthand for the algebraic transformations above G = xy’z’ + xy’z + xyz + xyz’ G = x(y’z’+ y’z + yz + yz’) (must be true) G = x(y’(z’+z) + y(z+z’)) G = x(y’+y) G = x Draw the biggest circle possible, or you’ll have more terms than really needed

8 K-maps Four adjacent cells can be in shape of a square OK to cover a 1 twice –Just like duplicating a term Remember, c + d = c + d + d No need to cover 1s more than once –Yields extra terms – not minimized H = x’y’z + x’yz + xy’z + xyz (xy appears in all combinations) I yz x x y’z The two circles are shorthand for: I = x’y’z + xy’z’ + xy’z + xyz + xyz’ I = x’y’z + xy’z + xy’z’ + xy’z + xyz + xyz’ I = (x’y’z + xy’z) + (xy’z’ + xy’z + xyz + xyz’) I = (y’z) + (x) a a a

9 K-maps Circles can cross left/right sides –Remember, edges are adjacent Minterms differ in one variable only Circles must have 1, 2, 4, or 8 cells – 3, 5, or 7 not allowed –3/5/7 doesn’t correspond to algebraic transformations that combine terms to eliminate a variable Circling all the cells is OK –Function just equals 1

10 K-maps for Four Variables Four-variable K-map follows same principle –Adjacent cells differ in one variable –Left/right adjacent –Top/bottom also adjacent 5 and 6 variable maps exist –But hard to use Two-variable maps exist –But not very useful – easy to do algebraically by hand F z y G=z F=w’xy’+yz

11 Two-Level Size Minimization Using K-maps General K-map method 1.Convert the function’s equation into sum-of-products form 2.Place 1s in the appropriate K-map cells for each term 3.Cover all 1s by drawing the fewest largest circles, with every 1 included at least once; write the corresponding term for each circle 4.OR all the resulting terms to create the minimized function. Example: Minimize: G = a + a’b’c’ + b*(c’ + bc’) 1. Convert to sum-of-products G = a + a’b’c’ + bc’ + bc’ 2. Place 1s in appropriate cells G bc a 1 bc’ 1 a’b’c’ 1111 a a 3. Cover 1s G bc a a c’ 4. OR terms: G = a + c’

12 Minimize: –H = a’b’(cd’ + c’d’) + ab’c’d’ + ab’cd’ + a’bd + a’bcd’ 1. Convert to sum-of-products: –H = a’b’cd’ + a’b’c’d’ + ab’c’d’ + ab’cd’ + a’bd + a’bcd’ 2. Place 1s in K-map cells 3. Cover 1s 4. OR resulting terms Two-Level Size Minimization Using K-maps – Four Variable Example H cd ab a a’bd a’bc b’d’ Funny-looking circle, but remember that left/right adjacent, and top/bottom adjacent a’b’c’d’ ab’c’d’ a’bd a’b’cd’ ab’cd’ a’bcd’ H = b’d’ + a’bc + a’bd

13 Multi-Level Logic Optimization – Performance/Size Tradeoffs We don’t always need the speed of two level logic –Multiple levels may yield fewer gates –Example F1 = ab + acd + ace  F2 = ab + ac(d + e) = a(b + c(d + e)) General technique: Factor out literals – xy + xz = x(y+z) a c e c a a b d 4 F1 F2 F1 = ab + acd + ace (a) F2 = a(b+c(d+e)) (b)(c) 22 transistors 2 gate delays 16 transistors 4 gate-delays a b c d e F1 F si z e (t r ansis t ors ) 1234 delay (gate-delays) size (transistors)

14 Multi-Level Example Q: Use multiple levels to reduce number of transistors for –F1 = abcd + abcef a A: abcd + abcef = abc(d + ef) Has fewer gate inputs, thus fewer transistors a b c e f b c a d F1 F2 F1 = abcd + abcefF2 = abc(d + ef) (a)(b)(c) 22 transistors 2 gate delays 18 transistors 3 gate delays a b c d e f F1 F ) 1234 delay (gate-delays) size (transistors)

15 State Reduction (State Minimization) xy if x = 1,1,0,0 then y = 0,1,1,0,0 Goal: Reduce number of states in FSM without changing behavior –Fewer states potentially reduces size of state register Consider the two FSMs below with x=1, then 1, then 0, 0 x state y x y S0 S1 S2S0S2S0 S1 y=0 y=1 S2 y=0 S3 y=1 x xx x’ x Inputs: x; Outputs: y S0 S1 y=0 y=1 x’x x For the same sequence of inputs, the output of the two FSMs is the same a

16 State Reduction: Equivalent States Two states are equivalent if: 1.They assign the same values to outputs –e.g. S0 and S2 both assign y to 0, –S1 and S3 both assign y to 1 2.AND, for all possible sequences of inputs, the FSM outputs will be the same starting from either state –e.g. say x=1,1,0,0,… starting from S1, y=1,1,0,0,… starting from S3, y=1,1,0,0,… S0 S1 y=0 y=1 S2 y=0 S3 y=1 x xx x’ x Inputs: x; Outputs: y States S0 and S2 equivalent States S1 and S3 equivalent S0, S2 S1, S3 y=0 y=1 x’x x a

17 State Reduction: Example with no Equivalencies Another example… State S0 is not equivalent with any other state since its output (y=0) differs from other states’ output S1 y=0 y=1 S2 y=1 S3 y=1 xx xx x’ Inputs: x; Outputs: y S0 Consider state S1 and S3 S1 y=0 y=1 S2 y=1 S3 y=1 xx xx x’ S0 Start from S1, x=0 S1 y=0 y=1 S2 y=1 S3 y=1 xx xx x’ S0 Start from S3, x=0 –Outputs are initially the same (y=1) –From S1, when x=0, go to S2 where y=1 –From S3, when x=0, go to S0 where y=0 –Outputs differ, so S1 and S3 are not equivalent. a

18 State Encoding Encoding: Assigning a unique bit representation to each state Different encodings may optimize size, or tradeoff size and performance Consider 3-Cycle Laser Timer… –Example 3.7’s encoding: 15 gate inputs –Try alternative encoding x = s1 + s0 n1 = s0 n0 = s1’b + s1’s0 Only 8 gate inputs b’ b x=0 x=1 Inputs: b; Outputs: x On1On2On3 Off a

19 State Encoding: One-Hot Encoding One-hot encoding –One bit per state – a bit being ‘1’ corresponds to a particular state –Alternative to minimum bit-width encoding in previous example –For A, B, C, D: A: 0001, B: 0010, C: 0100, D: 1000 Example: FSM that outputs 0, 1, 1, 1 –Equations if one-hot encoding: n3 = s2; n2 = s1; n1 = s0; x = s3 + s2 + s1 –Fewer gates and only one level of logic – less delay than two levels, so faster clock frequency Inputs: none; Outputs: x x=0 x=1 A B D C x= clk s1 n1 x s0 n0 State register clk n0 s3s2s1s0 n1 n2 n3 State register x delay (gate-delays) one-hot binary a

20 One-Hot Encoding Example: Three-Cycles-High Laser Timer Four states – Use four-bit one-hot encoding –State table leads to equations: x = s3 + s2 + s1 n3 = s2 n2 = s1 n1 = s0*b n0 = s0*b’ + s3 –Smaller (2+2) = 9 gate inputs Earlier binary encoding (Ch 3): 15 gate inputs –Faster Critical path: n0 = s0*b’ + s3 Previously: n0 = s1’s0’b + s1s0’ 2-input AND slightly faster than 3-input AND b’ b x=0 x=1 Inputs: b; Outputs: x On1On2On3 Off a