From 1d0554054664686c43fd3bc6dac7bd85ffcc39b7 Mon Sep 17 00:00:00 2001 From: Alex Forencich Date: Sun, 13 Aug 2023 13:25:57 -0700 Subject: [PATCH] Clean up sink pause handling Signed-off-by: Alex Forencich --- cocotbext/pcie/xilinx/us/interface.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cocotbext/pcie/xilinx/us/interface.py b/cocotbext/pcie/xilinx/us/interface.py index 221ec92..222d4f2 100644 --- a/cocotbext/pcie/xilinx/us/interface.py +++ b/cocotbext/pcie/xilinx/us/interface.py @@ -436,7 +436,7 @@ async def _run_sink(self): wake_event = self.wake_event.wait() while True: - pause_sample = self.pause + pause_sample = bool(self.pause) await clock_edge_event @@ -453,9 +453,11 @@ async def _run_sink(self): self.bus.sample(self.sample_obj) self.sample_sync.set() - self.bus.tready.value = (not self.full() and not pause_sample) + paused = self.full() or pause_sample - if not tvalid_sample or (self.pause and pause_sample) or self.full(): + self.bus.tready.value = not paused + + if (not tvalid_sample or paused) and (pause_sample == bool(self.pause)): self.wake_event.clear() await wake_event