R
Ray
Guest
say in the fool.v, i have signal a0 goes through a flipflop:
always @(posedge clk) begin
a1 <= a0;
end
in the testbench, when I use modelsim
I found the a1 didn't get delay, if my tb.v is like this:
initial begin
clk = 1;
a0 = 4'h0;
end
always #5 clk = ~clk;
initial begin
#10 a0 = 4'hf;
end
I found the a1 will be 4'hf at time 10 ns. But I would like it to be
4'hf at time 20 ns. The results are not consistent. When I have this
simple module simulated, a1 is 4'hf at time 20 ns. But when I included
this module into a very large module (instantiate this module from the
large module), then I found a1 is 4'hf at time 10 ns.
So I changed the tb.v to
initial begin
#11 a0 = 4'hf;
end
I delayed the a0 signal by 1 ns to avoid to change the value at the
exact time of posedge clk. Then this time I found both results are
correct. I'm just curious I didn't have this problem before. Why I got
this problem this time? Do you have similar experience? How to
simulate with flipflops? Thanks! -Ray
always @(posedge clk) begin
a1 <= a0;
end
in the testbench, when I use modelsim
I found the a1 didn't get delay, if my tb.v is like this:
initial begin
clk = 1;
a0 = 4'h0;
end
always #5 clk = ~clk;
initial begin
#10 a0 = 4'hf;
end
I found the a1 will be 4'hf at time 10 ns. But I would like it to be
4'hf at time 20 ns. The results are not consistent. When I have this
simple module simulated, a1 is 4'hf at time 20 ns. But when I included
this module into a very large module (instantiate this module from the
large module), then I found a1 is 4'hf at time 10 ns.
So I changed the tb.v to
initial begin
#11 a0 = 4'hf;
end
I delayed the a0 signal by 1 ns to avoid to change the value at the
exact time of posedge clk. Then this time I found both results are
correct. I'm just curious I didn't have this problem before. Why I got
this problem this time? Do you have similar experience? How to
simulate with flipflops? Thanks! -Ray