2015-03-06 04:10:34 -05:00
|
|
|
from misoclib.com.liteeth.common import *
|
|
|
|
from misoclib.com.liteeth.generic import *
|
|
|
|
|
|
|
|
def LiteEthPHY(clock_pads, pads, **kwargs):
|
|
|
|
# Autodetect PHY
|
|
|
|
if hasattr(pads, "source_stb"):
|
2015-03-12 11:57:38 -04:00
|
|
|
from misoclib.com.liteeth.phy.sim import LiteEthPHYSim
|
2015-03-06 04:10:34 -05:00
|
|
|
return LiteEthPHYSim(pads)
|
|
|
|
elif hasattr(clock_pads, "gtx") and flen(pads.tx_data) == 8:
|
2015-04-12 10:49:39 -04:00
|
|
|
if hasattr(clock_pads, "tx"):
|
|
|
|
# This is a 10/100/1G PHY
|
|
|
|
from misoclib.com.liteeth.phy.gmii_mii import LiteEthPHYGMIIMII
|
|
|
|
return LiteEthPHYGMIIMII(clock_pads, pads, **kwargs)
|
|
|
|
else:
|
|
|
|
# This is a pure 1G PHY
|
|
|
|
from misoclib.com.liteeth.phy.gmii import LiteEthPHYGMII
|
|
|
|
return LiteEthPHYGMII(clock_pads, pads, **kwargs)
|
2015-03-06 04:10:34 -05:00
|
|
|
elif flen(pads.tx_data) == 4:
|
2015-03-12 11:57:38 -04:00
|
|
|
from misoclib.com.liteeth.phy.mii import LiteEthPHYMII
|
2015-03-06 04:10:34 -05:00
|
|
|
return LiteEthPHYMII(clock_pads, pads, **kwargs)
|
|
|
|
else:
|
2015-03-12 16:54:10 -04:00
|
|
|
raise ValueError("Unable to autodetect PHY from platform file, use direct instantiation")
|