From 767d45727a2c876c45689886f1562398a33a4628 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Thu, 12 Mar 2015 16:57:38 +0100 Subject: [PATCH] uart/liteeth: only import the phy we are going to use (UARTPHYSim cannot be imported on Windows since based on pty). --- misoclib/com/liteeth/phy/__init__.py | 7 +++---- misoclib/com/uart/phy/__init__.py | 5 ++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/misoclib/com/liteeth/phy/__init__.py b/misoclib/com/liteeth/phy/__init__.py index 8a96d7fb3..a1800d012 100644 --- a/misoclib/com/liteeth/phy/__init__.py +++ b/misoclib/com/liteeth/phy/__init__.py @@ -1,17 +1,16 @@ from misoclib.com.liteeth.common import * from misoclib.com.liteeth.generic import * -from misoclib.com.liteeth.phy.sim import LiteEthPHYSim -from misoclib.com.liteeth.phy.mii import LiteEthPHYMII -from misoclib.com.liteeth.phy.gmii import LiteEthPHYGMII - def LiteEthPHY(clock_pads, pads, **kwargs): # Autodetect PHY if hasattr(pads, "source_stb"): + from misoclib.com.liteeth.phy.sim import LiteEthPHYSim return LiteEthPHYSim(pads) elif hasattr(clock_pads, "gtx") and flen(pads.tx_data) == 8: + from misoclib.com.liteeth.phy.gmii import LiteEthPHYGMII return LiteEthPHYGMII(clock_pads, pads, **kwargs) elif flen(pads.tx_data) == 4: + from misoclib.com.liteeth.phy.mii import LiteEthPHYMII return LiteEthPHYMII(clock_pads, pads, **kwargs) else: raise ValueError("Unable to autodetect PHY from platform file, use direct instanciation") diff --git a/misoclib/com/uart/phy/__init__.py b/misoclib/com/uart/phy/__init__.py index b9ecab8e3..171cb4236 100644 --- a/misoclib/com/uart/phy/__init__.py +++ b/misoclib/com/uart/phy/__init__.py @@ -1,12 +1,11 @@ from misoclib.com.liteeth.common import * from misoclib.com.liteeth.generic import * -from misoclib.com.uart.phy.sim import UARTPHYSim -from misoclib.com.uart.phy.serial import UARTPHYSerial - def UARTPHY(pads, *args, **kwargs): # Autodetect PHY if hasattr(pads, "source_stb"): + from misoclib.com.uart.phy.sim import UARTPHYSim return UARTPHYSim(pads, *args, **kwargs) else: + from misoclib.com.uart.phy.serial import UARTPHYSerial return UARTPHYSerial(pads, *args, **kwargs)