Glitches & Hazards Glitches / Hazards Gates have an inherent delay A glitch is an unwanted pulse at the output of a combinational circuit We have been ignoring this but delays do exist Glitches can result from gate delays Glitches depend on the input patterns glitches may not occur if the input pattern that would cause the glitch never occurs A circuit with the potential for a glitch has a hazard A circuit with a hazard may or may not glitch Glitch Example F = AB + A'C: assume all gate delays = 10ns An input change from ABC = 111 to 011 results in a glitch output changes from 1 0 1 again A static hazard: result should have stayed statically at 1 Static & Dynamic Hazards Static hazards: 1 0 1 1 0 0 Dynamic hazards: 1 0 1 0 0 1 Removing Static Hazards Glitch occurs in moving from one implicant to another within a cover When two adjacent 1's are not covered by a single implicant Solution: add an extra implicant to provide that coverage BC A 00 01 11 10 0 0 1 1 0 1 0 0 1 1 F = AB + A'C + BC No longer minimum form but no hazard now Hazard Removal: Example F(A,B,C,D) = m(6,7,8,9,12,13,14,15) CD AB 00 01 11 10 00 0 0 0 0 01 0 0 1 1 11 1 1 1 1 10 1 1 0 0 The red prime implicant removes the static-1 hazard Dynamic Hazards Dynamic hazards do not occur in two-level combinational circuits only in multi-level circuits One gate delay x1 x2,x3,x4 b x1 f a x2 c x3 x4 d a b c d f Causes of Dynamic Hazards For an output to change 0101 (i.e. 3 times) in response to a single input change, there must be at least 3 paths of different length in the circuit 2 gate delays: x1 b f 3 gate delays: x1 a b f 4 gate delays: x1 a c d f b x1 f a x2 c x3 x4 d Removing Dynamic Hazards Removing dynamic hazards is very difficult Even detecting dynamic hazards is very difficult Stick to two level designs to ensure combinational circuits do not have dynamic hazards Sequential circuits do not have this problem Quine-McClusky Method Quine-McClusky Method An algorithm that CAD tools can and do use Uses tables to: Compute all prime implicants Identify essential prime implicants Select the minimum number of prime implicants for a cover Is based on the combining property again x y + x y' = x (y + y') = x Grouping the Minterms f(A,B,C,D) = m(0,4,8,10,11,12,13,15) Arrange all minterms according to the number of 1’s in the binary representation Sort and group them These are called 0-cubes Like vertices of a 4D cube 0 0000 4 0100 8 1000 10 1010 12 1100 11 1011 13 1101 15 1111 Forming 1-cubes Compare each 0-cube in one group with each 0cube in an adjacent group Use combining property to form 1-cubes 1 cubes 0 cubes 0 0000 X 4 0100 X 8 1000 X 10 1010 X 12 1100 X 11 1011 X 13 1101 X 15 1111 X 0,4 0x00 0,8 x000 8,10 10x0 4,12 x100 8,12 1x00 10,11 101x 12,13 110x 11,15 1x11 13,15 11x1 Forming 2-cubes Compare each 1-cube in one group with each 1cube in an adjacent group Use combining property to form 2-cubes 1 cubes 2 cubes 0,4 0x00 X 0,8 x000 X 8,10 10x0 4,12 x100 X 8,12 1x00 X 10,11 101x 12,13 110x 11,15 1x11 13,15 11x1 0,8,4,12 xx00 mark each 1-cube that contributes to a 2-cube The Prime Implicants All “unchecked” cubes are prime implicants They did not get combined into a larger cube 0 cubes 1 cubes 2 cubes 0 0000 X 0,4 0x00 X 4 0100 X 0,8 x000 X 8 1000 X 8,10 10x0 10 1010 X 4,12 x100 X 12 1100 X 8,12 1x00 X 11 1011 X 10,11 101x 13 1101 X 12,13 110x 15 1111 X 11,15 1x11 13,15 11x1 0,8,4,12 xx00 All prime implicants are: P = { 10x0, 101x, 110x, 1x11, 11x1, xx00 } Prime Implicant Cover Table For each prime implicant, mark all minterms covered by that implicant prime implicants p1 10x0 p2 101x p3 110x p4 1x11 p5 11x1 p6 xx00 minterms 0 4 8 10 X X X 11 12 13 15 X X X X X X X X X X X Find Essential Prime Implicants p6 is an essential prime implicant minterms 0 and 4 must be covered by p6 Minimum cover C = { p6 } at the moment prime implicants p1 10x0 p2 101x p3 110x p4 1x11 p5 11x1 p6 xx00 minterms 0 4 8 10 X X X 11 12 13 15 X X X X X X X X X X X Row Dominance p2 row dominates p1 since p2 covers everything that p1 covers p1 can be eliminated Note: we remove the dominated row prime minterms implicants 10 11 p1 10x0 X p2 101x X p3 110x p4 1x11 p5 11x1 13 15 X p5 row dominates p3 X X X X X Column Dominance Column 11 column dominates column 10 since everything that covers column 10 also covers column 11 Column 11 can be eliminated Note: we remove the dominating column prime minterms implicants 10 11 p2 101x X p4 1x11 p5 11x1 13 15 X X X X column 15 dominates column 13 X We could also have considered p2 and p5 as essential at this point Final Cover prime minterms implicants 10 p2 101x X p4 1x11 p5 11x1 13 X The final cover is C = { p6, p2, p5 } f = xx00 + 101x + 11x1 = C'D' + AB'C + ABD Another Example f(A,B,C,D) = m(0,2,4,5,6,7,8,10,11,12,15) 0 cubes 0 0000 2 0010 4 0100 8 1000 5 0101 6 0110 10 1010 12 1100 7 0111 11 1011 15 1111 Cubes 1 cubes 0 cubes 0,2 00x0 X 0,4 0x00 X 0,8 x000 X 2,6 0x10 X 0 0000 X 2,10 x010 X 2 0010 X 4,5 010x X 4 0100 X 4,6 01x0 X 8 1000 X 4,12 x100 5 0101 X 8,10 6 0110 X 10 1010 12 2 cubes 0,2,4,6 0xx0 0,2,8,10 x0x0 X 0,4,8,12 xx00 10x0 X 4,5,6,7 01xx 8,12 1x00 X X 5,7 01x1 1100 X 6,7 011x X All prime implicants are: X 7 0111 X 10,11 101x 11 1011 X 7,15 x111 15 1111 X 11,15 1x11 P = { 101x, x111, 1x11, 0xx0, x0x0, xx00, 01xx } Cover Table prime implicants minterms 0 2 p1 101x p2 x111 p3 1x11 p4 0xx0 X X p5 x0x0 X X p6 xx00 X p7 01xx 4 5 6 7 8 10 11 X X 12 15 X X X X X X X X X X X X X X C = { p6, p7 } since p6 and p7 are essential X Row Dominance prime implicants minterms 2 p1 101x p2 x111 p3 1x11 p4 0xx0 X p5 x0x0 X 10 11 X X 15 X X X Row p5 dominates row p4 Row p3 dominates row p2 X Column Domination prime implicants p1 101x p3 1x11 p5 x0x0 minterms 2 10 11 X X 15 X X X X Column 10 dominates column 2 Column 11 dominates column 15 Final min cover is C = { p6, p7, p3, p5 } f = xx00 + 01xx + 1x11 + x0x0 = C'D' + A'B + ACD + B'D' Handling Don't Cares f(A,B,C,D) = m(0,3,10,15) + d(1,2,7,8,11,14) Don't care conditions are used for creating the prime implicants Don't care conditions are not used for computing the minimum cover 0 cubes 0 0000 1 0001 2 0010 8 1000 3 0011 10 1010 7 0111 11 1011 14 1110 15 1111 Cubes 1 cubes 0 cubes 0,1 000x X 0,2 00x0 X 2 cubes 0 0000 X 0,8 x000 X 0,1,2,3 00xx 1 0001 X 1,3 00x1 X 0,2,8,10 x0x0 2 0010 X 2,3 001x X 2,3,10,11 x01x 8 1000 X 2,10 x010 X 3,7,11,15 xx11 3 0011 X 8,10 10x0 X 10,11,14,15 1x1x 10 1010 X 3,7 0x11 X 7 0111 X 3,11 x011 X 11 1011 X 10,11 101x X 14 1110 X 10,14 1x10 X 15 1111 X 7,15 x111 X 11,15 1x11 X 14,15 111x X All prime implicants are: P = { 00xx, x0x0, x01x, xx11, 1x1x } Cover Table Include only required minterms in the initial cover table prime minterms implicants 0 3 p1 00xx X X p2 x0x0 X p3 x01x X p4 xx11 X p5 1x1x 10 15 X X X X X There are no essential prime implicants Branching There are no dominant rows and no dominant columns Require a branching strategy Backtracking type algorithm Select C = { p1 } prime minterms implicants 0 3 p1 00xx X X p2 x0x0 X p3 x01x X p4 xx11 X p5 1x1x 10 15 X X X X X Min Cover That Includes p1 Row p5 dominates rows p2, p3, and p4 Min cover C = { p1, p5 } f = 00xx + 1x1x = A'B' + AC Cost = 3 + 6 = 9 prime minterms implicants 10 p2 x0x0 X p3 x01x X p4 xx11 p5 1x1x 15 X X X Backtrack Now backtrack and eliminate p1 to find covers prime minterms implicants 0 3 p1 00xx X X p2 x0x0 X p3 x01x X p4 xx11 X p5 1x1x prime 10 15 minterms implicants 0 p2 x0x0 X X p3 x01x X X p4 xx11 X p5 1x1x X X 3 10 15 X X X X X X Column 10 dominates column 0 Min Cover That Excludes p1 Row p4 dominates rows p3 and p5 Min cover C = { p2, p4 } f = x0x0 + xx11 = B'D' + CD Cost = 3 + 6 = 9 Same cost as other solution! prime minterms implicants 0 3 p2 x0x0 X p3 x01x X p4 xx11 X p5 1x1x 15 X X Factoring and Decomposition Factoring Two level logic is good for problems with only a few variables and/or limited fan-in to all gates Factoring can be used to reduce fan-in, but results in > 2 level logic Ex: f(A,B,C,D,E,F) = AB'CD'EF + ABC'D'E'F If only 4 input AND gates are available then we can factor f into f(A,B,C,D,E,F) = AD'F(B'CE + BC'E') Requires two 6 input ANDs, one 2 input OR Requires one 4 input AND, two 3 input ANDs, one 2 input OR Requires 3 level logic multi-level synthesis Multi-level Synthesis If fan-in is limited to at most 4, then the original two level circuit could be done as …. cost = 5 + 16 = 21 cascading ANDs The factored circuit could be done as … cost = 4 + 12 = 16 Functional Decomposition Multi-level circuits may sometimes be preferred over two-level circuits due to reduced cost Done at the expense of longer delays Decompose circuits into subcircuits with shared functionality Shared subcircuits provide reduced total cost Example Functional Decomposition SOP form: f = A'BC + AB'C + ABD + A'B'D cost = 5 + 16 = 21 + 2 inverters + 2 fan-in = 25 factoring … f = (A'B + AB') C + (AB + A'B') D = g C + g' D where g = A'B + AB' since g' = (A'B + AB')' = (A'B)'(AB')' = (A+B')(A'+B) = AA' + B'A' + AB + B'B = AB + A'B' Implemented Decomposition cost = 6 + 12 + 3 inverters + 3 fan-in = 24 Another Example YZ WX 00 01 11 10 YZ WX 00 01 11 10 00 1 0 0 0 00 0 0 0 0 01 0 1 1 1 01 1 1 1 1 11 1 0 0 0 11 0 0 0 0 10 0 1 1 1 10 1 1 1 1 V=0 V=1 The shaded region is g(X,W) = XW' + X'W f(V,W,X,Y,Z) = g (V+Y+Z) + g' (V+Y+Z)' = g h + g' h' Implementation cost = 11 + 19 = 30 minimal SOP cost = 55 (includes inverters)