2.4 Timing
The previous section dealt with minimizing Boolean expressions. The minimized Boolean expressions can then be directly implemented as networks of gates or on programmable logic. All gates have a finite delay between a change at an input and a change at an output. If gates are used, therefore, different paths may exist in the network, with different delays. This may cause problems.
To understand the difficulties, it is helpful to draw a timing diagram. This is a diagram of the input and output waveforms as a function of time. For example, Figure 2.12 shows the timing diagram for an inverter. Note the stylized (finite) rise and fall times. An arrow shows causality, that is, the fact that the change in the output results from a change in the input.
Figure 2.12 Timing diagram for inverter.
A more complex circuit would implement the function
The value of is generated from C by an inverter. A possible implementation of this function is therefore given in Figure 2.13. In practice, the delay through each gate and through each type of gate would be slightly different. For simplicity, however, let us assume that the delay through each gate is one unit of time. To start with, let A = 1, B = 1. The output, Z, should be at 1 irrespective of the value of C. Let us see, by way of the timing diagram in Figure 2.14, what happens when C changes from 1 to 0. One unit of time after C changes and D change to 1. In turn, these changes cause E and Z to change to 0 another unit of time later. Finally, the change in E causes Z to change back to 1 a further unit of time later. This change in Z from 1 to 0 and back to 1 is known as a hazard. A hazard occurs as a result of delays in a circuit.
Figure 2.13 Circuit with static 1 hazard.
Figure 2.14 Timing diagram for the circuit of .
Figure 2.15 shows the different types of hazard that can occur. The hazard in the circuit of Figure 2.13 is a static 1 hazard. Static 1 hazards can only occur in AND-OR or NAND-NAND logic. Static 0 hazards can only occur in OR-AND or NOR-NOR logic. Dynamic hazards do not occur in two-level circuits. They require three or more unequal signal paths. Dynamic hazards are often caused by poor factorization in multi-level minimization.
Figure 2.15 Types of hazard.
Static hazards, on the other hand, can be avoided by designing with redundant logic. For example, the Karnaugh map of the circuit function of Figure 2.13 is shown in Figure 2.16. The redundant prime implicant is shown as a dashed circle. The redundant gate corresponding to this prime implicant can be introduced to eliminate the hazard. The circuit function is therefore
Figure 2.16 Redundant term on a Karnaugh map.
The circuit is shown in Figure 2.17. Now, F is independent of C. If A = B = 1, F = 0. F stays at 0 while C changes; therefore, Z stays at 1. (See Section 11.3.2 for another good reason why circuits with redundancy should be avoided.)
Figure 2.17 Hazard-free circuit.