tb: axis_mii_tx: Fix failures on newer versions of cocotb

Since cocotb/cocotb#2793, writes happen before the clock instead of
after the clock. This breaks the collision test, since we test for
differing behavior over a difference of 1 ns. Fix the failure by
applying an adjustment for newer versions.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
This commit is contained in:
Sean Anderson 2023-03-05 13:26:35 -05:00
parent ec04874781
commit a5d1eff22b
1 changed files with 5 additions and 0 deletions

View File

@ -143,7 +143,12 @@ async def start(mac, packet, **kwargs):
BIT_TIME_NS = 10
BYTE_TIME_NS = 8 * BIT_TIME_NS
COCOTB_17 = tuple(int(part) for part in cocotb.__version__.split('.')[:2]) >= (1, 7)
async def collide(mac, ns, duration=16):
# newer cocotbs order writes before the clock
ns += COCOTB_17
while not mac.mii_tx_en.value:
await FallingEdge(mac.clk)