2015-02-28 03:02:28 -05:00
|
|
|
from misoclib.com.liteeth.common import *
|
|
|
|
from misoclib.com.liteeth.generic import *
|
|
|
|
from misoclib.com.liteeth.generic.crossbar import LiteEthCrossbar
|
2015-02-11 19:30:17 -05:00
|
|
|
|
2015-04-13 04:20:02 -04:00
|
|
|
|
2015-02-11 19:30:17 -05:00
|
|
|
class LiteEthIPV4MasterPort:
|
2015-04-13 03:53:43 -04:00
|
|
|
def __init__(self, dw):
|
|
|
|
self.dw = dw
|
|
|
|
self.source = Source(eth_ipv4_user_description(dw))
|
|
|
|
self.sink = Sink(eth_ipv4_user_description(dw))
|
2015-02-11 19:30:17 -05:00
|
|
|
|
2015-04-13 04:20:02 -04:00
|
|
|
|
2015-02-11 19:30:17 -05:00
|
|
|
class LiteEthIPV4SlavePort:
|
2015-04-13 03:53:43 -04:00
|
|
|
def __init__(self, dw):
|
|
|
|
self.dw = dw
|
|
|
|
self.sink = Sink(eth_ipv4_user_description(dw))
|
|
|
|
self.source = Source(eth_ipv4_user_description(dw))
|
2015-02-11 19:30:17 -05:00
|
|
|
|
2015-04-13 04:20:02 -04:00
|
|
|
|
2015-02-11 19:30:17 -05:00
|
|
|
class LiteEthIPV4UserPort(LiteEthIPV4SlavePort):
|
2015-04-13 03:53:43 -04:00
|
|
|
def __init__(self, dw):
|
|
|
|
LiteEthIPV4SlavePort.__init__(self, dw)
|
2015-02-11 19:30:17 -05:00
|
|
|
|
2015-04-13 04:20:02 -04:00
|
|
|
|
2015-02-11 19:30:17 -05:00
|
|
|
class LiteEthIPV4Crossbar(LiteEthCrossbar):
|
2015-04-13 03:53:43 -04:00
|
|
|
def __init__(self):
|
|
|
|
LiteEthCrossbar.__init__(self, LiteEthIPV4MasterPort, "protocol")
|
2015-02-11 19:30:17 -05:00
|
|
|
|
2015-04-13 03:53:43 -04:00
|
|
|
def get_port(self, protocol):
|
|
|
|
if protocol in self.users.keys():
|
|
|
|
raise ValueError("Protocol {0:#x} already assigned".format(protocol))
|
|
|
|
port = LiteEthIPV4UserPort(8)
|
|
|
|
self.users[protocol] = port
|
|
|
|
return port
|