diff --git a/tb/axis_async_fifo/test_axis_async_fifo.py b/tb/axis_async_fifo/test_axis_async_fifo.py index 8952edb..86f51fb 100644 --- a/tb/axis_async_fifo/test_axis_async_fifo.py +++ b/tb/axis_async_fifo/test_axis_async_fifo.py @@ -457,6 +457,44 @@ async def run_test_overflow(dut): tb.sink.pause = True + size = (16*byte_lanes) + count = depth*2 // size + + test_data = bytearray(itertools.islice(itertools.cycle(range(256)), size)) + test_frame = AxiStreamFrame(test_data) + for k in range(count): + await tb.source.send(test_frame) + + for k in range((depth//byte_lanes)*2): + await RisingEdge(dut.s_clk) + + assert not tb.source.idle() + + tb.sink.pause = False + + for k in range(count): + rx_frame = await tb.sink.recv() + + assert rx_frame.tdata == test_data + assert not rx_frame.tuser + + assert tb.sink.empty() + + await RisingEdge(dut.s_clk) + await RisingEdge(dut.s_clk) + + +async def run_test_oversize(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)), depth*2)) test_frame = AxiStreamFrame(test_data) await tb.source.send(test_frame) @@ -558,7 +596,8 @@ def incrementing_payload(length): run_test_shift_out_source_reset, run_test_shift_out_sink_reset, run_test_pause, - run_test_overflow + run_test_overflow, + run_test_oversize ]: factory = TestFactory(test) 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 80d4157..d54af5f 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 @@ -454,6 +454,44 @@ async def run_test_overflow(dut): tb.sink.pause = True + size = (16*byte_lanes) + count = depth*2 // size + + test_data = bytearray(itertools.islice(itertools.cycle(range(256)), size)) + test_frame = AxiStreamFrame(test_data) + for k in range(count): + await tb.source.send(test_frame) + + for k in range((depth//byte_lanes)*2): + await RisingEdge(dut.s_clk) + + assert not tb.source.idle() + + tb.sink.pause = False + + for k in range(count): + rx_frame = await tb.sink.recv() + + assert rx_frame.tdata == test_data + assert not rx_frame.tuser + + assert tb.sink.empty() + + await RisingEdge(dut.s_clk) + await RisingEdge(dut.s_clk) + + +async def run_test_oversize(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)), depth*2)) test_frame = AxiStreamFrame(test_data) await tb.source.send(test_frame) @@ -555,7 +593,8 @@ def incrementing_payload(length): run_test_shift_out_source_reset, run_test_shift_out_sink_reset, run_test_pause, - run_test_overflow + run_test_overflow, + run_test_oversize ]: factory = TestFactory(test) diff --git a/tb/axis_fifo/test_axis_fifo.py b/tb/axis_fifo/test_axis_fifo.py index 63d9f98..843490b 100644 --- a/tb/axis_fifo/test_axis_fifo.py +++ b/tb/axis_fifo/test_axis_fifo.py @@ -243,6 +243,44 @@ async def run_test_overflow(dut): tb.sink.pause = True + size = (16*byte_lanes) + count = depth*2 // size + + test_data = bytearray(itertools.islice(itertools.cycle(range(256)), size)) + test_frame = AxiStreamFrame(test_data) + for k in range(count): + await tb.source.send(test_frame) + + for k in range((depth//byte_lanes)*2): + await RisingEdge(dut.clk) + + assert not tb.source.idle() + + tb.sink.pause = False + + for k in range(count): + rx_frame = await tb.sink.recv() + + assert rx_frame.tdata == test_data + assert not rx_frame.tuser + + assert tb.sink.empty() + + await RisingEdge(dut.clk) + await RisingEdge(dut.clk) + + +async def run_test_oversize(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)), depth*2)) test_frame = AxiStreamFrame(test_data) await tb.source.send(test_frame) @@ -338,7 +376,8 @@ def incrementing_payload(length): run_test_init_sink_pause, run_test_init_sink_pause_reset, run_test_pause, - run_test_overflow + run_test_overflow, + run_test_oversize ]: factory = TestFactory(test) diff --git a/tb/axis_fifo_adapter/test_axis_fifo_adapter.py b/tb/axis_fifo_adapter/test_axis_fifo_adapter.py index 2178970..b6f611b 100644 --- a/tb/axis_fifo_adapter/test_axis_fifo_adapter.py +++ b/tb/axis_fifo_adapter/test_axis_fifo_adapter.py @@ -243,6 +243,44 @@ async def run_test_overflow(dut): tb.sink.pause = True + size = (16*byte_lanes) + count = depth*2 // size + + test_data = bytearray(itertools.islice(itertools.cycle(range(256)), size)) + test_frame = AxiStreamFrame(test_data) + for k in range(count): + await tb.source.send(test_frame) + + for k in range((depth//byte_lanes)*2): + await RisingEdge(dut.clk) + + assert not tb.source.idle() + + tb.sink.pause = False + + for k in range(count): + rx_frame = await tb.sink.recv() + + assert rx_frame.tdata == test_data + assert not rx_frame.tuser + + assert tb.sink.empty() + + await RisingEdge(dut.clk) + await RisingEdge(dut.clk) + + +async def run_test_oversize(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)), depth*2)) test_frame = AxiStreamFrame(test_data) await tb.source.send(test_frame) @@ -338,7 +376,8 @@ def incrementing_payload(length): run_test_init_sink_pause, run_test_init_sink_pause_reset, run_test_pause, - run_test_overflow + run_test_overflow, + run_test_oversize ]: factory = TestFactory(test)