From c1d7f2d4274949d68cdb7ca5d8fd049b8efaa321 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Sat, 14 Nov 2015 03:43:27 +0100 Subject: [PATCH] phy: rename sim to model and remove from autodetect --- liteeth/phy/__init__.py | 6 +----- liteeth/phy/{sim.py => model.py} | 12 ++++++------ 2 files changed, 7 insertions(+), 11 deletions(-) rename liteeth/phy/{sim.py => model.py} (85%) diff --git a/liteeth/phy/__init__.py b/liteeth/phy/__init__.py index ce02482..c8ea8a1 100644 --- a/liteeth/phy/__init__.py +++ b/liteeth/phy/__init__.py @@ -3,11 +3,7 @@ from liteeth.common import * def LiteEthPHY(clock_pads, pads, clk_freq=None, **kwargs): # Autodetect PHY - if hasattr(pads, "source_stb"): - # This is a simulation PHY - from liteeth.phy.sim import LiteEthPHYSim - return LiteEthPHYSim(pads) - elif hasattr(clock_pads, "gtx") and len(pads.tx_data) == 8: + if hasattr(clock_pads, "gtx") and len(pads.tx_data) == 8: if hasattr(clock_pads, "tx"): # This is a 10/100/1G PHY from liteeth.phy.gmii_mii import LiteEthPHYGMIIMII diff --git a/liteeth/phy/sim.py b/liteeth/phy/model.py similarity index 85% rename from liteeth/phy/sim.py rename to liteeth/phy/model.py index 26e69f0..6deed17 100644 --- a/liteeth/phy/sim.py +++ b/liteeth/phy/model.py @@ -1,9 +1,9 @@ import os -from liteeth.common import * +from litex.soc.cores.liteeth_mini.common import * -class LiteEthPHYSimCRG(Module, AutoCSR): +class LiteEthPHYModelCRG(Module, AutoCSR): def __init__(self): self._reset = CSRStorage() @@ -23,10 +23,10 @@ class LiteEthPHYSimCRG(Module, AutoCSR): ] -class LiteEthPHYSim(Module, AutoCSR): +class LiteEthPHYModel(Module, AutoCSR): def __init__(self, pads, tap="tap0", ip_address="192.168.0.14"): self.dw = 8 - self.submodules.crg = LiteEthPHYSimCRG() + self.submodules.crg = LiteEthPHYModelCRG() self.sink = sink = Sink(eth_phy_description(8)) self.source = source = Source(eth_phy_description(8)) self.tap = tap @@ -47,12 +47,12 @@ class LiteEthPHYSim(Module, AutoCSR): self.source.eop.eq(~pads.sink_stb & self.source.stb), ] - # XXX avoid use of os.system + # TODO avoid use of os.system os.system("openvpn --mktun --dev {}".format(self.tap)) os.system("ifconfig {} {} up".format(self.tap, self.ip_address)) os.system("mknod /dev/net/{} c 10 200".format(self.tap)) def do_exit(self, *args, **kwargs): - # XXX avoid use of os.system + # TODO avoid use of os.system os.system("rm -f /dev/net/{}".format(self.tap)) os.system("openvpn --rmtun --dev {}".format(self.tap))