Put sources and sinks to sleep based on clock enables
Signed-off-by: Alex Forencich <alex@alexforencich.com>
This commit is contained in:
@@ -266,6 +266,10 @@ class GmiiSource(Reset):
|
|||||||
|
|
||||||
clock_edge_event = RisingEdge(self.clock)
|
clock_edge_event = RisingEdge(self.clock)
|
||||||
|
|
||||||
|
enable_event = None
|
||||||
|
if self.enable is not None:
|
||||||
|
enable_event = RisingEdge(self.enable)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
await clock_edge_event
|
await clock_edge_event
|
||||||
|
|
||||||
@@ -330,6 +334,9 @@ class GmiiSource(Reset):
|
|||||||
self.active = False
|
self.active = False
|
||||||
self.idle_event.set()
|
self.idle_event.set()
|
||||||
|
|
||||||
|
elif self.enable is not None and not self.enable.value:
|
||||||
|
await enable_event
|
||||||
|
|
||||||
|
|
||||||
class GmiiSink(Reset):
|
class GmiiSink(Reset):
|
||||||
|
|
||||||
@@ -432,6 +439,10 @@ class GmiiSink(Reset):
|
|||||||
|
|
||||||
clock_edge_event = RisingEdge(self.clock)
|
clock_edge_event = RisingEdge(self.clock)
|
||||||
|
|
||||||
|
enable_event = None
|
||||||
|
if self.enable is not None:
|
||||||
|
enable_event = RisingEdge(self.enable)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
await clock_edge_event
|
await clock_edge_event
|
||||||
|
|
||||||
@@ -492,6 +503,9 @@ class GmiiSink(Reset):
|
|||||||
frame.data.append(d_val)
|
frame.data.append(d_val)
|
||||||
frame.error.append(er_val)
|
frame.error.append(er_val)
|
||||||
|
|
||||||
|
elif self.enable is not None and not self.enable.value:
|
||||||
|
await enable_event
|
||||||
|
|
||||||
|
|
||||||
class GmiiPhy:
|
class GmiiPhy:
|
||||||
def __init__(self, txd, tx_er, tx_en, tx_clk, gtx_clk, rxd, rx_er, rx_dv, rx_clk,
|
def __init__(self, txd, tx_er, tx_en, tx_clk, gtx_clk, rxd, rx_er, rx_dv, rx_clk,
|
||||||
|
|||||||
@@ -167,6 +167,10 @@ class MiiSource(Reset):
|
|||||||
|
|
||||||
clock_edge_event = RisingEdge(self.clock)
|
clock_edge_event = RisingEdge(self.clock)
|
||||||
|
|
||||||
|
enable_event = None
|
||||||
|
if self.enable is not None:
|
||||||
|
enable_event = RisingEdge(self.enable)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
await clock_edge_event
|
await clock_edge_event
|
||||||
|
|
||||||
@@ -224,6 +228,9 @@ class MiiSource(Reset):
|
|||||||
self.active = False
|
self.active = False
|
||||||
self.idle_event.set()
|
self.idle_event.set()
|
||||||
|
|
||||||
|
elif self.enable is not None and not self.enable.value:
|
||||||
|
await enable_event
|
||||||
|
|
||||||
|
|
||||||
class MiiSink(Reset):
|
class MiiSink(Reset):
|
||||||
|
|
||||||
@@ -323,6 +330,10 @@ class MiiSink(Reset):
|
|||||||
|
|
||||||
clock_edge_event = RisingEdge(self.clock)
|
clock_edge_event = RisingEdge(self.clock)
|
||||||
|
|
||||||
|
enable_event = None
|
||||||
|
if self.enable is not None:
|
||||||
|
enable_event = RisingEdge(self.enable)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
await clock_edge_event
|
await clock_edge_event
|
||||||
|
|
||||||
@@ -378,6 +389,9 @@ class MiiSink(Reset):
|
|||||||
frame.data.append(d_val)
|
frame.data.append(d_val)
|
||||||
frame.error.append(er_val)
|
frame.error.append(er_val)
|
||||||
|
|
||||||
|
elif self.enable is not None and not self.enable.value:
|
||||||
|
await enable_event
|
||||||
|
|
||||||
|
|
||||||
class MiiPhy:
|
class MiiPhy:
|
||||||
def __init__(self, txd, tx_er, tx_en, tx_clk, rxd, rx_er, rx_dv, rx_clk, reset=None,
|
def __init__(self, txd, tx_er, tx_en, tx_clk, rxd, rx_er, rx_dv, rx_clk, reset=None,
|
||||||
|
|||||||
@@ -169,7 +169,17 @@ class RgmiiSource(Reset):
|
|||||||
clock_rising_edge_event = RisingEdge(self.clock)
|
clock_rising_edge_event = RisingEdge(self.clock)
|
||||||
clock_falling_edge_event = FallingEdge(self.clock)
|
clock_falling_edge_event = FallingEdge(self.clock)
|
||||||
|
|
||||||
|
enable_event = None
|
||||||
|
if self.enable is not None:
|
||||||
|
enable_event = RisingEdge(self.enable)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
await clock_falling_edge_event
|
||||||
|
|
||||||
|
# send low nibble after falling edge, leading in to rising edge
|
||||||
|
self.data.value = d & 0x0F
|
||||||
|
self.ctrl.value = en
|
||||||
|
|
||||||
await clock_rising_edge_event
|
await clock_rising_edge_event
|
||||||
|
|
||||||
# send high nibble after rising edge, leading in to falling edge
|
# send high nibble after rising edge, leading in to falling edge
|
||||||
@@ -235,11 +245,8 @@ class RgmiiSource(Reset):
|
|||||||
self.active = False
|
self.active = False
|
||||||
self.idle_event.set()
|
self.idle_event.set()
|
||||||
|
|
||||||
await clock_falling_edge_event
|
elif self.enable is not None and not self.enable.value:
|
||||||
|
await enable_event
|
||||||
# send low nibble after falling edge, leading in to rising edge
|
|
||||||
self.data.value = d & 0x0F
|
|
||||||
self.ctrl.value = en
|
|
||||||
|
|
||||||
|
|
||||||
class RgmiiSink(Reset):
|
class RgmiiSink(Reset):
|
||||||
@@ -345,6 +352,10 @@ class RgmiiSink(Reset):
|
|||||||
clock_rising_edge_event = RisingEdge(self.clock)
|
clock_rising_edge_event = RisingEdge(self.clock)
|
||||||
clock_falling_edge_event = FallingEdge(self.clock)
|
clock_falling_edge_event = FallingEdge(self.clock)
|
||||||
|
|
||||||
|
enable_event = None
|
||||||
|
if self.enable is not None:
|
||||||
|
enable_event = RisingEdge(self.enable)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
await clock_rising_edge_event
|
await clock_rising_edge_event
|
||||||
|
|
||||||
@@ -412,6 +423,9 @@ class RgmiiSink(Reset):
|
|||||||
frame.data.append(d_val)
|
frame.data.append(d_val)
|
||||||
frame.error.append(er_val)
|
frame.error.append(er_val)
|
||||||
|
|
||||||
|
elif self.enable is not None and not self.enable.value:
|
||||||
|
await enable_event
|
||||||
|
|
||||||
|
|
||||||
class RgmiiPhy:
|
class RgmiiPhy:
|
||||||
def __init__(self, txd, tx_ctl, tx_clk, rxd, rx_ctl, rx_clk, reset=None,
|
def __init__(self, txd, tx_ctl, tx_clk, rxd, rx_ctl, rx_clk, reset=None,
|
||||||
|
|||||||
@@ -274,6 +274,10 @@ class XgmiiSource(Reset):
|
|||||||
|
|
||||||
clock_edge_event = RisingEdge(self.clock)
|
clock_edge_event = RisingEdge(self.clock)
|
||||||
|
|
||||||
|
enable_event = None
|
||||||
|
if self.enable is not None:
|
||||||
|
enable_event = RisingEdge(self.enable)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
await clock_edge_event
|
await clock_edge_event
|
||||||
|
|
||||||
@@ -361,6 +365,9 @@ class XgmiiSource(Reset):
|
|||||||
self.active = False
|
self.active = False
|
||||||
self.idle_event.set()
|
self.idle_event.set()
|
||||||
|
|
||||||
|
elif self.enable is not None and not self.enable.value:
|
||||||
|
await enable_event
|
||||||
|
|
||||||
|
|
||||||
class XgmiiSink(Reset):
|
class XgmiiSink(Reset):
|
||||||
|
|
||||||
@@ -460,6 +467,10 @@ class XgmiiSink(Reset):
|
|||||||
|
|
||||||
clock_edge_event = RisingEdge(self.clock)
|
clock_edge_event = RisingEdge(self.clock)
|
||||||
|
|
||||||
|
enable_event = None
|
||||||
|
if self.enable is not None:
|
||||||
|
enable_event = RisingEdge(self.enable)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
await clock_edge_event
|
await clock_edge_event
|
||||||
|
|
||||||
@@ -499,3 +510,6 @@ class XgmiiSink(Reset):
|
|||||||
|
|
||||||
frame.data.append(d_val)
|
frame.data.append(d_val)
|
||||||
frame.ctrl.append(c_val)
|
frame.ctrl.append(c_val)
|
||||||
|
|
||||||
|
elif self.enable is not None and not self.enable.value:
|
||||||
|
await enable_event
|
||||||
|
|||||||
Reference in New Issue
Block a user