I have generated a core IP from Xilinx core generator for FIFO. I get some errors while simulating the design.
In stimulus my clock switches on every #1 and write flag is also set at #1 followed by din and again write flag unset at #1. Followed by same thing with read flag
The problems are: 1. Full flag is set earlier than the data is filled with FIFO. 2. The read won't start from first pointer, instead starts with 4th read pointer.
Any suggestions?
initial begin
clk = 0;
rst = 0;
rst = 1;
#1 rst = 0;
wr_en = 0;
rd_en = 0;
for (i=0; i<1024; i=i+1) begin : wr_loop
#1 wr_en = 1;
din <= i;//$urandom_range(5,14);
#1 wr_en = 0;
end
for (j=0; j<1024; j=j+1) begin : rd_loop
#1 rd_en = 1'b1;
#1 rd_en = 1'b0;
end
#900000 $finish;
end
always #1 clk = ~clk;
simulation image link: (the full flag should raise after 1024 entries)
din <= 1
guarantees that the data is fassigned after your wr_en is set. Why do you use the non-blocking assighment there? You just create races in your test bench. Can you elaborate on2. The read won't start from first pointer, instead starts with 4th read pointer.
? – Serge