I want to execute always block at time zero. For e.g. below code won't execute at time zero.
always @* begin
//functional code
end
I moved sensitivity list at the end so that code will execute at time zero,
always begin
//funcitonal code
@*;
end
This code executes at time zero but does not execute at all after time zero, even if there is a change in inputs used inside the block. For example see the code below and its output:
module AlwaysTimeZeroTest_v();
reg reg_A;
initial begin
$display ("I'm in Initial begin block \tTime=%f, reg_A=%b\n",$stime,reg_A);
#1
reg_A=1'bZ;
#1
reg_A=1'b1;
#1
reg_A=1'b0;
#1
reg_A=1'bZ;
#5 $finish;
end
always @* begin
$display ("I'm in Non-time Zero always block\tTime=%f, reg_A=%b\n",$stime,reg_A);
end
always begin
$display ("I'm in time Zero always block \tTime=%f, reg_A=%b\n",$stime,reg_A);
@*;
end
endmodule
Output:
**I'm in Initial begin block Time=0.000000, reg_A=x
I'm in time Zero always block Time=0.000000, reg_A=x
I'm in Non-time Zero always block Time=1.000000, reg_A=z
I'm in Non-time Zero always block Time=2.000000, reg_A=1
I'm in Non-time Zero always block Time=3.000000, reg_A=0
I'm in Non-time Zero always block Time=4.000000, reg_A=z**
Simulation complete via $finish(1) at time 9 NS + 0
Can anyone explain why second always block in the code do not execute at all after time zero?
Is there a way I can implement always block so that it executes at time zero without using initial block? (something similar to always_comb in SV?)