From 7febd080c9ff1e40b135f53e87a1eb3cbbd34292 Mon Sep 17 00:00:00 2001 From: Alex Forencich Date: Mon, 14 Aug 2023 16:58:22 -0700 Subject: [PATCH] Use FIFO depth in overflow test Signed-off-by: Alex Forencich --- tb/axis_async_fifo/test_axis_async_fifo.py | 9 ++++++--- .../test_axis_async_fifo_adapter.py | 9 ++++++--- tb/axis_fifo/test_axis_fifo.py | 9 ++++++--- tb/axis_fifo_adapter/test_axis_fifo_adapter.py | 9 ++++++--- 4 files changed, 24 insertions(+), 12 deletions(-) diff --git a/tb/axis_async_fifo/test_axis_async_fifo.py b/tb/axis_async_fifo/test_axis_async_fifo.py index 1b00e51f3..4d847e0ce 100644 --- a/tb/axis_async_fifo/test_axis_async_fifo.py +++ b/tb/axis_async_fifo/test_axis_async_fifo.py @@ -450,21 +450,24 @@ async def run_test_overflow(dut): tb = TB(dut) + depth = dut.DEPTH.value + byte_lanes = tb.source.byte_lanes + await tb.reset() tb.sink.pause = True - test_data = bytearray(itertools.islice(itertools.cycle(range(256)), 2048)) + test_data = bytearray(itertools.islice(itertools.cycle(range(256)), depth*2)) test_frame = AxiStreamFrame(test_data) await tb.source.send(test_frame) - for k in range(2048): + for k in range((depth//byte_lanes)*2): await RisingEdge(dut.s_clk) tb.sink.pause = False if dut.DROP_OVERSIZE_FRAME.value: - for k in range(2048): + for k in range((depth//byte_lanes)*2): await RisingEdge(dut.s_clk) else: diff --git a/tb/axis_async_fifo_adapter/test_axis_async_fifo_adapter.py b/tb/axis_async_fifo_adapter/test_axis_async_fifo_adapter.py index a62319c16..a93f4bb91 100644 --- a/tb/axis_async_fifo_adapter/test_axis_async_fifo_adapter.py +++ b/tb/axis_async_fifo_adapter/test_axis_async_fifo_adapter.py @@ -447,21 +447,24 @@ async def run_test_overflow(dut): tb = TB(dut) + depth = dut.DEPTH.value + byte_lanes = min(tb.source.byte_lanes, tb.sink.byte_lanes) + await tb.reset() tb.sink.pause = True - test_data = bytearray(itertools.islice(itertools.cycle(range(256)), 2048)) + test_data = bytearray(itertools.islice(itertools.cycle(range(256)), depth*2)) test_frame = AxiStreamFrame(test_data) await tb.source.send(test_frame) - for k in range(2048): + for k in range((depth//byte_lanes)*2): await RisingEdge(dut.s_clk) tb.sink.pause = False if dut.DROP_OVERSIZE_FRAME.value: - for k in range(2048): + for k in range((depth//byte_lanes)*2): await RisingEdge(dut.s_clk) else: diff --git a/tb/axis_fifo/test_axis_fifo.py b/tb/axis_fifo/test_axis_fifo.py index 9314c5248..95d76be8b 100644 --- a/tb/axis_fifo/test_axis_fifo.py +++ b/tb/axis_fifo/test_axis_fifo.py @@ -236,21 +236,24 @@ async def run_test_overflow(dut): tb = TB(dut) + depth = dut.DEPTH.value + byte_lanes = tb.source.byte_lanes + await tb.reset() tb.sink.pause = True - test_data = bytearray(itertools.islice(itertools.cycle(range(256)), 2048)) + test_data = bytearray(itertools.islice(itertools.cycle(range(256)), depth*2)) test_frame = AxiStreamFrame(test_data) await tb.source.send(test_frame) - for k in range(2048): + for k in range((depth//byte_lanes)*2): await RisingEdge(dut.clk) tb.sink.pause = False if dut.DROP_OVERSIZE_FRAME.value: - for k in range(2048): + for k in range((depth//byte_lanes)*2): await RisingEdge(dut.clk) else: diff --git a/tb/axis_fifo_adapter/test_axis_fifo_adapter.py b/tb/axis_fifo_adapter/test_axis_fifo_adapter.py index f072a6211..aaec4f30a 100644 --- a/tb/axis_fifo_adapter/test_axis_fifo_adapter.py +++ b/tb/axis_fifo_adapter/test_axis_fifo_adapter.py @@ -236,21 +236,24 @@ async def run_test_overflow(dut): tb = TB(dut) + depth = dut.DEPTH.value + byte_lanes = min(tb.source.byte_lanes, tb.sink.byte_lanes) + await tb.reset() tb.sink.pause = True - test_data = bytearray(itertools.islice(itertools.cycle(range(256)), 2048)) + test_data = bytearray(itertools.islice(itertools.cycle(range(256)), depth*2)) test_frame = AxiStreamFrame(test_data) await tb.source.send(test_frame) - for k in range(2048): + for k in range((depth//byte_lanes)*2): await RisingEdge(dut.clk) tb.sink.pause = False if dut.DROP_OVERSIZE_FRAME.value: - for k in range(2048): + for k in range((depth//byte_lanes)*2): await RisingEdge(dut.clk) else: