2019-06-24 05:43:10 -04:00
|
|
|
# This file is Copyright (c) 2015-2018 Florent Kermarrec <florent@enjoy-digital.fr>
|
|
|
|
# License: BSD
|
|
|
|
|
2015-09-08 03:50:45 -04:00
|
|
|
from liteeth.common import *
|
2015-09-07 07:28:02 -04:00
|
|
|
|
|
|
|
from targets.base import BaseSoC
|
|
|
|
|
|
|
|
|
|
|
|
class UDPSoC(BaseSoC):
|
|
|
|
default_platform = "kc705"
|
|
|
|
def __init__(self, platform):
|
|
|
|
BaseSoC.__init__(self, platform,
|
|
|
|
mac_address=0x10e2d5000000,
|
2016-03-15 10:40:06 -04:00
|
|
|
ip_address="192.168.1.50")
|
2015-09-07 07:28:02 -04:00
|
|
|
|
|
|
|
# add udp loopback on port 6000 with dw=8
|
|
|
|
self.add_udp_loopback(6000, 8, 8192, "loopback_8")
|
|
|
|
# add udp loopback on port 8000 with dw=32
|
|
|
|
self.add_udp_loopback(8000, 32, 8192, "loopback_32")
|
|
|
|
|
|
|
|
def add_udp_loopback(self, port, dw, depth, name=None):
|
|
|
|
port = self.core.udp.crossbar.get_port(port, dw)
|
2016-03-16 14:45:43 -04:00
|
|
|
buf = stream.SyncFIFO(eth_udp_user_description(dw), depth//(dw//8))
|
2015-09-07 07:28:02 -04:00
|
|
|
if name is None:
|
|
|
|
self.submodules += buf
|
|
|
|
else:
|
|
|
|
setattr(self.submodules, name, buf)
|
|
|
|
self.comb += Port.connect(port, buf)
|
|
|
|
|
|
|
|
|
|
|
|
class UDPSoCDevel(UDPSoC):
|
|
|
|
def __init__(self, platform):
|
2016-03-31 15:27:08 -04:00
|
|
|
from litescope import LiteScopeAnalyzer
|
2015-09-07 07:28:02 -04:00
|
|
|
UDPSoC.__init__(self, platform)
|
2016-03-31 15:27:08 -04:00
|
|
|
debug = [
|
2016-03-16 16:30:01 -04:00
|
|
|
self.loopback_8.sink.valid,
|
|
|
|
self.loopback_8.sink.last,
|
|
|
|
self.loopback_8.sink.ready,
|
2015-09-07 07:28:02 -04:00
|
|
|
self.loopback_8.sink.data,
|
|
|
|
|
2016-03-16 16:30:01 -04:00
|
|
|
self.loopback_8.source.valid,
|
|
|
|
self.loopback_8.source.last,
|
|
|
|
self.loopback_8.source.ready,
|
2015-09-07 07:28:02 -04:00
|
|
|
self.loopback_8.source.data,
|
|
|
|
|
2016-03-16 16:30:01 -04:00
|
|
|
self.loopback_32.sink.valid,
|
|
|
|
self.loopback_32.sink.last,
|
|
|
|
self.loopback_32.sink.ready,
|
2015-09-07 07:28:02 -04:00
|
|
|
self.loopback_32.sink.data,
|
|
|
|
|
2016-03-16 16:30:01 -04:00
|
|
|
self.loopback_32.source.valid,
|
|
|
|
self.loopback_32.source.last,
|
|
|
|
self.loopback_32.source.ready,
|
2015-09-07 07:28:02 -04:00
|
|
|
self.loopback_32.source.data
|
2016-03-31 15:27:08 -04:00
|
|
|
]
|
2019-11-23 09:47:42 -05:00
|
|
|
self.submodules.analyzer = LiteScopeAnalyzer(debug, 4096, csr_csv="test/analyzer.csv")
|
|
|
|
self.add_csr("analyzer")
|
2015-09-07 07:28:02 -04:00
|
|
|
|
|
|
|
default_subtarget = UDPSoC
|