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

@@ -266,6 +266,10 @@ class GmiiSource(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
@@ -330,6 +334,9 @@ class GmiiSource(Reset):
self.active = False
self.idle_event.set()
elif self.enable is not None and not self.enable.value:
await enable_event
class GmiiSink(Reset):
@@ -432,6 +439,10 @@ class GmiiSink(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
@@ -492,6 +503,9 @@ class GmiiSink(Reset):
frame.data.append(d_val)
frame.error.append(er_val)
elif self.enable is not None and not self.enable.value:
await enable_event
class GmiiPhy:
def __init__(self, txd, tx_er, tx_en, tx_clk, gtx_clk, rxd, rx_er, rx_dv, rx_clk,