proc_common_wait_some_cycles(ctlr_clk,10);-- some extra margin
ASSERTUNSIGNED(wr_fifo_usedw)<g_dp_factorREPORT"[ERROR] Write FIFO is flushed but not empty!"SEVERITYFAILURE;
ASSERTUNSIGNED(rd_fifo_usedw)=0REPORT"[ERROR] Read FIFO is not empty!"SEVERITYFAILURE;
ASSERTUNSIGNED(rd_fifo_usedw)=0REPORT"[ERROR] Read FIFO is not empty!"SEVERITYFAILURE;
ASSERTUNSIGNED(snk_val_cnt)=expected_cntREPORT"[ERROR] Unexpected number of read data!"SEVERITYFAILURE;
ASSERTUNSIGNED(snk_val_cnt)=expected_cntREPORT"[ERROR] Unexpected number of read data!"SEVERITYFAILURE;
-- Restart diagnostics source and sink
-- Restart diagnostics source and sink
proc_common_wait_some_cycles(dp_clk,1);
src_diag_en<='1';
src_diag_en<='1';
snk_diag_en<='1';
snk_diag_en<='1';
v_diag_first_rd:=TRUE;
ENDLOOP;
ENDLOOP;
-- If the test failed then it would have stopped already, so it the test has passed
REPORT"[OK] Test passed."SEVERITYNOTE;
REPORT"[OK] Test passed."SEVERITYNOTE;
tb_end<='1';
-- Stop the simulation
-- . Stopping the clocks via tb_end does end the tb for the DDR3 IP, but is not sufficient to stop the tb for the DDR4 IP.
-- . Making ctlr_ref_rst <= '1'; also does not stop the tb with the DDR4 IP (apparently some loop remains running in the DDR4 model), so therefore force simulation stop