Skip to content

Commit

Permalink
Clean up sink pause handling
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Forencich <[email protected]>
  • Loading branch information
alexforencich committed Aug 13, 2023
1 parent ac7450e commit 1d05540
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cocotbext/pcie/xilinx/us/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down

0 comments on commit 1d05540

Please sign in to comment.