Cache clock edge event objects

This commit is contained in:
Alex Forencich
2021-12-03 18:40:04 -08:00
parent 4a91212f37
commit 2b0b12c68d
2 changed files with 24 additions and 8 deletions

View File

@@ -394,9 +394,11 @@ class AxiStreamPause:
self.set_pause_generator(None)
async def _run_pause(self):
clock_edge_event = RisingEdge(self.clock)
for val in self._pause_generator:
self.pause = val
await RisingEdge(self.clock)
await clock_edge_event
class AxiStreamSource(AxiStreamBase, AxiStreamPause):
@@ -483,8 +485,10 @@ class AxiStreamSource(AxiStreamBase, AxiStreamPause):
frame_offset = 0
self.active = False
clock_edge_event = RisingEdge(self.clock)
while True:
await RisingEdge(self.clock)
await clock_edge_event
# read handshake signals
tready_sample = (not hasattr(self.bus, "tready")) or self.bus.tready.value
@@ -615,8 +619,10 @@ class AxiStreamMonitor(AxiStreamBase):
frame = None
self.active = False
clock_edge_event = RisingEdge(self.clock)
while True:
await RisingEdge(self.clock)
await clock_edge_event
# read handshake signals
tready_sample = (not hasattr(self.bus, "tready")) or self.bus.tready.value
@@ -693,8 +699,10 @@ class AxiStreamSink(AxiStreamMonitor, AxiStreamPause):
frame = None
self.active = False
clock_edge_event = RisingEdge(self.clock)
while True:
await RisingEdge(self.clock)
await clock_edge_event
# read handshake signals
tready_sample = (not hasattr(self.bus, "tready")) or self.bus.tready.value