Skip to content

Commit

Permalink
Remove uses of deprecated Join
Browse files Browse the repository at this point in the history
cocotb has deprecated Join with the message "Using task directly is
prefered to Join(task) in all situations where the latter could be
used.". Awaiting on task is possible in all places where cocotb-bus
currently uses Join.

Unfortunately the newer approach is not supported on older versions of
cocotb. Accordingly two code paths have been introduced in the
problematic place. It is a test for cocotb-bus itself, therefore there's
no performance impact to check versions there.
  • Loading branch information
p12tic authored and ktbarrett committed Sep 5, 2024
1 parent ac6ff9a commit dfc4613
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions tests/test_cases/test_axi4/test_axi4.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

from random import randint, randrange, getrandbits

from packaging.version import parse as parse_version

import cocotb
from cocotb.clock import Clock
from cocotb.regression import TestFactory
Expand Down Expand Up @@ -424,9 +426,16 @@ async def test_simultaneous(dut, sync, num=5):
for address, value in zip(dummy_addrs, write_values)]

read_values = []
for reader in readers:
read_values.append((await Join(reader))[0])
await Combine(*[Join(writer) for writer in dummy_writers])

if parse_version(cocotb.__version__) < parse_version("1.9.0"):
for reader in readers:
read_values.append((await Join(reader))[0])
await Combine(*[Join(writer) for writer in dummy_writers])
else:
for reader in readers:
await reader
read_values.append(reader.result()[0])
await Combine(*[cocotb.create_task(writer) for writer in dummy_writers])

for i, (written, read) in enumerate(zip(write_values, read_values)):
if written != read:
Expand Down

0 comments on commit dfc4613

Please sign in to comment.