From 1683a50cb5f18e69e5589ef2f3cad02f266966d8 Mon Sep 17 00:00:00 2001 From: Tobias Weber Date: Fri, 26 Sep 2014 18:10:48 +0200 Subject: [PATCH] Solved bug in event buffer that last fifo entry was not read on slow control channel (simulated) --- mupix/sources/EventBuffer.vhd | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/mupix/sources/EventBuffer.vhd b/mupix/sources/EventBuffer.vhd index 6e023f9..c2fb237 100644 --- a/mupix/sources/EventBuffer.vhd +++ b/mupix/sources/EventBuffer.vhd @@ -67,6 +67,7 @@ architecture behavioral of eventbuffer is signal fifo_read_s_fsm : fifo_read_s_states := idle; signal fifo_start_read : std_logic := '0'; signal fifo_read_s : std_logic := '0'; + signal fifo_read_wasempty_s : std_logic := '0'; signal fifo_reading_s : std_logic := '0'; signal fifo_read_done_s : std_logic := '0'; signal fifo_read_busy_s : std_logic := '0'; @@ -164,19 +165,23 @@ begin -- behavioral fifo_read_done_s <= '0'; fifo_read_s <= '0'; fifo_read_busy_s <= '0'; + fifo_read_wasempty_s <= '0'; case fifo_read_s_fsm is when idle => if fifo_start_read = '1' then if fifo_read_busy_f = '1' then fifo_read_done_s <= '1'; fifo_read_s_fsm <= idle; - elsif fifo_empty = '0' then - fifo_read_s <= '1'; - fifo_read_busy_s <= '1'; - fifo_read_s_fsm <= wait1; else - fifo_read_done_s <= '1'; - fifo_read_s_fsm <= idle; + if fifo_empty = '0' then + fifo_read_s <= '1'; + fifo_read_busy_s <= '1'; + fifo_read_s_fsm <= wait1; + else + fifo_read_done_s <= '1'; + fifo_read_wasempty_s <= '1'; + fifo_read_s_fsm <= idle; + end if; end if; end if; when wait1 => @@ -218,7 +223,7 @@ begin -- behavioral if (fifo_read_done_s = '0') then fifo_reading_s <= '1'; else - if (fifo_empty = '0') then + if (fifo_read_wasempty_s = '0') then slv_data_out <= fifo_data_out; slv_ack_out <= '1'; else -- 2.51.0