frontend: rename tty to stream (tty was too specific since modules can be used for any kind of data stream).

This commit is contained in:
Florent Kermarrec 2020-07-13 10:04:17 +02:00
parent dbe15f17fc
commit 1d76d02ea6
5 changed files with 54 additions and 56 deletions

View File

@ -0,0 +1,38 @@
# This file is Copyright (c) 2015-2019 Florent Kermarrec <florent@enjoy-digital.fr>
# License: BSD
from liteeth.common import *
from liteeth.frontend.stream import LiteEthUDPStreamer
from targets.base import BaseSoC
# StreamSoC ----------------------------------------------------------------------------------------
class StreamSoC(BaseSoC):
default_platform = "kc705"
def __init__(self, platform):
BaseSoC.__init__(self, platform,
mac_address = 0x10e2d5000000,
ip_address = "192.168.1.50")
self.submodules.streamer = LiteEthUDPStreamer(self.ethcore.udp, convert_ip("192.168.1.100"), 10000)
self.comb += self.streamer.source.connect(self.streamer.sink)
# StreamSoDevel ------------------------------------------------------------------------------------
class StreamSoCDevel(StreamSoC):
def __init__(self, platform):
from litescope import LiteScopeAnalyzer
StreamSoC.__init__(self, platform)
analyzer_signals = [
self.streamer.sink.valid,
self.streamer.sink.ready,
self.streamer.sink.data,
self.streamer.source.valid,
self.streamer.source.ready,
self.streamer.source.data
]
self.submodules.analyzer = LiteScopeAnalyzer(analyzer_signals, 4096, csr_csv="test/analyzer.csv")
self.add_csr("analyzer")
default_subtarget = StreamSoC

View File

@ -1,38 +0,0 @@
# This file is Copyright (c) 2015-2019 Florent Kermarrec <florent@enjoy-digital.fr>
# License: BSD
from liteeth.common import *
from liteeth.frontend.tty import LiteEthTTY
from targets.base import BaseSoC
# TTYSoC -------------------------------------------------------------------------------------------
class TTYSoC(BaseSoC):
default_platform = "kc705"
def __init__(self, platform):
BaseSoC.__init__(self, platform,
mac_address=0x10e2d5000000,
ip_address="192.168.1.50")
self.submodules.tty = LiteEthTTY(self.ethcore.udp, convert_ip("192.168.1.100"), 10000)
self.comb += self.tty.source.connect(self.tty.sink)
# TTYSoDevel ---------------------------------------------------------------------------------------
class TTYSoCDevel(TTYSoC):
def __init__(self, platform):
from litescope import LiteScopeAnalyzer
TTYSoC.__init__(self, platform)
analyzer_signals = [
self.tty.sink.valid,
self.tty.sink.ready,
self.tty.sink.data,
self.tty.source.valid,
self.tty.source.ready,
self.tty.source.data
]
self.submodules.analyzer = LiteScopeAnalyzer(analyzer_signals, 4096, csr_csv="test/analyzer.csv")
self.add_csr("analyzer")
default_subtarget = TTYSoC

View File

@ -38,7 +38,7 @@ def test(fpga_ip, udp_port, test_message):
# # #
test_message = "LiteEth virtual TTY Hello world\n"
test_message = "LiteEth Stream Hello world\n"
test("192.168.1.50", 10000, test_message)
# # #

View File

@ -3,9 +3,9 @@
from liteeth.common import *
# TTY TX -------------------------------------------------------------------------------------------
# Steam 2 UDP TX -----------------------------------------------------------------------------------
class LiteEthTTYTX(Module):
class LiteEthStream2UDPTX(Module):
def __init__(self, ip_address, udp_port, fifo_depth=None):
self.sink = sink = stream.Endpoint(eth_tty_description(8))
self.source = source = stream.Endpoint(eth_udp_user_description(8))
@ -60,9 +60,9 @@ class LiteEthTTYTX(Module):
)
)
# TTY RX -------------------------------------------------------------------------------------------
# UDP to Stream RX ---------------------------------------------------------------------------------
class LiteEthTTYRX(Module):
class LiteEthUDP2StreamRX(Module):
def __init__(self, ip_address, udp_port, fifo_depth=None):
self.sink = sink = stream.Endpoint(eth_udp_user_description(8))
self.source = source = stream.Endpoint(eth_tty_description(8))
@ -89,14 +89,12 @@ class LiteEthTTYRX(Module):
fifo.source.connect(source)
]
# TTY ----------------------------------------------------------------------------------------------
# UDP Streamer -------------------------------------------------------------------------------------
class LiteEthTTY(Module):
def __init__(self, udp, ip_address, udp_port,
rx_fifo_depth=64,
tx_fifo_depth=64):
self.submodules.tx = tx = LiteEthTTYTX(ip_address, udp_port, tx_fifo_depth)
self.submodules.rx = rx = LiteEthTTYRX(ip_address, udp_port, rx_fifo_depth)
class LiteEthUDPStreamer(Module):
def __init__(self, udp, ip_address, udp_port, rx_fifo_depth=64, tx_fifo_depth=64):
self.submodules.tx = tx = LiteEthStream2UDPTX(ip_address, udp_port, tx_fifo_depth)
self.submodules.rx = rx = LiteEthUDP2StreamRX(ip_address, udp_port, rx_fifo_depth)
udp_port = udp.crossbar.get_port(udp_port, dw=8)
self.comb += [
tx.source.connect(udp_port.sink),

View File

@ -31,6 +31,6 @@ class TestExamples(unittest.TestCase):
self.example_test("etherbone", "EtherboneSoC")
self.example_test("etherbone", "EtherboneSoCDevel")
def test_tty_example(self):
self.example_test("tty", "TTYSoC")
self.example_test("tty", "TTYSoCDevel")
def test_stream_example(self):
self.example_test("stream", "StreamSoC")
self.example_test("stream", "StreamSoCDevel")