From d1834e2b7a98dfe61bca6f140a0ad0c9eed23be8 Mon Sep 17 00:00:00 2001 From: Sean Anderson Date: Wed, 15 Mar 2023 15:34:51 -0400 Subject: [PATCH] axis_replay_buffer: Don't say we're ready during reset We can't actually accept data during reset, so don't assert ready. Modify the testbench to try to send data while the core is reset, so we can verify that it doesn't get accepted. Fixes: 52325f2 ("Add AXI stream replay buffer") Signed-off-by: Sean Anderson --- rtl/axis_replay_buffer.v | 2 +- tb/axis_replay_buffer.py | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/rtl/axis_replay_buffer.v b/rtl/axis_replay_buffer.v index c10807b..0614189 100644 --- a/rtl/axis_replay_buffer.v +++ b/rtl/axis_replay_buffer.v @@ -152,7 +152,7 @@ module axis_replay_buffer ( s_ptr <= 0; last <= 0; replayable <= 1; - s_axis_ready <= 1; + s_axis_ready <= 0; m_axis_valid <= 0; m_axis_last <= 0; sent_last <= 0; diff --git a/tb/axis_replay_buffer.py b/tb/axis_replay_buffer.py index 10a691f..671d804 100644 --- a/tb/axis_replay_buffer.py +++ b/tb/axis_replay_buffer.py @@ -57,11 +57,13 @@ async def test_replay(buf, in_ratio, out_ratio): buf.replay.value = 0 buf.done.value = 0 - await Timer(1) - buf.rst.value = 0 - await cocotb.start(Clock(buf.clk, 8, units='ns').start()) - await FallingEdge(buf.clk) - await cocotb.start(ClockEnable(buf.clk, buf.m_axis_ready, out_ratio)) + async def init(): + await Timer(1) + await cocotb.start(Clock(buf.clk, 8, units='ns').start()) + await cocotb.start(ClockEnable(buf.clk, buf.m_axis_ready, out_ratio)) + await FallingEdge(buf.clk) + buf.rst.value = 0 + await cocotb.start(init()) # A packet equal to BUF_SIZE, one around 2**BUF_WIDTH, and one around # 2**(BUF_WIDTH + 1) (plus some extra). This should capture most of the fun