Sub topic 11
Static hazards and how to remove them
This chapter assumes you can read a Karnaugh map, write a minimal SOP or POS expression, and use the consensus theorem (AB + A'C + BC = AB + A'C). You also need the gate-level model from the earlier chapters: every gate has a small, nonzero propagation delay.
What a hazard is
A hazard is a possible momentary wrong output (a glitch) that appears while the inputs change. The cause is unequal delay along different paths from an input to the output. The Boolean function is still correct. Only the transient behavior is wrong.
A static hazard occurs when one input changes and the output should stay at the same value, but it briefly flips and returns.
| Type | Output should stay | Glitch looks like | Typical circuit |
|---|---|---|---|
| Static-1 hazard | 1 | 1 → 0 → 1 | AND-OR (SOP) |
| Static-0 hazard | 0 | 0 → 1 → 0 | OR-AND (POS) |
| Dynamic hazard | Output should change once | Changes 3 or more times | Multi-level circuits |
GATE questions assume that only one input changes at a time, and this chapter does too.
A static-1 hazard in an SOP circuit
Take F = AB + A'C and set B = C = 1. Then F = A + A' = 1 whatever A does, so the output should stay at 1 when A changes.
In the circuit, A' comes from an inverter. When A falls from 1 to 0:
- The term AB falls to 0 as soon as A falls.
- The inverter output A' rises only after the inverter delay.
- The term A'C rises after that.
For a short time both terms are 0, so F dips to 0 and returns to 1.
Finding it on a K-map
Order the variables as ABC. AB covers minterms 6 and 7 (110, 111). A'C covers minterms 1 and 3 (001, 011).
| A \ BC | 00 | 01 | 11 | 10 |
|---|---|---|---|---|
| 0 | 0 | 1 | 1 | 0 |
| 1 | 0 | 0 | 1 | 1 |
Minterms 3 (011) and 7 (111) are adjacent 1s, but they sit in different groups. Changing A moves the circuit between them, so the output handoff passes from one AND gate to the other. That handoff is where the glitch can appear.
Rule for SOP: a two-level AND-OR circuit is free of static-1 hazards exactly when every pair of adjacent 1s is covered by at least one common product term.
Removing it
Add the consensus term that covers the boundary. Here it is BC, which covers minterms 3 and 7:
F = AB + A'C + BC
With B = C = 1, the term BC stays at 1 while A changes, so the OR output never drops. The new term is redundant for the logic function, since the consensus theorem says it changes nothing. It is not redundant for timing. This is why a hazard-free circuit is usually not the minimal one.
A static-0 hazard in a POS circuit
Take F = (A + B)(A' + C) and set B = C = 0. Then F = A · A' = 0, so the output should stay at 0.
When A rises from 0 to 1, the term A + B rises at once. The term A' + C falls only after the inverter delay. For a moment both sums are 1, so F glitches to 1.
On the K-map, the zeros are minterms 0, 1, 4 and 6. Minterms 0 (000) and 4 (100) are adjacent zeros in different groups. The fix is the dual of the SOP fix: add the redundant sum term (B + C), which covers both zeros.
F = (A + B)(A' + C)(B + C)
Rule for POS: a two-level OR-AND circuit is free of static-0 hazards exactly when every pair of adjacent 0s is covered by a common sum term.
A two-level AND-OR circuit with no complemented and uncomplemented copy of the same variable in a term cannot have a static-0 hazard. The same holds for OR-AND circuits and static-1 hazards. This is why a SOP circuit is checked for static-1 hazards only.
Procedure for checking and fixing
Steps to follow:
- Write the minimal expression and mark its groups on the K-map.
- For SOP, look at each pair of adjacent 1s. For POS, look at each pair of adjacent 0s.
- If no single group contains both cells of a pair, add a group that does.
- Make the new group as large as possible, so that it is a prime implicant (SOP) or prime implicate (POS).
- Check again. An added group can create new boundaries.
Simulating the hazard in Verilog
The gate primitives below give each gate a delay. The inverter is slower than the other gates, which creates the timing gap that causes the hazard.
module sop_hazard(input a, input b, input c, output f);
wire na, t1, t2;
not #2 (na, a);
and #1 (t1, a, b);
and #1 (t2, na, c);
or #1 (f, t1, t2);
endmodule
module sop_free(input a, input b, input c, output f);
wire na, t1, t2, t3;
not #2 (na, a);
and #1 (t1, a, b);
and #1 (t2, na, c);
and #1 (t3, b, c);
or #1 (f, t1, t2, t3);
endmodule
module tb;
reg a, b, c;
wire f_bad, f_good;
sop_hazard u1(a, b, c, f_bad);
sop_free u2(a, b, c, f_good);
initial begin
$monitor("t=%0t a=%b f_bad=%b f_good=%b", $time, a, f_bad, f_good);
a = 1; b = 1; c = 1;
#10 a = 0;
#10 $finish;
end
endmoduleAfter the circuit settles, both outputs are 1. When A falls at time 10, f_bad drops to 0 at time 12 and returns to 1 at time 14. f_good stays at 1 because the t3 term holds the OR gate high.
When hazards matter
In a fully synchronous circuit, a glitch is harmless if it dies out before the next clock edge, because the flip-flops only sample settled values. That is the timing constraint from the clock period chapter. Hazards matter when a signal is not sampled by a clock:
- Asynchronous set and reset inputs of flip-flops.
- The clock or enable of a latch or flip-flop, since a glitch can act as a false edge.
- Asynchronous sequential circuits, where outputs feed back as inputs.
Limits of this method
- The rules cover single-input changes only. If two inputs change together, a multiple-input hazard can occur that no added gate can remove in general.
- Dynamic hazards need at least three output transitions. They need three or more paths with different delays, so they do not occur in two-level circuits. A two-level circuit with no static hazard has no dynamic hazard either.
- A function with both a static-1 and a static-0 boundary can need a different cover for each, and the two-level forms must be checked separately.
Exercise
F = XY + X'Z. Which single product term removes the static-1 hazard, and for which input values and which input change does the hazard occur?
Show answer
The hazard occurs when Y = Z = 1 and X changes. The term YZ removes it, giving F = XY + X'Z + YZ.
Exercise
F(A, B, C) = Σm(0, 1, 3, 7) is implemented as the minimal SOP A'B' + BC. Is there a static-1 hazard? If so, give the added term.
Show answer
Yes. Minterms 1 (001) and 3 (011) are adjacent 1s covered by different groups (A'B' covers 0 and 1, BC covers 3 and 7). The cover is A'C, which includes minterms 1 and 3. The hazard-free expression is A'B' + BC + A'C.
Exercise
A two-level OR-AND circuit realizes F = (P + Q)(P' + R). Which static hazard can it have, and what term fixes it?
Show answer
It can have a static-0 hazard when Q = R = 0 and P changes. Add the sum (Q + R), giving F = (P + Q)(P' + R)(Q + R).