litesata: pep8 (E302)
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Mon, 13 Apr 2015 13:12:39 +0000 (15:12 +0200)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Mon, 13 Apr 2015 13:12:39 +0000 (15:12 +0200)
36 files changed:
misoclib/mem/litesata/__init__.py
misoclib/mem/litesata/common.py
misoclib/mem/litesata/core/__init__.py
misoclib/mem/litesata/core/command/__init__.py
misoclib/mem/litesata/core/link/__init__.py
misoclib/mem/litesata/core/link/cont.py
misoclib/mem/litesata/core/link/crc.py
misoclib/mem/litesata/core/link/scrambler.py
misoclib/mem/litesata/core/transport/__init__.py
misoclib/mem/litesata/example_designs/make.py
misoclib/mem/litesata/example_designs/platforms/kc705.py
misoclib/mem/litesata/example_designs/platforms/verilog_backend.py
misoclib/mem/litesata/example_designs/targets/bist.py
misoclib/mem/litesata/example_designs/targets/core.py
misoclib/mem/litesata/example_designs/test/bist.py
misoclib/mem/litesata/example_designs/test/make.py
misoclib/mem/litesata/example_designs/test/test_la.py
misoclib/mem/litesata/example_designs/test/tools.py
misoclib/mem/litesata/frontend/arbiter.py
misoclib/mem/litesata/frontend/bist.py
misoclib/mem/litesata/frontend/common.py
misoclib/mem/litesata/frontend/crossbar.py
misoclib/mem/litesata/phy/__init__.py
misoclib/mem/litesata/phy/ctrl.py
misoclib/mem/litesata/phy/datapath.py
misoclib/mem/litesata/phy/k7/crg.py
misoclib/mem/litesata/phy/k7/trx.py
misoclib/mem/litesata/test/bist_tb.py
misoclib/mem/litesata/test/command_tb.py
misoclib/mem/litesata/test/common.py
misoclib/mem/litesata/test/cont_tb.py
misoclib/mem/litesata/test/crc_tb.py
misoclib/mem/litesata/test/hdd.py
misoclib/mem/litesata/test/link_tb.py
misoclib/mem/litesata/test/phy_datapath_tb.py
misoclib/mem/litesata/test/scrambler_tb.py

index 2a9d88fbf4c118b6e5d9c42f76e59edfecdbb52a..3839db0fb85432b1fcbd59fb38cfa2cd308b5af2 100644 (file)
@@ -5,6 +5,7 @@ from misoclib.mem.litesata.frontend import *
 
 from migen.bank.description import *
 
+
 class LiteSATA(Module, AutoCSR):
     def __init__(self, phy, buffer_depth=2*fis_max_dwords,
             with_bist=False, with_bist_csr=False):
index 82c752d964984dbd8474281a8dd19143e6cbe629..4d2fa017011f77cbb3e70bf0283ea47a65a76528 100644 (file)
@@ -43,18 +43,21 @@ primitives = {
     "HOLDA"    :     0X9595AA7C
 }
 
+
 def is_primitive(dword):
     for k, v in primitives.items():
         if dword == v:
             return True
     return False
 
+
 def decode_primitive(dword):
     for k, v in primitives.items():
         if dword == v:
             return k
     return ""
 
+
 def phy_description(dw):
     layout = [
         ("data", dw),
@@ -62,6 +65,7 @@ def phy_description(dw):
     ]
     return EndpointDescription(layout, packetized=False)
 
+
 def link_description(dw):
     layout = [
         ("d", dw),
@@ -80,6 +84,7 @@ fis_types = {
     "DATA":             0x46
 }
 
+
 class FISField():
     def __init__(self, dword, offset, width):
         self.dword = dword
@@ -150,6 +155,7 @@ fis_data_layout = {
     "type": FISField(0,  0, 8)
 }
 
+
 def transport_tx_description(dw):
     layout = [
         ("type", 8),
@@ -166,6 +172,7 @@ def transport_tx_description(dw):
     ]
     return EndpointDescription(layout, packetized=True)
 
+
 def transport_rx_description(dw):
     layout = [
         ("type", 8),
@@ -204,6 +211,7 @@ reg_d2h_status = {
     "err"    :    0
 }
 
+
 def command_tx_description(dw):
     layout = [
         ("write", 1),
@@ -215,6 +223,7 @@ def command_tx_description(dw):
     ]
     return EndpointDescription(layout, packetized=True)
 
+
 def command_rx_description(dw):
     layout = [
         ("write", 1),
@@ -226,6 +235,7 @@ def command_rx_description(dw):
     ]
     return EndpointDescription(layout, packetized=True)
 
+
 def command_rx_cmd_description(dw):
     layout = [
         ("write", 1),
@@ -236,6 +246,7 @@ def command_rx_cmd_description(dw):
     ]
     return EndpointDescription(layout, packetized=False)
 
+
 def command_rx_data_description(dw):
     layout = [
         ("data", dw)
@@ -245,12 +256,15 @@ def command_rx_data_description(dw):
 # HDD
 logical_sector_size = 512 # constant since all HDDs use this
 
+
 def dwords2sectors(n):
     return math.ceil(n*4/logical_sector_size)
 
+
 def sectors2dwords(n):
     return n*logical_sector_size//4
 
+
 # Generic modules
 class BufferizeEndpoints(ModuleTransformer):
     def __init__(self, *names):
@@ -281,6 +295,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()
@@ -300,6 +315,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 de31ee3c5a8640fe602d50bc7b7ee0695367ef1d..e6834910337bfaaf3195dea8cbebf2c35478eb72 100644 (file)
@@ -3,6 +3,7 @@ from misoclib.mem.litesata.core.link import LiteSATALink
 from misoclib.mem.litesata.core.transport import LiteSATATransport
 from misoclib.mem.litesata.core.command import LiteSATACommand
 
+
 class LiteSATACore(Module):
     def __init__(self, phy, buffer_depth):
         self.submodules.link = LiteSATALink(phy, buffer_depth)
index 180d0391c62aa99b8bde876ddef297b0452e32df..81ecc31e6f29717bf97e4704163a206d6828d4bf 100644 (file)
@@ -12,6 +12,7 @@ rx_to_tx = [
     ("d2h_error", 1)
 ]
 
+
 class LiteSATACommandTX(Module):
     def __init__(self, transport):
         self.sink = sink = Sink(command_tx_description(32))
@@ -116,6 +117,7 @@ class LiteSATACommandTX(Module):
             )
         ]
 
+
 class LiteSATACommandRX(Module):
     def __init__(self, transport):
         self.source = source = Source(command_rx_description(32))
@@ -268,6 +270,7 @@ class LiteSATACommandRX(Module):
             to_tx.d2h_error.eq(d2h_error)
         ]
 
+
 class LiteSATACommand(Module):
     def __init__(self, transport):
         self.submodules.tx = LiteSATACommandTX(transport)
index b240f2ac13c85303a30f9ed9877a314018de9dd7..94fea63d945950df957138c829cf7bfdc8d66135 100644 (file)
@@ -9,6 +9,7 @@ from_rx = [
     ("det", 32)
 ]
 
+
 class LiteSATALinkTX(Module):
     def __init__(self, phy):
         self.sink = Sink(link_description(32))
@@ -109,6 +110,7 @@ class LiteSATALinkTX(Module):
             )
         )
 
+
 class LiteSATALinkRX(Module):
     def __init__(self, phy):
         self.source = Source(link_description(32))
@@ -239,6 +241,7 @@ class LiteSATALinkRX(Module):
             self.to_tx.det.eq(det)
         ]
 
+
 class LiteSATALink(Module):
     def __init__(self, phy, buffer_depth):
         self.submodules.tx_buffer = PacketBuffer(link_description(32), buffer_depth)
index 9158cd34ba986cd37ef192c14a8d8746c39292b3..ddd3ed89a988f4a948b9437c98cd4a6659df4f22 100644 (file)
@@ -1,6 +1,7 @@
 from misoclib.mem.litesata.common import *
 from misoclib.mem.litesata.core.link.scrambler import Scrambler
 
+
 class LiteSATACONTInserter(Module):
     def __init__(self, description):
         self.sink = sink = Sink(description)
@@ -72,6 +73,7 @@ class LiteSATACONTInserter(Module):
             )
         ]
 
+
 class LiteSATACONTRemover(Module):
     def __init__(self, description):
         self.sink = sink = Sink(description)
index 27e73faca45214b89d7a757609c6ae13b63ea1c5..b72f739f7b1372aaef755dad28556e1a94097322 100644 (file)
@@ -1,6 +1,7 @@
 from collections import OrderedDict
 from misoclib.mem.litesata.common import *
 
+
 class CRCEngine(Module):
     """Cyclic Redundancy Check Engine
 
@@ -68,6 +69,7 @@ class CRCEngine(Module):
                     xors += [new[n]]
             self.comb += self.next[i].eq(optree("^", xors))
 
+
 @DecorateModule(InsertReset)
 @DecorateModule(InsertCE)
 class LiteSATACRC(Module):
@@ -180,6 +182,7 @@ class CRCInserter(Module):
             )
         self.comb += self.busy.eq(~fsm.ongoing("IDLE"))
 
+
 class CRCChecker(Module):
     """CRC Checker
 
@@ -262,10 +265,12 @@ class CRCChecker(Module):
         )
         self.comb += self.busy.eq(~fsm.ongoing("IDLE"))
 
+
 class LiteSATACRCInserter(CRCInserter):
     def __init__(self, description):
         CRCInserter.__init__(self, LiteSATACRC, description)
 
+
 class LiteSATACRCChecker(CRCChecker):
     def __init__(self, description):
         CRCChecker.__init__(self, LiteSATACRC, description)
index 31890763ec5298db86e43a1bd8f49e2c6483662c..10be3abcbc011a3ad3e15d9d0703e50de39e42b4 100644 (file)
@@ -1,5 +1,6 @@
 from misoclib.mem.litesata.common import *
 
+
 @DecorateModule(InsertCE)
 class Scrambler(Module):
     """SATA Scrambler
@@ -64,6 +65,7 @@ class Scrambler(Module):
 
         self.comb += self.value.eq(next_value)
 
+
 @DecorateModule(InsertReset)
 class LiteSATAScrambler(Module):
     def __init__(self, description):
index 986a627beb6cb4cbc3b8e7d80e3d0d631dbb44e1..7d267de3d26d2cea425fd9c789e07739623e715e 100644 (file)
@@ -1,5 +1,6 @@
 from misoclib.mem.litesata.common import *
 
+
 def _get_item(obj, name, width):
     if "_lsb" in name:
         item = getattr(obj, name.replace("_lsb", ""))[:width]
@@ -9,6 +10,7 @@ def _get_item(obj, name, width):
         item = getattr(obj, name)
     return item
 
+
 def _encode_cmd(obj, description, signal):
     r = []
     for k, v in sorted(description.items()):
@@ -18,9 +20,11 @@ def _encode_cmd(obj, description, signal):
         r.append(signal[start:end].eq(item))
     return r
 
+
 def test_type(name, signal):
     return signal == fis_types[name]
 
+
 class LiteSATATransportTX(Module):
     def __init__(self, link):
         self.sink = sink = Sink(transport_tx_description(32))
@@ -114,6 +118,7 @@ class LiteSATATransportTX(Module):
             )
         ]
 
+
 def _decode_cmd(signal, description, obj):
     r = []
     for k, v in sorted(description.items()):
@@ -123,6 +128,7 @@ def _decode_cmd(signal, description, obj):
         r.append(item.eq(signal[start:end]))
     return r
 
+
 class LiteSATATransportRX(Module):
     def __init__(self, link):
         self.source = source = Source(transport_rx_description(32))
@@ -250,6 +256,7 @@ class LiteSATATransportRX(Module):
             )
         self.comb += cmd_done.eq((counter.value == cmd_len) & link.source.ack)
 
+
 class LiteSATATransport(Module):
     def __init__(self, link):
         self.submodules.tx = LiteSATATransportTX(link)
index 26ba660ed2e421b648c6a8a715b92bab86a9180e..8b5e6850acbdeae3122995269fb5f26bb9690541 100755 (executable)
@@ -13,9 +13,11 @@ from mibuild.xilinx.common import *
 from misoclib.soc import cpuif
 from misoclib.mem.litesata.common import *
 
+
 def _import(default, name):
     return importlib.import_module(default + "." + name)
 
+
 def _get_args():
     parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter,
         description="""\
index cf37d0b1e34d9bdaa1d94093a2a2c8bf8e8d0f92..0b22e643f54c62c5fdcc4082c83ec6fee48404fd 100644 (file)
@@ -12,6 +12,7 @@ _sata_io = [
     )
 ]
 
+
 class Platform(kc705.Platform):
     def __init__(self, *args, **kwargs):
         kc705.Platform.__init__(self, *args, **kwargs)
index 30afdd7b6a81101cac564d9964fe1ffda7b662d7..3780b2da5dd614404f68f3ad0254f6bb520043bd 100644 (file)
@@ -15,6 +15,7 @@ _io = [
     ),
 ]
 
+
 class Platform(XilinxPlatform):
     def __init__(self, device="xc7k325t", programmer=""):
         XilinxPlatform.__init__(self, device, _io)
index e25e34bf4dcfc12a5ba204691df398816a076639..806019b618165bcd0451861c7a3426f1a6869def 100644 (file)
@@ -14,6 +14,7 @@ from misoclib.mem.litesata.common import *
 from misoclib.mem.litesata.phy import LiteSATAPHY
 from misoclib.mem.litesata import LiteSATA
 
+
 class _CRG(Module):
     def __init__(self, platform):
         self.clock_domains.cd_sys = ClockDomain()
@@ -50,6 +51,7 @@ class _CRG(Module):
             AsyncResetSynchronizer(self.cd_sys, ~pll_locked | platform.request("cpu_reset") | self.reset),
         ]
 
+
 class BISTLeds(Module):
     def __init__(self, platform, sata_phy):
         # 1Hz blinking leds (sata_rx and sata_tx clocks)
@@ -81,6 +83,7 @@ class BISTLeds(Module):
         self.comb += platform.request("user_led", 2).eq(sata_phy.crg.ready)
         self.comb += platform.request("user_led", 3).eq(sata_phy.ctrl.ready)
 
+
 class BISTSoC(SoC, AutoCSR):
     default_platform = "kc705"
     csr_map = {
@@ -108,6 +111,7 @@ class BISTSoC(SoC, AutoCSR):
         # Status Leds
         self.submodules.leds = BISTLeds(platform, self.sata_phy)
 
+
 class BISTSoCDevel(BISTSoC, AutoCSR):
     csr_map = {
         "la":            20
index 1df688d8723adfb1f1ed041017161208f28fdfc8..67d7426ac1d18b6b21b75891a5a1c08a05e103b5 100644 (file)
@@ -6,6 +6,7 @@ from misoclib.mem.litesata.common import *
 from misoclib.mem.litesata.phy import LiteSATAPHY
 from misoclib.mem.litesata import LiteSATA
 
+
 class LiteSATACore(Module):
     default_platform = "verilog_backend"
     def __init__(self, platform, clk_freq=166*1000000, nports=4):
@@ -61,5 +62,4 @@ class LiteSATACore(Module):
                     ios = ios.union({obj})
         return ios
 
-
 default_subtarget = LiteSATACore
index 8385e2d064299beb107e562b8faa23bb7c7582de..57edf15ae9abe234a62b59a4cb96f7b887b8e83f 100644 (file)
@@ -10,6 +10,7 @@ GB = 1024*MB
 
 logical_sector_size = 512
 
+
 class Timer:
     def __init__(self):
         self.value = None
@@ -21,6 +22,7 @@ class Timer:
         self._stop = time.time()
         self.value = max(self._stop - self._start, 1/1000000)
 
+
 class LiteSATABISTUnitDriver:
     def __init__(self, regs, name):
         self.regs = regs
@@ -55,14 +57,17 @@ class LiteSATABISTUnitDriver:
             errors = -1
         return (aborted, errors, speed)
 
+
 class LiteSATABISTGeneratorDriver(LiteSATABISTUnitDriver):
     def __init__(self, regs, name):
         LiteSATABISTUnitDriver.__init__(self, regs, name + "_generator")
 
+
 class LiteSATABISTCheckerDriver(LiteSATABISTUnitDriver):
     def __init__(self, regs, name):
         LiteSATABISTUnitDriver.__init__(self, regs, name + "_checker")
 
+
 class LiteSATABISTIdentifyDriver:
     def __init__(self, regs, name):
         self.regs = regs
@@ -123,6 +128,7 @@ class LiteSATABISTIdentifyDriver:
             info += k + ": " + str(v) + "\n"
         print(info, end="")
 
+
 def _get_args():
     parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter,
         description="""\
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 129d1fb862f005f223b4c29310c326d2d5d877f5..a16085a20192676fd9df54286a5e0c214ddd1944 100644 (file)
@@ -3,6 +3,7 @@ from tools import *
 from test_bist import *
 from litescope.host.driver.la import LiteScopeLADriver
 
+
 def main(wb):
     la = LiteScopeLADriver(wb.regs, "la")
     identify = LiteSATABISTIdentifyDriver(wb.regs, "sata_bist")
index 1dc666f531f012271fef2f1921fb80faaf4d6dde..ebaf4b01c4e3efdf6b3197b8573738cd8d0eb95e 100644 (file)
@@ -17,12 +17,14 @@ primitives = {
     "HOLDA"    :     0X9595AA7C
 }
 
+
 def decode_primitive(dword):
     for k, v in primitives.items():
         if dword == v:
             return k
     return ""
 
+
 def link_trace(mila, tx_data_name, rx_data_name):
     r = ""
     dump = Dump()
index 80806db99355b4e3080325d94253748b520ab64e..badf2386894ddb9b49cf6ccea69e32593c628372 100644 (file)
@@ -3,6 +3,7 @@ from misoclib.mem.litesata.frontend.common import *
 
 from migen.genlib.roundrobin import *
 
+
 class LiteSATAArbiter(Module):
     def __init__(self, users, master):
         self.rr = RoundRobin(len(users))
index a6315754f820c8bb3f99c731df0563cd579cac48..fe675fbff7fded22d2817d7dfe6b3992db2c91ac 100644 (file)
@@ -3,6 +3,7 @@ from misoclib.mem.litesata.core.link.scrambler import Scrambler
 
 from migen.bank.description import *
 
+
 class LiteSATABISTGenerator(Module):
     def __init__(self, user_port):
         self.start = Signal()
@@ -66,6 +67,7 @@ class LiteSATABISTGenerator(Module):
         )
         self.sync += If(sink.stb & sink.ack, self.aborted.eq(sink.failed))
 
+
 class LiteSATABISTChecker(Module):
     def __init__(self, user_port):
         self.start = Signal()
@@ -147,6 +149,7 @@ class LiteSATABISTChecker(Module):
         )
         self.sync += If(sink.stb & sink.ack, self.aborted.eq(sink.failed))
 
+
 class LiteSATABISTUnitCSR(Module, AutoCSR):
     def __init__(self, bist_unit):
         self._start = CSR()
@@ -213,6 +216,7 @@ class LiteSATABISTUnitCSR(Module, AutoCSR):
             self._cycles.status.eq(cycles_counter.value)
         ]
 
+
 class LiteSATABISTIdentify(Module):
     def __init__(self, user_port):
         self.start = Signal()
@@ -261,6 +265,7 @@ class LiteSATABISTIdentify(Module):
             )
         )
 
+
 class LiteSATABISTIdentifyCSR(Module, AutoCSR):
     def __init__(self, bist_identify):
         self._start = CSR()
@@ -281,6 +286,7 @@ class LiteSATABISTIdentifyCSR(Module, AutoCSR):
             bist_identify.source.ack.eq(self._source_ack.r & self._source_ack.re)
         ]
 
+
 class LiteSATABIST(Module, AutoCSR):
     def __init__(self, crossbar, with_csr=False):
         generator = LiteSATABISTGenerator(crossbar.get_port())
index 8d85e40111489c9eaa03c8e0fe2757cf310e32c8..a7fd9e0a9c0bdf48ee767c57ac84c4d1cac7b798 100644 (file)
@@ -1,5 +1,6 @@
 from misoclib.mem.litesata.common import *
 
+
 class LiteSATAMasterPort:
     def __init__(self, dw):
         self.source = Source(command_tx_description(dw))
@@ -11,6 +12,7 @@ class LiteSATAMasterPort:
             Record.connect(slave.source, self.sink)
         ]
 
+
 class LiteSATASlavePort:
     def __init__(self, dw):
         self.sink = Sink(command_tx_description(dw))
@@ -22,6 +24,7 @@ class LiteSATASlavePort:
             Record.connect(master.sink, self.source)
         ]
 
+
 class LiteSATAUserPort(LiteSATASlavePort):
     def __init__(self, dw):
         LiteSATASlavePort.__init__(self, dw)
index 1d2eba0f72f1095d7c0a1f011cc6cbe36a45f0f6..5f0c3f3b242d3195388fe2ff96cda8d5d0cb6dd8 100644 (file)
@@ -2,6 +2,7 @@ from misoclib.mem.litesata.common import *
 from misoclib.mem.litesata.frontend.common import *
 from misoclib.mem.litesata.frontend.arbiter import LiteSATAArbiter
 
+
 class LiteSATACrossbar(Module):
     def __init__(self, core):
         self.users = []
index 1473859ff2ce69b361c2e0cc5abce31da9f2cc88..edaea4038f178eb5aae29bd696bf086b32b26d22 100644 (file)
@@ -2,6 +2,7 @@ from misoclib.mem.litesata.common import *
 from misoclib.mem.litesata.phy.ctrl import *
 from misoclib.mem.litesata.phy.datapath import *
 
+
 class LiteSATAPHY(Module):
     def __init__(self, device, pads, revision, clk_freq):
         self.pads = pads
index 32c71a45c6df3c3fd46062a0e3b0e4d8f145d11b..63ebbf7cabd119d0216fe1fa947c1a286e257b09 100644 (file)
@@ -1,9 +1,11 @@
 from misoclib.mem.litesata.common import *
 
+
 def us(t, clk_freq):
     clk_period_us = 1000000/clk_freq
     return math.ceil(t/clk_period_us)
 
+
 class LiteSATAPHYCtrl(Module):
     def __init__(self, trx, crg, clk_freq):
         self.ready = Signal()
index b6bac8491e8a9351b82a70659cc98a5942b7098f..0a3a928d49654a65ae81f4cf276456c8a4c494d2 100644 (file)
@@ -1,5 +1,6 @@
 from misoclib.mem.litesata.common import *
 
+
 class LiteSATAPHYDatapathRX(Module):
     def __init__(self):
         self.sink = sink = Sink(phy_description(16))
@@ -50,6 +51,7 @@ class LiteSATAPHYDatapathRX(Module):
             Record.connect(fifo.source, source)
         ]
 
+
 class LiteSATAPHYDatapathTX(Module):
     def __init__(self):
         self.sink = sink = Sink(phy_description(32))
@@ -77,6 +79,7 @@ class LiteSATAPHYDatapathTX(Module):
             Record.connect(converter.source, source)
         ]
 
+
 class LiteSATAPHYAlignInserter(Module):
     def __init__(self, ctrl):
         self.sink = sink = Sink(phy_description(32))
@@ -110,6 +113,7 @@ class LiteSATAPHYAlignInserter(Module):
             )
         ]
 
+
 class LiteSATAPHYAlignRemover(Module):
     def __init__(self):
         self.sink = sink = Sink(phy_description(32))
@@ -127,6 +131,7 @@ class LiteSATAPHYAlignRemover(Module):
                 Record.connect(sink, source)
             )
 
+
 class LiteSATAPHYDatapath(Module):
     def __init__(self, trx, ctrl):
         self.sink = sink = Sink(phy_description(32))
index ee08d22decae20b3518dd8b26fdb094166be53eb..380f19ee68673c39db2776c2603321b246238bd2 100644 (file)
@@ -1,5 +1,6 @@
 from misoclib.mem.litesata.common import *
 
+
 class K7LiteSATAPHYCRG(Module):
     def __init__(self, pads, gtx, revision, clk_freq):
         self.reset = Signal()
index f1624c50cf70f87f2cc82e38ad7d7d772a0f97cd..ad81326fc940d289f8829327cce6c9b0710a413f 100644 (file)
@@ -1,8 +1,10 @@
 from misoclib.mem.litesata.common import *
 
+
 def ones(width):
     return 2**width-1
 
+
 class _PulseSynchronizer(PulseSynchronizer):
     def __init__(self, i, idomain, o, odomain):
         PulseSynchronizer.__init__(self, idomain, odomain)
@@ -11,12 +13,14 @@ class _PulseSynchronizer(PulseSynchronizer):
             o.eq(self.o)
         ]
 
+
 class _RisingEdge(Module):
     def __init__(self, i, o):
         i_d = Signal()
         self.sync += i_d.eq(i)
         self.comb += o.eq(i & ~i_d)
 
+
 class K7LiteSATAPHYTRX(Module):
     def __init__(self, pads, revision):
     # Common signals
index 6b494aee748d4e43daa5a565fda0333b6634077a..460427132bfd3286b21d6e5d9c8e9cf2b538d95b 100644 (file)
@@ -5,6 +5,7 @@ from misoclib.mem.litesata.frontend.bist import LiteSATABISTGenerator, LiteSATAB
 from misoclib.mem.litesata.test.hdd import *
 from misoclib.mem.litesata.test.common import *
 
+
 class TB(Module):
     def __init__(self):
         self.submodules.hdd = HDD(
index cd340cb774050612583ccef6341dcddf2fd5b9a3..bc474493b2d53c36e06baa088fd58e0e85fd4f5b 100644 (file)
@@ -4,6 +4,7 @@ from misoclib.mem.litesata.core import LiteSATACore
 from misoclib.mem.litesata.test.hdd import *
 from misoclib.mem.litesata.test.common import *
 
+
 class CommandTXPacket(list):
     def __init__(self, write=0, read=0, sector=0, count=0, data=[]):
         self.ongoing = False
@@ -15,6 +16,7 @@ class CommandTXPacket(list):
         for d in data:
             self.append(d)
 
+
 class CommandStreamer(PacketStreamer):
     def __init__(self):
         PacketStreamer.__init__(self, command_tx_description(32), CommandTXPacket)
@@ -26,6 +28,7 @@ class CommandStreamer(PacketStreamer):
         selfp.source.sector = self.packet.sector
         selfp.source.count = self.packet.count
 
+
 class CommandRXPacket(list):
     def __init__(self):
         self.ongoing = False
@@ -34,6 +37,7 @@ class CommandRXPacket(list):
         self.read = 0
         self.failed = 0
 
+
 class CommandLogger(PacketLogger):
     def __init__(self):
         PacketLogger.__init__(self, command_rx_description(32), CommandRXPacket)
@@ -51,6 +55,7 @@ class CommandLogger(PacketLogger):
         if selfp.sink.stb == 1 and selfp.sink.eop == 1:
             self.packet.done = True
 
+
 class TB(Module):
     def __init__(self):
         self.submodules.hdd = HDD(
index 2a0a0c0b27e2b74eb461cbbe5bf22d1e1d8d36c0..53aa6b2f0881f5dc490f20e28c4740d76a667d6f 100644 (file)
@@ -4,12 +4,14 @@ from migen.sim.generic import run_simulation
 
 from misoclib.mem.litesata.common import *
 
+
 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)
@@ -31,9 +33,11 @@ def check(p1, p2):
                 errors += 1
         return shift, length, errors
 
+
 def randn(max_n):
     return random.randint(0, max_n-1)
 
+
 class PacketStreamer(Module):
     def __init__(self, description, packet_class):
         self.source = Source(description)
@@ -80,6 +84,7 @@ class PacketStreamer(Module):
                 self.packet.done = 1
                 selfp.source.stb = 0
 
+
 class PacketLogger(Module):
     def __init__(self, description, packet_class):
         self.sink = Sink(description)
@@ -110,6 +115,7 @@ class PacketLogger(Module):
             if selfp.sink.stb == 1 and selfp.sink.eop == 1:
                 self.packet.done = True
 
+
 class Randomizer(Module):
     def __init__(self, description, level=0):
         self.level = level
index 1c2f530119ea4c0673a61bcc22d28b744d2bbcc1..7010fe356780cbfd8fdad485ab075a152a6f2e7b 100644 (file)
@@ -3,6 +3,7 @@ from misoclib.mem.litesata.core.link.cont import LiteSATACONTInserter, LiteSATAC
 
 from misoclib.mem.litesata.test.common import *
 
+
 class ContPacket(list):
     def __init__(self, data=[]):
         self.ongoing = False
@@ -10,6 +11,7 @@ class ContPacket(list):
         for d in data:
             self.append(d)
 
+
 class ContStreamer(PacketStreamer):
     def __init__(self):
         PacketStreamer.__init__(self, phy_description(32), ContPacket)
@@ -26,10 +28,12 @@ class ContStreamer(PacketStreamer):
             except:
                 pass
 
+
 class ContLogger(PacketLogger):
     def __init__(self):
         PacketLogger.__init__(self, phy_description(32), ContPacket)
 
+
 class TB(Module):
     def __init__(self):
         self.submodules.streamer = ContStreamer()
index 7ecb66f3cf93eb1e55b694e8127f884d0e3f32c1..51fe7a9d2b1e56b577e3bb5379d4a00395e9bbe5 100644 (file)
@@ -5,6 +5,7 @@ from misoclib.mem.litesata.core.link.crc import *
 
 from misoclib.mem.litesata.test.common import *
 
+
 class TB(Module):
     def __init__(self, length, random):
         self.submodules.crc = LiteSATACRC()
index 671257c71a2dcb1c38567fd00ad7344c0da0f359..9817aafe9cdba1d0725449b68cb850d36606fb87 100644 (file)
@@ -4,6 +4,7 @@ import math
 from misoclib.mem.litesata.common import *
 from misoclib.mem.litesata.test.common import *
 
+
 def print_with_prefix(s, prefix=""):
     if not isinstance(s, str):
         s = s.__repr__()
@@ -11,6 +12,7 @@ def print_with_prefix(s, prefix=""):
     for l in s:
         print(prefix + l)
 
+
 # PHY Layer model
 class PHYDword:
     def __init__(self, dat=0):
@@ -18,6 +20,7 @@ class PHYDword:
         self.start = 1
         self.done = 0
 
+
 class PHYSource(Module):
     def __init__(self):
         self.source = Source(phy_description(32))
@@ -35,6 +38,7 @@ class PHYSource(Module):
                 selfp.source.charisk = 0b0001
         selfp.source.data = self.dword.dat
 
+
 class PHYSink(Module):
     def __init__(self):
         self.sink = Sink(phy_description(32))
@@ -53,6 +57,7 @@ class PHYSink(Module):
             self.dword.done = 1
             self.dword.dat = selfp.sink.data
 
+
 class PHYLayer(Module):
     def __init__(self):
 
@@ -80,16 +85,19 @@ class PHYLayer(Module):
 
         return receiving + sending
 
+
 # Link Layer model
 def print_link(s):
     print_with_prefix(s, "[LNK]: ")
 
+
 def import_scrambler_datas():
     with subprocess.Popen(["./scrambler"], stdin=subprocess.PIPE, stdout=subprocess.PIPE) as process:
         process.stdin.write("0x10000".encode("ASCII"))
         out, err = process.communicate()
     return [int(e, 16) for e in out.decode("utf-8").split("\n")[:-1]]
 
+
 class LinkPacket(list):
     def __init__(self, init=[]):
         self.ongoing = False
@@ -98,6 +106,7 @@ class LinkPacket(list):
         for dword in init:
             self.append(dword)
 
+
 class LinkRXPacket(LinkPacket):
     def descramble(self):
         for i in range(len(self)):
@@ -120,6 +129,7 @@ class LinkRXPacket(LinkPacket):
         self.descramble()
         return self.check_crc()
 
+
 class LinkTXPacket(LinkPacket):
     def insert_crc(self):
         stdin = ""
@@ -140,6 +150,7 @@ class LinkTXPacket(LinkPacket):
         self.insert_crc()
         self.scramble()
 
+
 class LinkLayer(Module):
     def  __init__(self, phy, debug=False, random_level=0):
         self.phy = phy
@@ -271,13 +282,16 @@ class LinkLayer(Module):
                 self.callback(rx_dword)
             self.insert_cont()
 
+
 # Transport Layer model
 def print_transport(s):
     print_with_prefix(s, "[TRN]: ")
 
+
 def get_field_data(field, packet):
     return (packet[field.dword] >> field.offset) & (2**field.width-1)
 
+
 class FIS:
     def __init__(self, packet, description, direction="H2D"):
         self.packet = packet
@@ -302,6 +316,7 @@ class FIS:
             r += k + " : 0x%x" %getattr(self,k) + "\n"
         return r
 
+
 class FIS_REG_H2D(FIS):
     def __init__(self, packet=[0]*fis_reg_h2d_cmd_len):
         FIS.__init__(self, packet, fis_reg_h2d_layout)
@@ -313,6 +328,7 @@ class FIS_REG_H2D(FIS):
         r += FIS.__repr__(self)
         return r
 
+
 class FIS_REG_D2H(FIS):
     def __init__(self, packet=[0]*fis_reg_d2h_cmd_len):
         FIS.__init__(self, packet, fis_reg_d2h_layout)
@@ -324,6 +340,7 @@ class FIS_REG_D2H(FIS):
         r += FIS.__repr__(self)
         return r
 
+
 class FIS_DMA_ACTIVATE_D2H(FIS):
     def __init__(self, packet=[0]*fis_dma_activate_d2h_cmd_len):
         FIS.__init__(self, packet, fis_dma_activate_d2h_layout)
@@ -335,6 +352,7 @@ class FIS_DMA_ACTIVATE_D2H(FIS):
         r += FIS.__repr__(self)
         return r
 
+
 class FIS_DATA(FIS):
     def __init__(self, packet=[0], direction="H2D"):
         FIS.__init__(self, packet, fis_data_layout, direction)
@@ -347,6 +365,7 @@ class FIS_DATA(FIS):
             r += "%08x\n" %data
         return r
 
+
 class FIS_UNKNOWN(FIS):
     def __init__(self, packet=[0], direction="H2D"):
         FIS.__init__(self, packet, {}, direction)
@@ -361,6 +380,7 @@ class FIS_UNKNOWN(FIS):
             r += "%08x\n" %dword
         return r
 
+
 class TransportLayer(Module):
     def __init__(self, link, debug=False, loopback=False):
         self.link = link
@@ -397,6 +417,7 @@ class TransportLayer(Module):
         else:
             self.command_callback(fis)
 
+
 # Command Layer model
 class CommandLayer(Module):
     def __init__(self, transport):
@@ -422,16 +443,19 @@ class CommandLayer(Module):
             for packet in resp:
                 self.transport.send(packet)
 
+
 # HDD model
 def print_hdd(s):
     print_with_prefix(s, "[HDD]: ")
 
+
 class HDDMemRegion:
     def __init__(self, base, count, sector_size):
         self.base = base
         self.count = count
         self.data = [0]*(count*sector_size//4)
 
+
 class HDD(Module):
     def __init__(self,
             link_debug=False, link_random_level=0,
index e75749a5740cd87fd6437ac6595b9bb3b18a5a90..51142fb1a4c2bac6fd63b64ee00c1c63ea2d2f08 100644 (file)
@@ -4,14 +4,17 @@ from misoclib.mem.litesata.core.link import LiteSATALink
 from misoclib.mem.litesata.test.common import *
 from misoclib.mem.litesata.test.hdd import *
 
+
 class LinkStreamer(PacketStreamer):
     def __init__(self):
         PacketStreamer.__init__(self, link_description(32), LinkTXPacket)
 
+
 class LinkLogger(PacketLogger):
     def __init__(self):
         PacketLogger.__init__(self, link_description(32), LinkRXPacket)
 
+
 class TB(Module):
     def __init__(self):
         self.submodules.hdd = HDD(
index 43163bf6d0fdf74e9d88c0e3be23d7fcb2d1a995..265570023aae1a87cbe91f423e77a149cdb5260d 100644 (file)
@@ -3,6 +3,7 @@ from misoclib.mem.litesata.phy.datapath import LiteSATAPHYDatapath
 
 from misoclib.mem.litesata.test.common import *
 
+
 class DataPacket(list):
     def __init__(self, data=[]):
         self.ongoing = False
@@ -10,6 +11,7 @@ class DataPacket(list):
         for d in data:
             self.append(d)
 
+
 class DataStreamer(PacketStreamer):
     def __init__(self):
         PacketStreamer.__init__(self, phy_description(32), DataPacket)
@@ -26,22 +28,26 @@ class DataStreamer(PacketStreamer):
             except:
                 pass
 
+
 class DataLogger(PacketLogger):
     def __init__(self):
         PacketLogger.__init__(self, phy_description(32), DataPacket)
 
+
 class TRX(Module):
     def __init__(self):
         self.sink = Sink(phy_description(32))
         self.source = Source(phy_description(32))
         self.comb += Record.connect(self.sink, self.source)
 
+
 class CTRL(Module):
     def __init__(self):
         self.sink = Sink(phy_description(32))
         self.source = Source(phy_description(32))
         self.ready = Signal(reset=1)
 
+
 class TB(Module):
     def __init__(self):
         # use sys_clk for each clock_domain
index 298e5e3e484ce64aac5184de15e9546244da95c9..806c3e25cd932a08450762c795c3ecd82f814abf 100644 (file)
@@ -5,6 +5,7 @@ from misoclib.mem.litesata.core.link.scrambler import *
 
 from misoclib.mem.litesata.test.common import *
 
+
 class TB(Module):
     def __init__(self, length):
         self.submodules.scrambler = InsertReset(Scrambler())