Put sources and sinks to sleep based on clock enables
Signed-off-by: Alex Forencich <alex@alexforencich.com>
This commit is contained in:
@@ -167,6 +167,10 @@ class MiiSource(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
|
||||
|
||||
@@ -224,6 +228,9 @@ class MiiSource(Reset):
|
||||
self.active = False
|
||||
self.idle_event.set()
|
||||
|
||||
elif self.enable is not None and not self.enable.value:
|
||||
await enable_event
|
||||
|
||||
|
||||
class MiiSink(Reset):
|
||||
|
||||
@@ -323,6 +330,10 @@ class MiiSink(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
|
||||
|
||||
@@ -378,6 +389,9 @@ class MiiSink(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 MiiPhy:
|
||||
def __init__(self, txd, tx_er, tx_en, tx_clk, rxd, rx_er, rx_dv, rx_clk, reset=None,
|
||||
|
||||
Reference in New Issue
Block a user