create Port class and remove connect method of mac/ip/udp Ports
This commit is contained in:
parent
01d980b062
commit
000ba7f0ab
|
@ -252,6 +252,15 @@ def eth_etherbone_user_description(dw):
|
||||||
return EndpointDescription(payload_layout, param_layout, packetized=True)
|
return EndpointDescription(payload_layout, param_layout, packetized=True)
|
||||||
|
|
||||||
|
|
||||||
|
# Generic classes
|
||||||
|
class Port:
|
||||||
|
def connect(self, port):
|
||||||
|
r = [
|
||||||
|
Record.connect(self.source, port.sink),
|
||||||
|
Record.connect(port.source, self.sink)
|
||||||
|
]
|
||||||
|
return r
|
||||||
|
|
||||||
# Generic modules
|
# Generic modules
|
||||||
@DecorateModule(InsertReset)
|
@DecorateModule(InsertReset)
|
||||||
@DecorateModule(InsertCE)
|
@DecorateModule(InsertCE)
|
||||||
|
|
|
@ -25,24 +25,12 @@ class LiteEthIPV4MasterPort:
|
||||||
self.source = Source(eth_ipv4_user_description(dw))
|
self.source = Source(eth_ipv4_user_description(dw))
|
||||||
self.sink = Sink(eth_ipv4_user_description(dw))
|
self.sink = Sink(eth_ipv4_user_description(dw))
|
||||||
|
|
||||||
def connect(self, slave):
|
|
||||||
return [
|
|
||||||
Record.connect(self.source, slave.sink),
|
|
||||||
Record.connect(slave.source, self.sink)
|
|
||||||
]
|
|
||||||
|
|
||||||
class LiteEthIPV4SlavePort:
|
class LiteEthIPV4SlavePort:
|
||||||
def __init__(self, dw):
|
def __init__(self, dw):
|
||||||
self.dw = dw
|
self.dw = dw
|
||||||
self.sink = Sink(eth_ipv4_user_description(dw))
|
self.sink = Sink(eth_ipv4_user_description(dw))
|
||||||
self.source = Source(eth_ipv4_user_description(dw))
|
self.source = Source(eth_ipv4_user_description(dw))
|
||||||
|
|
||||||
def connect(self, master):
|
|
||||||
return [
|
|
||||||
Record.connect(self.sink, master.source),
|
|
||||||
Record.connect(master.sink, self.source)
|
|
||||||
]
|
|
||||||
|
|
||||||
class LiteEthIPV4UserPort(LiteEthIPV4SlavePort):
|
class LiteEthIPV4UserPort(LiteEthIPV4SlavePort):
|
||||||
def __init__(self, dw):
|
def __init__(self, dw):
|
||||||
LiteEthIPV4SlavePort.__init__(self, dw)
|
LiteEthIPV4SlavePort.__init__(self, dw)
|
||||||
|
|
|
@ -25,24 +25,12 @@ class LiteEthUDPMasterPort:
|
||||||
self.source = Source(eth_udp_user_description(dw))
|
self.source = Source(eth_udp_user_description(dw))
|
||||||
self.sink = Sink(eth_udp_user_description(dw))
|
self.sink = Sink(eth_udp_user_description(dw))
|
||||||
|
|
||||||
def connect(self, slave):
|
|
||||||
return [
|
|
||||||
Record.connect(self.source, slave.sink),
|
|
||||||
Record.connect(slave.source, self.sink)
|
|
||||||
]
|
|
||||||
|
|
||||||
class LiteEthUDPSlavePort:
|
class LiteEthUDPSlavePort:
|
||||||
def __init__(self, dw):
|
def __init__(self, dw):
|
||||||
self.dw =dw
|
self.dw =dw
|
||||||
self.sink = Sink(eth_udp_user_description(dw))
|
self.sink = Sink(eth_udp_user_description(dw))
|
||||||
self.source = Source(eth_udp_user_description(dw))
|
self.source = Source(eth_udp_user_description(dw))
|
||||||
|
|
||||||
def connect(self, master):
|
|
||||||
return [
|
|
||||||
Record.connect(self.sink, master.source),
|
|
||||||
Record.connect(master.sink, self.source)
|
|
||||||
]
|
|
||||||
|
|
||||||
class LiteEthUDPUserPort(LiteEthUDPSlavePort):
|
class LiteEthUDPUserPort(LiteEthUDPSlavePort):
|
||||||
def __init__(self, dw):
|
def __init__(self, dw):
|
||||||
LiteEthUDPSlavePort.__init__(self, dw)
|
LiteEthUDPSlavePort.__init__(self, dw)
|
||||||
|
|
|
@ -20,10 +20,7 @@ class LiteEthMAC(Module, AutoCSR):
|
||||||
]
|
]
|
||||||
elif interface == "wishbone":
|
elif interface == "wishbone":
|
||||||
self.submodules.interface = LiteEthMACWishboneInterface(dw, 2, 2)
|
self.submodules.interface = LiteEthMACWishboneInterface(dw, 2, 2)
|
||||||
self.comb += [
|
self.comb += Port.connect(self.interface, self.core)
|
||||||
Record.connect(self.interface.source, self.core.sink),
|
|
||||||
Record.connect(self.core.source, self.interface.sink)
|
|
||||||
]
|
|
||||||
self.ev, self.bus = self.interface.sram.ev, self.interface.bus
|
self.ev, self.bus = self.interface.sram.ev, self.interface.bus
|
||||||
self.csrs = self.interface.get_csrs()
|
self.csrs = self.interface.get_csrs()
|
||||||
elif interface == "dma":
|
elif interface == "dma":
|
||||||
|
|
|
@ -24,23 +24,11 @@ class LiteEthMACMasterPort:
|
||||||
self.source = Source(eth_mac_description(dw))
|
self.source = Source(eth_mac_description(dw))
|
||||||
self.sink = Sink(eth_mac_description(dw))
|
self.sink = Sink(eth_mac_description(dw))
|
||||||
|
|
||||||
def connect(self, slave):
|
|
||||||
return [
|
|
||||||
Record.connect(self.source, slave.sink),
|
|
||||||
Record.connect(slave.source, self.sink)
|
|
||||||
]
|
|
||||||
|
|
||||||
class LiteEthMACSlavePort:
|
class LiteEthMACSlavePort:
|
||||||
def __init__(self, dw):
|
def __init__(self, dw):
|
||||||
self.sink = Sink(eth_mac_description(dw))
|
self.sink = Sink(eth_mac_description(dw))
|
||||||
self.source = Source(eth_mac_description(dw))
|
self.source = Source(eth_mac_description(dw))
|
||||||
|
|
||||||
def connect(self, master):
|
|
||||||
return [
|
|
||||||
Record.connect(self.sink, master.source),
|
|
||||||
Record.connect(master.sink, self.source)
|
|
||||||
]
|
|
||||||
|
|
||||||
class LiteEthMACUserPort(LiteEthMACSlavePort):
|
class LiteEthMACUserPort(LiteEthMACSlavePort):
|
||||||
def __init__(self, dw):
|
def __init__(self, dw):
|
||||||
LiteEthMACSlavePort.__init__(self, dw)
|
LiteEthMACSlavePort.__init__(self, dw)
|
||||||
|
|
Loading…
Reference in New Issue