Skip to content

Commit

Permalink
Don't pass argument to cocotb.triggers.Event.set()
Browse files Browse the repository at this point in the history
The argument to cocotb.triggers.Event.set() was not documented and ended
up being removed from upcoming cocotb 2.0 release. Unfortunately it was
exposed to the users of Monitor, thus for now we simply set the .data
attribute that Event no longer has any support for. This can be removed
on next API break.
  • Loading branch information
p12tic committed Sep 5, 2024
1 parent 5b0f5c8 commit 5c890f3
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/cocotb_bus/monitors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ class Monitor:

def __init__(self, callback=None, event=None):
self._event = event
if self._event is not None:
self._event.data = None # FIXME: This attribute should be removed on next API break
self._wait_event = Event()
self._wait_event.data = None
self._recvQ = deque()
self._callbacks = []
self.stats = MonitorStatistics()
Expand Down Expand Up @@ -106,7 +109,7 @@ async def wait_for_recv(self, timeout=None):
else:
await self._wait_event.wait()

return self._wait_event.data
return self._wait_event_data

# this is not `async` so that we fail in `__init__` on subclasses without it
def _monitor_recv(self):
Expand All @@ -132,11 +135,13 @@ def _recv(self, transaction):
self._recvQ.append(transaction)

if self._event is not None:
self._event.set(data=transaction)
self._event.set()
self._event.data = transaction

# If anyone was waiting then let them know
if self._wait_event is not None:
self._wait_event.set(data=transaction)
self._wait_event.set()
self._wait_event.data = transaction
self._wait_event.clear()


Expand Down

0 comments on commit 5c890f3

Please sign in to comment.