From cb55bd7111cadc9952c0b5a5127d8e63d9f82327 Mon Sep 17 00:00:00 2001
From: Erik Kooistra <kooistra@astron.nl>
Date: Thu, 8 Jan 2015 06:40:59 +0000
Subject: [PATCH] Check UNSIGNED(wr_fifo_usedw) < c_dp_factor, because a mixed
 width FIFO cannot always be flushed completely empty, which is ok.diff

---
 libraries/io/ddr/tb/vhdl/tb_io_ddr.vhd | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/libraries/io/ddr/tb/vhdl/tb_io_ddr.vhd b/libraries/io/ddr/tb/vhdl/tb_io_ddr.vhd
index e42f972dfc..e5b70fc7b8 100644
--- a/libraries/io/ddr/tb/vhdl/tb_io_ddr.vhd
+++ b/libraries/io/ddr/tb/vhdl/tb_io_ddr.vhd
@@ -178,6 +178,7 @@ BEGIN
       END LOOP;
       
       -- Stop diagnostics source and sink
+      proc_common_wait_some_cycles(dp_clk, 1);
       src_diag_en <= '0';
       snk_diag_en <= '0';
       
@@ -188,9 +189,9 @@ BEGIN
       
       -- Wait until the wr fifo has been flushed and the rd fifo has been read empty
       proc_common_wait_some_cycles(ctlr_clk, 500*c_dp_factor);
-      ASSERT UNSIGNED(wr_fifo_usedw) = 0          REPORT "[ERROR] Write FIFO is flushed but not empty!" SEVERITY FAILURE;
-      ASSERT UNSIGNED(rd_fifo_usedw) = 0          REPORT "[ERROR] Read FIFO is not empty!" SEVERITY FAILURE;
-      ASSERT UNSIGNED(snk_val_cnt) = expected_cnt REPORT "[ERROR] Unexpected number of read data!" SEVERITY FAILURE;
+      ASSERT UNSIGNED(wr_fifo_usedw) < c_dp_factor  REPORT "[ERROR] Write FIFO is flushed but not empty!" SEVERITY FAILURE;
+      ASSERT UNSIGNED(rd_fifo_usedw) = 0            REPORT "[ERROR] Read FIFO is not empty!" SEVERITY FAILURE;
+      ASSERT UNSIGNED(snk_val_cnt)   = expected_cnt REPORT "[ERROR] Unexpected number of read data!" SEVERITY FAILURE;
       
       -- Restart diagnostics source and sink
       src_diag_en <= '1';
-- 
GitLab