请教大家一个基础的问题。自己写一个数据源,如下.状态在i=1时,Dataout有跳变,在状态i=2时,只计数,计1600次,信号LEN跳变,不管Dataout;经在开发板上测试发现,在这1600次计数过程中,Dataout会有输出。这是为什么呢,不是有时钟来了Dataout才会有输出吗?
initial
begin
i <= 6'd0;
j <=0;
end
always @(negedge clk)
begin
case (i)
6'd0:
begin
LEN <= 0;
i <= 6'd1;
end
6'd1:
begin
if(j >= 20)
begin
i <= 6'd2;
j <= 0;
LEN <=1;
Dataout <= Dataout + 1;
end
else
begin
i <= 6'd1;
j <= j + 1;
end
end
6'd2:
begin
if(col_cnt >= 1600)
begin
LEN <= 1;
col_cnt <= 0;
i <= 6'd3;
line_cnt <= line_cnt + 1;
end
else
begin
i <= 6'd2;
col_cnt <= col_cnt + 1;
end
end
..........................
Do you know what is the blocking and non-blocking assignment?
That is the first topic of the learn the coding of verilog.
The rtl coding has many concept doesn't same as c language.
The RTL has some block can be parallel execution but the c language does the sequential execution of the program.
So I suggest you to make sure you are understand what's differnt of blocking and non-blocking assignment.
The first make sure your code is a behavior model or synthesizable RTL code.
If the RTL code that can't have a initial statement. You may be written a test bench to connect your DUT to do the function simulation.