From 5c890f3c4b43163c18802527eab32567e4911fea Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Thu, 5 Sep 2024 20:14:16 +0300 Subject: [PATCH] Don't pass argument to cocotb.triggers.Event.set() 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. --- src/cocotb_bus/monitors/__init__.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/cocotb_bus/monitors/__init__.py b/src/cocotb_bus/monitors/__init__.py index 5735263c..5cbcf0b0 100644 --- a/src/cocotb_bus/monitors/__init__.py +++ b/src/cocotb_bus/monitors/__init__.py @@ -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() @@ -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): @@ -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()