Professional Documents
Culture Documents
John Knight
Hazards
Glitches and a Hazards
A glitch is a fast spike usually unwanted. A hazard is a circuit which may produce a glitch. We will see this happens if the propagation delays are unbalanced.
static-one hazard; signal is one, glitch falls. dynamic hazard; signal is changing, up or down
John Knight
Basic static-0
1 1
Any circuit with a static-0 hazard must reduce to the equivalent circuit of FIG. 1-1, if other variables are set to appropriate constants.
0 x x 0 x 1 0 x 0 x FIG. 1-2
Explaination:
0 x 0 x
John Knight
Any circuit with a static-1 hazard must reduce to the equivalent circuit of FIG. 1-3
FIG. 1-4 1
x 0
John Knight
delay
FIG. 1-5
The basic dynamic hazard circuit with its imbedded static-1 hazard.
The basic dynamic hazard circuit with its imbedded static-0 hazard.
John Knight
Adding delay can remove hazards, if one has good control of propagation delays. The original circuit with the delay in the inverter.
FIG. 1-7
Basic static-1 hazard circuit from FIG. 1-3. Note the hazard appears on the falling edge of x.
0 0
Adding an equal delay in the other path removes the falling-edge glitch. Adding too much delay will make the glitch appear on the rising edge.
FIG. 1-8
Adding delay, moves the glitch from x to x . To kill the glitch balance the delays exactly, if you can!
delay 0 0
At the silicon layout level, one might balance delays closely enough to suppress the glitch. With standard cells and field-programmable arrays, balancing is harder.
But see Summary Of Hazards on page 36. John Knight Electronics Department, Carleton University Printed; March 24, 04 Modified; March 24, 04
FIG. 1-9
Map of a static-1 hazard. On the of map, each OR gate input is a separate circle. Standing on top of a hill gives a 1. Changing hills causes a 0 glitch as one crosses the valley. The shows the hazard.
x 0 1 1 0 x 0 0
x 1 1
K-map of y=x
K-map of y=x
K-map of y = x + x
x=0
x=1
John Knight
of maps can only show static-1 hazards, not static-0 or dynamic hazard.
AB 00 01 11 10 X 0 0 BX 0
1
FIG. 1-10
AX
B X A
BX AX + BX AX
AND gates have been added to the hazard. The hazard is still the inverter and the OR gate. The hazard appears only when A = 1, B = 1. Then signal x travels right through the ANDs.
Masking a Hazard.
To mask static-1 hazards add a gate that stays high across the This gate is logically redundant.
AB X 00 01 11 10 0 0 BX 0 1 0 0 AX B BX BX + AX + AB AB A AX X AB FIG. 1-11
transition.
The equation F = BX + AX has redundant term AB added F = BX + AX + AB This fills the valley between terms BX and AX .
John Knight
F = [ABC + D(AB+C)]A F = {[{ABC} +{D({AB} +C)}]A} FDUAL ={[{A+B+C} {D+({A+B}C)}]+A} FDUAL= {A+B+C}{D+{A+B}C}+A F = {A+B+C}{D+{A+B}C}+A
Examples
F = (X + B)( X + A)
F = (XB) + (XA) 2. Map F on a Karnaugh map This is a of which is easy to map. F = XB + XA 3. Change this F map into a map of F: write 0 in the circled squares, write 1 in the uncircled squares. This gives the of map for F.
Map of F with 0s circled. AB X 00 01 11 10
0 1
of
Map of F
AB X 00 01 11 10 0 0 1 1 0
1
0 1
of map for F
F = (X + B)( X + A)
John Knight
10
FIG. 1-12
Plot of map.
F = (X + B)( X + A) F =(XB) + ( XA)
0 A X
0 1
1 A+X
B+X
If the circles overlap, there is no hazard, The circles have to be adjacent, not corner-to-corner.
John Knight
11
Get of map
F = (D + X)(E + X) F = (DX)+(EX)
Circle 0s not 1s. Gaps between adjacent circles show static-0 hazards. Dont forget wrap around
FIG. 1-14
D+X D+E
hazard
To mask the static-0 hazard: AND F with a term which stays 0 across the hazard. The hazard is X,D,E = 1,0,0 to 0,0,0. The term which stays 0 across the gap is X,D,E = -,0,0, or (D + E).
XD 00 01 E 11 10
D+X
F= (D + X)(E + X) (D + E)
E+X
D+E
1
D+E
John Knight
12
For work with dynamic hazards, avoid the distributive law. (Factoring)
The distributive laws can create dynamic hazards from static hazards, even a masked one. They will not remove or create static hazards.
The Distributive Laws
(x + y)x= x
13
Algebra of Hazards
Algebra of Hazards
The basic forms for hazards and their equations. x and x are treated as separate variables. If a circuit has a hazard, the equation of the circuit will reduce to one of these forms.
FIG. 1-15 x Static-0 xx Static-1 x+x x Dynamic xx + x x Dynamic (x + x )x
An Example
Below, a hazard in x must reduce to a basic hazard circuit when c=1 or when c=0.
c x FIG. 1-16 Static-1 hazard cx + x x c FIG. 1-17 No Hazard (c + x )xc
Circuit equation is (c + x)xc When c = 1, get (1 + x)x1 = x When c = 0, get (0 + x)x0 = 0 There are no hazard
John Knight
14
Glitches and Hazards in Digital Circuits The Distributive Law and Hazards
Algebra of Hazards
The distributive laws can change 2 parallel paths into 3, this may create a dynamic hazard from a static one. They can create a dynamic hazard from a masked hazard ( FIG. 1-18 bottom).
FIG. 1-18
x c
John Knight
15
Glitches and Hazards in Digital Circuits DeMorgans Law Does Not Change Hazards
FIG. 1-19
Algebra of Hazards
DeMorgans Law does not change static hazards or dynamic hazards, other than possibly inverting them.
ORIGINAL CIRCUIT Static-1 hazard x CIRCUIT AFTER APPLYING DEMORGANS LAW Static-0 hazard inverted = static-1 hazard x
DeMorgan a +b = a b
x+x
xx
Dynamic hazard x
xx + x
(x + x)x
John Knight
16
Method
Method
Step 1) Remove confusing extended overbars. using DeMorgan. Step 2) Find which variables cannot have hazards.
Step 3) Check for hazards in each variable. Select one variable for checking. make other variables 1 or 0 to bring out hazard.
AX + (BX + C)
Make A=1, B=1, C=0 1X + (1X + 0)
Static-1 hazard
X + X
John Knight Electronics Department, Carleton University Printed; March 24, 04 Modified; March 24, 04
17
Example
Find All The Hazards In F.
b c a d F
John Knight
18
Glitches and Hazards in Digital Circuits DeMorgans Laws in Graphical Form (Review)
FIG. 1-20
A B
AND
A B
D+E
DE
AND
D E
OR
D E
OR
GH
G+H
D+E
DE
G H FIG. 1-21
NAND
G H
NAND AND
D E
NOR
D E
NOR
NOR
iv) Result
F = (a + c)(b + c) + cd
Printed; March 24, 04 Modified; March 24, 04
John Knight
19
b c a F
To see hazardous paths: Check for reconvergent paths one of which is inverting. Only variable c has such a path; only c can have hazards.
d b c a d
To check which variables can have hazards. Check which variables have x and x F = (a + c)(b + c) + cd \ Only c has both c and c terms.
John Knight
20
(a + c) (b + c) + cd
(0 + c) (0 + c) + c0 (0 + c) (0 + c) + c1 (0 + c) (1 + c) + c1 (0 + c) (1 + c) + c0 (1 + c) (0 + c) + c0 (1 + c) (0 + c) + c1 (1 + c) (1 + c) + c1 (1 + c) (1 + c) + c0
cc cc + c c+c c c c+c
1+c 1
c
1
21
F = (a + c)(b + c) + cd
Note only c can have a hazard. Select c to to be the variable that changes. Sequentially substitute 1 or 0 for the other letters. A little thought shows a must be 0, else a + c = 1 => no c => no hazard Set a = 0 first.
a bcd a b cd 0 bcd
(a + c)( b + c) + cd (a + c)(b + c)+ cd (0 + c)(b + c)+ cd try b = 1 d must be 1 a must be 0, or no c. = c(b + c)+ cd = c(1 + c)+ cd = c + cd = c + c1
a,b,c,d.
0 1 cd 0 1 c1
0 0 cd 0 0 c0 0 0 c1
= c+ c
Static-1 for
01c1
00c0 00c1
0 1 0
b
0
c+c cc cc + c
Printed; March 24, 04 Modified; March 24, 04
John Knight
22
Example: Find all the single-variable change hazards f = ( abc + acd )( abc + de ) Note only c or d can have hazards.
a bcd e a bcd e 0 bcd e ( abc + acd)(abc + de ) ( abc + acd)(abc + de ) ( bc + cd )( bc + de ) = (bc + cd)(bc + de)
a must be 0 (a = 1), or no c or d
0 cde b = 1 or no c 0 1c e if d is 1 0 1c 0 e if d is 0 0 1c0 if e is 0 00 c d e try b = 0 001 d 1 if c=1 and e=1 01 c d e try b = 1 0 0 d e try c=1 0 0 d e try c=0
= (c + cd )( c + de) (c + c)c = (c + c)( c + 0 ) = (c)(c + e) = (c + 0)( c + 1e ) = = (c)(c) = ( 0 + cd)(0 + de) = = ( 0 + d)(0 + d) =dd = ( c + cd)(c + de) = 0 + 1d)(1 + de) = ( 1 + 0d)(0 + de)
c
a
1 0 1
Static-0
No hazard No hazard
1 0
d
1
1 0 1 0 1 1
(c + c)c
e
b
1 0
cc
c c
1 0
dd
John Knight
23
a bcd
[(a + bc)d + (b + ac)d ]ab [ (a + bc)d +(b + ac)d]ab b must be 1, or F 0 [ (a + 1c)d +(0 + ac)d]a1 = [(a+c)d+ acd ]a c, must be 0, or no a set c = 0 = [( a+0)d+ a1d ]a= [ad+ ad]a d may be 0 . = [a0 + a1]a = aa Static-0 for a100 or d may be 1 = [a1 + a0]a = aa Static-0 for a101
a bcd a 1 cd a1 0d a 10 0 a 10 1
a bcd 0 bcd 0 bc 0 a b cd 0 1 cd a bc d 0 1 cd
John Knight
[ (a + bc)d +(b + ac)d]ab [ (0 + bc)d +(b + 0c)d]1b = [ bcd + bd ] b [( bc0 + b1]b = [b]b [ (a + bc)d +(b + ac)d]ab = [ (0 + 1c)d +(0 + 0c)d]11 = [ cd ] [ (a + bc)d +(b + ac)d]ab = [ (0 + 1c)d +(0 + 0c)d]11 = [ cd ]
Electronics Department, Carleton University
a must be 1, or F 0 d must be 0 or no b Static-0 for 0 b - 0 This hazard is independent of c. a,b must be 1,1, or F 0 There is no c, hence no hazard a,b must be 1,1, or F 0 There is no d, hence no hazard
Printed; March 24, 04 Modified; March 24, 04
24
Glitches and Hazards in Digital Circuits Graph of the previous hazard search F = [(a + bc)d + (b + ac)d ]ab [(a+c)d+ acd ]a [ad +ad]a
0 1
1 0
0 1
aa aa
[ bcd + bd ]b
[(bc0+ b1]b
0 1
0 1
0 1
b b b b
0 1
0 1
bcd + bdb
[cd] b
1 0
0 1
0 1
John Knight
25
To get cc in F as above on must place c and c as inputs to the same AND gate. This is ignorant. Rule I:
a
Except for the gross carelessness of including terms like acc, c of implementations have no static-0 hazards.
John Knight
26
Sum-of-Product Circuits Have No Dynamic Hazards of circuit have equations of the form
F = abc + abd + abcd + . . . . . . .+ abcd + abccd
Dynamic hazards are of the form cc + c or (c+c)c. In F, try fixing a, b and d at any combination of 0 or 1. A dynamic hazard in c, must have a term containing cc. In F above, one can only get a dynamic hazard by using the ignorant term abccd . Thus Rule II is:
a c
John Knight
27
Sum-of-Product Circuits Have Only Easily Eliminated Static-1 Hazards of circuits can still have static-1 hazards They are easily found and removed using: a Karnaugh map, or algebraically. .
FIG. 1-23
Map of function F = bx + ax It is of The hazards must all be static-1. Hazard when a,b = 1,1. Add term ab to mask the hazard. F = bx + ax + ab Is shown on the right.
ab x 0 1
00 01
0 0
11 10
0
ab x 0
bx
0
00 01 11 10 0 0 bx ab ax
Printed; March 24, 04 Modified; March 24, 04
ax
John Knight
28
Product-of Sum Circuits Have No Static-1 Hazards of circuit equations are of the form
F = (a+b+c)(a+b+d)(a+b+c+d)( . . . . . . .)(a+b+c+d)
Static-1 hazards are of the form c + c. To get c+c in F one must place c and c as inputs to the same OR gate. This is ignorant.
Except for the gross carelessness of including terms like a+c+c, a of implementations have no static-1 hazards. c
a c
Product-of Sum Circuits Have Only Easily Eliminated Static-0 Hazards of circuits can still have static-0 hazards They are easily found and removed using a of Karnaugh map
John Knight Electronics Department, Carleton University Printed; March 24, 04 Modified; March 24, 04
29
F = ab + bc + acd
Then add circles which cover the arrows; FIG. 1-24(right). The hazard free equation, on this final map, is -
F = ab + bc + acd + ac + bcd + a bd
++ +
FIG. 1-24
Left) Example to be implemented as a hazard free circuit. Centre) A possible of encirclement showing hazards. Right) The map with the hazards covered.
cd ab 00 01 11 10 00 01 11 10 ab 00 01 11 10 00 0 0 01 acd 1 cd 11 10 bc ab 00 01 11 10 00 0 0 1 0 01 1 1 bcd 0
cd
11 abd 0 10 1 0
0 0 1 0
1 1 1 0
1 0 1 1
1 0 1 1
1
0
1
0
1
0
1 ab 1
0
1
bc
1 1
1 ac 1
F = ab + bc + ac d
30
Two-variable-change hazards
AB00 01 0 BX BX 0
FIG. 1-25
11 10
0 1
AX 0
Start at square A,B,X =1,1,0 (the tail of the arrows) Change both B and X to move to square A,B,X =1,0,1 (the head of the arrows). If B changes slightly before X, one travels the upper route . The valley between AX and BX may glitch. A masking term AB can cover the valley. It only removes the glitch on the upper path. If X changes slightly before B, one takes the lower path . This will always glitch. It cannot be covered. Covering the offending 0 changes the function.
A X BX
AX F AX + BX + BX
B BX
John Knight
31
A COMBINATIONAL B C D LOGIC
AB CD 00
00 01 11 10
01
11
10
GLITCH HEAVEN
With 2 variables changing one is very likely to have hazards. With more variables changing they are like waves in the ocean.
But very fast glitches will be absorbed inside gates (inertial delay)..
John Knight
32
The flip-flops only respond in the circled region on the waveforms below. A glitch at any other time will not influence state of the machine. The glitches die out long before the clock edge. The glitches have no influence on the state.
INPUT CLOCK D INPUT CLOCK Q1 D2 Q2 D3 Q3
1D C1
Q1
D2
1D C1
Q2
slow
D3
1D C1
Q3
John Knight
33
CLK DA DB DC DD
1D C1 1D C1 1D C1 1D C1
A COMBINATIONAL B C D LOGIC
S1 1 R KILLER GLITCH
John Knight
34
Memories
Memory chips are asynchronous latches, and are sensitive to glitches. Memory control leads must be glitch free.
John Knight
35
Summary Of Hazards
Summary Of Hazards
Single variable change hazards
Can be found and cured.
John Knight
36
+ aceX set a,c,e to1,1,1 or no X If only one X, set all symbols ANDing X to 1. If only one X, set symbols ANDing X at 1, and ORing X at 0. y(e + Xc) set c,e,y to 1,0,1 or no X. If all Xs have a common factor, fix factor at 1. b(cX + acX) + acXy c must be 1 or no X a bce y y(e + bc) + b(ce + ace) + acey y(e + bc) + b(ce + ace) + acey y(e + b0) + b(1e + a0e) + a1ey = ye + be + aey y(e + bc) + b(ce + ace) + acey 1(0 + b1) + b(01 + a10) + a010 = b + 0 y(e + bc) + b(ce + ace) + acey y(0 + bc) + b(c1 + ac0) + ac1y = ybc + bc + acy = 11c + 0c + ac0 y(e + bc) + b(ce + ace) + acey y(e + b0) + b(1e + a0e) + a1ey = ye + be + aey = 1e + be + ae0= e + be = e+e y(e + bc) + b(ce + ace) + acey y(0 + b0) +b(11 + 000) + 111y = b + y
Electronics Department, Carleton University
a bce y a b 1ey
a bce y a b 010 a b ce y a b c1 y a 0c 01 a b ce y a b 1e y a b 1e 0 a 11e 0 a b ce y 1 b11 y
John Knight
c must be 1, or no a no a => no hazards in a c,e,y must be 1,0,1 or no b. no b => no hazards in b. e must be 1 or no c. yb must be 1,1 or no c no c => No hazards. c must be 1 or no e y must be 1 or no e b must be 1 Static-1 for a11e0 a,c,e must be 1,1,1 or no y. no y => No hazards in y.
Printed; March 24, 04 Modified; March 24, 04
37
Glitches and Hazards in Digital Circuits Graph of the previous hazard search
1 0
no a no a
y(e + b) + b(ae)
0 1
e no b
1 0
no b no b
y(bc) + bc + acy
bc + bc
0 1
1 0
y no c
b no c
0 1
no c no c
ye + be + aey
e + be
y
0 1
1 0
b no e
1 0
e+e
no e
no e
ye + be + ey
1 0
1 0
c no y
e no y
1 0
no y no y
John Knight
38
Example 4
Example 4
Equation. f = ( abc + acd )( abc + de ) Note only c or d can have a hazard. a bcde a bcde 0bcde 0 0 0 0 0 0 0 0 0 cde 1c e 1c 1 e 1 c 0 01 0cde 01d1 1cde 0 de 0 de ( abc + acd)(abc + de ) ( abc + acd)(abc + de ) ( bc + cd )( bc + de ) = (bc + cd)(bc + de) b = 1 or no c if d is 1 if d is 0 if e is 0 try b = 0 if c=1 and e=1 try b = 1 try c=1 try c=0 a must be 0 (a = 1), or no c or d
= ( 0 + cd)(0 + de) = = dd + c0 = dd Static-0 = ( c + cd)(c + de) No hazard = ( 0 + 1d)(1 + de) No hazard = ( 1 + 0d)(0 + de)
1 0 1 0
0 1
e
(c + c)c e=1 or 0
0 1
cc
0 0
c c
1 1 1 0
0 1
dd
John Knight
39
Example 4
a) Place arrows on the K-map for F to show where all the single-variable-change static-1 hazards might occur. b) On another map show what AND terms must be added to F to mask these hazards. Write the equation for the simplest F you can find that still has masked hazards. You may change the original four terms of F if it would be beneficial.
1 1 1
c
1 1 1
c
1 1 1
c
1 1 a
1 1
1 1 1 1
b a
1 1
1 1
1 1 1 1
1 1 a
1 1
1 1 1 1
F = abc + bc + bd + abc
2. Problem
Given G = ba + ac + bcd (a) State with reasons, but without doing any calculation or map work,: i) How many static-0 hazards G has. ii) How many dynamic hazards G has. (b) Find all the single-variable-change hazards algebraically.
John Knight
40