diff --git a/lib/JBUS/src/busmaster_async.vhd b/lib/JBUS/src/busmaster_async.vhd index ccac16b..12ba678 100644 --- a/lib/JBUS/src/busmaster_async.vhd +++ b/lib/JBUS/src/busmaster_async.vhd @@ -137,7 +137,9 @@ proc_bus_read_counter: elsif cmd_read_en = '1' and read_fifo_empty = '1' then read_cnt <= read_cnt + 1; elsif cmd_read_en = '0' and read_fifo_empty = '0' and dout_re = '1' then - read_cnt <= read_cnt - 1; + if read_cnt > 0 then + read_cnt <= read_cnt - 1; + end if; end if; end if; end process;