baddelay - EDA Playground
Warning! This exercise has been opened in another tab; autosave has been disabled. Close this tab or refresh to reactivate.

 Languages & Libraries

 Tools & Simulators

 Examples

203


41
 
1
// Example of delay issues
2
`default_nettype none
3
4
module delayinv(input a, output reg z);
5
6
  always @(a)
7
    z<=#5 ~a;
8
9
endmodule
10
11
module delayand(input a, input b, output reg z);
12
  always @(a,b)
13
     z<=#5 a&b;
14
endmodule
15
16
17
18
module test;
19
20
reg a, b;
21
wire anot, z;
22
23
  delayinv gate1(a,anot);
24
  delayand gate2(anot,b,z);
25
26
initial
27
  begin
28
    // Dump waves
29
    $dumpfile("dump.vcd");
30
    $dumpvars(1);
31
    a=1'b0;
32
    b=1'b0; 
33
#15  b=1'b1;
34
    a=1'b1;
35
#45 b=1'b0;
36
    $finish;
37
  end
38
39
40
endmodule
41
xxxxxxxxxx
1
 
1
242 views and 0 likes     
A short description will be helpful for you to remember your playground's details
 
100:0