pp_fifo: Fix full fifo losing all data on simultaneous push & pop
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Thu, 14 May 2020 02:30:11 +0000 (12:30 +1000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Fri, 15 May 2020 10:49:09 +0000 (20:49 +1000)
The pp_fifo decides whether top = bottom means empty or full based
on whether the previous operation was a push or a pop.

If the fifo performs both in one cycle, it sets the previous op to
pop. That means that a full fifo being added a character and removed
one at the same time becomes empty.

Instead, just leave the previous op alone. If the fifo was empty, it
remains so, if it was full ditto.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
fpga/pp_fifo.vhd

index ee9b70115117fb1bd1478d86708457d711cf99c1..553a499b1931dfd8376bdb8e9a2ca02dfc8a0126 100644 (file)
@@ -78,7 +78,7 @@ begin
                 prev_op <= FIFO_POP;
             else
                 if push = '1' and pop = '1' then
-                    prev_op <= FIFO_POP;
+                    -- Keep the same value for prev_op
                 elsif push = '1' then
                     prev_op <= FIFO_PUSH;
                 elsif pop = '1' then