liteeth: more pep8 (when convenient), should be almost OK
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Mon, 13 Apr 2015 11:02:04 +0000 (13:02 +0200)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Mon, 13 Apr 2015 11:02:04 +0000 (13:02 +0200)
19 files changed:
misoclib/com/liteeth/common.py
misoclib/com/liteeth/core/etherbone/packet.py
misoclib/com/liteeth/core/etherbone/record.py
misoclib/com/liteeth/core/icmp/__init__.py
misoclib/com/liteeth/core/ip/__init__.py
misoclib/com/liteeth/core/udp/__init__.py
misoclib/com/liteeth/core/udp/crossbar.py
misoclib/com/liteeth/example_designs/test/make.py
misoclib/com/liteeth/generic/crossbar.py
misoclib/com/liteeth/mac/core/__init__.py
misoclib/com/liteeth/phy/gmii.py
misoclib/com/liteeth/phy/mii.py
misoclib/com/liteeth/test/etherbone_tb.py
misoclib/com/liteeth/test/model/arp.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/udp.py

index 61f276c876e3ba1b4a4a508c1e5aa96fe5ec377c..fb109a7f15a8af9e37db7e99a4ab9ae763e986f1 100644 (file)
@@ -266,7 +266,11 @@ def eth_etherbone_packet_description(dw):
 
 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")
+    param_layout = _remove_from_layout(param_layout,
+                                       "magic",
+                                       "portsize",
+                                       "addrsize",
+                                       "version")
     param_layout += eth_udp_user_description(dw).param_layout
     payload_layout = [
         ("data", dw),
index 5f5155f335f99057c20da5bda445770a31ce21fb..ecd7dc456cb3f4f4ab34f8434ae1b74e91be4878 100644 (file)
@@ -120,7 +120,9 @@ class LiteEthEtherbonePacketRX(Module):
         )
         fsm.act("DROP",
             depacketizer.source.ack.eq(1),
-            If(depacketizer.source.stb & depacketizer.source.eop & depacketizer.source.ack,
+            If(depacketizer.source.stb &
+               depacketizer.source.eop &
+               depacketizer.source.ack,
                 NextState("IDLE")
             )
         )
index e0cfc7feb4be33f819d398d7f232b2f325bb3572..eb75a02912735e262b9d441fa070f4e0131fd2d5 100644 (file)
@@ -29,7 +29,8 @@ class LiteEthEtherboneRecordReceiver(Module):
 
         # # #
 
-        fifo = SyncFIFO(eth_etherbone_record_description(32), buffer_depth, buffered=True)
+        fifo = SyncFIFO(eth_etherbone_record_description(32), buffer_depth,
+                        buffered=True)
         self.submodules += fifo
         self.comb += Record.connect(sink, fifo.sink)
 
@@ -179,7 +180,8 @@ class LiteEthEtherboneRecord(Module):
         self.comb += [
             Record.connect(sender.source, packetizer.sink),
             Record.connect(packetizer.source, source),
-            source.length.eq(sender.source.wcount*4 + 4 + etherbone_record_header_len),  # XXX improve this
+            # XXX improve this
+            source.length.eq(sender.source.wcount*4 + 4 + etherbone_record_header_len),
             source.ip_address.eq(last_ip_address)
         ]
         if endianness is "big":
index 379a2086ae18f763472535a2cb3b131f22059ad8..e3f1a3aa14f5369324928c3dc6539b7e84f41db8 100644 (file)
@@ -112,7 +112,9 @@ class LiteEthICMPRX(Module):
         )
         fsm.act("DROP",
             depacketizer.source.ack.eq(1),
-            If(depacketizer.source.stb & depacketizer.source.eop & depacketizer.source.ack,
+            If(depacketizer.source.stb &
+               depacketizer.source.eop &
+               depacketizer.source.ack,
                 NextState("IDLE")
             )
         )
index baa4d6565be12d49cdda7f73ba164f614db7da81..f625f0511c9453a21454ec7947ad8458f73038e4 100644 (file)
@@ -91,7 +91,9 @@ class LiteEthIPTX(Module):
         )
         fsm.act("DROP",
             packetizer.source.ack.eq(1),
-            If(packetizer.source.stb & packetizer.source.eop & packetizer.source.ack,
+            If(packetizer.source.stb &
+               packetizer.source.eop &
+               packetizer.source.ack,
                 NextState("IDLE")
             )
         )
@@ -167,7 +169,9 @@ class LiteEthIPRX(Module):
         )
         fsm.act("DROP",
             depacketizer.source.ack.eq(1),
-            If(depacketizer.source.stb & depacketizer.source.eop & depacketizer.source.ack,
+            If(depacketizer.source.stb &
+               depacketizer.source.eop &
+               depacketizer.source.ack,
                 NextState("IDLE")
             )
         )
index 60122ea64390020fa3bd97e132e982b2257a6068..7cadbddc45e74e95e0356a3e8007dcc2c6f73b29 100644 (file)
@@ -112,7 +112,9 @@ class LiteEthUDPRX(Module):
         )
         fsm.act("DROP",
             depacketizer.source.ack.eq(1),
-            If(depacketizer.source.stb & depacketizer.source.eop & depacketizer.source.ack,
+            If(depacketizer.source.stb &
+               depacketizer.source.eop &
+               depacketizer.source.ack,
                 NextState("IDLE")
             )
         )
index 1fb31d7a3accb5951f25d06884bcb9a424e114d4..e0024ed7830d479ef0594767734f4f3dc89917a1 100644 (file)
@@ -33,13 +33,15 @@ class LiteEthUDPCrossbar(LiteEthCrossbar):
         user_port = LiteEthUDPUserPort(dw)
         internal_port = LiteEthUDPUserPort(8)
         if dw != 8:
-            converter = Converter(eth_udp_user_description(user_port.dw), eth_udp_user_description(8))
+            converter = Converter(eth_udp_user_description(user_port.dw),
+                                  eth_udp_user_description(8))
             self.submodules += converter
             self.comb += [
                 Record.connect(user_port.sink, converter.sink),
                 Record.connect(converter.source, internal_port.sink)
             ]
-            converter = Converter(eth_udp_user_description(8), eth_udp_user_description(user_port.dw))
+            converter = Converter(eth_udp_user_description(8),
+                                  eth_udp_user_description(user_port.dw))
             self.submodules += converter
             self.comb += [
                 Record.connect(internal_port.source, converter.sink),
index f7a9ec671cc316f27af26bfdb3b6f0e7e2731bf0..aa3c5cceff0531bbf922f8a33df57844692864b8 100644 (file)
@@ -8,7 +8,7 @@ def _get_args():
     parser.add_argument("-b", "--bridge", default="uart", help="Bridge to use")
     parser.add_argument("--port", default="2", help="UART port")
     parser.add_argument("--baudrate", default=115200, help="UART baudrate")
-    parser.add_argument("--ip_address", default="192.168.0.42", help="Etherbone  IP address")
+    parser.add_argument("--ip_address", default="192.168.0.42", help="Etherbone IP address")
     parser.add_argument("--udp_port", default=20000, help="Etherbone UDP port")
     parser.add_argument("--busword", default=32, help="CSR busword")
 
index 9938df9fdcf6b0afee4963eb259cddaa29ddb283..3965db4f114a976a7cdbdf01845fa59edee5fc57 100644 (file)
@@ -23,7 +23,9 @@ class LiteEthCrossbar(Module):
 
         # RX dispatch
         sources = [port.source for port in self.users.values()]
-        self.submodules.dispatcher = Dispatcher(self.master.sink, sources, one_hot=True)
+        self.submodules.dispatcher = Dispatcher(self.master.sink,
+                                                sources,
+                                                one_hot=True)
         cases = {}
         cases["default"] = self.dispatcher.sel.eq(0)
         for i, (k, v) in enumerate(self.users.items()):
index 127d645d8ce5acc7eedac5d304d7c44475ff7d95..7322c42ff92e9d689a523a06218bcb54acff97cb 100644 (file)
@@ -68,8 +68,12 @@ class LiteEthMACCore(Module, AutoCSR):
         # Converters
         if dw != phy.dw:
             reverse = endianness == "big"
-            tx_converter = Converter(eth_phy_description(dw), eth_phy_description(phy.dw), reverse=reverse)
-            rx_converter = Converter(eth_phy_description(phy.dw), eth_phy_description(dw), reverse=reverse)
+            tx_converter = Converter(eth_phy_description(dw),
+                                     eth_phy_description(phy.dw),
+                                     reverse=reverse)
+            rx_converter = Converter(eth_phy_description(phy.dw),
+                                     eth_phy_description(dw),
+                                     reverse=reverse)
             self.submodules += RenameClockDomains(tx_converter, "eth_tx")
             self.submodules += RenameClockDomains(rx_converter, "eth_rx")
 
index c181a3808f77474d0412044a531e74ab6859ad88..bccaf1db7dddd1fbfed8f3fa93eafa2574d7d92a 100644 (file)
@@ -63,10 +63,10 @@ class LiteEthPHYGMIICRG(Module, AutoCSR):
         self.specials += DDROutput(1, mii_mode, clock_pads.gtx, ClockSignal("eth_tx"))
         # XXX Xilinx specific, replace BUFGMUX with a generic clock buffer?
         self.specials += Instance("BUFGMUX",
-                            i_I0=self.cd_eth_rx.clk,
-                            i_I1=clock_pads.tx,
-                            i_S=mii_mode,
-                            o_O=self.cd_eth_tx.clk)
+                                  i_I0=self.cd_eth_rx.clk,
+                                  i_I1=clock_pads.tx,
+                                  i_S=mii_mode,
+                                  o_O=self.cd_eth_tx.clk)
 
         if with_hw_init_reset:
             reset = Signal()
@@ -89,7 +89,11 @@ class LiteEthPHYGMIICRG(Module, AutoCSR):
 class LiteEthPHYGMII(Module, AutoCSR):
     def __init__(self, clock_pads, pads, with_hw_init_reset=True):
         self.dw = 8
-        self.submodules.crg = LiteEthPHYGMIICRG(clock_pads, pads, with_hw_init_reset)
-        self.submodules.tx = RenameClockDomains(LiteEthPHYGMIITX(pads), "eth_tx")
-        self.submodules.rx = RenameClockDomains(LiteEthPHYGMIIRX(pads), "eth_rx")
+        self.submodules.crg = LiteEthPHYGMIICRG(clock_pads,
+                                                pads,
+                                                with_hw_init_reset)
+        self.submodules.tx = RenameClockDomains(LiteEthPHYGMIITX(pads),
+                                                "eth_tx")
+        self.submodules.rx = RenameClockDomains(LiteEthPHYGMIIRX(pads),
+                                                "eth_rx")
         self.sink, self.source = self.tx.sink, self.rx.source
index 52ac0d8b5c592ad88ba3c0ef82e2992e50f86e73..5f121cdfda176cd1a6ea5d5b06c97a5f6f2f973d 100644 (file)
@@ -15,7 +15,8 @@ class LiteEthPHYMIITX(Module):
 
         if hasattr(pads, "tx_er"):
             self.sync += pads.tx_er.eq(0)
-        converter = Converter(converter_description(8), converter_description(4))
+        converter = Converter(converter_description(8),
+                              converter_description(4))
         self.submodules += converter
         self.comb += [
             converter.sink.stb.eq(sink.stb),
@@ -42,7 +43,8 @@ class LiteEthPHYMIIRX(Module):
         sop = FlipFlop(reset=1)
         self.submodules += sop
 
-        converter = Converter(converter_description(4), converter_description(8))
+        converter = Converter(converter_description(4),
+                              converter_description(8))
         converter = InsertReset(converter)
         self.submodules += converter
 
index cfb07dfb72b139a69f06cdd92dac19ac1ba233d3..c070a32be7add507acfe1f1281c2a4135351d7fa 100644 (file)
@@ -65,7 +65,8 @@ class TB(Module):
             # test writes
             if test_writes:
                 writes_datas = [j for j in range(16)]
-                writes = etherbone.EtherboneWrites(base_addr=0x1000, datas=writes_datas)
+                writes = etherbone.EtherboneWrites(base_addr=0x1000,
+                                                   datas=writes_datas)
                 record = etherbone.EtherboneRecord()
                 record.writes = writes
                 record.reads = None
@@ -88,7 +89,8 @@ class TB(Module):
             # test reads
             if test_reads:
                 reads_addrs = [0x1000 + 4*j for j in range(16)]
-                reads = etherbone.EtherboneReads(base_ret_addr=0x1000, addrs=reads_addrs)
+                reads = etherbone.EtherboneReads(base_ret_addr=0x1000,
+                                                 addrs=reads_addrs)
                 record = etherbone.EtherboneRecord()
                 record.writes = None
                 record.reads = reads
index 88f39b9ebee6e03b93061af3bcfb7dae58128164..31aab2eca8048c1d9e4d54e53d4128022b94ddec 100644 (file)
@@ -27,7 +27,9 @@ class ARPPacket(Packet):
     def encode(self):
         header = 0
         for k, v in sorted(arp_header.items()):
-            value = merge_bytes(split_bytes(getattr(self, k), math.ceil(v.width/8)), "little")
+            value = merge_bytes(split_bytes(getattr(self, k),
+                                            math.ceil(v.width/8)),
+                                            "little")
             header += (value << v.offset+(v.byte*8))
         for d in split_bytes(header, arp_header_len):
             self.insert(0, d)
index 1ad51b2c5d4a74a6d0e07a0577c282c3699f3ae2..aa4af60f938fd53f6d6482d6126f5713ada54fb3 100644 (file)
@@ -194,7 +194,9 @@ class EtherboneRecord(Packet):
             self.set_reads(self.reads)
         header = 0
         for k, v in sorted(etherbone_record_header.items()):
-            value = merge_bytes(split_bytes(getattr(self, k), math.ceil(v.width/8)), "little")
+            value = merge_bytes(split_bytes(getattr(self, k),
+                                            math.ceil(v.width/8)),
+                                            "little")
             header += (value << v.offset+(v.byte*8))
         for d in split_bytes(header, etherbone_record_header_len):
             self.insert(0, d)
index e293101f7219530f6aab0cc12460a609f4aa16b9..36975f82f825f30c75241ab087576355f1f18fa2 100644 (file)
@@ -25,7 +25,9 @@ class ICMPPacket(Packet):
     def encode(self):
         header = 0
         for k, v in sorted(icmp_header.items()):
-            value = merge_bytes(split_bytes(getattr(self, k), math.ceil(v.width/8)), "little")
+            value = merge_bytes(split_bytes(getattr(self, k),
+                                            math.ceil(v.width/8)),
+                                            "little")
             header += (value << v.offset+(v.byte*8))
         for d in split_bytes(header, icmp_header_len):
             self.insert(0, d)
index 802815a1bdb79ec3f9ce6a66a5c94366a09e48ff..c2a1f67bd6e03cb226549c20f2f88938d3c90545 100644 (file)
@@ -44,7 +44,9 @@ class IPPacket(Packet):
     def encode(self):
         header = 0
         for k, v in sorted(ipv4_header.items()):
-            value = merge_bytes(split_bytes(getattr(self, k), math.ceil(v.width/8)), "little")
+            value = merge_bytes(split_bytes(getattr(self, k),
+                                            math.ceil(v.width/8)),
+                                            "little")
             header += (value << v.offset+(v.byte*8))
         for d in split_bytes(header, ipv4_header_len):
             self.insert(0, d)
index f61502d4dc3f3a634cb96f2c816f66b3f4a34e53..11177733212cc4983688723c81807ebea92afd5d 100644 (file)
@@ -60,7 +60,9 @@ class MACPacket(Packet):
     def encode_header(self):
         header = 0
         for k, v in sorted(mac_header.items()):
-            value = merge_bytes(split_bytes(getattr(self, k), math.ceil(v.width/8)), "little")
+            value = merge_bytes(split_bytes(getattr(self, k),
+                                            math.ceil(v.width/8)),
+                                            "little")
             header += (value << v.offset+(v.byte*8))
         for d in split_bytes(header, mac_header_len):
             self.insert(0, d)
index 22fecb90815f2bed4d67ef5dc954d1cdd3b91897..f8242ec529a55e6b488f334e553eb2643f13ddb9 100644 (file)
@@ -25,7 +25,9 @@ class UDPPacket(Packet):
     def encode(self):
         header = 0
         for k, v in sorted(udp_header.items()):
-            value = merge_bytes(split_bytes(getattr(self, k), math.ceil(v.width/8)), "little")
+            value = merge_bytes(split_bytes(getattr(self, k),
+                                            math.ceil(v.width/8)),
+                                            "little")
             header += (value << v.offset+(v.byte*8))
         for d in split_bytes(header, udp_header_len):
             self.insert(0, d)