1. Gate Delays:
Incorporating time delay in digital modeling are easily done in Verilog. If numerical values are desired, then we
must introduce Compiler Directive of the form,
'timescale tUNIT / tPRECISION
where:
tUNIT with values of 1, 10, or 100 followed by time scale unit of s, ms, us, ns, ps, or fs, tPRECISION gives the resolution of the time scale. tUNIT must be greater than tPRECISION
//TUTdelay.v
//Demonstrate delay in circuit: y = a b + /b c
`timescale 10ns/1ns
module DELAY(y,a,b,c);
input a,b,c;
output y;
wire w1,w2,w3;
not #2(w1,b);
nand #1(w2,w1,c);
nand #1(w3,a,b);
nand #1(y,w2,w3);
endmodule
//The "Testbench" for DELAY
module tester;
reg A,B,C; //Hold input values
wire Y; //Driven output value
//G1 is a Circuit "Instantiation"
DELAY G1(Y,A,B,C);
initial
begin
$monitor ($time,"A=%b,B=%b,C=%b,Y=%b",A,B,C,Y);
A=1;B=1;C=1;
#2 B=0;
#5 A=1;B=1;C=1;
#5 $finish;
end
endmodule
Create a new project and compile the code. Shown below SILOS III simulation result with top portion header deleted,
Reading "tutdelay.v"
sim to 0
Highest level modules (that have been auto-instantiated):
stimulus
7 total devices.
Linking ...
8 nets total: 16 saved and 0 monitored.
67 registers total: 67 saved.
Done.
0A=1,B=1,C=1,Y=1
0 State changes on observable nets.
Simulation stopped at the end of time 0.000us.
Ready: sim
2A=1,B=0,C=1,Y=1
4A=1,B=0,C=1,Y=0
6A=1,B=0,C=1,Y=1
7A=1,B=1,C=1,Y=1
12 State changes on observable nets.
Simulation stopped at the end of time 0.120us.
Ready:

2. Static-1 Circuit Hazard
ABC = 111 to 101
If all the gates are ideal, this single input value change should not affect the value of the output y = 1. This is the way we learn them from the textbook. But real-life digital gates do possess hard to predict amount of propagation delays. As demonstrated by Verilog a short undesirable negative-going "spike" exist. If the succeeding driven circuit is of fast logic families, this spike can cause malfunctioning in the overall circuit. Our sample circuit is known to possess a Static-1 Hazard.
3. Methods of Eliminating Possible Circuit Hazard:
Use output NAND gate that possess longer propagation delay. If we change the propagation from #1 to #3 on the last NAND gate, the overall circuit is blind to "glitches".Simulation Result:
![]()
Method 2: - Add Redundant K-covering to Avoid input transition from one K-map covering to another disjoin K-map covering.
Original: Y = A B + /B C Modified: Y = A B + /B C + A C
The Code:
//TUTdelay2.v
//Demonstrate delay in circuit: y = a b + /b c + a c
`timescale 10ns/1ns
module DELAY(y,a,b,c);
input a,b,c;
output y;
wire w1,w2,w3,w4;
not #2(w1,b);
nand #1(w2,w1,c);
nand #1(w3,a,b);
nand #1(w4,a,c);
nand #1(y,w2,w3,w4);
endmodule
//The "Testbench" for DELAY
module tester;
reg A,B,C; //Hold input values
wire Y; //This is a driven output value
//G1 is a circuit "Instantiation"
DELAY G1(Y,A,B,C);
initial
begin
$monitor ($time,"A=%b,B=%b,C=%b,Y=%b",A,B,C,Y);
A=1;B=1;C=1;
#2 B=0;
#5 A=1;B=1;C=1;
#5 $finish;
end
endmodule
Simulation Result,
4. Dynamic Hazards:
![]()
The Code:
Simulation Result,
![]()