liteeth: pep8 (E302)
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Mon, 13 Apr 2015 08:20:02 +0000 (10:20 +0200)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Mon, 13 Apr 2015 08:20:02 +0000 (10:20 +0200)
63 files changed:
misoclib/com/liteeth/common.py
misoclib/com/liteeth/core/__init__.py
misoclib/com/liteeth/core/arp/__init__.py
misoclib/com/liteeth/core/etherbone/__init__.py
misoclib/com/liteeth/core/etherbone/packet.py
misoclib/com/liteeth/core/etherbone/probe.py
misoclib/com/liteeth/core/etherbone/record.py
misoclib/com/liteeth/core/etherbone/wishbone.py
misoclib/com/liteeth/core/icmp/__init__.py
misoclib/com/liteeth/core/ip/__init__.py
misoclib/com/liteeth/core/ip/checksum.py
misoclib/com/liteeth/core/ip/crossbar.py
misoclib/com/liteeth/core/tty/__init__.py
misoclib/com/liteeth/core/udp/__init__.py
misoclib/com/liteeth/core/udp/crossbar.py
misoclib/com/liteeth/example_designs/make.py
misoclib/com/liteeth/example_designs/targets/base.py
misoclib/com/liteeth/example_designs/targets/etherbone.py
misoclib/com/liteeth/example_designs/targets/tty.py
misoclib/com/liteeth/example_designs/targets/udp.py
misoclib/com/liteeth/example_designs/test/make.py
misoclib/com/liteeth/example_designs/test/test_etherbone.py
misoclib/com/liteeth/example_designs/test/test_la.py
misoclib/com/liteeth/example_designs/test/test_tty.py
misoclib/com/liteeth/example_designs/test/test_udp.py
misoclib/com/liteeth/generic/__init__.py
misoclib/com/liteeth/generic/arbiter.py
misoclib/com/liteeth/generic/crossbar.py
misoclib/com/liteeth/generic/depacketizer.py
misoclib/com/liteeth/generic/dispatcher.py
misoclib/com/liteeth/generic/packetizer.py
misoclib/com/liteeth/mac/__init__.py
misoclib/com/liteeth/mac/common.py
misoclib/com/liteeth/mac/core/__init__.py
misoclib/com/liteeth/mac/core/crc.py
misoclib/com/liteeth/mac/core/gap.py
misoclib/com/liteeth/mac/core/last_be.py
misoclib/com/liteeth/mac/core/padding.py
misoclib/com/liteeth/mac/core/preamble.py
misoclib/com/liteeth/mac/frontend/sram.py
misoclib/com/liteeth/mac/frontend/wishbone.py
misoclib/com/liteeth/phy/__init__.py
misoclib/com/liteeth/phy/gmii.py
misoclib/com/liteeth/phy/gmii_mii.py
misoclib/com/liteeth/phy/loopback.py
misoclib/com/liteeth/phy/mii.py
misoclib/com/liteeth/phy/sim.py
misoclib/com/liteeth/test/arp_tb.py
misoclib/com/liteeth/test/common.py
misoclib/com/liteeth/test/etherbone_tb.py
misoclib/com/liteeth/test/icmp_tb.py
misoclib/com/liteeth/test/ip_tb.py
misoclib/com/liteeth/test/mac_core_tb.py
misoclib/com/liteeth/test/mac_wishbone_tb.py
misoclib/com/liteeth/test/model/arp.py
misoclib/com/liteeth/test/model/dumps.py
misoclib/com/liteeth/test/model/etherbone.py
misoclib/com/liteeth/test/model/icmp.py
misoclib/com/liteeth/test/model/ip.py
misoclib/com/liteeth/test/model/mac.py
misoclib/com/liteeth/test/model/phy.py
misoclib/com/liteeth/test/model/udp.py
misoclib/com/liteeth/test/udp_tb.py

index 8643b3fcfd20c6fb8df3d3275a3d64c238bf209a..c29beb556e439950dcfd97d9c07829a7edab2ebd 100644 (file)
@@ -18,6 +18,7 @@ eth_interpacket_gap = 12
 eth_preamble = 0xD555555555555555
 buffer_depth = 2**log2_int(eth_mtu, need_pow2=False)
 
+
 class HField():
     def __init__(self, byte, offset, width):
         self.byte = byte
@@ -115,6 +116,7 @@ etherbone_record_header = {
     "rcount":           HField( 3,  0, 8)
 }
 
+
 def reverse_bytes(v):
     n = math.ceil(flen(v)/8)
     r = []
@@ -122,6 +124,7 @@ def reverse_bytes(v):
         r.append(v[i*8:min((i+1)*8, flen(v))])
     return Cat(iter(r))
 
+
 # layouts
 def _layout_from_header(header):
     _layout = []
@@ -129,6 +132,7 @@ def _layout_from_header(header):
         _layout.append((k, v.width))
     return _layout
 
+
 def _remove_from_layout(layout, *args):
     r = []
     for f in layout:
@@ -140,6 +144,7 @@ def _remove_from_layout(layout, *args):
             r.append(f)
     return r
 
+
 def eth_phy_description(dw):
     payload_layout = [
         ("data", dw),
@@ -148,6 +153,7 @@ def eth_phy_description(dw):
     ]
     return EndpointDescription(payload_layout, packetized=True)
 
+
 def eth_mac_description(dw):
     payload_layout = _layout_from_header(mac_header) + [
         ("data", dw),
@@ -156,6 +162,7 @@ def eth_mac_description(dw):
     ]
     return EndpointDescription(payload_layout, packetized=True)
 
+
 def eth_arp_description(dw):
     param_layout = _layout_from_header(arp_header)
     payload_layout = [
@@ -173,6 +180,7 @@ arp_table_response_layout = [
     ("mac_address", 48)
 ]
 
+
 def eth_ipv4_description(dw):
     param_layout = _layout_from_header(ipv4_header)
     payload_layout = [
@@ -181,6 +189,7 @@ def eth_ipv4_description(dw):
     ]
     return EndpointDescription(payload_layout, param_layout, packetized=True)
 
+
 def eth_ipv4_user_description(dw):
     param_layout = [
         ("length", 16),
@@ -193,6 +202,7 @@ def eth_ipv4_user_description(dw):
     ]
     return EndpointDescription(payload_layout, param_layout, packetized=True)
 
+
 def convert_ip(s):
     ip = 0
     for e in s.split("."):
@@ -200,6 +210,7 @@ def convert_ip(s):
         ip += int(e)
     return ip
 
+
 def eth_icmp_description(dw):
     param_layout = _layout_from_header(icmp_header)
     payload_layout = [
@@ -208,6 +219,7 @@ def eth_icmp_description(dw):
     ]
     return EndpointDescription(payload_layout, param_layout, packetized=True)
 
+
 def eth_icmp_user_description(dw):
     param_layout = _layout_from_header(icmp_header) + [
         ("ip_address", 32),
@@ -219,6 +231,7 @@ def eth_icmp_user_description(dw):
     ]
     return EndpointDescription(payload_layout, param_layout, packetized=True)
 
+
 def eth_udp_description(dw):
     param_layout = _layout_from_header(udp_header)
     payload_layout = [
@@ -227,6 +240,7 @@ def eth_udp_description(dw):
     ]
     return EndpointDescription(payload_layout, param_layout, packetized=True)
 
+
 def eth_udp_user_description(dw):
     param_layout = [
         ("src_port", 16),
@@ -240,6 +254,7 @@ def eth_udp_user_description(dw):
     ]
     return EndpointDescription(payload_layout, param_layout, packetized=True)
 
+
 def eth_etherbone_packet_description(dw):
     param_layout = _layout_from_header(etherbone_packet_header)
     payload_layout = [
@@ -248,6 +263,7 @@ def eth_etherbone_packet_description(dw):
     ]
     return EndpointDescription(payload_layout, param_layout, packetized=True)
 
+
 def eth_etherbone_packet_user_description(dw):
     param_layout = _layout_from_header(etherbone_packet_header)
     param_layout = _remove_from_layout(param_layout, "magic", "portsize", "addrsize", "version")
@@ -258,6 +274,7 @@ def eth_etherbone_packet_user_description(dw):
     ]
     return EndpointDescription(payload_layout, param_layout, packetized=True)
 
+
 def eth_etherbone_record_description(dw):
     param_layout = _layout_from_header(etherbone_record_header)
     payload_layout = [
@@ -266,6 +283,7 @@ def eth_etherbone_record_description(dw):
     ]
     return EndpointDescription(payload_layout, param_layout, packetized=True)
 
+
 def eth_etherbone_mmap_description(dw):
     param_layout = [
         ("we", 1),
@@ -279,6 +297,7 @@ def eth_etherbone_mmap_description(dw):
     ]
     return EndpointDescription(payload_layout, param_layout, packetized=True)
 
+
 def eth_tty_description(dw):
     payload_layout = [("data", dw)]
     return EndpointDescription(payload_layout, packetized=False)
index 7d14ec32326fb9395b251a8bbb129b531aa3fd3b..10bd2f9078a1578c6f81db480611a4fc010d6296 100644 (file)
@@ -6,6 +6,7 @@ from misoclib.com.liteeth.core.ip import LiteEthIP
 from misoclib.com.liteeth.core.udp import LiteEthUDP
 from misoclib.com.liteeth.core.icmp import LiteEthICMP
 
+
 class LiteEthIPCore(Module, AutoCSR):
     def __init__(self, phy, mac_address, ip_address, clk_freq):
         self.submodules.mac = LiteEthMAC(phy, 8, interface="crossbar", with_hw_preamble_crc=True)
@@ -13,6 +14,7 @@ class LiteEthIPCore(Module, AutoCSR):
         self.submodules.ip = LiteEthIP(self.mac, mac_address, ip_address, self.arp.table)
         self.submodules.icmp = LiteEthICMP(self.ip, ip_address)
 
+
 class LiteEthUDPIPCore(LiteEthIPCore):
     def __init__(self, phy, mac_address, ip_address, clk_freq):
         LiteEthIPCore.__init__(self, phy, mac_address, ip_address, clk_freq)
index 6efb239064a01c04d0f3b7a5fce7c1632994f84e..50bd9a5b8fa927a0eabeae16cfc89cd1dd8b0df5 100644 (file)
@@ -10,6 +10,7 @@ _arp_table_layout = [
         ("mac_address", 48)
     ]
 
+
 class LiteEthARPPacketizer(LiteEthPacketizer):
     def __init__(self):
         LiteEthPacketizer.__init__(self,
@@ -18,6 +19,7 @@ class LiteEthARPPacketizer(LiteEthPacketizer):
             arp_header,
             arp_header_len)
 
+
 class LiteEthARPTX(Module):
     def __init__(self, mac_address, ip_address):
         self.sink = sink = Sink(_arp_table_layout)
@@ -72,6 +74,7 @@ class LiteEthARPTX(Module):
             )
         )
 
+
 class LiteEthARPDepacketizer(LiteEthDepacketizer):
     def __init__(self):
         LiteEthDepacketizer.__init__(self,
@@ -80,6 +83,7 @@ class LiteEthARPDepacketizer(LiteEthDepacketizer):
             arp_header,
             arp_header_len)
 
+
 class LiteEthARPRX(Module):
     def __init__(self, mac_address, ip_address):
         self.sink = sink = Sink(eth_mac_description(8))
@@ -131,6 +135,7 @@ class LiteEthARPRX(Module):
             )
         )
 
+
 class LiteEthARPTable(Module):
     def __init__(self, clk_freq, max_requests=8):
         self.sink = sink = Sink(_arp_table_layout)             # from arp_rx
@@ -247,6 +252,7 @@ class LiteEthARPTable(Module):
             )
         )
 
+
 class LiteEthARP(Module):
     def __init__(self, mac, mac_address, ip_address, clk_freq):
         self.submodules.tx = tx = LiteEthARPTX(mac_address, ip_address)
index 95285425f23ea2652d694edbc044a6a3efd72196..4b622a73dc3ecda3803bf36c4252f29139bc12d1 100644 (file)
@@ -7,6 +7,7 @@ from misoclib.com.liteeth.core.etherbone.probe import *
 from misoclib.com.liteeth.core.etherbone.record import *
 from misoclib.com.liteeth.core.etherbone.wishbone import *
 
+
 class LiteEthEtherbone(Module):
     def __init__(self, udp, udp_port):
         # decode/encode etherbone packets
index 7db4b5cabbacfa185d858529ae29bfdde05f37fd..fa8d76a30a2c6e8f3376b3755d24aede174da310 100644 (file)
@@ -3,6 +3,7 @@ from misoclib.com.liteeth.generic import *
 from misoclib.com.liteeth.generic.depacketizer import LiteEthDepacketizer
 from misoclib.com.liteeth.generic.packetizer import LiteEthPacketizer
 
+
 class LiteEthEtherbonePacketPacketizer(LiteEthPacketizer):
     def __init__(self):
         LiteEthPacketizer.__init__(self,
@@ -11,6 +12,7 @@ class LiteEthEtherbonePacketPacketizer(LiteEthPacketizer):
             etherbone_packet_header,
             etherbone_packet_header_len)
 
+
 class LiteEthEtherbonePacketTX(Module):
     def __init__(self, udp_port):
         self.sink = sink = Sink(eth_etherbone_packet_user_description(32))
@@ -52,6 +54,7 @@ class LiteEthEtherbonePacketTX(Module):
             )
         )
 
+
 class LiteEthEtherbonePacketDepacketizer(LiteEthDepacketizer):
     def __init__(self):
         LiteEthDepacketizer.__init__(self,
@@ -60,6 +63,7 @@ class LiteEthEtherbonePacketDepacketizer(LiteEthDepacketizer):
             etherbone_packet_header,
             etherbone_packet_header_len)
 
+
 class LiteEthEtherbonePacketRX(Module):
     def __init__(self):
         self.sink = sink = Sink(eth_udp_user_description(32))
@@ -117,6 +121,7 @@ class LiteEthEtherbonePacketRX(Module):
             )
         )
 
+
 class LiteEthEtherbonePacket(Module):
     def __init__(self, udp, udp_port):
         self.submodules.tx = tx = LiteEthEtherbonePacketTX(udp_port)
index cdc7b7e28970ff63946376b1f8c0c3a05752fd3b..bc25fe37bfe6926e5709e917aa954d1e5bc9a7e5 100644 (file)
@@ -1,6 +1,7 @@
 from misoclib.com.liteeth.common import *
 from misoclib.com.liteeth.generic import *
 
+
 class LiteEthEtherboneProbe(Module):
     def __init__(self):
         self.sink = sink = Sink(eth_etherbone_packet_user_description(32))
index 3e053a52b6c52b0f01c01873a8ca97d9e85cb3d1..09f9b1985b2098b34dbe5e35c3d25d1228b97da1 100644 (file)
@@ -3,6 +3,7 @@ from misoclib.com.liteeth.generic import *
 from misoclib.com.liteeth.generic.depacketizer import LiteEthDepacketizer
 from misoclib.com.liteeth.generic.packetizer import LiteEthPacketizer
 
+
 class LiteEthEtherboneRecordPacketizer(LiteEthPacketizer):
     def __init__(self):
         LiteEthPacketizer.__init__(self,
@@ -11,6 +12,7 @@ class LiteEthEtherboneRecordPacketizer(LiteEthPacketizer):
             etherbone_record_header,
             etherbone_record_header_len)
 
+
 class LiteEthEtherboneRecordDepacketizer(LiteEthDepacketizer):
     def __init__(self):
         LiteEthDepacketizer.__init__(self,
@@ -19,6 +21,7 @@ class LiteEthEtherboneRecordDepacketizer(LiteEthDepacketizer):
             etherbone_record_header,
             etherbone_record_header_len)
 
+
 class LiteEthEtherboneRecordReceiver(Module):
     def __init__(self, buffer_depth=256):
         self.sink = sink = Sink(eth_etherbone_record_description(32))
@@ -90,6 +93,7 @@ class LiteEthEtherboneRecordReceiver(Module):
             )
         )
 
+
 class LiteEthEtherboneRecordSender(Module):
     def __init__(self, buffer_depth=256):
         self.sink = sink = Sink(eth_etherbone_mmap_description(32))
@@ -138,6 +142,7 @@ class LiteEthEtherboneRecordSender(Module):
             )
         )
 
+
 # Limitation: For simplicity we only support 1 record per packet
 class LiteEthEtherboneRecord(Module):
     def __init__(self, endianness="big"):
index 2cd3ac7a4c5087c30b07ac27ea9fc43f76f34247..d6d2b375ec945e2cbb9cd859a949496f0b46a23e 100644 (file)
@@ -2,6 +2,7 @@ from misoclib.com.liteeth.common import *
 from misoclib.com.liteeth.generic import *
 from migen.bus import wishbone
 
+
 class LiteEthEtherboneWishboneMaster(Module):
     def __init__(self):
         self.sink = sink = Sink(eth_etherbone_mmap_description(32))
index 66c2f6a45b3d7fce1596bbc257fb6d3f0caf9108..720a377b83713328d8f95e251adf07842cb3e89d 100644 (file)
@@ -3,6 +3,7 @@ from misoclib.com.liteeth.generic import *
 from misoclib.com.liteeth.generic.depacketizer import LiteEthDepacketizer
 from misoclib.com.liteeth.generic.packetizer import LiteEthPacketizer
 
+
 class LiteEthICMPPacketizer(LiteEthPacketizer):
     def __init__(self):
         LiteEthPacketizer.__init__(self,
@@ -11,6 +12,7 @@ class LiteEthICMPPacketizer(LiteEthPacketizer):
             icmp_header,
             icmp_header_len)
 
+
 class LiteEthICMPTX(Module):
     def __init__(self, ip_address):
         self.sink = sink = Sink(eth_icmp_user_description(8))
@@ -47,6 +49,7 @@ class LiteEthICMPTX(Module):
             )
         )
 
+
 class LiteEthICMPDepacketizer(LiteEthDepacketizer):
     def __init__(self):
         LiteEthDepacketizer.__init__(self,
@@ -55,6 +58,7 @@ class LiteEthICMPDepacketizer(LiteEthDepacketizer):
             icmp_header,
             icmp_header_len)
 
+
 class LiteEthICMPRX(Module):
     def __init__(self, ip_address):
         self.sink = sink = Sink(eth_ipv4_user_description(8))
@@ -109,6 +113,7 @@ class LiteEthICMPRX(Module):
             )
         )
 
+
 class LiteEthICMPEcho(Module):
     def __init__(self):
         self.sink = sink = Sink(eth_icmp_user_description(8))
@@ -122,6 +127,7 @@ class LiteEthICMPEcho(Module):
             self.source.checksum.eq(~((~self.buffer.source.checksum)-0x0800))
         ]
 
+
 class LiteEthICMP(Module):
     def __init__(self, ip, ip_address):
         self.submodules.tx = tx = LiteEthICMPTX(ip_address)
index 9fb5a9471a2ac1de8736cad0e710d239e78e5dad..553f131c1e671ca11c284beb4a2df3257debed5e 100644 (file)
@@ -5,6 +5,7 @@ from misoclib.com.liteeth.core.ip.crossbar import *
 from misoclib.com.liteeth.generic.depacketizer import LiteEthDepacketizer
 from misoclib.com.liteeth.generic.packetizer import LiteEthPacketizer
 
+
 class LiteEthIPV4Packetizer(LiteEthPacketizer):
     def __init__(self):
         LiteEthPacketizer.__init__(self,
@@ -13,6 +14,7 @@ class LiteEthIPV4Packetizer(LiteEthPacketizer):
             ipv4_header,
             ipv4_header_len)
 
+
 class LiteEthIPTX(Module):
     def __init__(self, mac_address, ip_address, arp_table):
         self.sink = sink = Sink(eth_ipv4_user_description(8))
@@ -92,6 +94,7 @@ class LiteEthIPTX(Module):
             )
         )
 
+
 class LiteEthIPV4Depacketizer(LiteEthDepacketizer):
     def __init__(self):
         LiteEthDepacketizer.__init__(self,
@@ -100,6 +103,7 @@ class LiteEthIPV4Depacketizer(LiteEthDepacketizer):
             ipv4_header,
             ipv4_header_len)
 
+
 class LiteEthIPRX(Module):
     def __init__(self, mac_address, ip_address):
         self.sink = sink = Sink(eth_mac_description(8))
@@ -164,6 +168,7 @@ class LiteEthIPRX(Module):
             )
         )
 
+
 class LiteEthIP(Module):
     def __init__(self, mac, mac_address, ip_address, arp_table):
         self.submodules.tx = tx = LiteEthIPTX(mac_address, ip_address, arp_table)
index ea5e61566683db72e2d2025effb9493f523a2470..24d13ce98459b038d2a3be914b3bfd2a5ab77b50 100644 (file)
@@ -1,6 +1,7 @@
 from misoclib.com.liteeth.common import *
 from misoclib.com.liteeth.generic import *
 
+
 class LiteEthIPV4Checksum(Module):
     def __init__(self, words_per_clock_cycle=1, skip_checksum=False):
         self.reset = Signal() # XXX FIXME InsertReset generates incorrect verilog
index 7b402e83745fd07e86378153e01cddd5af889b0d..6228c9e781d5dabd61fbfc7b749bd234b8e93a35 100644 (file)
@@ -2,22 +2,26 @@ from misoclib.com.liteeth.common import *
 from misoclib.com.liteeth.generic import *
 from misoclib.com.liteeth.generic.crossbar import LiteEthCrossbar
 
+
 class LiteEthIPV4MasterPort:
     def __init__(self, dw):
         self.dw = dw
         self.source = Source(eth_ipv4_user_description(dw))
         self.sink = Sink(eth_ipv4_user_description(dw))
 
+
 class LiteEthIPV4SlavePort:
     def __init__(self, dw):
         self.dw = dw
         self.sink = Sink(eth_ipv4_user_description(dw))
         self.source = Source(eth_ipv4_user_description(dw))
 
+
 class LiteEthIPV4UserPort(LiteEthIPV4SlavePort):
     def __init__(self, dw):
         LiteEthIPV4SlavePort.__init__(self, dw)
 
+
 class LiteEthIPV4Crossbar(LiteEthCrossbar):
     def __init__(self):
         LiteEthCrossbar.__init__(self, LiteEthIPV4MasterPort, "protocol")
index 828d75b02b634c2e09aeabf0a4675e4963461053..4a0917b3d2c34a81e734c8143ac2ed6cff720fab 100644 (file)
@@ -1,6 +1,7 @@
 from misoclib.com.liteeth.common import *
 from misoclib.com.liteeth.generic import *
 
+
 class LiteEthTTYTX(Module):
     def __init__(self, ip_address, udp_port, fifo_depth=None):
         self.sink = sink = Sink(eth_tty_description(8))
@@ -58,6 +59,7 @@ class LiteEthTTYTX(Module):
                 )
             )
 
+
 class LiteEthTTYRX(Module):
     def __init__(self, ip_address, udp_port, fifo_depth=None):
         self.sink = sink = Sink(eth_udp_user_description(8))
@@ -83,6 +85,7 @@ class LiteEthTTYRX(Module):
                 Record.connect(fifo.source, source)
             ]
 
+
 class LiteEthTTY(Module):
     def __init__(self, udp, ip_address, udp_port,
             rx_fifo_depth=64,
index 1518dec68259f778449f1103f9e8447d0ff666e2..ec5ac2b787ee2a299a05eaadd9cba833cd480efc 100644 (file)
@@ -4,6 +4,7 @@ from misoclib.com.liteeth.core.udp.crossbar import *
 from misoclib.com.liteeth.generic.depacketizer import LiteEthDepacketizer
 from misoclib.com.liteeth.generic.packetizer import LiteEthPacketizer
 
+
 class LiteEthUDPPacketizer(LiteEthPacketizer):
     def __init__(self):
         LiteEthPacketizer.__init__(self,
@@ -12,6 +13,7 @@ class LiteEthUDPPacketizer(LiteEthPacketizer):
             udp_header,
             udp_header_len)
 
+
 class LiteEthUDPTX(Module):
     def __init__(self, ip_address):
         self.sink = sink = Sink(eth_udp_user_description(8))
@@ -48,6 +50,7 @@ class LiteEthUDPTX(Module):
             )
         )
 
+
 class LiteEthUDPDepacketizer(LiteEthDepacketizer):
     def __init__(self):
         LiteEthDepacketizer.__init__(self,
@@ -56,6 +59,7 @@ class LiteEthUDPDepacketizer(LiteEthDepacketizer):
             udp_header,
             udp_header_len)
 
+
 class LiteEthUDPRX(Module):
     def __init__(self, ip_address):
         self.sink = sink = Sink(eth_ipv4_user_description(8))
@@ -109,6 +113,7 @@ class LiteEthUDPRX(Module):
             )
         )
 
+
 class LiteEthUDP(Module):
     def __init__(self, ip, ip_address):
         self.submodules.tx = tx = LiteEthUDPTX(ip_address)
index 0bb55796a14033016abf0a0bcff3d055b4a2682b..1ea2d0375ce65b797adec2ed659417da5ced621e 100644 (file)
@@ -3,22 +3,26 @@ from misoclib.com.liteeth.generic import *
 
 from misoclib.com.liteeth.generic.crossbar import LiteEthCrossbar
 
+
 class LiteEthUDPMasterPort:
     def __init__(self, dw):
         self.dw = dw
         self.source = Source(eth_udp_user_description(dw))
         self.sink = Sink(eth_udp_user_description(dw))
 
+
 class LiteEthUDPSlavePort:
     def __init__(self, dw):
         self.dw =dw
         self.sink = Sink(eth_udp_user_description(dw))
         self.source = Source(eth_udp_user_description(dw))
 
+
 class LiteEthUDPUserPort(LiteEthUDPSlavePort):
     def __init__(self, dw):
         LiteEthUDPSlavePort.__init__(self, dw)
 
+
 class LiteEthUDPCrossbar(LiteEthCrossbar):
     def __init__(self):
         LiteEthCrossbar.__init__(self, LiteEthUDPMasterPort, "dst_port")
index 162ed184984bf7befefd7bc81f30db433c3c5fb7..4fdf983bb1a2c5de29c3bf182d8995a02509b624 100644 (file)
@@ -13,9 +13,11 @@ from mibuild.xilinx.common import *
 from misoclib.soc import cpuif
 from misoclib.com.liteeth.common import *
 
+
 def _import(default, name):
     return importlib.import_module(default + "." + name)
 
+
 def _get_args():
     parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter,
         description="""\
index 1b32de0ea41ab69b94d2e8b6ed29648f61e26b40..6f5f11d6cc2e92fc6a9161c5a14156419b59845a 100644 (file)
@@ -13,6 +13,7 @@ from misoclib.com.liteeth.generic import *
 from misoclib.com.liteeth.phy.gmii import LiteEthPHYGMII
 from misoclib.com.liteeth.core import LiteEthUDPIPCore
 
+
 class BaseSoC(SoC, AutoCSR):
     csr_map = {
         "phy":        11,
@@ -42,6 +43,7 @@ class BaseSoC(SoC, AutoCSR):
         self.submodules.phy = LiteEthPHYGMII(platform.request("eth_clocks"), platform.request("eth"))
         self.submodules.core = LiteEthUDPIPCore(self.phy, mac_address, convert_ip(ip_address), clk_freq)
 
+
 class BaseSoCDevel(BaseSoC, AutoCSR):
     csr_map = {
         "la":            20
index 51f9cb9ac6a628fedf58c376532af256378fe5d3..7e5d141bc97de2b09f52756615c5e9fc434b81d7 100644 (file)
@@ -8,6 +8,7 @@ from misoclib.com.liteeth.generic import *
 from targets.base import BaseSoC
 from misoclib.com.liteeth.core.etherbone import LiteEthEtherbone
 
+
 class EtherboneSoC(BaseSoC):
     default_platform = "kc705"
     def __init__(self, platform):
@@ -17,6 +18,7 @@ class EtherboneSoC(BaseSoC):
         self.submodules.etherbone = LiteEthEtherbone(self.core.udp, 20000)
         self.add_wb_master(self.etherbone.master.bus)
 
+
 class EtherboneSoCDevel(EtherboneSoC):
     csr_map = {
         "la":            20
index a4a6f749357408d85af607309bef8b5a762076ad..a915c8575f19f251cb4f6890d20aebfb919cb879 100644 (file)
@@ -8,6 +8,7 @@ from misoclib.com.liteeth.generic import *
 from targets.base import BaseSoC
 from misoclib.com.liteeth.core.tty import LiteEthTTY
 
+
 class TTYSoC(BaseSoC):
     default_platform = "kc705"
     def __init__(self, platform):
@@ -17,6 +18,7 @@ class TTYSoC(BaseSoC):
         self.submodules.tty = LiteEthTTY(self.core.udp, convert_ip("192.168.0.14"), 10000)
         self.comb += Record.connect(self.tty.source, self.tty.sink)
 
+
 class TTYSoCDevel(TTYSoC):
     csr_map = {
         "la":            20
index 746f11510987bf80a2ff346c37868c85c61870a0..76f13990868995365289afe686f766dbd51c9d86 100644 (file)
@@ -7,6 +7,7 @@ from misoclib.com.liteeth.generic import *
 
 from targets.base import BaseSoC
 
+
 class UDPSoC(BaseSoC):
     default_platform = "kc705"
     def __init__(self, platform):
@@ -28,6 +29,7 @@ class UDPSoC(BaseSoC):
             setattr(self.submodules, name, buf)
         self.comb += Port.connect(port, buf)
 
+
 class UDPSoCDevel(UDPSoC):
     csr_map = {
         "la":            20
index 1d3f2d9d835edc04c984f7c06eb980bec0f9689f..2c8bd7835901be48c47741bd566224698d6e170b 100644 (file)
@@ -1,6 +1,7 @@
 #!/usr/bin/env python3
 import argparse, importlib
 
+
 def _get_args():
     parser = argparse.ArgumentParser()
     parser.add_argument("-b", "--bridge", default="uart", help="Bridge to use")
index 715de265acbb209355b6d58934d10391e323b6a5..d8eeef760d5c6d9d891230ee105e92904c2e9cc5 100644 (file)
@@ -5,6 +5,7 @@ SRAM_BASE = 0x02000000
 
 import socket
 
+
 def main(wb):
     sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
 
index 45686bba76aa39594992b7b68fd1ec258cdc2851..1a4dc16995df4aae12c0b54d6a897a46257275c5 100644 (file)
@@ -1,6 +1,7 @@
 import time
 from misoclib.tools.litescope.host.driver.la import LiteScopeLADriver
 
+
 def main(wb):
     la = LiteScopeLADriver(wb.regs, "la", debug=True)
 
index a2a7aa9252f9d8eb8af8732f718089e9ad9865c8..fdf1d0381a5dcfd601999d5fb1b255db9731eef4 100644 (file)
@@ -1,6 +1,7 @@
 import socket
 import threading
 
+
 def test(fpga_ip, udp_port, test_message):
     tx_sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
     rx_sock  = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
@@ -31,6 +32,7 @@ def test(fpga_ip, udp_port, test_message):
     except KeyboardInterrupt:
         pass
 
+
 def main(wb):
     test_message = "LiteEth virtual TTY Hello world\n"
     test("192.168.0.42", 10000, test_message)
index 68e62c0758e3691a88f717cea79f50a29e75f5e0..6b28974dfd354e039f6a8fc28a09587cb7523d33 100644 (file)
@@ -7,12 +7,14 @@ KB = 1024
 MB = 1024*KB
 GB = 1024*MB
 
+
 def seed_to_data(seed, random=True):
     if random:
         return (seed * 0x31415979 + 1) & 0xffffffff
     else:
         return seed
 
+
 def check(p1, p2):
     p1 = copy.deepcopy(p1)
     p2 = copy.deepcopy(p2)
@@ -34,6 +36,7 @@ def check(p1, p2):
                 errors += 1
         return shift, length, errors
 
+
 def generate_packet(seed, length):
     r = []
     for i in range(length):
@@ -41,6 +44,7 @@ def generate_packet(seed, length):
         seed += 1
     return r, seed
 
+
 def test(fpga_ip, udp_port, test_size):
     tx_sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
     rx_sock  = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
@@ -76,6 +80,7 @@ def test(fpga_ip, udp_port, test_size):
     except KeyboardInterrupt:
         pass
 
+
 def main(wb):
     test("192.168.0.42", 6000, 128*KB)
     test("192.168.0.42", 8000, 128*KB)
index cebfe76b9dccf0177d4bb896cbdb1d7dbf2fd27c..cff32b0af90309e9634825455abfbee7fbce9a88 100644 (file)
@@ -1,6 +1,7 @@
 from migen.fhdl.decorators import ModuleTransformer
 from misoclib.com.liteeth.common import *
 
+
 # Generic classes
 class Port:
     def connect(self, port):
@@ -10,6 +11,7 @@ class Port:
         ]
         return r
 
+
 # Generic modules
 class BufferizeEndpoints(ModuleTransformer):
     def __init__(self, *names):
@@ -40,6 +42,7 @@ class BufferizeEndpoints(ModuleTransformer):
             submodule.comb += Record.connect(source, buf.d)
             setattr(self, name, buf.q)
 
+
 class EndpointPacketStatus(Module):
     def __init__(self, endpoint):
         self.start = Signal()
@@ -59,6 +62,7 @@ class EndpointPacketStatus(Module):
             )
         self.comb += self.ongoing.eq((self.start | ongoing) & ~self.done)
 
+
 class PacketBuffer(Module):
     def __init__(self, description, data_depth, cmd_depth=4, almost_full=None):
         self.sink = sink = Sink(description)
index 07200a932f871afa2b4229e9b5404fb4c0d01a8a..cb6503b0e2a0f3a52bed671a36cb3edde5d31421 100644 (file)
@@ -2,6 +2,7 @@ from migen.fhdl.std import *
 from migen.genlib.roundrobin import *
 from migen.genlib.record import *
 
+
 class Arbiter(Module):
     def __init__(self, sources, sink):
         if len(sources) == 0:
index 67268b410a6776bf35be7061579ac8d9a180ae90..9938df9fdcf6b0afee4963eb259cddaa29ddb283 100644 (file)
@@ -5,6 +5,7 @@ from misoclib.com.liteeth.generic import *
 from misoclib.com.liteeth.generic.arbiter import Arbiter
 from misoclib.com.liteeth.generic.dispatcher import Dispatcher
 
+
 class LiteEthCrossbar(Module):
     def __init__(self, master_port, dispatch_param):
         self.users = OrderedDict()
index 2a0dc5eb013efba5c52f5c4f332beac06699036d..c6e13dffa2b3380b2f6a14b2d5bb4e7003399f01 100644 (file)
@@ -1,6 +1,7 @@
 from misoclib.com.liteeth.common import *
 from misoclib.com.liteeth.generic import *
 
+
 def _decode_header(h_dict, h_signal, obj):
     r = []
     for k, v in sorted(h_dict.items()):
@@ -9,6 +10,7 @@ def _decode_header(h_dict, h_signal, obj):
         r.append(getattr(obj, k).eq(reverse_bytes(h_signal[start:end])))
     return r
 
+
 class LiteEthDepacketizer(Module):
     def __init__(self, sink_description, source_description, header_type, header_length):
         self.sink = sink = Sink(sink_description)
index a822bdedd0dc59cd6aeb2f5259e744eba75a3e63..3f88cff001966187372130eff2a89018fb5be3a5 100644 (file)
@@ -1,6 +1,7 @@
 from migen.fhdl.std import *
 from migen.genlib.record import *
 
+
 class Dispatcher(Module):
     def __init__(self, source, sinks, one_hot=False):
         if len(sinks) == 0:
index 7412d965ecc1d402717135f76d6c60bc2646ecec..8ad2bf151b3461d7172359dc84941fa090726abf 100644 (file)
@@ -1,6 +1,7 @@
 from misoclib.com.liteeth.common import *
 from misoclib.com.liteeth.generic import *
 
+
 def _encode_header(h_dict, h_signal, obj):
     r = []
     for k, v in sorted(h_dict.items()):
@@ -9,6 +10,7 @@ def _encode_header(h_dict, h_signal, obj):
         r.append(h_signal[start:end].eq(reverse_bytes(getattr(obj, k))))
     return r
 
+
 class LiteEthPacketizer(Module):
     def __init__(self, sink_description, source_description, header_type, header_length):
         self.sink = sink = Sink(sink_description)
index 9ac6531452e8fa8f6ace89e021b3a6a83305ae3d..7611f192e4606f1d5389ea94dd478ce13cd24b25 100644 (file)
@@ -4,6 +4,7 @@ from misoclib.com.liteeth.mac.common import *
 from misoclib.com.liteeth.mac.core import LiteEthMACCore
 from misoclib.com.liteeth.mac.frontend.wishbone import LiteEthMACWishboneInterface
 
+
 class LiteEthMAC(Module, AutoCSR):
     def __init__(self, phy, dw, interface="crossbar", endianness="big",
             with_hw_preamble_crc=True):
index 7e6aadb6a0891dfe34fa5f7ea9c460dd3ce0f789..d5a6d57903cdf4d11aef60e4e7f7aab94eae7f24 100644 (file)
@@ -4,6 +4,7 @@ from misoclib.com.liteeth.generic.depacketizer import LiteEthDepacketizer
 from misoclib.com.liteeth.generic.packetizer import LiteEthPacketizer
 from misoclib.com.liteeth.generic.crossbar import LiteEthCrossbar
 
+
 class LiteEthMACDepacketizer(LiteEthDepacketizer):
     def __init__(self):
         LiteEthDepacketizer.__init__(self,
@@ -12,6 +13,7 @@ class LiteEthMACDepacketizer(LiteEthDepacketizer):
             mac_header,
             mac_header_len)
 
+
 class LiteEthMACPacketizer(LiteEthPacketizer):
     def __init__(self):
         LiteEthPacketizer.__init__(self,
@@ -20,20 +22,24 @@ class LiteEthMACPacketizer(LiteEthPacketizer):
             mac_header,
             mac_header_len)
 
+
 class LiteEthMACMasterPort:
     def __init__(self, dw):
         self.source = Source(eth_mac_description(dw))
         self.sink = Sink(eth_mac_description(dw))
 
+
 class LiteEthMACSlavePort:
     def __init__(self, dw):
         self.sink = Sink(eth_mac_description(dw))
         self.source = Source(eth_mac_description(dw))
 
+
 class LiteEthMACUserPort(LiteEthMACSlavePort):
     def __init__(self, dw):
         LiteEthMACSlavePort.__init__(self, dw)
 
+
 class LiteEthMACCrossbar(LiteEthCrossbar):
     def __init__(self):
         LiteEthCrossbar.__init__(self, LiteEthMACMasterPort, "ethernet_type")
index 4aebf81b1d5b9661e308cd844bc7efa647f2abb6..da512aeec526f97a5209da143e527a09780f4c89 100644 (file)
@@ -3,6 +3,7 @@ from misoclib.com.liteeth.generic import *
 from misoclib.com.liteeth.mac.core import gap, preamble, crc, padding, last_be
 from misoclib.com.liteeth.phy.sim import LiteEthPHYSim
 
+
 class LiteEthMACCore(Module, AutoCSR):
     def __init__(self, phy, dw, endianness="big",
             with_preamble_crc=True,
index b272ca190d00f46f8268a86d0d75c77b33839ef4..5f0996abc7418c74fb2f91c9e462091dc9bf5b43 100644 (file)
@@ -1,6 +1,7 @@
 from misoclib.com.liteeth.common import *
 from misoclib.com.liteeth.generic import *
 
+
 class LiteEthMACCRCEngine(Module):
     """Cyclic Redundancy Check Engine
 
@@ -69,6 +70,7 @@ class LiteEthMACCRCEngine(Module):
                     xors += [self.data[n]]
             self.comb += self.next[i].eq(optree("^", xors))
 
+
 @DecorateModule(InsertReset)
 @DecorateModule(InsertCE)
 class LiteEthMACCRC32(Module):
@@ -112,6 +114,7 @@ class LiteEthMACCRC32(Module):
             self.error.eq(self.engine.next != self.check)
         ]
 
+
 class LiteEthMACCRCInserter(Module):
     """CRC Inserter
 
@@ -186,10 +189,12 @@ class LiteEthMACCRCInserter(Module):
             )
         self.comb += self.busy.eq(~fsm.ongoing("IDLE"))
 
+
 class LiteEthMACCRC32Inserter(LiteEthMACCRCInserter):
     def __init__(self, description):
         LiteEthMACCRCInserter.__init__(self, LiteEthMACCRC32, description)
 
+
 class LiteEthMACCRCChecker(Module):
     """CRC Checker
 
@@ -272,6 +277,7 @@ class LiteEthMACCRCChecker(Module):
         )
         self.comb += self.busy.eq(~fsm.ongoing("IDLE"))
 
+
 class LiteEthMACCRC32Checker(LiteEthMACCRCChecker):
     def __init__(self, description):
         LiteEthMACCRCChecker.__init__(self, LiteEthMACCRC32, description)
index b814ed8fc52b37c114e23f28a65559dab5d33cff..07620113a6571e4da0b1a50eac1d40e07b57822b 100644 (file)
@@ -1,6 +1,7 @@
 from misoclib.com.liteeth.common import *
 from misoclib.com.liteeth.generic import *
 
+
 class LiteEthMACGap(Module):
     def __init__(self, dw, ack_on_gap=False):
         self.sink = sink = Sink(eth_phy_description(dw))
index c14177d6dff9af72ea408b0ac2c390a62045a445..200c2cd208f992a38e4657fada5526cf52a92685 100644 (file)
@@ -1,6 +1,7 @@
 from misoclib.com.liteeth.common import *
 from misoclib.com.liteeth.generic import *
 
+
 class LiteEthMACTXLastBE(Module):
     def __init__(self, dw):
         self.sink = sink = Sink(eth_phy_description(dw))
@@ -23,6 +24,7 @@ class LiteEthMACTXLastBE(Module):
             sink.ack.eq(source.ack)
         ]
 
+
 class LiteEthMACRXLastBE(Module):
     def __init__(self, dw):
         self.sink = sink = Sink(eth_phy_description(dw))
index 4bc02cca1033294902feeb0b3fa02ba4f2110ec5..54003288fe91e1c110d2501de331a281c23698a4 100644 (file)
@@ -1,6 +1,7 @@
 from misoclib.com.liteeth.common import *
 from misoclib.com.liteeth.generic import *
 
+
 class LiteEthMACPaddingInserter(Module):
     def __init__(self, dw, packet_min_length):
         self.sink = sink = Sink(eth_phy_description(dw))
@@ -36,6 +37,7 @@ class LiteEthMACPaddingInserter(Module):
             )
         )
 
+
 class LiteEthMACPaddingChecker(Module):
     def __init__(self, dw, packet_min_length):
         self.sink = sink = Sink(eth_phy_description(dw))
index 8ddc0e9326b7d15c90b3f8b086f8df95ecea124c..3394e0e818bd10e3636dc94d7285526dabab0c89 100644 (file)
@@ -1,6 +1,7 @@
 from misoclib.com.liteeth.common import *
 from misoclib.com.liteeth.generic import *
 
+
 class LiteEthMACPreambleInserter(Module):
     def __init__(self, dw):
         self.sink = Sink(eth_phy_description(dw))
@@ -50,6 +51,7 @@ class LiteEthMACPreambleInserter(Module):
             )
         )
 
+
 class LiteEthMACPreambleChecker(Module):
     def __init__(self, dw):
         self.sink = Sink(eth_phy_description(dw))
index 724509ccfbccca8b885629dd0493a2f9214c0b11..f5f1168cc245f31578fda0d0218a6dca3fe3afdd 100644 (file)
@@ -4,6 +4,7 @@ from misoclib.com.liteeth.generic import *
 from migen.bank.description import *
 from migen.bank.eventmanager import *
 
+
 class LiteEthMACSRAMWriter(Module, AutoCSR):
     def __init__(self, dw, depth, nslots=2):
         self.sink = sink = Sink(eth_phy_description(dw))
@@ -225,6 +226,7 @@ class LiteEthMACSRAMReader(Module, AutoCSR):
             cases[n] = [source.data.eq(port.dat_r)]
         self.comb += Case(rd_slot, cases)
 
+
 class LiteEthMACSRAM(Module, AutoCSR):
     def __init__(self, dw, depth, nrxslots, ntxslots):
         self.submodules.writer = LiteEthMACSRAMWriter(dw, depth, nrxslots)
index 240df40ea31bd2e3d86be8b2e41c534605ec7a3f..053478068f3d5ef44f5c638cccc5684a25dc8661 100644 (file)
@@ -5,6 +5,7 @@ from misoclib.com.liteeth.mac.frontend import sram
 from migen.bus import wishbone
 from migen.fhdl.simplify import FullMemoryWE
 
+
 class LiteEthMACWishboneInterface(Module, AutoCSR):
     def __init__(self, dw, nrxslots=2, ntxslots=2):
         self.sink = Sink(eth_phy_description(dw))
index 533fbd05c30552f9e5f95382d43471e89dd0b8a3..d06352acf928b6ff1c76f8b0765e3ed0738f5974 100644 (file)
@@ -1,6 +1,7 @@
 from misoclib.com.liteeth.common import *
 from misoclib.com.liteeth.generic import *
 
+
 def LiteEthPHY(clock_pads, pads, **kwargs):
     # Autodetect PHY
     if hasattr(pads, "source_stb"):
index c1712b97023d13736633c1e73fd27b5059297352..a39453b48084399007f5a24024ef7ab1a5797d25 100644 (file)
@@ -3,6 +3,7 @@ from migen.genlib.io import DDROutput
 from misoclib.com.liteeth.common import *
 from misoclib.com.liteeth.generic import *
 
+
 class LiteEthPHYGMIITX(Module):
     def __init__(self, pads, pads_register):
         self.sink = sink = Sink(eth_phy_description(8))
@@ -19,6 +20,7 @@ class LiteEthPHYGMIITX(Module):
             self.comb += pads_eq
         self.comb += sink.ack.eq(1)
 
+
 class LiteEthPHYGMIIRX(Module):
     def __init__(self, pads):
         self.source = source = Source(eth_phy_description(8))
@@ -39,6 +41,7 @@ class LiteEthPHYGMIIRX(Module):
         ]
         self.comb += source.eop.eq(eop)
 
+
 class LiteEthPHYGMIICRG(Module, AutoCSR):
     def __init__(self, clock_pads, pads, with_hw_init_reset, mii_mode=0):
         self._reset = CSRStorage()
@@ -76,6 +79,7 @@ class LiteEthPHYGMIICRG(Module, AutoCSR):
             AsyncResetSynchronizer(self.cd_eth_rx, reset),
         ]
 
+
 class LiteEthPHYGMII(Module, AutoCSR):
     def __init__(self, clock_pads, pads, with_hw_init_reset=True):
         self.dw = 8
index 2f5ac7b9627091fc2e6b3179887e1fc12c8a4949..3c65168b2190360c1452451893ea4bf7c7a5fa4c 100644 (file)
@@ -17,6 +17,7 @@ modes = {
 tx_pads_layout = [("tx_er", 1), ("tx_en", 1), ("tx_data", 8)]
 rx_pads_layout = [("rx_er", 1), ("dv", 1), ("rx_data", 8)]
 
+
 class LiteEthPHYGMIIMIITX(Module):
     def __init__(self, pads, mode):
         self.sink = sink = Sink(eth_phy_description(8))
@@ -50,6 +51,7 @@ class LiteEthPHYGMIIMIITX(Module):
             )
         ]
 
+
 class LiteEthPHYGMIIMIIRX(Module):
     def __init__(self, pads, mode):
         self.source = source = Source(eth_phy_description(8))
@@ -75,6 +77,7 @@ class LiteEthPHYGMIIMIIRX(Module):
             Record.connect(mux.source, source)
         ]
 
+
 class LiteEthGMIIMIIClockCounter(Module, AutoCSR):
     def __init__(self):
         self._reset = CSRStorage()
@@ -88,6 +91,7 @@ class LiteEthGMIIMIIClockCounter(Module, AutoCSR):
         ]
         self.specials += MultiReg(counter.value, self._value.status)
 
+
 class LiteEthPHYGMIIMII(Module, AutoCSR):
     def __init__(self, clock_pads, pads, with_hw_init_reset=True):
         self.dw = 8
index 9658c5a5718a025c06cab8d385932f37fa5cc450..aa046224c9e5e7f25d2febe613383745cbb518be 100644 (file)
@@ -1,6 +1,7 @@
 from misoclib.com.liteeth.common import *
 from misoclib.com.liteeth.generic import *
 
+
 class LiteEthPHYLoopbackCRG(Module, AutoCSR):
     def __init__(self):
         self._reset = CSRStorage()
@@ -18,6 +19,7 @@ class LiteEthPHYLoopbackCRG(Module, AutoCSR):
             self.cd_eth_tx.rst.eq(reset)
         ]
 
+
 class LiteEthPHYLoopback(Module, AutoCSR):
     def __init__(self):
         self.dw = 8
index cd6ba499f705284ae18aa328cdfcb83821e5933a..8c5659f210dcdd6a62ae4fa23378f67ac1f94803 100644 (file)
@@ -1,10 +1,12 @@
 from misoclib.com.liteeth.common import *
 from misoclib.com.liteeth.generic import *
 
+
 def converter_description(dw):
     payload_layout = [("data", dw)]
     return EndpointDescription(payload_layout, packetized=True)
 
+
 class LiteEthPHYMIITX(Module):
     def __init__(self, pads, pads_register=True):
         self.sink = sink = Sink(eth_phy_description(8))
@@ -28,6 +30,7 @@ class LiteEthPHYMIITX(Module):
         else:
             self.comb += pads_eq
 
+
 class LiteEthPHYMIIRX(Module):
     def __init__(self, pads):
         self.source = source = Source(eth_phy_description(8))
@@ -52,6 +55,7 @@ class LiteEthPHYMIIRX(Module):
         ]
         self.comb += Record.connect(converter.source, source)
 
+
 class LiteEthPHYMIICRG(Module, AutoCSR):
     def __init__(self, clock_pads, pads, with_hw_init_reset):
         self._reset = CSRStorage()
@@ -81,6 +85,7 @@ class LiteEthPHYMIICRG(Module, AutoCSR):
             AsyncResetSynchronizer(self.cd_eth_rx, reset),
         ]
 
+
 class LiteEthPHYMII(Module, AutoCSR):
     def __init__(self, clock_pads, pads, with_hw_init_reset=True):
         self.dw = 8
index c3f0883215030ad6e74051867d40db4638dc21f6..3c8268ffddfb99cc10804ea17094be62caf58360 100644 (file)
@@ -3,6 +3,7 @@ import os
 from misoclib.com.liteeth.common import *
 from misoclib.com.liteeth.generic import *
 
+
 class LiteEthPHYSimCRG(Module, AutoCSR):
     def __init__(self):
         self._reset = CSRStorage()
@@ -22,6 +23,7 @@ class LiteEthPHYSimCRG(Module, AutoCSR):
             self.cd_eth_tx.rst.eq(reset)
         ]
 
+
 class LiteEthPHYSim(Module, AutoCSR):
     def __init__(self, pads, tap="tap0", ip_address="192.168.0.14"):
         self.dw = 8
index f2dedfd671500f5bb18a1a5ff1221f5f5fcc72e8..f7b76855088aff132227024f7ab2665290d62e37 100644 (file)
@@ -13,6 +13,7 @@ from misoclib.com.liteeth.test.model import phy, mac, arp
 ip_address = 0x12345678
 mac_address = 0x12345678abcd
 
+
 class TB(Module):
     def __init__(self):
         self.submodules.phy_model = phy.PHY(8, debug=False)
index fb42730939e46361bf2ebdc1ea3221a4c531dc55..0b26c4b297919c05a5649feb52b5f239cd3d61bc 100644 (file)
@@ -6,6 +6,7 @@ from migen.genlib.record import *
 
 from misoclib.com.liteeth.common import *
 
+
 def print_with_prefix(s, prefix=""):
     if not isinstance(s, str):
         s = s.__repr__()
@@ -13,12 +14,14 @@ def print_with_prefix(s, prefix=""):
     for l in s:
         print(prefix + l)
 
+
 def seed_to_data(seed, random=True):
     if random:
         return (seed * 0x31415979 + 1) & 0xffffffff
     else:
         return seed
 
+
 def split_bytes(v, n, endianness="big"):
     r = []
     r_bytes = v.to_bytes(n, byteorder=endianness)
@@ -26,13 +29,16 @@ def split_bytes(v, n, endianness="big"):
         r.append(int(byte))
     return r
 
+
 def merge_bytes(b, endianness="big"):
     return int.from_bytes(bytes(b), endianness)
 
+
 def get_field_data(field, datas):
     v = merge_bytes(datas[field.byte:field.byte+math.ceil(field.width/8)])
     return (v >> field.offset) & (2**field.width-1)
 
+
 def comp(p1, p2):
     r = True
     for x, y in zip(p1, p2):
@@ -40,6 +46,7 @@ def comp(p1, p2):
             r = False
     return r
 
+
 def check(p1, p2):
     p1 = copy.deepcopy(p1)
     p2 = copy.deepcopy(p2)
@@ -61,9 +68,11 @@ def check(p1, p2):
                 errors += 1
         return shift, length, errors
 
+
 def randn(max_n):
     return random.randint(0, max_n-1)
 
+
 class Packet(list):
     def __init__(self, init=[]):
         self.ongoing = False
@@ -71,6 +80,7 @@ class Packet(list):
         for data in init:
             self.append(data)
 
+
 class PacketStreamer(Module):
     def __init__(self, description, last_be=None):
         self.source = Source(description)
@@ -115,6 +125,7 @@ class PacketStreamer(Module):
                 self.packet.done = True
                 selfp.source.stb = 0
 
+
 class PacketLogger(Module):
     def __init__(self, description):
         self.sink = Sink(description)
@@ -136,6 +147,7 @@ class PacketLogger(Module):
         if selfp.sink.stb == 1 and selfp.sink.eop == 1:
             self.packet.done = True
 
+
 class AckRandomizer(Module):
     def __init__(self, description, level=0):
         self.level = level
index 97531467f27c5b6377abb27335f49f21b1c12fb3..0bdc65f9fb156bff571a3a06a5e0419fbcca6db5 100644 (file)
@@ -13,6 +13,7 @@ from misoclib.com.liteeth.test.model import phy, mac, arp, ip, udp, etherbone
 ip_address = 0x12345678
 mac_address = 0x12345678abcd
 
+
 class TB(Module):
     def __init__(self):
         self.submodules.phy_model = phy.PHY(8, debug=False)
index bade68d6123a78cdb3bb54add01a96ca395dcd68..580271717a1ebe858fe07676a08a0e32efd9f453 100644 (file)
@@ -16,6 +16,7 @@ from misoclib.com.liteeth.test.model import phy, mac, arp, ip, icmp
 ip_address = 0x12345678
 mac_address = 0x12345678abcd
 
+
 class TB(Module):
     def __init__(self):
         self.submodules.phy_model = phy.PHY(8, debug=True)
index 7c581dd560e7462e8e7dda0094d8e4dc979bcdec..1275b5904d03715cfcbdc1f9edb2cbfe4651c73f 100644 (file)
@@ -12,6 +12,7 @@ from misoclib.com.liteeth.test.model import phy, mac, arp, ip
 ip_address = 0x12345678
 mac_address = 0x12345678abcd
 
+
 class TB(Module):
     def __init__(self):
         self.submodules.phy_model = phy.PHY(8, debug=False)
index 2f0edb33bd34881a6d28d2501adefdcb32be9b8e..b49cbc1aa7c164243c13009fcba5042a82769059 100644 (file)
@@ -9,6 +9,7 @@ from misoclib.com.liteeth.mac.core import LiteEthMACCore
 from misoclib.com.liteeth.test.common import *
 from misoclib.com.liteeth.test.model import phy, mac
 
+
 class TB(Module):
     def __init__(self):
         self.submodules.phy_model = phy.PHY(8, debug=False)
index e11d451b0e5fcec004c05d1470465d4d984092f6..f0e0f172cc0bfbc4ca124cd87ab8c42cb63ced23 100644 (file)
@@ -9,6 +9,7 @@ from misoclib.com.liteeth.mac import LiteEthMAC
 from misoclib.com.liteeth.test.common import *
 from misoclib.com.liteeth.test.model import phy, mac
 
+
 class WishboneMaster:
     def __init__(self, obj):
         self.obj = obj
@@ -41,6 +42,7 @@ class WishboneMaster:
         self.obj.stb = 0
         yield
 
+
 class SRAMReaderDriver:
     def __init__(self, obj):
         self.obj = obj
@@ -63,6 +65,7 @@ class SRAMReaderDriver:
         self.obj.ev.done.clear = 0
         yield
 
+
 class SRAMWriterDriver:
     def __init__(self, obj):
         self.obj = obj
@@ -77,6 +80,7 @@ class SRAMWriterDriver:
         self.obj.ev.available.clear = 0
         yield
 
+
 class TB(Module):
     def __init__(self):
         self.submodules.phy_model = phy.PHY(8, debug=False)
index 52a12dfc4a932b80dd13eb62e558c7dc53f7c1b3..82a32b06496ae761c31dfa319f4c72ae1df16a27 100644 (file)
@@ -5,11 +5,13 @@ from misoclib.com.liteeth.test.common import *
 
 from misoclib.com.liteeth.test.model import mac
 
+
 def print_arp(s):
     print_with_prefix(s, "[ARP]")
 
 preamble = split_bytes(eth_preamble, 8)
 
+
 # ARP model
 class ARPPacket(Packet):
     def __init__(self, init=[]):
@@ -39,6 +41,7 @@ class ARPPacket(Packet):
             r += "{:02x}".format(d)
         return r
 
+
 class ARP(Module):
     def  __init__(self, mac, mac_address, ip_address, debug=False):
         self.mac = mac
index 3ae38c2611f995cd8ebe170d96ee0a544056f15d..91a61c672aff95893894c9b14e344e5b92ae795e 100644 (file)
@@ -1,8 +1,10 @@
 import re
 
+
 def format_dump(dump):
     return [int(s, 16) for s in re.split(r'[;,\s\n]\s*', dump) if s is not ""]
 
+
 def verify_packet(packet, infos):
     errors = 0
     for k, v in infos.items():
index c2d875c889421d04240636db36e1f976aebdc455..0cf636145a7fba711307e7d231bf16d43af06233 100644 (file)
@@ -5,9 +5,11 @@ from misoclib.com.liteeth.test.common import *
 
 from misoclib.com.liteeth.test.model import udp
 
+
 def print_etherbone(s):
     print_with_prefix(s, "[ETHERBONE]")
 
+
 # Etherbone model
 class EtherboneWrite:
     def __init__(self, data):
@@ -16,6 +18,7 @@ class EtherboneWrite:
     def __repr__(self):
         return "WR32 0x{:08x}".format(self.data)
 
+
 class EtherboneRead:
     def __init__(self, addr):
         self.addr = addr
@@ -23,6 +26,7 @@ class EtherboneRead:
     def __repr__(self):
         return "RD32 @ 0x{:08x}".format(self.addr)
 
+
 class EtherboneWrites(Packet):
     def __init__(self, init=[], base_addr=0, datas=[]):
         Packet.__init__(self, init)
@@ -74,6 +78,7 @@ class EtherboneWrites(Packet):
             r += write.__repr__() + "\n"
         return r
 
+
 class EtherboneReads(Packet):
     def __init__(self, init=[], base_ret_addr=0, addrs=[]):
         Packet.__init__(self, init)
@@ -125,6 +130,7 @@ class EtherboneReads(Packet):
             r += read.__repr__() + "\n"
         return r
 
+
 class EtherboneRecord(Packet):
     def __init__(self, init=[]):
         Packet.__init__(self, init)
@@ -208,6 +214,7 @@ class EtherboneRecord(Packet):
                 r += self.reads.__repr__()
         return r
 
+
 class EtherbonePacket(Packet):
     def __init__(self, init=[]):
         Packet.__init__(self, init)
@@ -275,6 +282,7 @@ class EtherbonePacket(Packet):
                 r += record.__repr__(i)
         return r
 
+
 class Etherbone(Module):
     def  __init__(self, udp, debug=False):
         self.udp = udp
index 249b9face2f906bf0b851b5a8d4aff387fe05d0b..c89c244b6a163c7b9492cb67e2b664e5727ad424 100644 (file)
@@ -5,9 +5,11 @@ from misoclib.com.liteeth.test.common import *
 
 from misoclib.com.liteeth.test.model import ip
 
+
 def print_icmp(s):
     print_with_prefix(s, "[ICMP]")
 
+
 # ICMP model
 class ICMPPacket(Packet):
     def __init__(self, init=[]):
@@ -37,6 +39,7 @@ class ICMPPacket(Packet):
             r += "{:02x}".format(d)
         return r
 
+
 class ICMP(Module):
     def  __init__(self, ip, ip_address, debug=False):
         self.ip = ip
index ee1bdbf6573dd0dd630e8e75a151634f28bc03bc..165f1e0d4276c17e71d67cb75089b11a803aba49 100644 (file)
@@ -5,13 +5,16 @@ from misoclib.com.liteeth.test.common import *
 
 from misoclib.com.liteeth.test.model import mac
 
+
 def print_ip(s):
     print_with_prefix(s, "[IP]")
 
+
 def carry_around_add(a, b):
     c = a + b
     return (c & 0xffff) + (c >> 16)
 
+
 def checksum(msg):
     s = 0
     for i in range(0, len(msg), 2):
@@ -19,6 +22,7 @@ def checksum(msg):
         s = carry_around_add(s, w)
     return ~s & 0xffff
 
+
 # IP model
 class IPPacket(Packet):
     def __init__(self, init=[]):
@@ -61,6 +65,7 @@ class IPPacket(Packet):
             r += "{:02x}".format(d)
         return r
 
+
 class IP(Module):
     def  __init__(self, mac, mac_address, ip_address, debug=False, loopback=False):
         self.mac = mac
index a3a7a8d553bde3205be2057cf6295cb827873578..6c06390d9011622da0ed3bf0aed35024e3a214fc 100644 (file)
@@ -3,11 +3,13 @@ import math, binascii
 from misoclib.com.liteeth.common import *
 from misoclib.com.liteeth.test.common import *
 
+
 def print_mac(s):
     print_with_prefix(s, "[MAC]")
 
 preamble = split_bytes(eth_preamble, 8, "little")
 
+
 def crc32(l):
     crc = []
     crc_bytes = split_bytes(binascii.crc32(bytes(l)), 4, "little")
@@ -15,6 +17,7 @@ def crc32(l):
         crc.append(int(byte))
     return crc
 
+
 # MAC model
 class MACPacket(Packet):
     def __init__(self, init=[]):
@@ -83,6 +86,7 @@ class MACPacket(Packet):
             r += "{:02x}".format(d)
         return r
 
+
 class MAC(Module):
     def  __init__(self, phy, debug=False, loopback=False):
         self.phy = phy
index 5bb6973135e34cafe82f0b3a5e2b380b4f6024fe..0bc2908a178489d1e4a7be4f6c91e0b9604be4e8 100644 (file)
@@ -1,18 +1,22 @@
 from misoclib.com.liteeth.common import *
 from misoclib.com.liteeth.test.common import *
 
+
 def print_phy(s):
     print_with_prefix(s, "[PHY]")
 
+
 # PHY model
 class PHYSource(PacketStreamer):
     def __init__(self, dw):
         PacketStreamer.__init__(self, eth_phy_description(dw))
 
+
 class PHYSink(PacketLogger):
     def __init__(self, dw):
         PacketLogger.__init__(self, eth_phy_description(dw))
 
+
 class PHY(Module):
     def __init__(self, dw, debug=False):
         self.dw = dw
index f59ab116c3b26834958db740c9cdb2dffa25cfce..c69b6c8c06e55d0a8804150b23c59acd9655ed4a 100644 (file)
@@ -5,9 +5,11 @@ from misoclib.com.liteeth.test.common import *
 
 from misoclib.com.liteeth.test.model import ip
 
+
 def print_udp(s):
     print_with_prefix(s, "[UDP]")
 
+
 # UDP model
 class UDPPacket(Packet):
     def __init__(self, init=[]):
@@ -37,6 +39,7 @@ class UDPPacket(Packet):
             r += "{:02x}".format(d)
         return r
 
+
 class UDP(Module):
     def  __init__(self, ip, ip_address, debug=False, loopback=False):
         self.ip = ip
index 6803571af7ddc2e73904363681448265cd75a268..00e1c7891f8e8fbc1d447e8cbfca0259c93c3243 100644 (file)
@@ -12,6 +12,7 @@ from misoclib.com.liteeth.test.model import phy, mac, arp, ip, udp
 ip_address = 0x12345678
 mac_address = 0x12345678abcd
 
+
 class TB(Module):
     def __init__(self, dw=8):
         self.dw = dw