Put sources and sinks to sleep based on clock enables

Signed-off-by: Alex Forencich <alex@alexforencich.com>
This commit is contained in:
Alex Forencich
2023-01-24 17:41:36 -08:00
parent 45ee1193cb
commit dd35d734f9
4 changed files with 61 additions and 5 deletions

View File

@@ -274,6 +274,10 @@ class XgmiiSource(Reset):
clock_edge_event = RisingEdge(self.clock)
enable_event = None
if self.enable is not None:
enable_event = RisingEdge(self.enable)
while True:
await clock_edge_event
@@ -361,6 +365,9 @@ class XgmiiSource(Reset):
self.active = False
self.idle_event.set()
elif self.enable is not None and not self.enable.value:
await enable_event
class XgmiiSink(Reset):
@@ -460,6 +467,10 @@ class XgmiiSink(Reset):
clock_edge_event = RisingEdge(self.clock)
enable_event = None
if self.enable is not None:
enable_event = RisingEdge(self.enable)
while True:
await clock_edge_event
@@ -499,3 +510,6 @@ class XgmiiSink(Reset):
frame.data.append(d_val)
frame.ctrl.append(c_val)
elif self.enable is not None and not self.enable.value:
await enable_event