global: more pep8
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Mon, 13 Apr 2015 15:56:51 +0000 (17:56 +0200)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Mon, 13 Apr 2015 16:02:26 +0000 (18:02 +0200)
we will have to continue the work... volunteers are welcome :)

26 files changed:
misoclib/com/uart/test/test_serial_phy.py
misoclib/cpu/lm32/__init__.py
misoclib/cpu/mor1kx/__init__.py
misoclib/mem/sdram/core/__init__.py
misoclib/mem/sdram/core/lasmibus.py
misoclib/mem/sdram/core/lasmicon/bankmachine.py
misoclib/mem/sdram/frontend/memtest.py
misoclib/mem/sdram/phy/dfi.py
misoclib/mem/sdram/phy/k7ddrphy.py
misoclib/mem/sdram/phy/s6ddrphy.py
misoclib/mem/sdram/phy/simphy.py
misoclib/mem/sdram/test/minicon_tb.py
misoclib/others/mxcrg/__init__.py
misoclib/soc/sdram.py
misoclib/video/dvisampler/clocking.py
misoclib/video/dvisampler/datacapture.py
misoclib/video/framebuffer/dvi.py
misoclib/video/framebuffer/phy.py
targets/de0nano.py
targets/kc705.py
targets/minispartan6.py
targets/mlabs_video.py
targets/pipistrello.py
targets/ppro.py
targets/simple.py
targets/versa.py

index dc90d8ee1b7f8247d75359d6f67665dfd28ee633..71318c7af9001c11d1460ae8b6748dc6c47958b8 100644 (file)
@@ -92,5 +92,6 @@ class UARTTB(Module):
 if __name__ == "__main__":
     from migen.sim.generic import Simulator, TopLevel
     from migen.sim import icarus
-    with Simulator(UARTTB(), TopLevel("top.vcd", clk_period=int(1/0.08333333)), icarus.Runner(keep_files=False)) as s:
+    with Simulator(UARTTB(), TopLevel("top.vcd", clk_period=int(1/0.08333333)),
+                   icarus.Runner(keep_files=False)) as s:
         s.run(20000)
index e70afcee5698e42f6735edfb371bd19fb1736239..8ea7637b2d7b70d0cd6e6ac8b3bcfa005696268b 100644 (file)
@@ -15,38 +15,38 @@ class LM32(Module):
         i_adr_o = Signal(32)
         d_adr_o = Signal(32)
         self.specials += Instance("lm32_cpu",
-            p_eba_reset=Instance.PreformattedParam("32'h{:08x}".format(eba_reset)),
-
-            i_clk_i=ClockSignal(),
-            i_rst_i=ResetSignal(),
-
-            i_interrupt=self.interrupt,
-
-            o_I_ADR_O=i_adr_o,
-            o_I_DAT_O=i.dat_w,
-            o_I_SEL_O=i.sel,
-            o_I_CYC_O=i.cyc,
-            o_I_STB_O=i.stb,
-            o_I_WE_O=i.we,
-            o_I_CTI_O=i.cti,
-            o_I_BTE_O=i.bte,
-            i_I_DAT_I=i.dat_r,
-            i_I_ACK_I=i.ack,
-            i_I_ERR_I=i.err,
-            i_I_RTY_I=0,
-
-            o_D_ADR_O=d_adr_o,
-            o_D_DAT_O=d.dat_w,
-            o_D_SEL_O=d.sel,
-            o_D_CYC_O=d.cyc,
-            o_D_STB_O=d.stb,
-            o_D_WE_O=d.we,
-            o_D_CTI_O=d.cti,
-            o_D_BTE_O=d.bte,
-            i_D_DAT_I=d.dat_r,
-            i_D_ACK_I=d.ack,
-            i_D_ERR_I=d.err,
-            i_D_RTY_I=0)
+                                   p_eba_reset=Instance.PreformattedParam("32'h{:08x}".format(eba_reset)),
+
+                                   i_clk_i=ClockSignal(),
+                                   i_rst_i=ResetSignal(),
+
+                                   i_interrupt=self.interrupt,
+
+                                   o_I_ADR_O=i_adr_o,
+                                   o_I_DAT_O=i.dat_w,
+                                   o_I_SEL_O=i.sel,
+                                   o_I_CYC_O=i.cyc,
+                                   o_I_STB_O=i.stb,
+                                   o_I_WE_O=i.we,
+                                   o_I_CTI_O=i.cti,
+                                   o_I_BTE_O=i.bte,
+                                   i_I_DAT_I=i.dat_r,
+                                   i_I_ACK_I=i.ack,
+                                   i_I_ERR_I=i.err,
+                                   i_I_RTY_I=0,
+
+                                   o_D_ADR_O=d_adr_o,
+                                   o_D_DAT_O=d.dat_w,
+                                   o_D_SEL_O=d.sel,
+                                   o_D_CYC_O=d.cyc,
+                                   o_D_STB_O=d.stb,
+                                   o_D_WE_O=d.we,
+                                   o_D_CTI_O=d.cti,
+                                   o_D_BTE_O=d.bte,
+                                   i_D_DAT_I=d.dat_r,
+                                   i_D_ACK_I=d.ack,
+                                   i_D_ERR_I=d.err,
+                                   i_D_RTY_I=0)
 
         self.comb += [
             self.ibus.adr.eq(i_adr_o[2:]),
index 42d607f7221457a5a60cf2d1e69891fae3514b78..4114c3190f0ec1b3dd28d75950a7e553c415f6ce 100644 (file)
@@ -15,60 +15,60 @@ class MOR1KX(Module):
         i_adr_o = Signal(32)
         d_adr_o = Signal(32)
         self.specials += Instance("mor1kx",
-            p_FEATURE_INSTRUCTIONCACHE="ENABLED",
-            p_OPTION_ICACHE_BLOCK_WIDTH=4,
-            p_OPTION_ICACHE_SET_WIDTH=8,
-            p_OPTION_ICACHE_WAYS=1,
-            p_OPTION_ICACHE_LIMIT_WIDTH=31,
-            p_FEATURE_DATACACHE="ENABLED",
-            p_OPTION_DCACHE_BLOCK_WIDTH=4,
-            p_OPTION_DCACHE_SET_WIDTH=8,
-            p_OPTION_DCACHE_WAYS=1,
-            p_OPTION_DCACHE_LIMIT_WIDTH=31,
-            p_FEATURE_TIMER="NONE",
-            p_OPTION_PIC_TRIGGER="LEVEL",
-            p_FEATURE_SYSCALL="NONE",
-            p_FEATURE_TRAP="NONE",
-            p_FEATURE_RANGE="NONE",
-            p_FEATURE_OVERFLOW="NONE",
-            p_FEATURE_ADDC="NONE",
-            p_FEATURE_CMOV="NONE",
-            p_FEATURE_FFL1="NONE",
-            p_OPTION_CPU0="CAPPUCCINO",
-            p_OPTION_RESET_PC=reset_pc,
-            p_IBUS_WB_TYPE="B3_REGISTERED_FEEDBACK",
-            p_DBUS_WB_TYPE="B3_REGISTERED_FEEDBACK",
+                                  p_FEATURE_INSTRUCTIONCACHE="ENABLED",
+                                  p_OPTION_ICACHE_BLOCK_WIDTH=4,
+                                  p_OPTION_ICACHE_SET_WIDTH=8,
+                                  p_OPTION_ICACHE_WAYS=1,
+                                  p_OPTION_ICACHE_LIMIT_WIDTH=31,
+                                  p_FEATURE_DATACACHE="ENABLED",
+                                  p_OPTION_DCACHE_BLOCK_WIDTH=4,
+                                  p_OPTION_DCACHE_SET_WIDTH=8,
+                                  p_OPTION_DCACHE_WAYS=1,
+                                  p_OPTION_DCACHE_LIMIT_WIDTH=31,
+                                  p_FEATURE_TIMER="NONE",
+                                  p_OPTION_PIC_TRIGGER="LEVEL",
+                                  p_FEATURE_SYSCALL="NONE",
+                                  p_FEATURE_TRAP="NONE",
+                                  p_FEATURE_RANGE="NONE",
+                                  p_FEATURE_OVERFLOW="NONE",
+                                  p_FEATURE_ADDC="NONE",
+                                  p_FEATURE_CMOV="NONE",
+                                  p_FEATURE_FFL1="NONE",
+                                  p_OPTION_CPU0="CAPPUCCINO",
+                                  p_OPTION_RESET_PC=reset_pc,
+                                  p_IBUS_WB_TYPE="B3_REGISTERED_FEEDBACK",
+                                  p_DBUS_WB_TYPE="B3_REGISTERED_FEEDBACK",
 
-            i_clk=ClockSignal(),
-            i_rst=ResetSignal(),
+                                  i_clk=ClockSignal(),
+                                  i_rst=ResetSignal(),
 
-            i_irq_i=self.interrupt,
+                                  i_irq_i=self.interrupt,
 
-            o_iwbm_adr_o=i_adr_o,
-            o_iwbm_dat_o=i.dat_w,
-            o_iwbm_sel_o=i.sel,
-            o_iwbm_cyc_o=i.cyc,
-            o_iwbm_stb_o=i.stb,
-            o_iwbm_we_o=i.we,
-            o_iwbm_cti_o=i.cti,
-            o_iwbm_bte_o=i.bte,
-            i_iwbm_dat_i=i.dat_r,
-            i_iwbm_ack_i=i.ack,
-            i_iwbm_err_i=i.err,
-            i_iwbm_rty_i=0,
+                                  o_iwbm_adr_o=i_adr_o,
+                                  o_iwbm_dat_o=i.dat_w,
+                                  o_iwbm_sel_o=i.sel,
+                                  o_iwbm_cyc_o=i.cyc,
+                                  o_iwbm_stb_o=i.stb,
+                                  o_iwbm_we_o=i.we,
+                                  o_iwbm_cti_o=i.cti,
+                                  o_iwbm_bte_o=i.bte,
+                                  i_iwbm_dat_i=i.dat_r,
+                                  i_iwbm_ack_i=i.ack,
+                                  i_iwbm_err_i=i.err,
+                                  i_iwbm_rty_i=0,
 
-            o_dwbm_adr_o=d_adr_o,
-            o_dwbm_dat_o=d.dat_w,
-            o_dwbm_sel_o=d.sel,
-            o_dwbm_cyc_o=d.cyc,
-            o_dwbm_stb_o=d.stb,
-            o_dwbm_we_o=d.we,
-            o_dwbm_cti_o=d.cti,
-            o_dwbm_bte_o=d.bte,
-            i_dwbm_dat_i=d.dat_r,
-            i_dwbm_ack_i=d.ack,
-            i_dwbm_err_i=d.err,
-            i_dwbm_rty_i=0)
+                                  o_dwbm_adr_o=d_adr_o,
+                                  o_dwbm_dat_o=d.dat_w,
+                                  o_dwbm_sel_o=d.sel,
+                                  o_dwbm_cyc_o=d.cyc,
+                                  o_dwbm_stb_o=d.stb,
+                                  o_dwbm_we_o=d.we,
+                                  o_dwbm_cti_o=d.cti,
+                                  o_dwbm_bte_o=d.bte,
+                                  i_dwbm_dat_i=d.dat_r,
+                                  i_dwbm_ack_i=d.ack,
+                                  i_dwbm_err_i=d.err,
+                                  i_dwbm_rty_i=0)
 
         self.comb += [
             self.ibus.adr.eq(i_adr_o[2:]),
@@ -76,4 +76,5 @@ class MOR1KX(Module):
         ]
 
         # add Verilog sources
-        platform.add_source_dir(os.path.join("extcores", "mor1kx", "submodule", "rtl", "verilog"))
+        platform.add_source_dir(os.path.join("extcores", "mor1kx", "submodule",
+                                             "rtl", "verilog"))
index 8c1a6a63d9175f1ddef1c7f7848878f0cf640f81..1892f81819793906402f474fddb6630e431e9d93 100644 (file)
@@ -16,15 +16,21 @@ class SDRAMCore(Module, AutoCSR):
 
         # LASMICON
         if isinstance(controller_settings, lasmicon.LASMIconSettings):
-            self.submodules.controller = controller = lasmicon.LASMIcon(phy.settings, geom_settings, timing_settings,
-                controller_settings, **kwargs)
+            self.submodules.controller = controller = lasmicon.LASMIcon(phy.settings,
+                                                                        geom_settings,
+                                                                        timing_settings,
+                                                                        controller_settings,
+                                                                        **kwargs)
             self.comb += Record.connect(controller.dfi, self.dfii.slave)
 
-            self.submodules.crossbar = lasmixbar.LASMIxbar([controller.lasmic], controller.nrowbits)
+            self.submodules.crossbar = lasmixbar.LASMIxbar([controller.lasmic],
+                                                           controller.nrowbits)
 
         # MINICON
         elif isinstance(controller_settings, minicon.MiniconSettings):
-            self.submodules.controller = controller = minicon.Minicon(phy.settings, geom_settings, timing_settings)
+            self.submodules.controller = controller = minicon.Minicon(phy.settings,
+                                                                      geom_settings,
+                                                                      timing_settings)
             self.comb += Record.connect(controller.dfi, self.dfii.slave)
         else:
             raise ValueError("Unsupported SDRAM controller type")
index 65d385dcacdbf5474e3cc5c79a9f3492ecaa2d68..c1d3b0cde371da0e451d41917ced690d177e0e15 100644 (file)
@@ -15,22 +15,22 @@ class Interface(Record):
         self.write_latency = write_latency
 
         bank_layout = [
-            ("adr",            aw,        DIR_M_TO_S),
-            ("we",            1,        DIR_M_TO_S),
-            ("stb",            1,        DIR_M_TO_S),
-            ("req_ack",        1,        DIR_S_TO_M),
-            ("dat_w_ack",    1,        DIR_S_TO_M),
-            ("dat_r_ack",    1,        DIR_S_TO_M),
-            ("lock",        1,        DIR_S_TO_M)
+            ("adr",      aw, DIR_M_TO_S),
+            ("we",        1, DIR_M_TO_S),
+            ("stb",       1, DIR_M_TO_S),
+            ("req_ack",   1, DIR_S_TO_M),
+            ("dat_w_ack", 1, DIR_S_TO_M),
+            ("dat_r_ack", 1, DIR_S_TO_M),
+            ("lock",      1, DIR_S_TO_M)
         ]
         if nbanks > 1:
             layout = [("bank"+str(i), bank_layout) for i in range(nbanks)]
         else:
             layout = bank_layout
         layout += [
-            ("dat_w",    dw,     DIR_M_TO_S),
-            ("dat_we",    dw//8,     DIR_M_TO_S),
-            ("dat_r",    dw,     DIR_S_TO_M)
+            ("dat_w",     dw, DIR_M_TO_S),
+            ("dat_we", dw//8, DIR_M_TO_S),
+            ("dat_r",     dw, DIR_S_TO_M)
         ]
         Record.__init__(self, layout)
 
index 9337f097b908d17f2b1539ae9b450c5b0d70eec6..cd5bcab5040507c6813ec75347f87b9e53e0f0fc 100644 (file)
@@ -36,7 +36,8 @@ class BankMachine(Module):
         ###
 
         # Request FIFO
-        self.submodules.req_fifo = SyncFIFO([("we", 1), ("adr", flen(req.adr))], controller_settings.req_queue_size)
+        self.submodules.req_fifo = SyncFIFO([("we", 1), ("adr", flen(req.adr))],
+                                            controller_settings.req_queue_size)
         self.comb += [
             self.req_fifo.din.we.eq(req.we),
             self.req_fifo.din.adr.eq(req.adr),
index df5ba9fecded7fa33eb09dc02bacf6b032dc7d98..790aa765bbaeabc6314cbd3f5d734c36a2a8c54b 100644 (file)
@@ -35,7 +35,8 @@ class MemtestWriter(Module):
         self._magic = CSRStatus(16)
         self._reset = CSR()
         self._shoot = CSR()
-        self.submodules._dma = DMAWriteController(dma_lasmi.Writer(lasmim), MODE_EXTERNAL)
+        self.submodules._dma = DMAWriteController(dma_lasmi.Writer(lasmim),
+                                                  MODE_EXTERNAL)
 
         ###
 
@@ -72,7 +73,8 @@ class MemtestReader(Module):
         self._magic = CSRStatus(16)
         self._reset = CSR()
         self._error_count = CSRStatus(lasmim.aw)
-        self.submodules._dma = DMAReadController(dma_lasmi.Reader(lasmim), MODE_SINGLE_SHOT)
+        self.submodules._dma = DMAReadController(dma_lasmi.Reader(lasmim),
+                                                 MODE_SINGLE_SHOT)
 
         ###
 
index 4182faecb5844e7ea33b1fe89ca0b1c18790ad68..76379e283fd6a518eb92ce54c80b4ddfd5dff1ba 100644 (file)
@@ -4,31 +4,31 @@ from migen.genlib.record import *
 
 def phase_cmd_description(addressbits, bankbits):
     return [
-        ("address",            addressbits,    DIR_M_TO_S),
-        ("bank",            bankbits,        DIR_M_TO_S),
-        ("cas_n",            1,                DIR_M_TO_S),
-        ("cs_n",            1,                DIR_M_TO_S),
-        ("ras_n",            1,                DIR_M_TO_S),
-        ("we_n",            1,                DIR_M_TO_S),
-        ("cke",                1,                DIR_M_TO_S),
-        ("odt",                1,                DIR_M_TO_S),
-        ("reset_n",            1,                DIR_M_TO_S)
+        ("address", addressbits, DIR_M_TO_S),
+        ("bank",       bankbits, DIR_M_TO_S),
+        ("cas_n",             1, DIR_M_TO_S),
+        ("cs_n",              1, DIR_M_TO_S),
+        ("ras_n",             1, DIR_M_TO_S),
+        ("we_n",              1, DIR_M_TO_S),
+        ("cke",               1, DIR_M_TO_S),
+        ("odt",               1, DIR_M_TO_S),
+        ("reset_n",           1, DIR_M_TO_S)
     ]
 
 
 def phase_wrdata_description(databits):
     return [
-        ("wrdata",            databits,        DIR_M_TO_S),
-        ("wrdata_en",        1,                DIR_M_TO_S),
-        ("wrdata_mask",        databits//8,    DIR_M_TO_S)
+        ("wrdata",         databits, DIR_M_TO_S),
+        ("wrdata_en",             1, DIR_M_TO_S),
+        ("wrdata_mask", databits//8, DIR_M_TO_S)
     ]
 
 
 def phase_rddata_description(databits):
     return [
-        ("rddata_en",        1,                DIR_M_TO_S),
-        ("rddata",            databits,        DIR_S_TO_M),
-        ("rddata_valid",    1,                DIR_S_TO_M)
+        ("rddata_en",           1, DIR_M_TO_S),
+        ("rddata",       databits, DIR_S_TO_M),
+        ("rddata_valid",        1, DIR_S_TO_M)
     ]
 
 
index 4f8ee96585307eee6183e997c54e73923bf7b663..d516680ad88a8144c3f2a68cb5e714e301fadc64 100644 (file)
@@ -48,21 +48,21 @@ class K7DDRPHY(Module, AutoCSR):
         sd_clk_se = Signal()
         self.specials += [
             Instance("OSERDESE2",
-                p_DATA_WIDTH=8, p_TRISTATE_WIDTH=1,
-                p_DATA_RATE_OQ="DDR", p_DATA_RATE_TQ="BUF",
-                p_SERDES_MODE="MASTER",
+                     p_DATA_WIDTH=8, p_TRISTATE_WIDTH=1,
+                     p_DATA_RATE_OQ="DDR", p_DATA_RATE_TQ="BUF",
+                     p_SERDES_MODE="MASTER",
 
-                o_OQ=sd_clk_se,
-                i_OCE=1,
-                i_RST=ResetSignal(),
-                i_CLK=ClockSignal("sys4x"), i_CLKDIV=ClockSignal(),
-                i_D1=0, i_D2=1, i_D3=0, i_D4=1,
-                i_D5=0, i_D6=1, i_D7=0, i_D8=1
+                     o_OQ=sd_clk_se,
+                     i_OCE=1,
+                     i_RST=ResetSignal(),
+                     i_CLK=ClockSignal("sys4x"), i_CLKDIV=ClockSignal(),
+                     i_D1=0, i_D2=1, i_D3=0, i_D4=1,
+                     i_D5=0, i_D6=1, i_D7=0, i_D8=1
             ),
             Instance("OBUFDS",
-                i_I=sd_clk_se,
-                o_O=pads.clk_p,
-                o_OB=pads.clk_n
+                     i_I=sd_clk_se,
+                     o_O=pads.clk_p,
+                     o_OB=pads.clk_n
             )
         ]
 
@@ -70,50 +70,50 @@ class K7DDRPHY(Module, AutoCSR):
         for i in range(addressbits):
             self.specials += \
                 Instance("OSERDESE2",
-                    p_DATA_WIDTH=8, p_TRISTATE_WIDTH=1,
-                    p_DATA_RATE_OQ="DDR", p_DATA_RATE_TQ="BUF",
-                    p_SERDES_MODE="MASTER",
+                         p_DATA_WIDTH=8, p_TRISTATE_WIDTH=1,
+                         p_DATA_RATE_OQ="DDR", p_DATA_RATE_TQ="BUF",
+                         p_SERDES_MODE="MASTER",
 
-                    o_OQ=pads.a[i],
-                    i_OCE=1,
-                    i_RST=ResetSignal(),
-                    i_CLK=ClockSignal("sys4x"), i_CLKDIV=ClockSignal(),
-                    i_D1=self.dfi.phases[0].address[i], i_D2=self.dfi.phases[0].address[i],
-                    i_D3=self.dfi.phases[1].address[i], i_D4=self.dfi.phases[1].address[i],
-                    i_D5=self.dfi.phases[2].address[i], i_D6=self.dfi.phases[2].address[i],
-                    i_D7=self.dfi.phases[3].address[i], i_D8=self.dfi.phases[3].address[i]
+                         o_OQ=pads.a[i],
+                         i_OCE=1,
+                         i_RST=ResetSignal(),
+                         i_CLK=ClockSignal("sys4x"), i_CLKDIV=ClockSignal(),
+                         i_D1=self.dfi.phases[0].address[i], i_D2=self.dfi.phases[0].address[i],
+                         i_D3=self.dfi.phases[1].address[i], i_D4=self.dfi.phases[1].address[i],
+                         i_D5=self.dfi.phases[2].address[i], i_D6=self.dfi.phases[2].address[i],
+                         i_D7=self.dfi.phases[3].address[i], i_D8=self.dfi.phases[3].address[i]
                 )
         for i in range(bankbits):
             self.specials += \
                 Instance("OSERDESE2",
-                    p_DATA_WIDTH=8, p_TRISTATE_WIDTH=1,
-                    p_DATA_RATE_OQ="DDR", p_DATA_RATE_TQ="BUF",
-                    p_SERDES_MODE="MASTER",
+                         p_DATA_WIDTH=8, p_TRISTATE_WIDTH=1,
+                         p_DATA_RATE_OQ="DDR", p_DATA_RATE_TQ="BUF",
+                         p_SERDES_MODE="MASTER",
 
-                    o_OQ=pads.ba[i],
-                    i_OCE=1,
-                    i_RST=ResetSignal(),
-                    i_CLK=ClockSignal("sys4x"), i_CLKDIV=ClockSignal(),
-                    i_D1=self.dfi.phases[0].bank[i], i_D2=self.dfi.phases[0].bank[i],
-                    i_D3=self.dfi.phases[1].bank[i], i_D4=self.dfi.phases[1].bank[i],
-                    i_D5=self.dfi.phases[2].bank[i], i_D6=self.dfi.phases[2].bank[i],
-                    i_D7=self.dfi.phases[3].bank[i], i_D8=self.dfi.phases[3].bank[i]
+                         o_OQ=pads.ba[i],
+                         i_OCE=1,
+                         i_RST=ResetSignal(),
+                         i_CLK=ClockSignal("sys4x"), i_CLKDIV=ClockSignal(),
+                         i_D1=self.dfi.phases[0].bank[i], i_D2=self.dfi.phases[0].bank[i],
+                         i_D3=self.dfi.phases[1].bank[i], i_D4=self.dfi.phases[1].bank[i],
+                         i_D5=self.dfi.phases[2].bank[i], i_D6=self.dfi.phases[2].bank[i],
+                         i_D7=self.dfi.phases[3].bank[i], i_D8=self.dfi.phases[3].bank[i]
                 )
         for name in "ras_n", "cas_n", "we_n", "cs_n", "cke", "odt", "reset_n":
             self.specials += \
                 Instance("OSERDESE2",
-                    p_DATA_WIDTH=8, p_TRISTATE_WIDTH=1,
-                    p_DATA_RATE_OQ="DDR", p_DATA_RATE_TQ="BUF",
-                    p_SERDES_MODE="MASTER",
+                         p_DATA_WIDTH=8, p_TRISTATE_WIDTH=1,
+                         p_DATA_RATE_OQ="DDR", p_DATA_RATE_TQ="BUF",
+                         p_SERDES_MODE="MASTER",
 
-                    o_OQ=getattr(pads, name),
-                    i_OCE=1,
-                    i_RST=ResetSignal(),
-                    i_CLK=ClockSignal("sys4x"), i_CLKDIV=ClockSignal(),
-                    i_D1=getattr(self.dfi.phases[0], name), i_D2=getattr(self.dfi.phases[0], name),
-                    i_D3=getattr(self.dfi.phases[1], name), i_D4=getattr(self.dfi.phases[1], name),
-                    i_D5=getattr(self.dfi.phases[2], name), i_D6=getattr(self.dfi.phases[2], name),
-                    i_D7=getattr(self.dfi.phases[3], name), i_D8=getattr(self.dfi.phases[3], name)
+                         o_OQ=getattr(pads, name),
+                         i_OCE=1,
+                         i_RST=ResetSignal(),
+                         i_CLK=ClockSignal("sys4x"), i_CLKDIV=ClockSignal(),
+                         i_D1=getattr(self.dfi.phases[0], name), i_D2=getattr(self.dfi.phases[0], name),
+                         i_D3=getattr(self.dfi.phases[1], name), i_D4=getattr(self.dfi.phases[1], name),
+                         i_D5=getattr(self.dfi.phases[2], name), i_D6=getattr(self.dfi.phases[2], name),
+                         i_D7=getattr(self.dfi.phases[3], name), i_D8=getattr(self.dfi.phases[3], name)
                 )
 
         # DQS and DM
@@ -133,31 +133,31 @@ class K7DDRPHY(Module, AutoCSR):
             dm_o_nodelay = Signal()
             self.specials += \
                 Instance("OSERDESE2",
-                    p_DATA_WIDTH=8, p_TRISTATE_WIDTH=1,
-                    p_DATA_RATE_OQ="DDR", p_DATA_RATE_TQ="BUF",
-                    p_SERDES_MODE="MASTER",
+                         p_DATA_WIDTH=8, p_TRISTATE_WIDTH=1,
+                         p_DATA_RATE_OQ="DDR", p_DATA_RATE_TQ="BUF",
+                         p_SERDES_MODE="MASTER",
 
-                    o_OQ=dm_o_nodelay,
-                    i_OCE=1,
-                    i_RST=ResetSignal(),
-                    i_CLK=ClockSignal("sys4x"), i_CLKDIV=ClockSignal(),
-                    i_D1=self.dfi.phases[0].wrdata_mask[i], i_D2=self.dfi.phases[0].wrdata_mask[databits//8+i],
-                    i_D3=self.dfi.phases[1].wrdata_mask[i], i_D4=self.dfi.phases[1].wrdata_mask[databits//8+i],
-                    i_D5=self.dfi.phases[2].wrdata_mask[i], i_D6=self.dfi.phases[2].wrdata_mask[databits//8+i],
-                    i_D7=self.dfi.phases[3].wrdata_mask[i], i_D8=self.dfi.phases[3].wrdata_mask[databits//8+i]
+                         o_OQ=dm_o_nodelay,
+                         i_OCE=1,
+                         i_RST=ResetSignal(),
+                         i_CLK=ClockSignal("sys4x"), i_CLKDIV=ClockSignal(),
+                         i_D1=self.dfi.phases[0].wrdata_mask[i], i_D2=self.dfi.phases[0].wrdata_mask[databits//8+i],
+                         i_D3=self.dfi.phases[1].wrdata_mask[i], i_D4=self.dfi.phases[1].wrdata_mask[databits//8+i],
+                         i_D5=self.dfi.phases[2].wrdata_mask[i], i_D6=self.dfi.phases[2].wrdata_mask[databits//8+i],
+                         i_D7=self.dfi.phases[3].wrdata_mask[i], i_D8=self.dfi.phases[3].wrdata_mask[databits//8+i]
                 )
             self.specials += \
                 Instance("ODELAYE2",
-                    p_DELAY_SRC="ODATAIN", p_SIGNAL_PATTERN="DATA",
-                    p_CINVCTRL_SEL="FALSE", p_HIGH_PERFORMANCE_MODE="TRUE", p_REFCLK_FREQUENCY=200.0,
-                    p_PIPE_SEL="FALSE", p_ODELAY_TYPE="VARIABLE", p_ODELAY_VALUE=0,
+                         p_DELAY_SRC="ODATAIN", p_SIGNAL_PATTERN="DATA",
+                         p_CINVCTRL_SEL="FALSE", p_HIGH_PERFORMANCE_MODE="TRUE", p_REFCLK_FREQUENCY=200.0,
+                         p_PIPE_SEL="FALSE", p_ODELAY_TYPE="VARIABLE", p_ODELAY_VALUE=0,
 
-                    i_C=ClockSignal(),
-                    i_LD=self._dly_sel.storage[i] & self._wdly_dq_rst.re,
-                    i_CE=self._dly_sel.storage[i] & self._wdly_dq_inc.re,
-                    i_LDPIPEEN=0, i_INC=1,
+                         i_C=ClockSignal(),
+                         i_LD=self._dly_sel.storage[i] & self._wdly_dq_rst.re,
+                         i_CE=self._dly_sel.storage[i] & self._wdly_dq_inc.re,
+                         i_LDPIPEEN=0, i_INC=1,
 
-                    o_ODATAIN=dm_o_nodelay, o_DATAOUT=pads.dm[i]
+                         o_ODATAIN=dm_o_nodelay, o_DATAOUT=pads.dm[i]
                 )
 
             dqs_nodelay = Signal()
@@ -165,35 +165,35 @@ class K7DDRPHY(Module, AutoCSR):
             dqs_t = Signal()
             self.specials += [
                 Instance("OSERDESE2",
-                    p_DATA_WIDTH=8, p_TRISTATE_WIDTH=1,
-                    p_DATA_RATE_OQ="DDR", p_DATA_RATE_TQ="BUF",
-                    p_SERDES_MODE="MASTER",
+                         p_DATA_WIDTH=8, p_TRISTATE_WIDTH=1,
+                         p_DATA_RATE_OQ="DDR", p_DATA_RATE_TQ="BUF",
+                         p_SERDES_MODE="MASTER",
 
-                    o_OFB=dqs_nodelay, o_TQ=dqs_t,
-                    i_OCE=1, i_TCE=1,
-                    i_RST=ResetSignal(),
-                    i_CLK=ClockSignal("sys4x"), i_CLKDIV=ClockSignal(),
-                    i_D1=dqs_serdes_pattern[0], i_D2=dqs_serdes_pattern[1],
-                    i_D3=dqs_serdes_pattern[2], i_D4=dqs_serdes_pattern[3],
-                    i_D5=dqs_serdes_pattern[4], i_D6=dqs_serdes_pattern[5],
-                    i_D7=dqs_serdes_pattern[6], i_D8=dqs_serdes_pattern[7],
-                    i_T1=~oe_dqs
+                         o_OFB=dqs_nodelay, o_TQ=dqs_t,
+                         i_OCE=1, i_TCE=1,
+                         i_RST=ResetSignal(),
+                         i_CLK=ClockSignal("sys4x"), i_CLKDIV=ClockSignal(),
+                         i_D1=dqs_serdes_pattern[0], i_D2=dqs_serdes_pattern[1],
+                         i_D3=dqs_serdes_pattern[2], i_D4=dqs_serdes_pattern[3],
+                         i_D5=dqs_serdes_pattern[4], i_D6=dqs_serdes_pattern[5],
+                         i_D7=dqs_serdes_pattern[6], i_D8=dqs_serdes_pattern[7],
+                         i_T1=~oe_dqs
                 ),
                 Instance("ODELAYE2",
-                    p_DELAY_SRC="ODATAIN", p_SIGNAL_PATTERN="DATA",
-                    p_CINVCTRL_SEL="FALSE", p_HIGH_PERFORMANCE_MODE="TRUE", p_REFCLK_FREQUENCY=200.0,
-                    p_PIPE_SEL="FALSE", p_ODELAY_TYPE="VARIABLE", p_ODELAY_VALUE=6,
+                         p_DELAY_SRC="ODATAIN", p_SIGNAL_PATTERN="DATA",
+                         p_CINVCTRL_SEL="FALSE", p_HIGH_PERFORMANCE_MODE="TRUE", p_REFCLK_FREQUENCY=200.0,
+                         p_PIPE_SEL="FALSE", p_ODELAY_TYPE="VARIABLE", p_ODELAY_VALUE=6,
 
-                    i_C=ClockSignal(),
-                    i_LD=self._dly_sel.storage[i] & self._wdly_dqs_rst.re,
-                    i_CE=self._dly_sel.storage[i] & self._wdly_dqs_inc.re,
-                    i_LDPIPEEN=0, i_INC=1,
+                         i_C=ClockSignal(),
+                         i_LD=self._dly_sel.storage[i] & self._wdly_dqs_rst.re,
+                         i_CE=self._dly_sel.storage[i] & self._wdly_dqs_inc.re,
+                         i_LDPIPEEN=0, i_INC=1,
 
-                    o_ODATAIN=dqs_nodelay, o_DATAOUT=dqs_delayed
+                         o_ODATAIN=dqs_nodelay, o_DATAOUT=dqs_delayed
                 ),
                 Instance("OBUFTDS",
-                    i_I=dqs_delayed, i_T=dqs_t,
-                    o_O=pads.dqs_p[i], o_OB=pads.dqs_n[i]
+                         i_I=dqs_delayed, i_T=dqs_t,
+                         o_O=pads.dqs_p[i], o_OB=pads.dqs_n[i]
                 )
             ]
 
@@ -207,62 +207,62 @@ class K7DDRPHY(Module, AutoCSR):
             dq_t = Signal()
             self.specials += [
                 Instance("OSERDESE2",
-                    p_DATA_WIDTH=8, p_TRISTATE_WIDTH=1,
-                    p_DATA_RATE_OQ="DDR", p_DATA_RATE_TQ="BUF",
-                    p_SERDES_MODE="MASTER",
+                         p_DATA_WIDTH=8, p_TRISTATE_WIDTH=1,
+                         p_DATA_RATE_OQ="DDR", p_DATA_RATE_TQ="BUF",
+                         p_SERDES_MODE="MASTER",
 
-                    o_OQ=dq_o_nodelay, o_TQ=dq_t,
-                    i_OCE=1, i_TCE=1,
-                    i_RST=ResetSignal(),
-                    i_CLK=ClockSignal("sys4x"), i_CLKDIV=ClockSignal(),
-                    i_D1=self.dfi.phases[0].wrdata[i], i_D2=self.dfi.phases[0].wrdata[databits+i],
-                    i_D3=self.dfi.phases[1].wrdata[i], i_D4=self.dfi.phases[1].wrdata[databits+i],
-                    i_D5=self.dfi.phases[2].wrdata[i], i_D6=self.dfi.phases[2].wrdata[databits+i],
-                    i_D7=self.dfi.phases[3].wrdata[i], i_D8=self.dfi.phases[3].wrdata[databits+i],
-                    i_T1=~oe_dq
+                         o_OQ=dq_o_nodelay, o_TQ=dq_t,
+                         i_OCE=1, i_TCE=1,
+                         i_RST=ResetSignal(),
+                         i_CLK=ClockSignal("sys4x"), i_CLKDIV=ClockSignal(),
+                         i_D1=self.dfi.phases[0].wrdata[i], i_D2=self.dfi.phases[0].wrdata[databits+i],
+                         i_D3=self.dfi.phases[1].wrdata[i], i_D4=self.dfi.phases[1].wrdata[databits+i],
+                         i_D5=self.dfi.phases[2].wrdata[i], i_D6=self.dfi.phases[2].wrdata[databits+i],
+                         i_D7=self.dfi.phases[3].wrdata[i], i_D8=self.dfi.phases[3].wrdata[databits+i],
+                         i_T1=~oe_dq
                 ),
                 Instance("ISERDESE2",
-                    p_DATA_WIDTH=8, p_DATA_RATE="DDR",
-                    p_SERDES_MODE="MASTER", p_INTERFACE_TYPE="NETWORKING",
-                    p_NUM_CE=1, p_IOBDELAY="IFD",
+                         p_DATA_WIDTH=8, p_DATA_RATE="DDR",
+                         p_SERDES_MODE="MASTER", p_INTERFACE_TYPE="NETWORKING",
+                         p_NUM_CE=1, p_IOBDELAY="IFD",
 
-                    i_DDLY=dq_i_delayed,
-                    i_CE1=1,
-                    i_RST=ResetSignal() | (self._dly_sel.storage[i//8] & self._wdly_dq_rst.re),
-                    i_CLK=ClockSignal("sys4x"), i_CLKB=~ClockSignal("sys4x"), i_CLKDIV=ClockSignal(),
-                    i_BITSLIP=self._dly_sel.storage[i//8] & self._rdly_dq_bitslip.re,
-                    o_Q8=self.dfi.phases[0].rddata[i], o_Q7=self.dfi.phases[0].rddata[databits+i],
-                    o_Q6=self.dfi.phases[1].rddata[i], o_Q5=self.dfi.phases[1].rddata[databits+i],
-                    o_Q4=self.dfi.phases[2].rddata[i], o_Q3=self.dfi.phases[2].rddata[databits+i],
-                    o_Q2=self.dfi.phases[3].rddata[i], o_Q1=self.dfi.phases[3].rddata[databits+i]
+                         i_DDLY=dq_i_delayed,
+                         i_CE1=1,
+                         i_RST=ResetSignal() | (self._dly_sel.storage[i//8] & self._wdly_dq_rst.re),
+                         i_CLK=ClockSignal("sys4x"), i_CLKB=~ClockSignal("sys4x"), i_CLKDIV=ClockSignal(),
+                         i_BITSLIP=self._dly_sel.storage[i//8] & self._rdly_dq_bitslip.re,
+                         o_Q8=self.dfi.phases[0].rddata[i], o_Q7=self.dfi.phases[0].rddata[databits+i],
+                         o_Q6=self.dfi.phases[1].rddata[i], o_Q5=self.dfi.phases[1].rddata[databits+i],
+                         o_Q4=self.dfi.phases[2].rddata[i], o_Q3=self.dfi.phases[2].rddata[databits+i],
+                         o_Q2=self.dfi.phases[3].rddata[i], o_Q1=self.dfi.phases[3].rddata[databits+i]
                 ),
                 Instance("ODELAYE2",
-                    p_DELAY_SRC="ODATAIN", p_SIGNAL_PATTERN="DATA",
-                    p_CINVCTRL_SEL="FALSE", p_HIGH_PERFORMANCE_MODE="TRUE", p_REFCLK_FREQUENCY=200.0,
-                    p_PIPE_SEL="FALSE", p_ODELAY_TYPE="VARIABLE", p_ODELAY_VALUE=0,
+                         p_DELAY_SRC="ODATAIN", p_SIGNAL_PATTERN="DATA",
+                         p_CINVCTRL_SEL="FALSE", p_HIGH_PERFORMANCE_MODE="TRUE", p_REFCLK_FREQUENCY=200.0,
+                         p_PIPE_SEL="FALSE", p_ODELAY_TYPE="VARIABLE", p_ODELAY_VALUE=0,
 
-                    i_C=ClockSignal(),
-                    i_LD=self._dly_sel.storage[i//8] & self._wdly_dq_rst.re,
-                    i_CE=self._dly_sel.storage[i//8] & self._wdly_dq_inc.re,
-                    i_LDPIPEEN=0, i_INC=1,
+                         i_C=ClockSignal(),
+                         i_LD=self._dly_sel.storage[i//8] & self._wdly_dq_rst.re,
+                         i_CE=self._dly_sel.storage[i//8] & self._wdly_dq_inc.re,
+                         i_LDPIPEEN=0, i_INC=1,
 
-                    o_ODATAIN=dq_o_nodelay, o_DATAOUT=dq_o_delayed
+                         o_ODATAIN=dq_o_nodelay, o_DATAOUT=dq_o_delayed
                 ),
                 Instance("IDELAYE2",
-                    p_DELAY_SRC="IDATAIN", p_SIGNAL_PATTERN="DATA",
-                    p_CINVCTRL_SEL="FALSE", p_HIGH_PERFORMANCE_MODE="TRUE", p_REFCLK_FREQUENCY=200.0,
-                    p_PIPE_SEL="FALSE", p_IDELAY_TYPE="VARIABLE", p_IDELAY_VALUE=6,
+                         p_DELAY_SRC="IDATAIN", p_SIGNAL_PATTERN="DATA",
+                         p_CINVCTRL_SEL="FALSE", p_HIGH_PERFORMANCE_MODE="TRUE", p_REFCLK_FREQUENCY=200.0,
+                         p_PIPE_SEL="FALSE", p_IDELAY_TYPE="VARIABLE", p_IDELAY_VALUE=6,
 
-                    i_C=ClockSignal(),
-                    i_LD=self._dly_sel.storage[i//8] & self._rdly_dq_rst.re,
-                    i_CE=self._dly_sel.storage[i//8] & self._rdly_dq_inc.re,
-                    i_LDPIPEEN=0, i_INC=1,
+                         i_C=ClockSignal(),
+                         i_LD=self._dly_sel.storage[i//8] & self._rdly_dq_rst.re,
+                         i_CE=self._dly_sel.storage[i//8] & self._rdly_dq_inc.re,
+                         i_LDPIPEEN=0, i_INC=1,
 
-                    i_IDATAIN=dq_i_nodelay, o_DATAOUT=dq_i_delayed
+                         i_IDATAIN=dq_i_nodelay, o_DATAOUT=dq_i_delayed
                 ),
                 Instance("IOBUF",
-                    i_I=dq_o_delayed, o_O=dq_i_nodelay, i_T=dq_t,
-                    io_IO=pads.dq[i]
+                         i_I=dq_o_delayed, o_O=dq_i_nodelay, i_T=dq_t,
+                         io_IO=pads.dq[i]
                 )
             ]
 
index 86208d5fbbffeb568ac7220d3a66a49e278aa64c..11a92ef6271805f4dca8707e00707abffcc82603 100644 (file)
@@ -146,55 +146,55 @@ class S6DDRPHY(Module):
         for i in range(databits//8):
             # DQS output
             self.specials += Instance("ODDR2",
-                p_DDR_ALIGNMENT=dqs_ddr_alignment,
-                p_INIT=0,
-                p_SRTYPE="ASYNC",
+                                      p_DDR_ALIGNMENT=dqs_ddr_alignment,
+                                      p_INIT=0,
+                                      p_SRTYPE="ASYNC",
 
-                i_C0=sdram_half_clk,
-                i_C1=sdram_half_clk_n,
+                                      i_C0=sdram_half_clk,
+                                      i_C1=sdram_half_clk_n,
 
-                i_CE=1,
-                i_D0=0,
-                i_D1=1,
-                i_R=0,
-                i_S=0,
+                                      i_CE=1,
+                                      i_D0=0,
+                                      i_D1=1,
+                                      i_R=0,
+                                      i_S=0,
 
-                o_Q=dqs_o[i]
+                                      o_Q=dqs_o[i]
             )
 
             # DQS tristate cmd
             self.specials += Instance("ODDR2",
-                p_DDR_ALIGNMENT=dqs_ddr_alignment,
-                p_INIT=0,
-                p_SRTYPE="ASYNC",
+                                      p_DDR_ALIGNMENT=dqs_ddr_alignment,
+                                      p_INIT=0,
+                                      p_SRTYPE="ASYNC",
 
-                i_C0=sdram_half_clk,
-                i_C1=sdram_half_clk_n,
+                                      i_C0=sdram_half_clk,
+                                      i_C1=sdram_half_clk_n,
 
-                i_CE=1,
-                i_D0=dqs_t_d0,
-                i_D1=dqs_t_d1,
-                i_R=0,
-                i_S=0,
+                                      i_CE=1,
+                                      i_D0=dqs_t_d0,
+                                      i_D1=dqs_t_d1,
+                                      i_R=0,
+                                      i_S=0,
 
-                o_Q=dqs_t[i]
+                                      o_Q=dqs_t[i]
             )
 
             # DQS tristate buffer
             if hasattr(pads, "dqs_n"):
                 self.specials += Instance("OBUFTDS",
-                    i_I=dqs_o[i],
-                    i_T=dqs_t[i],
+                                          i_I=dqs_o[i],
+                                          i_T=dqs_t[i],
 
-                    o_O=pads.dqs[i],
-                    o_OB=pads.dqs_n[i],
+                                          o_O=pads.dqs[i],
+                                          o_OB=pads.dqs_n[i],
                 )
             else:
                 self.specials += Instance("OBUFT",
-                    i_I=dqs_o[i],
-                    i_T=dqs_t[i],
+                                          i_I=dqs_o[i],
+                                          i_T=dqs_t[i],
 
-                    o_O=pads.dqs[i]
+                                          o_O=pads.dqs[i]
                 )
 
         sd_sdram_half += postamble.eq(drive_dqs)
@@ -233,67 +233,67 @@ class S6DDRPHY(Module):
         for i in range(databits):
             # Data serializer
             self.specials += Instance("OSERDES2",
-                p_DATA_WIDTH=4,
-                p_DATA_RATE_OQ="SDR",
-                p_DATA_RATE_OT="SDR",
-                p_SERDES_MODE="NONE",
-                p_OUTPUT_MODE="SINGLE_ENDED",
-
-                o_OQ=dq_o[i],
-                i_OCE=1,
-                i_CLK0=sdram_full_wr_clk,
-                i_CLK1=0,
-                i_IOCE=self.clk4x_wr_strb,
-                i_RST=0,
-                i_CLKDIV=sys_clk,
-
-                i_D1=dq_wrdata[wr_bitslip+3][i],
-                i_D2=dq_wrdata[wr_bitslip+2][i],
-                i_D3=dq_wrdata[wr_bitslip+1][i],
-                i_D4=dq_wrdata[wr_bitslip+0][i],
-
-                o_TQ=dq_t[i],
-                i_T1=drive_dq_n[(wr_bitslip+3)//4],
-                i_T2=drive_dq_n[(wr_bitslip+2)//4],
-                i_T3=drive_dq_n[(wr_bitslip+1)//4],
-                i_T4=drive_dq_n[(wr_bitslip+0)//4],
-                i_TRAIN=0,
-                i_TCE=1,
-                i_SHIFTIN1=0,
-                i_SHIFTIN2=0,
-                i_SHIFTIN3=0,
-                i_SHIFTIN4=0,
+                                      p_DATA_WIDTH=4,
+                                      p_DATA_RATE_OQ="SDR",
+                                      p_DATA_RATE_OT="SDR",
+                                      p_SERDES_MODE="NONE",
+                                      p_OUTPUT_MODE="SINGLE_ENDED",
+
+                                      o_OQ=dq_o[i],
+                                      i_OCE=1,
+                                      i_CLK0=sdram_full_wr_clk,
+                                      i_CLK1=0,
+                                      i_IOCE=self.clk4x_wr_strb,
+                                      i_RST=0,
+                                      i_CLKDIV=sys_clk,
+
+                                      i_D1=dq_wrdata[wr_bitslip+3][i],
+                                      i_D2=dq_wrdata[wr_bitslip+2][i],
+                                      i_D3=dq_wrdata[wr_bitslip+1][i],
+                                      i_D4=dq_wrdata[wr_bitslip+0][i],
+
+                                      o_TQ=dq_t[i],
+                                      i_T1=drive_dq_n[(wr_bitslip+3)//4],
+                                      i_T2=drive_dq_n[(wr_bitslip+2)//4],
+                                      i_T3=drive_dq_n[(wr_bitslip+1)//4],
+                                      i_T4=drive_dq_n[(wr_bitslip+0)//4],
+                                      i_TRAIN=0,
+                                      i_TCE=1,
+                                      i_SHIFTIN1=0,
+                                      i_SHIFTIN2=0,
+                                      i_SHIFTIN3=0,
+                                      i_SHIFTIN4=0,
             )
 
             # Data deserializer
             self.specials += Instance("ISERDES2",
-                p_DATA_WIDTH=4,
-                p_DATA_RATE="SDR",
-                p_BITSLIP_ENABLE="TRUE",
-                p_SERDES_MODE="NONE",
-                p_INTERFACE_TYPE="RETIMED",
-
-                i_D=dq_i[i],
-                i_CE0=1,
-                i_CLK0=sdram_full_rd_clk,
-                i_CLK1=0,
-                i_IOCE=self.clk4x_rd_strb,
-                i_RST=ResetSignal(),
-                i_CLKDIV=sys_clk,
-                i_BITSLIP=bitslip_inc,
-
-                o_Q1=d_dfi[0*nphases+0].rddata[i+databits],
-                o_Q2=d_dfi[0*nphases+0].rddata[i],
-                o_Q3=d_dfi[0*nphases+1].rddata[i+databits],
-                o_Q4=d_dfi[0*nphases+1].rddata[i],
+                                      p_DATA_WIDTH=4,
+                                      p_DATA_RATE="SDR",
+                                      p_BITSLIP_ENABLE="TRUE",
+                                      p_SERDES_MODE="NONE",
+                                      p_INTERFACE_TYPE="RETIMED",
+
+                                      i_D=dq_i[i],
+                                      i_CE0=1,
+                                      i_CLK0=sdram_full_rd_clk,
+                                      i_CLK1=0,
+                                      i_IOCE=self.clk4x_rd_strb,
+                                      i_RST=ResetSignal(),
+                                      i_CLKDIV=sys_clk,
+                                      i_BITSLIP=bitslip_inc,
+
+                                      o_Q1=d_dfi[0*nphases+0].rddata[i+databits],
+                                      o_Q2=d_dfi[0*nphases+0].rddata[i],
+                                      o_Q3=d_dfi[0*nphases+1].rddata[i+databits],
+                                      o_Q4=d_dfi[0*nphases+1].rddata[i],
             )
 
             # Data buffer
             self.specials += Instance("IOBUF",
-                i_I=dq_o[i],
-                o_O=dq_i[i],
-                i_T=dq_t[i],
-                io_IO=pads.dq[i]
+                                      i_I=dq_o[i],
+                                      o_O=dq_i[i],
+                                      i_T=dq_t[i],
+                                      io_IO=pads.dq[i]
             )
 
         dq_wrdata_mask = []
@@ -305,31 +305,31 @@ class S6DDRPHY(Module):
         for i in range(databits//8):
             # Mask serializer
             self.specials += Instance("OSERDES2",
-                p_DATA_WIDTH=4,
-                p_DATA_RATE_OQ="SDR",
-                p_DATA_RATE_OT="SDR",
-                p_SERDES_MODE="NONE",
-                p_OUTPUT_MODE="SINGLE_ENDED",
-
-                o_OQ=pads.dm[i],
-                i_OCE=1,
-                i_CLK0=sdram_full_wr_clk,
-                i_CLK1=0,
-                i_IOCE=self.clk4x_wr_strb,
-                i_RST=0,
-                i_CLKDIV=sys_clk,
-
-                i_D1=dq_wrdata_mask[wr_bitslip+3][i],
-                i_D2=dq_wrdata_mask[wr_bitslip+2][i],
-                i_D3=dq_wrdata_mask[wr_bitslip+1][i],
-                i_D4=dq_wrdata_mask[wr_bitslip+0][i],
-
-                i_TRAIN=0,
-                i_TCE=0,
-                i_SHIFTIN1=0,
-                i_SHIFTIN2=0,
-                i_SHIFTIN3=0,
-                i_SHIFTIN4=0,
+                                      p_DATA_WIDTH=4,
+                                      p_DATA_RATE_OQ="SDR",
+                                      p_DATA_RATE_OT="SDR",
+                                      p_SERDES_MODE="NONE",
+                                      p_OUTPUT_MODE="SINGLE_ENDED",
+
+                                      o_OQ=pads.dm[i],
+                                      i_OCE=1,
+                                      i_CLK0=sdram_full_wr_clk,
+                                      i_CLK1=0,
+                                      i_IOCE=self.clk4x_wr_strb,
+                                      i_RST=0,
+                                      i_CLKDIV=sys_clk,
+
+                                      i_D1=dq_wrdata_mask[wr_bitslip+3][i],
+                                      i_D2=dq_wrdata_mask[wr_bitslip+2][i],
+                                      i_D3=dq_wrdata_mask[wr_bitslip+1][i],
+                                      i_D4=dq_wrdata_mask[wr_bitslip+0][i],
+
+                                      i_TRAIN=0,
+                                      i_TCE=0,
+                                      i_SHIFTIN1=0,
+                                      i_SHIFTIN2=0,
+                                      i_SHIFTIN3=0,
+                                      i_SHIFTIN4=0,
             )
 
         #
index 944d69e1ffa5104ed2056715b08aabdac2bae48a..538093859347e681874575898ceb9e313f2d6b65 100644 (file)
@@ -40,7 +40,8 @@ class Bank(Module):
             )
 
         self.specials.mem = mem = Memory(data_width, nrows*ncols)
-        self.specials.write_port = write_port = mem.get_port(write_capable=True, we_granularity=8)
+        self.specials.write_port = write_port = mem.get_port(write_capable=True,
+                                                             we_granularity=8)
         self.specials.read_port = read_port = mem.get_port(async_read=True)
         self.comb += [
             If(active,
index 202dabfd76f44a097ea219f84be015648c77fc79..8c7f639dcc7bebac1c915d6a71a60736fa4963d5 100644 (file)
@@ -41,16 +41,16 @@ class MiniconTB(Module):
         self.pads = pads
 
         self.specials += Instance("mt48lc4m16a2",
-            io_Dq=pads.dq,
-            i_Addr=pads.a,
-            i_Ba=pads.ba,
-            i_Clk=ClockSignal(),
-            i_Cke=pads.cke,
-            i_Cs_n=pads.cs_n,
-            i_Ras_n=pads.ras_n,
-            i_Cas_n=pads.cas_n,
-            i_We_n=pads.we_n,
-            i_Dqm=pads.dm
+                                  io_Dq=pads.dq,
+                                  i_Addr=pads.a,
+                                  i_Ba=pads.ba,
+                                  i_Clk=ClockSignal(),
+                                  i_Cke=pads.cke,
+                                  i_Cs_n=pads.cs_n,
+                                  i_Ras_n=pads.ras_n,
+                                  i_Cas_n=pads.cas_n,
+                                  i_We_n=pads.we_n,
+                                  i_Dqm=pads.dm
         )
 
     def genxfers(self):
index c87daa663a5451e389b1bcc2cabcf3ec09256c26..673530c63d87e5f35fb8580f99b111237b5987c6 100644 (file)
@@ -21,21 +21,21 @@ class MXCRG(Module):
         in_period = float(Fraction(1000000000)/Fraction(infreq))
 
         self.specials += Instance("mxcrg",
-            Instance.Parameter("in_period", in_period),
-            Instance.Parameter("f_mult", ratio.numerator),
-            Instance.Parameter("f_div", ratio.denominator),
-            Instance.Input("clk50_pad", pads.clk50),
-            Instance.Input("trigger_reset", pads.trigger_reset),
-
-            Instance.Output("sys_clk", self.cd_sys.clk),
-            Instance.Output("sys_rst", self.cd_sys.rst),
-            Instance.Output("clk2x_270", self.cd_sdram_half.clk),
-            Instance.Output("clk4x_wr", self.cd_sdram_full_wr.clk),
-            Instance.Output("clk4x_rd", self.cd_sdram_full_rd.clk),
-            Instance.Output("base50_clk", self.cd_base50.clk),
-
-            Instance.Output("clk4x_wr_strb", self.clk4x_wr_strb),
-            Instance.Output("clk4x_rd_strb", self.clk4x_rd_strb),
-            Instance.Output("norflash_rst_n", pads.norflash_rst_n),
-            Instance.Output("ddr_clk_pad_p", pads.ddr_clk_p),
-            Instance.Output("ddr_clk_pad_n", pads.ddr_clk_n))
+                                  Instance.Parameter("in_period", in_period),
+                                  Instance.Parameter("f_mult", ratio.numerator),
+                                  Instance.Parameter("f_div", ratio.denominator),
+                                  Instance.Input("clk50_pad", pads.clk50),
+                                  Instance.Input("trigger_reset", pads.trigger_reset),
+
+                                  Instance.Output("sys_clk", self.cd_sys.clk),
+                                  Instance.Output("sys_rst", self.cd_sys.rst),
+                                  Instance.Output("clk2x_270", self.cd_sdram_half.clk),
+                                  Instance.Output("clk4x_wr", self.cd_sdram_full_wr.clk),
+                                  Instance.Output("clk4x_rd", self.cd_sdram_full_rd.clk),
+                                  Instance.Output("base50_clk", self.cd_base50.clk),
+
+                                  Instance.Output("clk4x_wr_strb", self.clk4x_wr_strb),
+                                  Instance.Output("clk4x_rd_strb", self.clk4x_rd_strb),
+                                  Instance.Output("norflash_rst_n", pads.norflash_rst_n),
+                                  Instance.Output("ddr_clk_pad_p", pads.ddr_clk_p),
+                                  Instance.Output("ddr_clk_pad_n", pads.ddr_clk_n))
index 4ef8a6f350eb981b66246fe7f605c1094ef9544a..1d96d280b6eef096ec60bcef089df1849e64336e 100644 (file)
@@ -11,10 +11,10 @@ from misoclib.soc import SoC
 
 class SDRAMSoC(SoC):
     csr_map = {
-        "sdram":                8,
-        "wishbone2lasmi":        9,
-        "memtest_w":            10,
-        "memtest_r":            11
+        "sdram":           8,
+        "wishbone2lasmi":  9,
+        "memtest_w":      10,
+        "memtest_r":      11
     }
     csr_map.update(SoC.csr_map)
 
@@ -35,7 +35,10 @@ class SDRAMSoC(SoC):
             raise NotImplementedError("Minicon only supports SDR memtype for now (" + phy.settings.memtype + ")")
 
         # Core
-        self.submodules.sdram = SDRAMCore(phy, phy.module.geom_settings, phy.module.timing_settings, self.sdram_controller_settings)
+        self.submodules.sdram = SDRAMCore(phy,
+                                          phy.module.geom_settings,
+                                          phy.module.timing_settings,
+                                          self.sdram_controller_settings)
 
         dfi_databits_divisor = 1 if phy.settings.memtype == "SDR" else 2
         sdram_width = phy.settings.dfi_databits//dfi_databits_divisor
index 274d3053342ce8efaaffcf3e705af195f725a266..d13b1fb9d15b3952c115380706e591ec46425b7a 100644 (file)
@@ -39,31 +39,31 @@ class Clocking(Module, AutoCSR):
             self._pll_drdy.status.eq(1)
         )
         self.specials += Instance("PLL_ADV",
-            p_CLKFBOUT_MULT=10,
-            p_CLKOUT0_DIVIDE=1,   # pix10x
-            p_CLKOUT1_DIVIDE=5,   # pix2x
-            p_CLKOUT2_DIVIDE=10,  # pix
-            p_COMPENSATION="INTERNAL",
+                                  p_CLKFBOUT_MULT=10,
+                                  p_CLKOUT0_DIVIDE=1,   # pix10x
+                                  p_CLKOUT1_DIVIDE=5,   # pix2x
+                                  p_CLKOUT2_DIVIDE=10,  # pix
+                                  p_COMPENSATION="INTERNAL",
 
-            i_CLKINSEL=1,
-            i_CLKIN1=clk_se,
-            o_CLKOUT0=pll_clk0, o_CLKOUT1=pll_clk1, o_CLKOUT2=pll_clk2,
-            o_CLKFBOUT=clkfbout, i_CLKFBIN=clkfbout,
-            o_LOCKED=pll_locked, i_RST=self._pll_reset.storage,
+                                  i_CLKINSEL=1,
+                                  i_CLKIN1=clk_se,
+                                  o_CLKOUT0=pll_clk0, o_CLKOUT1=pll_clk1, o_CLKOUT2=pll_clk2,
+                                  o_CLKFBOUT=clkfbout, i_CLKFBIN=clkfbout,
+                                  o_LOCKED=pll_locked, i_RST=self._pll_reset.storage,
 
-            i_DADDR=self._pll_adr.storage,
-            o_DO=self._pll_dat_r.status,
-            i_DI=self._pll_dat_w.storage,
-            i_DEN=self._pll_read.re | self._pll_write.re,
-            i_DWE=self._pll_write.re,
-            o_DRDY=pll_drdy,
-            i_DCLK=ClockSignal())
+                                  i_DADDR=self._pll_adr.storage,
+                                  o_DO=self._pll_dat_r.status,
+                                  i_DI=self._pll_dat_w.storage,
+                                  i_DEN=self._pll_read.re | self._pll_write.re,
+                                  i_DWE=self._pll_write.re,
+                                  o_DRDY=pll_drdy,
+                                  i_DCLK=ClockSignal())
 
         locked_async = Signal()
         self.specials += [
             Instance("BUFPLL", p_DIVIDE=5,
-                i_PLLIN=pll_clk0, i_GCLK=ClockSignal("pix2x"), i_LOCKED=pll_locked,
-                o_IOCLK=self._cd_pix10x.clk, o_LOCK=locked_async, o_SERDESSTROBE=self.serdesstrobe),
+                     i_PLLIN=pll_clk0, i_GCLK=ClockSignal("pix2x"), i_LOCKED=pll_locked,
+                     o_IOCLK=self._cd_pix10x.clk, o_LOCK=locked_async, o_SERDESSTROBE=self.serdesstrobe),
             Instance("BUFG", i_I=pll_clk1, o_O=self._cd_pix2x.clk),
             Instance("BUFG", i_I=pll_clk2, o_O=self._cd_pix.clk),
             MultiReg(locked_async, self.locked, "sys")
index 3f8d9bf4b791fb1d5710309cb23bf172ccff36cf..8e91ad04acc868cacc27980acba0169edb54d891 100644 (file)
@@ -30,27 +30,27 @@ class DataCapture(Module, AutoCSR):
         delay_slave_rst = Signal()
         delay_slave_busy = Signal()
         self.specials += Instance("IODELAY2",
-            p_SERDES_MODE="MASTER",
-            p_DELAY_SRC="IDATAIN", p_IDELAY_TYPE="DIFF_PHASE_DETECTOR",
-            p_COUNTER_WRAPAROUND="STAY_AT_LIMIT", p_DATA_RATE="SDR",
+                                  p_SERDES_MODE="MASTER",
+                                  p_DELAY_SRC="IDATAIN", p_IDELAY_TYPE="DIFF_PHASE_DETECTOR",
+                                  p_COUNTER_WRAPAROUND="STAY_AT_LIMIT", p_DATA_RATE="SDR",
 
-            i_IDATAIN=pad_se, o_DATAOUT=pad_delayed_master,
-            i_CLK=ClockSignal("pix2x"), i_IOCLK0=ClockSignal("pix10x"),
+                                  i_IDATAIN=pad_se, o_DATAOUT=pad_delayed_master,
+                                  i_CLK=ClockSignal("pix2x"), i_IOCLK0=ClockSignal("pix10x"),
 
-            i_INC=delay_inc, i_CE=delay_ce,
-            i_CAL=delay_master_cal, i_RST=delay_master_rst, o_BUSY=delay_master_busy,
-            i_T=1)
+                                  i_INC=delay_inc, i_CE=delay_ce,
+                                  i_CAL=delay_master_cal, i_RST=delay_master_rst, o_BUSY=delay_master_busy,
+                                  i_T=1)
         self.specials += Instance("IODELAY2",
-            p_SERDES_MODE="SLAVE",
-            p_DELAY_SRC="IDATAIN", p_IDELAY_TYPE="DIFF_PHASE_DETECTOR",
-            p_COUNTER_WRAPAROUND="WRAPAROUND", p_DATA_RATE="SDR",
+                                  p_SERDES_MODE="SLAVE",
+                                  p_DELAY_SRC="IDATAIN", p_IDELAY_TYPE="DIFF_PHASE_DETECTOR",
+                                  p_COUNTER_WRAPAROUND="WRAPAROUND", p_DATA_RATE="SDR",
 
-            i_IDATAIN=pad_se, o_DATAOUT=pad_delayed_slave,
-            i_CLK=ClockSignal("pix2x"), i_IOCLK0=ClockSignal("pix10x"),
+                                  i_IDATAIN=pad_se, o_DATAOUT=pad_delayed_slave,
+                                  i_CLK=ClockSignal("pix2x"), i_IOCLK0=ClockSignal("pix10x"),
 
-            i_INC=delay_inc, i_CE=delay_ce,
-            i_CAL=delay_slave_cal, i_RST=delay_slave_rst, o_BUSY=delay_slave_busy,
-            i_T=1)
+                                  i_INC=delay_inc, i_CE=delay_ce,
+                                  i_CAL=delay_slave_cal, i_RST=delay_slave_rst, o_BUSY=delay_slave_busy,
+                                  i_T=1)
 
         dsr2 = Signal(5)
         pd_valid = Signal()
@@ -58,32 +58,32 @@ class DataCapture(Module, AutoCSR):
         pd_edge = Signal()
         pd_cascade = Signal()
         self.specials += Instance("ISERDES2",
-            p_SERDES_MODE="MASTER",
-            p_BITSLIP_ENABLE="FALSE", p_DATA_RATE="SDR", p_DATA_WIDTH=5,
-            p_INTERFACE_TYPE="RETIMED",
+                                  p_SERDES_MODE="MASTER",
+                                  p_BITSLIP_ENABLE="FALSE", p_DATA_RATE="SDR", p_DATA_WIDTH=5,
+                                  p_INTERFACE_TYPE="RETIMED",
 
-            i_D=pad_delayed_master,
-            o_Q4=dsr2[4], o_Q3=dsr2[3], o_Q2=dsr2[2], o_Q1=dsr2[1],
+                                  i_D=pad_delayed_master,
+                                  o_Q4=dsr2[4], o_Q3=dsr2[3], o_Q2=dsr2[2], o_Q1=dsr2[1],
 
-            i_BITSLIP=0, i_CE0=1, i_RST=0,
-            i_CLK0=ClockSignal("pix10x"), i_CLKDIV=ClockSignal("pix2x"),
-            i_IOCE=self.serdesstrobe,
+                                  i_BITSLIP=0, i_CE0=1, i_RST=0,
+                                  i_CLK0=ClockSignal("pix10x"), i_CLKDIV=ClockSignal("pix2x"),
+                                  i_IOCE=self.serdesstrobe,
 
-            o_VALID=pd_valid, o_INCDEC=pd_incdec,
-            i_SHIFTIN=pd_edge, o_SHIFTOUT=pd_cascade)
+                                  o_VALID=pd_valid, o_INCDEC=pd_incdec,
+                                  i_SHIFTIN=pd_edge, o_SHIFTOUT=pd_cascade)
         self.specials += Instance("ISERDES2",
-            p_SERDES_MODE="SLAVE",
-            p_BITSLIP_ENABLE="FALSE", p_DATA_RATE="SDR", p_DATA_WIDTH=5,
-            p_INTERFACE_TYPE="RETIMED",
+                                  p_SERDES_MODE="SLAVE",
+                                  p_BITSLIP_ENABLE="FALSE", p_DATA_RATE="SDR", p_DATA_WIDTH=5,
+                                  p_INTERFACE_TYPE="RETIMED",
 
-            i_D=pad_delayed_slave,
-            o_Q4=dsr2[0],
+                                  i_D=pad_delayed_slave,
+                                  o_Q4=dsr2[0],
 
-            i_BITSLIP=0, i_CE0=1, i_RST=0,
-            i_CLK0=ClockSignal("pix10x"), i_CLKDIV=ClockSignal("pix2x"),
-            i_IOCE=self.serdesstrobe,
+                                  i_BITSLIP=0, i_CE0=1, i_RST=0,
+                                  i_CLK0=ClockSignal("pix10x"), i_CLKDIV=ClockSignal("pix2x"),
+                                  i_IOCE=self.serdesstrobe,
 
-            i_SHIFTIN=pd_cascade, o_SHIFTOUT=pd_edge)
+                                  i_SHIFTIN=pd_cascade, o_SHIFTOUT=pd_edge)
 
         # Phase error accumulator
         lateness = Signal(ntbits, reset=2**(ntbits - 1))
index 65060e31374a489a37b1fffe8188d93fae069fec..0ba8b4b489c2591526f99c3bad6a4dbfe49850e5 100644 (file)
@@ -104,30 +104,30 @@ class _EncoderSerializer(Module):
         pad_se = Signal()
         self.specials += [
             Instance("OSERDES2",
-                p_DATA_WIDTH=5, p_DATA_RATE_OQ="SDR", p_DATA_RATE_OT="SDR",
-                p_SERDES_MODE="MASTER", p_OUTPUT_MODE="DIFFERENTIAL",
-
-                o_OQ=pad_se,
-                i_OCE=1, i_IOCE=serdesstrobe, i_RST=0,
-                i_CLK0=ClockSignal("pix10x"), i_CLK1=0, i_CLKDIV=ClockSignal("pix2x"),
-                i_D1=ed_2x[4], i_D2=0, i_D3=0, i_D4=0,
-                i_T1=0, i_T2=0, i_T3=0, i_T4=0,
-                i_TRAIN=0, i_TCE=1,
-                i_SHIFTIN1=1, i_SHIFTIN2=1,
-                i_SHIFTIN3=cascade_do, i_SHIFTIN4=cascade_to,
-                o_SHIFTOUT1=cascade_di, o_SHIFTOUT2=cascade_ti),
+                     p_DATA_WIDTH=5, p_DATA_RATE_OQ="SDR", p_DATA_RATE_OT="SDR",
+                     p_SERDES_MODE="MASTER", p_OUTPUT_MODE="DIFFERENTIAL",
+
+                     o_OQ=pad_se,
+                     i_OCE=1, i_IOCE=serdesstrobe, i_RST=0,
+                     i_CLK0=ClockSignal("pix10x"), i_CLK1=0, i_CLKDIV=ClockSignal("pix2x"),
+                     i_D1=ed_2x[4], i_D2=0, i_D3=0, i_D4=0,
+                     i_T1=0, i_T2=0, i_T3=0, i_T4=0,
+                     i_TRAIN=0, i_TCE=1,
+                     i_SHIFTIN1=1, i_SHIFTIN2=1,
+                     i_SHIFTIN3=cascade_do, i_SHIFTIN4=cascade_to,
+                     o_SHIFTOUT1=cascade_di, o_SHIFTOUT2=cascade_ti),
             Instance("OSERDES2",
-                p_DATA_WIDTH=5, p_DATA_RATE_OQ="SDR", p_DATA_RATE_OT="SDR",
-                p_SERDES_MODE="SLAVE", p_OUTPUT_MODE="DIFFERENTIAL",
-
-                i_OCE=1, i_IOCE=serdesstrobe, i_RST=0,
-                i_CLK0=ClockSignal("pix10x"), i_CLK1=0, i_CLKDIV=ClockSignal("pix2x"),
-                i_D1=ed_2x[0], i_D2=ed_2x[1], i_D3=ed_2x[2], i_D4=ed_2x[3],
-                i_T1=0, i_T2=0, i_T3=0, i_T4=0,
-                i_TRAIN=0, i_TCE=1,
-                i_SHIFTIN1=cascade_di, i_SHIFTIN2=cascade_ti,
-                i_SHIFTIN3=1, i_SHIFTIN4=1,
-                o_SHIFTOUT3=cascade_do, o_SHIFTOUT4=cascade_to),
+                     p_DATA_WIDTH=5, p_DATA_RATE_OQ="SDR", p_DATA_RATE_OT="SDR",
+                     p_SERDES_MODE="SLAVE", p_OUTPUT_MODE="DIFFERENTIAL",
+
+                     i_OCE=1, i_IOCE=serdesstrobe, i_RST=0,
+                     i_CLK0=ClockSignal("pix10x"), i_CLK1=0, i_CLKDIV=ClockSignal("pix2x"),
+                     i_D1=ed_2x[0], i_D2=ed_2x[1], i_D3=ed_2x[2], i_D4=ed_2x[3],
+                     i_T1=0, i_T2=0, i_T3=0, i_T4=0,
+                     i_TRAIN=0, i_TCE=1,
+                     i_SHIFTIN1=cascade_di, i_SHIFTIN2=cascade_ti,
+                     i_SHIFTIN3=1, i_SHIFTIN4=1,
+                     o_SHIFTOUT3=cascade_do, o_SHIFTOUT4=cascade_to),
             Instance("OBUFDS", i_I=pad_se, o_O=pad_p, o_OB=pad_n)
         ]
 
index 7103b631ed37259d4a0e6f4e03cc20074b081d6d..d4958ff98dd8eb7b0a8832f24860ad3267f72407 100644 (file)
@@ -81,13 +81,13 @@ class _Clocking(Module, AutoCSR):
         pix_progdone = Signal()
         pix_locked = Signal()
         self.specials += Instance("DCM_CLKGEN",
-            p_CLKFXDV_DIVIDE=2, p_CLKFX_DIVIDE=4, p_CLKFX_MD_MAX=1.0, p_CLKFX_MULTIPLY=2,
-            p_CLKIN_PERIOD=20.0, p_SPREAD_SPECTRUM="NONE", p_STARTUP_WAIT="FALSE",
+                                  p_CLKFXDV_DIVIDE=2, p_CLKFX_DIVIDE=4, p_CLKFX_MD_MAX=1.0, p_CLKFX_MULTIPLY=2,
+                                  p_CLKIN_PERIOD=20.0, p_SPREAD_SPECTRUM="NONE", p_STARTUP_WAIT="FALSE",
 
-            i_CLKIN=ClockSignal("base50"), o_CLKFX=clk_pix_unbuffered,
-            i_PROGCLK=ClockSignal(), i_PROGDATA=pix_progdata, i_PROGEN=pix_progen,
-            o_PROGDONE=pix_progdone, o_LOCKED=pix_locked,
-            i_FREEZEDCM=0, i_RST=ResetSignal())
+                                  i_CLKIN=ClockSignal("base50"), o_CLKFX=clk_pix_unbuffered,
+                                  i_PROGCLK=ClockSignal(), i_PROGDATA=pix_progdata, i_PROGEN=pix_progen,
+                                  o_PROGDONE=pix_progdone, o_LOCKED=pix_locked,
+                                  i_FREEZEDCM=0, i_RST=ResetSignal())
 
         remaining_bits = Signal(max=11)
         transmitting = Signal()
@@ -142,29 +142,29 @@ class _Clocking(Module, AutoCSR):
             )
             self.specials += [
                 Instance("PLL_ADV",
-                    p_CLKFBOUT_MULT=10,
-                    p_CLKOUT0_DIVIDE=1,   # pix10x
-                    p_CLKOUT1_DIVIDE=5,   # pix2x
-                    p_CLKOUT2_DIVIDE=10,  # pix
-                    p_COMPENSATION="INTERNAL",
-
-                    i_CLKINSEL=1,
-                    i_CLKIN1=clk_pix_unbuffered,
-                    o_CLKOUT0=pll_clk0, o_CLKOUT1=pll_clk1, o_CLKOUT2=pll_clk2,
-                    o_CLKFBOUT=clkfbout, i_CLKFBIN=clkfbout,
-                    o_LOCKED=pll_locked,
-                    i_RST=~pix_locked | self._pll_reset.storage,
-
-                    i_DADDR=self._pll_adr.storage,
-                    o_DO=self._pll_dat_r.status,
-                    i_DI=self._pll_dat_w.storage,
-                    i_DEN=self._pll_read.re | self._pll_write.re,
-                    i_DWE=self._pll_write.re,
-                    o_DRDY=pll_drdy,
-                    i_DCLK=ClockSignal()),
+                         p_CLKFBOUT_MULT=10,
+                         p_CLKOUT0_DIVIDE=1,   # pix10x
+                         p_CLKOUT1_DIVIDE=5,   # pix2x
+                         p_CLKOUT2_DIVIDE=10,  # pix
+                         p_COMPENSATION="INTERNAL",
+
+                         i_CLKINSEL=1,
+                         i_CLKIN1=clk_pix_unbuffered,
+                         o_CLKOUT0=pll_clk0, o_CLKOUT1=pll_clk1, o_CLKOUT2=pll_clk2,
+                         o_CLKFBOUT=clkfbout, i_CLKFBIN=clkfbout,
+                         o_LOCKED=pll_locked,
+                         i_RST=~pix_locked | self._pll_reset.storage,
+
+                         i_DADDR=self._pll_adr.storage,
+                         o_DO=self._pll_dat_r.status,
+                         i_DI=self._pll_dat_w.storage,
+                         i_DEN=self._pll_read.re | self._pll_write.re,
+                         i_DWE=self._pll_write.re,
+                         o_DRDY=pll_drdy,
+                         i_DCLK=ClockSignal()),
                 Instance("BUFPLL", p_DIVIDE=5,
-                    i_PLLIN=pll_clk0, i_GCLK=ClockSignal("pix2x"), i_LOCKED=pll_locked,
-                    o_IOCLK=self.cd_pix10x.clk, o_LOCK=locked_async, o_SERDESSTROBE=self.serdesstrobe),
+                         i_PLLIN=pll_clk0, i_GCLK=ClockSignal("pix2x"), i_LOCKED=pll_locked,
+                         o_IOCLK=self.cd_pix10x.clk, o_LOCK=locked_async, o_SERDESSTROBE=self.serdesstrobe),
                 Instance("BUFG", i_I=pll_clk1, o_O=self.cd_pix2x.clk),
                 Instance("BUFG", name="dviout_pix_bufg", i_I=pll_clk2, o_O=self.cd_pix.clk),
                 MultiReg(locked_async, mult_locked, "sys")
@@ -173,23 +173,23 @@ class _Clocking(Module, AutoCSR):
         # Drive VGA/DVI clock pads
         if pads_vga is not None:
             self.specials += Instance("ODDR2",
-                p_DDR_ALIGNMENT="NONE", p_INIT=0, p_SRTYPE="SYNC",
-                o_Q=pads_vga.clk,
-                i_C0=ClockSignal("pix"),
-                i_C1=~ClockSignal("pix"),
-                i_CE=1, i_D0=1, i_D1=0,
-                i_R=0, i_S=0)
+                                      p_DDR_ALIGNMENT="NONE", p_INIT=0, p_SRTYPE="SYNC",
+                                      o_Q=pads_vga.clk,
+                                      i_C0=ClockSignal("pix"),
+                                      i_C1=~ClockSignal("pix"),
+                                      i_CE=1, i_D0=1, i_D1=0,
+                                      i_R=0, i_S=0)
         if pads_dvi is not None:
             dvi_clk_se = Signal()
             self.specials += Instance("ODDR2",
-                p_DDR_ALIGNMENT="NONE", p_INIT=0, p_SRTYPE="SYNC",
-                o_Q=dvi_clk_se,
-                i_C0=ClockSignal("pix"),
-                i_C1=~ClockSignal("pix"),
-                i_CE=1, i_D0=1, i_D1=0,
-                i_R=0, i_S=0)
+                                      p_DDR_ALIGNMENT="NONE", p_INIT=0, p_SRTYPE="SYNC",
+                                      o_Q=dvi_clk_se,
+                                      i_C0=ClockSignal("pix"),
+                                      i_C1=~ClockSignal("pix"),
+                                      i_CE=1, i_D0=1, i_D1=0,
+                                      i_R=0, i_S=0)
             self.specials += Instance("OBUFDS", i_I=dvi_clk_se,
-                o_O=pads_dvi.clk_p, o_OB=pads_dvi.clk_n)
+                                      o_O=pads_dvi.clk_p, o_OB=pads_dvi.clk_n)
 
 
 class Driver(Module, AutoCSR):
index a10d4f04a5d9e1d43f971e8d68c23f21d36714fc..c6f733d3cd0d41e8c77fafaa5e843c4d548697b4 100644 (file)
@@ -12,36 +12,36 @@ class _PLL(Module):
         self.clk_out = Signal()
 
         self.specials += Instance("ALTPLL",
-            p_bandwidth_type = "AUTO",
-            p_clk0_divide_by = 1,
-            p_clk0_duty_cycle = 50,
-            p_clk0_multiply_by = 2,
-            p_clk0_phase_shift = "{}".format(str(phase_shift)),
-            p_compensate_clock = "CLK0",
-            p_inclk0_input_frequency = int(period_in*1000),
-            p_intended_device_family = "Cyclone IV E",
-            p_lpm_hint = "CBX_MODULE_PREFIX={}_pll".format(name),
-            p_lpm_type = "altpll",
-            p_operation_mode = operation_mode,
-            i_inclk=self.clk_in,
-            o_clk=self.clk_out,
-            i_areset=0,
-            i_clkena=0x3f,
-            i_clkswitch=0,
-            i_configupdate=0,
-            i_extclkena=0xf,
-            i_fbin=1,
-            i_pfdena=1,
-            i_phasecounterselect=0xf,
-            i_phasestep=1,
-            i_phaseupdown=1,
-            i_pllena=1,
-            i_scanaclr=0,
-            i_scanclk=0,
-            i_scanclkena=1,
-            i_scandata=0,
-            i_scanread=0,
-            i_scanwrite=0
+                                  p_bandwidth_type = "AUTO",
+                                  p_clk0_divide_by = 1,
+                                  p_clk0_duty_cycle = 50,
+                                  p_clk0_multiply_by = 2,
+                                  p_clk0_phase_shift = "{}".format(str(phase_shift)),
+                                  p_compensate_clock = "CLK0",
+                                  p_inclk0_input_frequency = int(period_in*1000),
+                                  p_intended_device_family = "Cyclone IV E",
+                                  p_lpm_hint = "CBX_MODULE_PREFIX={}_pll".format(name),
+                                  p_lpm_type = "altpll",
+                                  p_operation_mode = operation_mode,
+                                  i_inclk=self.clk_in,
+                                  o_clk=self.clk_out,
+                                  i_areset=0,
+                                  i_clkena=0x3f,
+                                  i_clkswitch=0,
+                                  i_configupdate=0,
+                                  i_extclkena=0xf,
+                                  i_fbin=1,
+                                  i_pfdena=1,
+                                  i_phasecounterselect=0xf,
+                                  i_phasestep=1,
+                                  i_phaseupdown=1,
+                                  i_pllena=1,
+                                  i_scanaclr=0,
+                                  i_scanclk=0,
+                                  i_scanclkena=1,
+                                  i_scandata=0,
+                                  i_scanread=0,
+                                  i_scanwrite=0
         )
 
 
@@ -84,15 +84,16 @@ class BaseSoC(SDRAMSoC):
 
     def __init__(self, platform, sdram_controller_settings=LASMIconSettings(), **kwargs):
         SDRAMSoC.__init__(self, platform,
-            clk_freq=100*1000000,
-            integrated_rom_size=0x8000,
-            sdram_controller_settings=sdram_controller_settings,
-            **kwargs)
+                          clk_freq=100*1000000,
+                          integrated_rom_size=0x8000,
+                          sdram_controller_settings=sdram_controller_settings,
+                          **kwargs)
 
         self.submodules.crg = _CRG(platform)
 
         if not self.integrated_main_ram_size:
-            self.submodules.sdrphy = gensdrphy.GENSDRPHY(platform.request("sdram"), IS42S16160(self.clk_freq))
+            self.submodules.sdrphy = gensdrphy.GENSDRPHY(platform.request("sdram"),
+                                                         IS42S16160(self.clk_freq))
             self.register_sdram_phy(self.sdrphy)
 
 default_subtarget = BaseSoC
index 2f0e328fa2d3b23bad79b075548dfa6a780fb925..cda3d8e18c9d41c746e9f14c63b9aa2c10be54fa 100644 (file)
@@ -31,25 +31,25 @@ class _CRG(Module):
         pll_clk200 = Signal()
         self.specials += [
             Instance("PLLE2_BASE",
-                p_STARTUP_WAIT="FALSE", o_LOCKED=pll_locked,
+                     p_STARTUP_WAIT="FALSE", o_LOCKED=pll_locked,
 
-                # VCO @ 1GHz
-                p_REF_JITTER1=0.01, p_CLKIN1_PERIOD=5.0,
-                p_CLKFBOUT_MULT=5, p_DIVCLK_DIVIDE=1,
-                i_CLKIN1=clk200_se, i_CLKFBIN=pll_fb, o_CLKFBOUT=pll_fb,
+                     # VCO @ 1GHz
+                     p_REF_JITTER1=0.01, p_CLKIN1_PERIOD=5.0,
+                     p_CLKFBOUT_MULT=5, p_DIVCLK_DIVIDE=1,
+                     i_CLKIN1=clk200_se, i_CLKFBIN=pll_fb, o_CLKFBOUT=pll_fb,
 
-                # 125MHz
-                p_CLKOUT0_DIVIDE=8, p_CLKOUT0_PHASE=0.0, o_CLKOUT0=self.pll_sys,
+                     # 125MHz
+                     p_CLKOUT0_DIVIDE=8, p_CLKOUT0_PHASE=0.0, o_CLKOUT0=self.pll_sys,
 
-                # 500MHz
-                p_CLKOUT1_DIVIDE=2, p_CLKOUT1_PHASE=0.0, o_CLKOUT1=pll_sys4x,
+                     # 500MHz
+                     p_CLKOUT1_DIVIDE=2, p_CLKOUT1_PHASE=0.0, o_CLKOUT1=pll_sys4x,
 
-                # 200MHz
-                p_CLKOUT2_DIVIDE=5, p_CLKOUT2_PHASE=0.0, o_CLKOUT2=pll_clk200,
+                     # 200MHz
+                     p_CLKOUT2_DIVIDE=5, p_CLKOUT2_PHASE=0.0, o_CLKOUT2=pll_clk200,
 
-                p_CLKOUT3_DIVIDE=2, p_CLKOUT3_PHASE=0.0, #o_CLKOUT3=,
+                     p_CLKOUT3_DIVIDE=2, p_CLKOUT3_PHASE=0.0, #o_CLKOUT3=,
 
-                p_CLKOUT4_DIVIDE=4, p_CLKOUT4_PHASE=0.0, #o_CLKOUT4=
+                     p_CLKOUT4_DIVIDE=4, p_CLKOUT4_PHASE=0.0, #o_CLKOUT4=
             ),
             Instance("BUFG", i_I=self.pll_sys, o_O=self.cd_sys.clk),
             Instance("BUFG", i_I=pll_sys4x, o_O=self.cd_sys4x.clk),
@@ -80,22 +80,23 @@ class BaseSoC(SDRAMSoC):
 
     def __init__(self, platform, sdram_controller_settings=LASMIconSettings(), **kwargs):
         SDRAMSoC.__init__(self, platform,
-            clk_freq=125*1000000, cpu_reset_address=0xaf0000,
-            sdram_controller_settings=sdram_controller_settings,
-            **kwargs)
+                          clk_freq=125*1000000, cpu_reset_address=0xaf0000,
+                          sdram_controller_settings=sdram_controller_settings,
+                          **kwargs)
 
         self.submodules.crg = _CRG(platform)
 
         if not self.integrated_main_ram_size:
-            self.submodules.ddrphy = k7ddrphy.K7DDRPHY(platform.request("ddram"), MT8JTF12864(self.clk_freq))
+            self.submodules.ddrphy = k7ddrphy.K7DDRPHY(platform.request("ddram"),
+                                                       MT8JTF12864(self.clk_freq))
             self.register_sdram_phy(self.ddrphy)
 
         if not self.integrated_rom_size:
             spiflash_pads = platform.request("spiflash")
             spiflash_pads.clk = Signal()
             self.specials += Instance("STARTUPE2",
-                i_CLK=0, i_GSR=0, i_GTS=0, i_KEYCLEARB=0, i_PACK=0,
-                i_USRCCLKO=spiflash_pads.clk, i_USRCCLKTS=0, i_USRDONEO=1, i_USRDONETS=1)
+                                      i_CLK=0, i_GSR=0, i_GTS=0, i_KEYCLEARB=0, i_PACK=0,
+                                      i_USRCCLKO=spiflash_pads.clk, i_USRCCLKTS=0, i_USRDONEO=1, i_USRDONETS=1)
             self.submodules.spiflash = spiflash.SpiFlash(spiflash_pads, dummy=11, div=2)
             self.flash_boot_address = 0xb00000
             self.register_rom(self.spiflash.bus)
index c667543b6ed12949e2a87e93aad65e3e54d36192..e1a04ad462f0b28a150c5e6afbf8eec0d869587c 100644 (file)
@@ -20,8 +20,8 @@ class _CRG(Module):
         self.specials += Instance("IBUFG", i_I=clk32, o_O=clk32a)
         clk32b = Signal()
         self.specials += Instance("BUFIO2", p_DIVIDE=1,
-            p_DIVIDE_BYPASS="TRUE", p_I_INVERT="FALSE",
-            i_I=clk32a, o_DIVCLK=clk32b)
+                                  p_DIVIDE_BYPASS="TRUE", p_I_INVERT="FALSE",
+                                  i_I=clk32a, o_DIVCLK=clk32b)
         f = Fraction(int(clk_freq), int(f0))
         n, m, p = f.denominator, f.numerator, 8
         assert f0/n*m == clk_freq
@@ -29,35 +29,35 @@ class _CRG(Module):
         pll_fb = Signal()
         pll = Signal(6)
         self.specials.pll = Instance("PLL_ADV", p_SIM_DEVICE="SPARTAN6",
-            p_BANDWIDTH="OPTIMIZED", p_COMPENSATION="INTERNAL",
-            p_REF_JITTER=.01, p_CLK_FEEDBACK="CLKFBOUT",
-            i_DADDR=0, i_DCLK=0, i_DEN=0, i_DI=0, i_DWE=0, i_RST=0, i_REL=0,
-            p_DIVCLK_DIVIDE=1, p_CLKFBOUT_MULT=m*p//n, p_CLKFBOUT_PHASE=0.,
-            i_CLKIN1=clk32b, i_CLKIN2=0, i_CLKINSEL=1,
-            p_CLKIN1_PERIOD=1000000000/f0, p_CLKIN2_PERIOD=0.,
-            i_CLKFBIN=pll_fb, o_CLKFBOUT=pll_fb, o_LOCKED=pll_lckd,
-            o_CLKOUT0=pll[0], p_CLKOUT0_DUTY_CYCLE=.5,
-            o_CLKOUT1=pll[1], p_CLKOUT1_DUTY_CYCLE=.5,
-            o_CLKOUT2=pll[2], p_CLKOUT2_DUTY_CYCLE=.5,
-            o_CLKOUT3=pll[3], p_CLKOUT3_DUTY_CYCLE=.5,
-            o_CLKOUT4=pll[4], p_CLKOUT4_DUTY_CYCLE=.5,
-            o_CLKOUT5=pll[5], p_CLKOUT5_DUTY_CYCLE=.5,
-            p_CLKOUT0_PHASE=0., p_CLKOUT0_DIVIDE=p//1,
-            p_CLKOUT1_PHASE=0., p_CLKOUT1_DIVIDE=p//1,
-            p_CLKOUT2_PHASE=0., p_CLKOUT2_DIVIDE=p//1,
-            p_CLKOUT3_PHASE=0., p_CLKOUT3_DIVIDE=p//1,
-            p_CLKOUT4_PHASE=0., p_CLKOUT4_DIVIDE=p//1,  # sys
-            p_CLKOUT5_PHASE=270., p_CLKOUT5_DIVIDE=p//1,  # sys_ps
+                                     p_BANDWIDTH="OPTIMIZED", p_COMPENSATION="INTERNAL",
+                                     p_REF_JITTER=.01, p_CLK_FEEDBACK="CLKFBOUT",
+                                     i_DADDR=0, i_DCLK=0, i_DEN=0, i_DI=0, i_DWE=0, i_RST=0, i_REL=0,
+                                     p_DIVCLK_DIVIDE=1, p_CLKFBOUT_MULT=m*p//n, p_CLKFBOUT_PHASE=0.,
+                                     i_CLKIN1=clk32b, i_CLKIN2=0, i_CLKINSEL=1,
+                                     p_CLKIN1_PERIOD=1000000000/f0, p_CLKIN2_PERIOD=0.,
+                                     i_CLKFBIN=pll_fb, o_CLKFBOUT=pll_fb, o_LOCKED=pll_lckd,
+                                     o_CLKOUT0=pll[0], p_CLKOUT0_DUTY_CYCLE=.5,
+                                     o_CLKOUT1=pll[1], p_CLKOUT1_DUTY_CYCLE=.5,
+                                     o_CLKOUT2=pll[2], p_CLKOUT2_DUTY_CYCLE=.5,
+                                     o_CLKOUT3=pll[3], p_CLKOUT3_DUTY_CYCLE=.5,
+                                     o_CLKOUT4=pll[4], p_CLKOUT4_DUTY_CYCLE=.5,
+                                     o_CLKOUT5=pll[5], p_CLKOUT5_DUTY_CYCLE=.5,
+                                     p_CLKOUT0_PHASE=0., p_CLKOUT0_DIVIDE=p//1,
+                                     p_CLKOUT1_PHASE=0., p_CLKOUT1_DIVIDE=p//1,
+                                     p_CLKOUT2_PHASE=0., p_CLKOUT2_DIVIDE=p//1,
+                                     p_CLKOUT3_PHASE=0., p_CLKOUT3_DIVIDE=p//1,
+                                     p_CLKOUT4_PHASE=0., p_CLKOUT4_DIVIDE=p//1,  # sys
+                                     p_CLKOUT5_PHASE=270., p_CLKOUT5_DIVIDE=p//1,  # sys_ps
         )
         self.specials += Instance("BUFG", i_I=pll[4], o_O=self.cd_sys.clk)
         self.specials += Instance("BUFG", i_I=pll[5], o_O=self.cd_sys_ps.clk)
         self.specials += AsyncResetSynchronizer(self.cd_sys, ~pll_lckd)
 
         self.specials += Instance("ODDR2", p_DDR_ALIGNMENT="NONE",
-            p_INIT=0, p_SRTYPE="SYNC",
-            i_D0=0, i_D1=1, i_S=0, i_R=0, i_CE=1,
-            i_C0=self.cd_sys.clk, i_C1=~self.cd_sys.clk,
-            o_Q=platform.request("sdram_clock"))
+                                  p_INIT=0, p_SRTYPE="SYNC",
+                                  i_D0=0, i_D1=1, i_S=0, i_R=0, i_CE=1,
+                                  i_C0=self.cd_sys.clk, i_C1=~self.cd_sys.clk,
+                                  o_Q=platform.request("sdram_clock"))
 
 
 class BaseSoC(SDRAMSoC):
@@ -66,14 +66,15 @@ class BaseSoC(SDRAMSoC):
     def __init__(self, platform, sdram_controller_settings=LASMIconSettings(), **kwargs):
         clk_freq = 80*1000000
         SDRAMSoC.__init__(self, platform, clk_freq,
-            integrated_rom_size=0x8000,
-            sdram_controller_settings=sdram_controller_settings,
-            **kwargs)
+                          integrated_rom_size=0x8000,
+                          sdram_controller_settings=sdram_controller_settings,
+                          **kwargs)
 
         self.submodules.crg = _CRG(platform, clk_freq)
 
         if not self.integrated_main_ram_size:
-            self.submodules.sdrphy = gensdrphy.GENSDRPHY(platform.request("sdram"), AS4C16M16(clk_freq))
+            self.submodules.sdrphy = gensdrphy.GENSDRPHY(platform.request("sdram"),
+                                                         AS4C16M16(clk_freq))
             self.register_sdram_phy(self.sdrphy)
 
 default_subtarget = BaseSoC
index 1973be3a8761107f8cc817e35f6ae13b13bdb193..378c8d0416e36d8a89446e179782a9451d5fe0d5 100644 (file)
@@ -37,16 +37,19 @@ class BaseSoC(SDRAMSoC):
 
     def __init__(self, platform, sdram_controller_settings=LASMIconSettings(), **kwargs):
         SDRAMSoC.__init__(self, platform,
-            clk_freq=(83 + Fraction(1, 3))*1000000,
-            cpu_reset_address=0x00180000,
-            sdram_controller_settings=sdram_controller_settings,
-            **kwargs)
+                          clk_freq=(83 + Fraction(1, 3))*1000000,
+                          cpu_reset_address=0x00180000,
+                          sdram_controller_settings=sdram_controller_settings,
+                          **kwargs)
 
         self.submodules.crg = mxcrg.MXCRG(_MXClockPads(platform), self.clk_freq)
 
         if not self.integrated_main_ram_size:
-            self.submodules.ddrphy = s6ddrphy.S6DDRPHY(platform.request("ddram"), MT46V32M16(self.clk_freq),
-                rd_bitslip=0, wr_bitslip=3, dqs_ddr_alignment="C1")
+            self.submodules.ddrphy = s6ddrphy.S6DDRPHY(platform.request("ddram"),
+                                                       MT46V32M16(self.clk_freq),
+                                                       rd_bitslip=0,
+                                                       wr_bitslip=3,
+                                                       dqs_ddr_alignment="C1")
             self.register_sdram_phy(self.ddrphy)
             self.comb += [
                 self.ddrphy.clk4x_wr_strb.eq(self.crg.clk4x_wr_strb),
@@ -90,10 +93,12 @@ class MiniSoC(BaseSoC):
         if platform.name == "mixxeo":
             self.submodules.leds = gpio.GPIOOut(platform.request("user_led"))
         if platform.name == "m1":
-            self.submodules.buttons = gpio.GPIOIn(Cat(platform.request("user_btn", 0), platform.request("user_btn", 2)))
+            self.submodules.buttons = gpio.GPIOIn(Cat(platform.request("user_btn", 0),
+                                                      platform.request("user_btn", 2)))
             self.submodules.leds = gpio.GPIOOut(Cat(platform.request("user_led", i) for i in range(2)))
 
-        self.submodules.ethphy = LiteEthPHY(platform.request("eth_clocks"), platform.request("eth"))
+        self.submodules.ethphy = LiteEthPHY(platform.request("eth_clocks"),
+                                            platform.request("eth"))
         self.submodules.ethmac = LiteEthMAC(phy=self.ethphy, dw=32, interface="wishbone")
         self.add_wb_slave(mem_decoder(self.mem_map["ethmac"]), self.ethmac.bus)
         self.add_memory_region("ethmac", self.mem_map["ethmac"]+0x80000000, 0x2000)
@@ -133,7 +138,8 @@ class FramebufferSoC(MiniSoC):
     def __init__(self, platform, **kwargs):
         MiniSoC.__init__(self, platform, **kwargs)
         pads_vga, pads_dvi = get_vga_dvi(platform)
-        self.submodules.fb = framebuffer.Framebuffer(pads_vga, pads_dvi, self.sdram.crossbar.get_master())
+        self.submodules.fb = framebuffer.Framebuffer(pads_vga, pads_dvi,
+                                                     self.sdram.crossbar.get_master())
         add_vga_tig(platform, self.fb)
 
 default_subtarget = FramebufferSoC
index ef9454728f87f2c059a3558ee836c00b601b671f..cbd958c4527e9e1399635f9847c708fcadcb7cd8 100644 (file)
@@ -26,8 +26,8 @@ class _CRG(Module):
         self.specials += Instance("IBUFG", i_I=clk50, o_O=clk50a)
         clk50b = Signal()
         self.specials += Instance("BUFIO2", p_DIVIDE=1,
-            p_DIVIDE_BYPASS="TRUE", p_I_INVERT="FALSE",
-            i_I=clk50a, o_DIVCLK=clk50b)
+                                  p_DIVIDE_BYPASS="TRUE", p_I_INVERT="FALSE",
+                                  i_I=clk50a, o_DIVCLK=clk50b)
         f = Fraction(int(clk_freq), int(f0))
         n, m = f.denominator, f.numerator
         assert f0/n*m == clk_freq
@@ -36,25 +36,25 @@ class _CRG(Module):
         pll_fb = Signal()
         pll = Signal(6)
         self.specials.pll = Instance("PLL_ADV", p_SIM_DEVICE="SPARTAN6",
-            p_BANDWIDTH="OPTIMIZED", p_COMPENSATION="INTERNAL",
-            p_REF_JITTER=.01, p_CLK_FEEDBACK="CLKFBOUT",
-            i_DADDR=0, i_DCLK=0, i_DEN=0, i_DI=0, i_DWE=0, i_RST=0, i_REL=0,
-            p_DIVCLK_DIVIDE=1, p_CLKFBOUT_MULT=m*p//n, p_CLKFBOUT_PHASE=0.,
-            i_CLKIN1=clk50b, i_CLKIN2=0, i_CLKINSEL=1,
-            p_CLKIN1_PERIOD=1000000000/f0, p_CLKIN2_PERIOD=0.,
-            i_CLKFBIN=pll_fb, o_CLKFBOUT=pll_fb, o_LOCKED=pll_lckd,
-            o_CLKOUT0=pll[0], p_CLKOUT0_DUTY_CYCLE=.5,
-            o_CLKOUT1=pll[1], p_CLKOUT1_DUTY_CYCLE=.5,
-            o_CLKOUT2=pll[2], p_CLKOUT2_DUTY_CYCLE=.5,
-            o_CLKOUT3=pll[3], p_CLKOUT3_DUTY_CYCLE=.5,
-            o_CLKOUT4=pll[4], p_CLKOUT4_DUTY_CYCLE=.5,
-            o_CLKOUT5=pll[5], p_CLKOUT5_DUTY_CYCLE=.5,
-            p_CLKOUT0_PHASE=0., p_CLKOUT0_DIVIDE=p//4,  # sdram wr rd
-            p_CLKOUT1_PHASE=0., p_CLKOUT1_DIVIDE=p//8,
-            p_CLKOUT2_PHASE=270., p_CLKOUT2_DIVIDE=p//2,  # sdram dqs adr ctrl
-            p_CLKOUT3_PHASE=250., p_CLKOUT3_DIVIDE=p//2,  # off-chip ddr
-            p_CLKOUT4_PHASE=0., p_CLKOUT4_DIVIDE=p//1,
-            p_CLKOUT5_PHASE=0., p_CLKOUT5_DIVIDE=p//1,  # sys
+                                     p_BANDWIDTH="OPTIMIZED", p_COMPENSATION="INTERNAL",
+                                     p_REF_JITTER=.01, p_CLK_FEEDBACK="CLKFBOUT",
+                                     i_DADDR=0, i_DCLK=0, i_DEN=0, i_DI=0, i_DWE=0, i_RST=0, i_REL=0,
+                                     p_DIVCLK_DIVIDE=1, p_CLKFBOUT_MULT=m*p//n, p_CLKFBOUT_PHASE=0.,
+                                     i_CLKIN1=clk50b, i_CLKIN2=0, i_CLKINSEL=1,
+                                     p_CLKIN1_PERIOD=1000000000/f0, p_CLKIN2_PERIOD=0.,
+                                     i_CLKFBIN=pll_fb, o_CLKFBOUT=pll_fb, o_LOCKED=pll_lckd,
+                                     o_CLKOUT0=pll[0], p_CLKOUT0_DUTY_CYCLE=.5,
+                                     o_CLKOUT1=pll[1], p_CLKOUT1_DUTY_CYCLE=.5,
+                                     o_CLKOUT2=pll[2], p_CLKOUT2_DUTY_CYCLE=.5,
+                                     o_CLKOUT3=pll[3], p_CLKOUT3_DUTY_CYCLE=.5,
+                                     o_CLKOUT4=pll[4], p_CLKOUT4_DUTY_CYCLE=.5,
+                                     o_CLKOUT5=pll[5], p_CLKOUT5_DUTY_CYCLE=.5,
+                                     p_CLKOUT0_PHASE=0., p_CLKOUT0_DIVIDE=p//4,  # sdram wr rd
+                                     p_CLKOUT1_PHASE=0., p_CLKOUT1_DIVIDE=p//8,
+                                     p_CLKOUT2_PHASE=270., p_CLKOUT2_DIVIDE=p//2,  # sdram dqs adr ctrl
+                                     p_CLKOUT3_PHASE=250., p_CLKOUT3_DIVIDE=p//2,  # off-chip ddr
+                                     p_CLKOUT4_PHASE=0., p_CLKOUT4_DIVIDE=p//1,
+                                     p_CLKOUT5_PHASE=0., p_CLKOUT5_DIVIDE=p//1,  # sys
         )
         self.specials += Instance("BUFG", i_I=pll[5], o_O=self.cd_sys.clk)
         reset = platform.request("user_btn")
@@ -66,9 +66,9 @@ class _CRG(Module):
         self.specials += AsyncResetSynchronizer(self.cd_sys, ~pll_lckd | (por > 0))
         self.specials += Instance("BUFG", i_I=pll[2], o_O=self.cd_sdram_half.clk)
         self.specials += Instance("BUFPLL", p_DIVIDE=4,
-                            i_PLLIN=pll[0], i_GCLK=self.cd_sys.clk,
-                            i_LOCKED=pll_lckd, o_IOCLK=self.cd_sdram_full_wr.clk,
-                            o_SERDESSTROBE=self.clk4x_wr_strb)
+                                  i_PLLIN=pll[0], i_GCLK=self.cd_sys.clk,
+                                  i_LOCKED=pll_lckd, o_IOCLK=self.cd_sdram_full_wr.clk,
+                                  o_SERDESSTROBE=self.clk4x_wr_strb)
         self.comb += [
             self.cd_sdram_full_rd.clk.eq(self.cd_sdram_full_wr.clk),
             self.clk4x_rd_strb.eq(self.clk4x_wr_strb),
@@ -77,15 +77,15 @@ class _CRG(Module):
         self.specials += Instance("BUFG", i_I=pll[3], o_O=clk_sdram_half_shifted)
         clk = platform.request("ddram_clock")
         self.specials += Instance("ODDR2", p_DDR_ALIGNMENT="NONE",
-            p_INIT=0, p_SRTYPE="SYNC",
-            i_D0=1, i_D1=0, i_S=0, i_R=0, i_CE=1,
-            i_C0=clk_sdram_half_shifted, i_C1=~clk_sdram_half_shifted,
-            o_Q=clk.p)
+                                  p_INIT=0, p_SRTYPE="SYNC",
+                                  i_D0=1, i_D1=0, i_S=0, i_R=0, i_CE=1,
+                                  i_C0=clk_sdram_half_shifted, i_C1=~clk_sdram_half_shifted,
+                                  o_Q=clk.p)
         self.specials += Instance("ODDR2", p_DDR_ALIGNMENT="NONE",
-            p_INIT=0, p_SRTYPE="SYNC",
-            i_D0=0, i_D1=1, i_S=0, i_R=0, i_CE=1,
-            i_C0=clk_sdram_half_shifted, i_C1=~clk_sdram_half_shifted,
-            o_Q=clk.n)
+                                  p_INIT=0, p_SRTYPE="SYNC",
+                                  i_D0=0, i_D1=1, i_S=0, i_R=0, i_CE=1,
+                                  i_C0=clk_sdram_half_shifted, i_C1=~clk_sdram_half_shifted,
+                                  o_Q=clk.n)
 
 
 class BaseSoC(SDRAMSoC):
@@ -99,15 +99,18 @@ class BaseSoC(SDRAMSoC):
     def __init__(self, platform, sdram_controller_settings=LASMIconSettings(), **kwargs):
         clk_freq = 75*1000000
         SDRAMSoC.__init__(self, platform, clk_freq,
-                    cpu_reset_address=0x170000,  # 1.5 MB
-                    sdram_controller_settings=sdram_controller_settings,
-                    **kwargs)
+                          cpu_reset_address=0x170000,  # 1.5 MB
+                          sdram_controller_settings=sdram_controller_settings,
+                          **kwargs)
 
         self.submodules.crg = _CRG(platform, clk_freq)
 
         if not self.integrated_main_ram_size:
-            self.submodules.ddrphy = s6ddrphy.S6DDRPHY(platform.request("ddram"), MT46H32M16(self.clk_freq),
-                rd_bitslip=1, wr_bitslip=3, dqs_ddr_alignment="C1")
+            self.submodules.ddrphy = s6ddrphy.S6DDRPHY(platform.request("ddram"),
+                                                       MT46H32M16(self.clk_freq),
+                                                       rd_bitslip=1,
+                                                       wr_bitslip=3,
+                                                       dqs_ddr_alignment="C1")
             self.comb += [
                 self.ddrphy.clk4x_wr_strb.eq(self.crg.clk4x_wr_strb),
                 self.ddrphy.clk4x_rd_strb.eq(self.crg.clk4x_rd_strb),
@@ -115,7 +118,8 @@ class BaseSoC(SDRAMSoC):
             self.register_sdram_phy(self.ddrphy)
 
         if not self.integrated_rom_size:
-            self.submodules.spiflash = spiflash.SpiFlash(platform.request("spiflash4x"), dummy=10, div=4)
+            self.submodules.spiflash = spiflash.SpiFlash(platform.request("spiflash4x"),
+                                                         dummy=10, div=4)
             self.flash_boot_address = 0x180000
             self.register_rom(self.spiflash.bus, 0x1000000)
 
index f0b98d9135c722b675d598d95744269056e488a7..96eaf221b903944b2f6679ae2037d72375038f8e 100644 (file)
@@ -21,8 +21,8 @@ class _CRG(Module):
         self.specials += Instance("IBUFG", i_I=clk32, o_O=clk32a)
         clk32b = Signal()
         self.specials += Instance("BUFIO2", p_DIVIDE=1,
-            p_DIVIDE_BYPASS="TRUE", p_I_INVERT="FALSE",
-            i_I=clk32a, o_DIVCLK=clk32b)
+                                  p_DIVIDE_BYPASS="TRUE", p_I_INVERT="FALSE",
+                                  i_I=clk32a, o_DIVCLK=clk32b)
         f = Fraction(int(clk_freq), int(f0))
         n, m, p = f.denominator, f.numerator, 8
         assert f0/n*m == clk_freq
@@ -30,35 +30,35 @@ class _CRG(Module):
         pll_fb = Signal()
         pll = Signal(6)
         self.specials.pll = Instance("PLL_ADV", p_SIM_DEVICE="SPARTAN6",
-            p_BANDWIDTH="OPTIMIZED", p_COMPENSATION="INTERNAL",
-            p_REF_JITTER=.01, p_CLK_FEEDBACK="CLKFBOUT",
-            i_DADDR=0, i_DCLK=0, i_DEN=0, i_DI=0, i_DWE=0, i_RST=0, i_REL=0,
-            p_DIVCLK_DIVIDE=1, p_CLKFBOUT_MULT=m*p//n, p_CLKFBOUT_PHASE=0.,
-            i_CLKIN1=clk32b, i_CLKIN2=0, i_CLKINSEL=1,
-            p_CLKIN1_PERIOD=1000000000/f0, p_CLKIN2_PERIOD=0.,
-            i_CLKFBIN=pll_fb, o_CLKFBOUT=pll_fb, o_LOCKED=pll_lckd,
-            o_CLKOUT0=pll[0], p_CLKOUT0_DUTY_CYCLE=.5,
-            o_CLKOUT1=pll[1], p_CLKOUT1_DUTY_CYCLE=.5,
-            o_CLKOUT2=pll[2], p_CLKOUT2_DUTY_CYCLE=.5,
-            o_CLKOUT3=pll[3], p_CLKOUT3_DUTY_CYCLE=.5,
-            o_CLKOUT4=pll[4], p_CLKOUT4_DUTY_CYCLE=.5,
-            o_CLKOUT5=pll[5], p_CLKOUT5_DUTY_CYCLE=.5,
-            p_CLKOUT0_PHASE=0., p_CLKOUT0_DIVIDE=p//1,
-            p_CLKOUT1_PHASE=0., p_CLKOUT1_DIVIDE=p//1,
-            p_CLKOUT2_PHASE=0., p_CLKOUT2_DIVIDE=p//1,
-            p_CLKOUT3_PHASE=0., p_CLKOUT3_DIVIDE=p//1,
-            p_CLKOUT4_PHASE=0., p_CLKOUT4_DIVIDE=p//1,  # sys
-            p_CLKOUT5_PHASE=270., p_CLKOUT5_DIVIDE=p//1,  # sys_ps
+                                     p_BANDWIDTH="OPTIMIZED", p_COMPENSATION="INTERNAL",
+                                     p_REF_JITTER=.01, p_CLK_FEEDBACK="CLKFBOUT",
+                                     i_DADDR=0, i_DCLK=0, i_DEN=0, i_DI=0, i_DWE=0, i_RST=0, i_REL=0,
+                                     p_DIVCLK_DIVIDE=1, p_CLKFBOUT_MULT=m*p//n, p_CLKFBOUT_PHASE=0.,
+                                     i_CLKIN1=clk32b, i_CLKIN2=0, i_CLKINSEL=1,
+                                     p_CLKIN1_PERIOD=1000000000/f0, p_CLKIN2_PERIOD=0.,
+                                     i_CLKFBIN=pll_fb, o_CLKFBOUT=pll_fb, o_LOCKED=pll_lckd,
+                                     o_CLKOUT0=pll[0], p_CLKOUT0_DUTY_CYCLE=.5,
+                                     o_CLKOUT1=pll[1], p_CLKOUT1_DUTY_CYCLE=.5,
+                                     o_CLKOUT2=pll[2], p_CLKOUT2_DUTY_CYCLE=.5,
+                                     o_CLKOUT3=pll[3], p_CLKOUT3_DUTY_CYCLE=.5,
+                                     o_CLKOUT4=pll[4], p_CLKOUT4_DUTY_CYCLE=.5,
+                                     o_CLKOUT5=pll[5], p_CLKOUT5_DUTY_CYCLE=.5,
+                                     p_CLKOUT0_PHASE=0., p_CLKOUT0_DIVIDE=p//1,
+                                     p_CLKOUT1_PHASE=0., p_CLKOUT1_DIVIDE=p//1,
+                                     p_CLKOUT2_PHASE=0., p_CLKOUT2_DIVIDE=p//1,
+                                     p_CLKOUT3_PHASE=0., p_CLKOUT3_DIVIDE=p//1,
+                                     p_CLKOUT4_PHASE=0., p_CLKOUT4_DIVIDE=p//1,  # sys
+                                     p_CLKOUT5_PHASE=270., p_CLKOUT5_DIVIDE=p//1,  # sys_ps
         )
         self.specials += Instance("BUFG", i_I=pll[4], o_O=self.cd_sys.clk)
         self.specials += Instance("BUFG", i_I=pll[5], o_O=self.cd_sys_ps.clk)
         self.specials += AsyncResetSynchronizer(self.cd_sys, ~pll_lckd)
 
         self.specials += Instance("ODDR2", p_DDR_ALIGNMENT="NONE",
-            p_INIT=0, p_SRTYPE="SYNC",
-            i_D0=0, i_D1=1, i_S=0, i_R=0, i_CE=1,
-            i_C0=self.cd_sys.clk, i_C1=~self.cd_sys.clk,
-            o_Q=platform.request("sdram_clock"))
+                                  p_INIT=0, p_SRTYPE="SYNC",
+                                  i_D0=0, i_D1=1, i_S=0, i_R=0, i_CE=1,
+                                  i_C0=self.cd_sys.clk, i_C1=~self.cd_sys.clk,
+                                  o_Q=platform.request("sdram_clock"))
 
 
 class BaseSoC(SDRAMSoC):
@@ -72,18 +72,20 @@ class BaseSoC(SDRAMSoC):
     def __init__(self, platform, sdram_controller_settings=LASMIconSettings(), **kwargs):
         clk_freq = 80*1000000
         SDRAMSoC.__init__(self, platform, clk_freq,
-            cpu_reset_address=0x60000,
-            sdram_controller_settings=sdram_controller_settings,
-            **kwargs)
+                          cpu_reset_address=0x60000,
+                          sdram_controller_settings=sdram_controller_settings,
+                          **kwargs)
 
         self.submodules.crg = _CRG(platform, clk_freq)
 
         if not self.integrated_main_ram_size:
-            self.submodules.sdrphy = gensdrphy.GENSDRPHY(platform.request("sdram"), MT48LC4M16(clk_freq))
+            self.submodules.sdrphy = gensdrphy.GENSDRPHY(platform.request("sdram"),
+                                                         MT48LC4M16(clk_freq))
             self.register_sdram_phy(self.sdrphy)
 
         if not self.integrated_rom_size:
-            self.submodules.spiflash = spiflash.SpiFlash(platform.request("spiflash2x"), dummy=4, div=6)
+            self.submodules.spiflash = spiflash.SpiFlash(platform.request("spiflash2x"),
+                                                         dummy=4, div=6)
             self.flash_boot_address = 0x70000
             self.register_rom(self.spiflash.bus)
 
index 24d0d406bee3bf37a7521ba03dfaac3e7c8ed2e4..de7f21e8e8b9091f732124c0eabc8446090bd377 100644 (file)
@@ -37,8 +37,11 @@ class MiniSoC(BaseSoC):
     def __init__(self, platform, **kwargs):
         BaseSoC.__init__(self, platform, **kwargs)
 
-        self.submodules.ethphy = LiteEthPHY(platform.request("eth_clocks"), platform.request("eth"))
-        self.submodules.ethmac = LiteEthMAC(phy=self.ethphy, dw=32, interface="wishbone", with_hw_preamble_crc=False)
+        self.submodules.ethphy = LiteEthPHY(platform.request("eth_clocks"),
+                                            platform.request("eth"))
+        self.submodules.ethmac = LiteEthMAC(phy=self.ethphy, dw=32,
+                                            interface="wishbone",
+                                            with_hw_preamble_crc=False)
         self.add_wb_slave(mem_decoder(self.mem_map["ethmac"]), self.ethmac.bus)
         self.add_memory_region("ethmac", self.mem_map["ethmac"]+0x80000000, 0x2000)
 
index 2ea16ac2faaf2f958241d971f2dd1765f818812a..e1c376efae3b8e938aa15e892c893ccd3070a899 100644 (file)
@@ -9,9 +9,9 @@ class BaseSoC(SoC):
     default_platform = "versa"
     def __init__(self, platform, **kwargs):
         SoC.__init__(self, platform,
-            clk_freq=100*1000000,
-            integrated_rom_size=0x8000,
-            **kwargs)
+                     clk_freq=100*1000000,
+                     integrated_rom_size=0x8000,
+                     **kwargs)
         self.submodules.crg = CRG(platform.request("clk100"), ~platform.request("rst_n"))
         self.comb += platform.request("user_led", 0).eq(ResetSignal())