Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/misoc
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 360c849f21f4
Choose a base ref
...
head repository: m-labs/misoc
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: b10836a8eb58
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Mar 9, 2015

  1. Copy the full SHA
    1b58813 View commit details
  2. Copy the full SHA
    b10836a View commit details
Showing with 15 additions and 4 deletions.
  1. +15 −1 misoclib/com/liteeth/phy/sim.py
  2. +0 −3 misoclib/soc/__init__.py
16 changes: 15 additions & 1 deletion misoclib/com/liteeth/phy/sim.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import os

from misoclib.com.liteeth.common import *
from misoclib.com.liteeth.generic import *

@@ -21,11 +23,13 @@ def __init__(self):
]

class LiteEthPHYSim(Module, AutoCSR):
def __init__(self, pads):
def __init__(self, pads, tap="tap0", ip_address="192.168.0.14"):
self.dw = 8
self.submodules.crg = LiteEthPHYSimCRG()
self.sink = sink = Sink(eth_phy_description(8))
self.source = source = Source(eth_phy_description(8))
self.tap = tap
self.ip_address = ip_address

self.comb += [
pads.source_stb.eq(self.sink.stb),
@@ -41,3 +45,13 @@ def __init__(self, pads):
self.comb += [
self.source.eop.eq(~pads.sink_stb & self.source.stb),
]

# XXX 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
os.system("rm -f /dev/net/{}".format(self.tap))
os.system("openvpn --rmtun --dev {}".format(self.tap))
3 changes: 0 additions & 3 deletions misoclib/soc/__init__.py
Original file line number Diff line number Diff line change
@@ -193,6 +193,3 @@ def ns(self, t, margin=True):
if margin:
t += clk_period_ns/2
return ceil(t/clk_period_ns)

def do_exit(self, vns):
pass