From 68751229a062046578102475cb0105847c7dd8f4 Mon Sep 17 00:00:00 2001 From: Sean Anderson Date: Wed, 11 Jan 2023 17:23:10 -0500 Subject: [PATCH] tb: axis_mii_tx: Forward keyword arguments to send_packet This makes it easier to add additional arguments. Signed-off-by: Sean Anderson --- tb/axis_mii_tx.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tb/axis_mii_tx.py b/tb/axis_mii_tx.py index e31c408..447e45a 100644 --- a/tb/axis_mii_tx.py +++ b/tb/axis_mii_tx.py @@ -32,7 +32,7 @@ async def init(mac): await cocotb.start(Clock(mac.clk, 8, units='ns').start()) await FallingEdge(mac.clk) -def send_packet(mac, packet, ratio=1): +def send_packet(mac, packet, **kwargs): return axis_replay_buffer.send_packet({ 'clk': mac.clk, 'data': mac.axis_data, @@ -40,7 +40,7 @@ def send_packet(mac, packet, ratio=1): 'valid': mac.axis_valid, 'last': mac.axis_last, 'ready': mac.axis_ready, - }, packet, ratio) + }, packet, **kwargs) class MACError(Exception): pass @@ -133,8 +133,8 @@ async def get_status(mac): elif underflow: return Status.UNDERFLOW -async def start(mac, packet, ratio=1): - send = await cocotb.start(send_packet(mac, packet, ratio)) +async def start(mac, packet, **kwargs): + send = await cocotb.start(send_packet(mac, packet, **kwargs)) status = await cocotb.start(get_status(mac)) return send, status @@ -182,7 +182,7 @@ async def test_send(mac, ratio): async def send_packets(): for packet in packets: - await send_packet(mac, packet, ratio) + await send_packet(mac, packet, ratio=ratio) await cocotb.start(send_packets()) for i, packet in enumerate(packets): @@ -213,7 +213,7 @@ async def test_underflow(mac): await send.join() assert await status.join() == Status.UNDERFLOW - send, status = await start(mac, range(32), 30) + send, status = await start(mac, range(32), ratio=30) await underflow(mac, send, status) send, status = await start(mac, [*range(56), None])