Convert DOS line endings.
authorStaf Verhaegen <staf@stafverhaegen.be>
Mon, 17 Jun 2019 19:41:54 +0000 (21:41 +0200)
committerwhitequark <whitequark@whitequark.org>
Wed, 19 Jun 2019 01:10:45 +0000 (01:10 +0000)
nmigen_boards/icebreaker.py

index d9e684a3d2f8b306945bf80ba5d69c31f8a32675..b9b02016992b60c2a26ad6183d5f77ffabf33b72 100644 (file)
@@ -1,76 +1,76 @@
-import os\r
-import subprocess\r
-\r
-from nmigen.build import *\r
-from nmigen.vendor.lattice_ice40 import *\r
-from .dev import *\r
-\r
-\r
-__all__ = ["ICEBreakerPlatform"]\r
-\r
-\r
-class ICEBreakerPlatform(LatticeICE40Platform):\r
-    device = "iCE40UP5K"\r
-    package = "SG48"\r
-    resources  = [\r
-        Resource("clk12", 0, Pins("35", dir="i"),\r
-                 Clock(12e6), Attrs(GLOBAL="1", IO_STANDARD="SB_LVCMOS33")),\r
-\r
-        Resource("user_led",  0, PinsN("11", dir="o"), Attrs(IO_STANDARD="SB_LVCMOS33")),\r
-        Resource("user_led",  1, PinsN("37", dir="o"), Attrs(IO_STANDARD="SB_LVCMOS33")),\r
-        # Color-specific aliases\r
-        Resource("user_ledr", 0, PinsN("11", dir="o"), Attrs(IO_STANDARD="SB_LVCMOS33")),\r
-        Resource("user_ledg", 0, PinsN("37", dir="o"), Attrs(IO_STANDARD="SB_LVCMOS33")),\r
-\r
-        Resource("user_btn",  4, PinsN("10", dir="i"), Attrs(IO_STANDARD="SB_LVCMOS33")),\r
-\r
-        Resource("serial", 0,\r
-            Subsignal("rx",  Pins("6", dir="i")),\r
-            Subsignal("tx",  Pins("9", dir="o"), Attrs(PULLUP="1")),\r
-            Attrs(IO_STANDARD="SB_LVTTL")\r
-        ),\r
-\r
-        *SPIFlashResources(0,\r
-            cs="16", clk="15", mosi="14", miso="17", wp="12", hold="13",\r
-            attrs=Attrs(IO_STANDARD="SB_LVCMOS33")\r
-        ),\r
-    ]\r
-    connectors = [\r
-        Connector("pmod", 0, "4 2 47 45 - -  3 48 46 44 - -"),  # PMOD1A\r
-        Connector("pmod", 1, "43 38 34 31 - - 42 36 32 28 - -"), # PMOD1B\r
-        Connector("pmod", 2, "27 25 21 19 - -  26 23 20 18 - -"), # PMOD2\r
-    ]\r
-    # The attached LED/button section can be either used standalone or as a PMOD.\r
-    # Attach to platform using:\r
-    # p.add_resources(p.break_off_pmod)\r
-    # pmod_btn = plat.request("user_btn")\r
-    break_off_pmod = [\r
-         Resource("user_btn", 0, Pins("9", dir="i", conn=("pmod", 2)), Attrs(IO_STANDARD="SB_LVCMOS33")),\r
-         Resource("user_btn", 1, Pins("4",  dir="i", conn=("pmod", 2)), Attrs(IO_STANDARD="SB_LVCMOS33")),\r
-         Resource("user_btn", 2, Pins("10",  dir="i", conn=("pmod", 2)), Attrs(IO_STANDARD="SB_LVCMOS33")),\r
-\r
-         Resource("user_led", 0, Pins("7", dir="o", conn=("pmod", 2)), Attrs(IO_STANDARD="SB_LVCMOS33")),\r
-         Resource("user_led", 1, Pins("1", dir="o", conn=("pmod", 2)), Attrs(IO_STANDARD="SB_LVCMOS33")),\r
-         Resource("user_led", 2, Pins("2", dir="o", conn=("pmod", 2)), Attrs(IO_STANDARD="SB_LVCMOS33")),\r
-         Resource("user_led", 3, Pins("8", dir="o", conn=("pmod", 2)), Attrs(IO_STANDARD="SB_LVCMOS33")),\r
-         Resource("user_led", 4, Pins("3", dir="o", conn=("pmod", 2)), Attrs(IO_STANDARD="SB_LVCMOS33")),\r
-\r
-         # Color-specific aliases\r
-         Resource("user_ledr", 0, Pins("7", dir="o", conn=("pmod", 2)), Attrs(IO_STANDARD="SB_LVCMOS33")),\r
-         Resource("user_ledg", 0, Pins("1", dir="o", conn=("pmod", 2)), Attrs(IO_STANDARD="SB_LVCMOS33")),\r
-         Resource("user_ledg", 1, Pins("2", dir="o", conn=("pmod", 2)), Attrs(IO_STANDARD="SB_LVCMOS33")),\r
-         Resource("user_ledg", 2, Pins("8", dir="o", conn=("pmod", 2)), Attrs(IO_STANDARD="SB_LVCMOS33")),\r
-         Resource("user_ledg", 3, Pins("3", dir="o", conn=("pmod", 2)), Attrs(IO_STANDARD="SB_LVCMOS33"))\r
-    ]\r
-\r
-    def toolchain_program(self, products, name):\r
-        iceprog = os.environ.get("ICEPROG", "iceprog")\r
-        with products.extract("{}.bin".format(name)) as bitstream_filename:\r
-            subprocess.run([iceprog, bitstream_filename], check=True)\r
-\r
-\r
-if __name__ == "__main__":\r
-    from ._blinky import Blinky\r
-    p = ICEBreakerPlatform()\r
-    p.add_resources(p.break_off_pmod)\r
-    p.build(Blinky("clk12"), do_program=True)\r
+import os
+import subprocess
+
+from nmigen.build import *
+from nmigen.vendor.lattice_ice40 import *
+from .dev import *
+
+
+__all__ = ["ICEBreakerPlatform"]
+
+
+class ICEBreakerPlatform(LatticeICE40Platform):
+    device = "iCE40UP5K"
+    package = "SG48"
+    resources  = [
+        Resource("clk12", 0, Pins("35", dir="i"),
+                 Clock(12e6), Attrs(GLOBAL="1", IO_STANDARD="SB_LVCMOS33")),
+
+        Resource("user_led",  0, PinsN("11", dir="o"), Attrs(IO_STANDARD="SB_LVCMOS33")),
+        Resource("user_led",  1, PinsN("37", dir="o"), Attrs(IO_STANDARD="SB_LVCMOS33")),
+        # Color-specific aliases
+        Resource("user_ledr", 0, PinsN("11", dir="o"), Attrs(IO_STANDARD="SB_LVCMOS33")),
+        Resource("user_ledg", 0, PinsN("37", dir="o"), Attrs(IO_STANDARD="SB_LVCMOS33")),
+
+        Resource("user_btn",  4, PinsN("10", dir="i"), Attrs(IO_STANDARD="SB_LVCMOS33")),
+
+        Resource("serial", 0,
+            Subsignal("rx",  Pins("6", dir="i")),
+            Subsignal("tx",  Pins("9", dir="o"), Attrs(PULLUP="1")),
+            Attrs(IO_STANDARD="SB_LVTTL")
+        ),
+
+        *SPIFlashResources(0,
+            cs="16", clk="15", mosi="14", miso="17", wp="12", hold="13",
+            attrs=Attrs(IO_STANDARD="SB_LVCMOS33")
+        ),
+    ]
+    connectors = [
+        Connector("pmod", 0, "4 2 47 45 - -  3 48 46 44 - -"),  # PMOD1A
+        Connector("pmod", 1, "43 38 34 31 - - 42 36 32 28 - -"), # PMOD1B
+        Connector("pmod", 2, "27 25 21 19 - -  26 23 20 18 - -"), # PMOD2
+    ]
+    # The attached LED/button section can be either used standalone or as a PMOD.
+    # Attach to platform using:
+    # p.add_resources(p.break_off_pmod)
+    # pmod_btn = plat.request("user_btn")
+    break_off_pmod = [
+         Resource("user_btn", 0, Pins("9", dir="i", conn=("pmod", 2)), Attrs(IO_STANDARD="SB_LVCMOS33")),
+         Resource("user_btn", 1, Pins("4",  dir="i", conn=("pmod", 2)), Attrs(IO_STANDARD="SB_LVCMOS33")),
+         Resource("user_btn", 2, Pins("10",  dir="i", conn=("pmod", 2)), Attrs(IO_STANDARD="SB_LVCMOS33")),
+
+         Resource("user_led", 0, Pins("7", dir="o", conn=("pmod", 2)), Attrs(IO_STANDARD="SB_LVCMOS33")),
+         Resource("user_led", 1, Pins("1", dir="o", conn=("pmod", 2)), Attrs(IO_STANDARD="SB_LVCMOS33")),
+         Resource("user_led", 2, Pins("2", dir="o", conn=("pmod", 2)), Attrs(IO_STANDARD="SB_LVCMOS33")),
+         Resource("user_led", 3, Pins("8", dir="o", conn=("pmod", 2)), Attrs(IO_STANDARD="SB_LVCMOS33")),
+         Resource("user_led", 4, Pins("3", dir="o", conn=("pmod", 2)), Attrs(IO_STANDARD="SB_LVCMOS33")),
+
+         # Color-specific aliases
+         Resource("user_ledr", 0, Pins("7", dir="o", conn=("pmod", 2)), Attrs(IO_STANDARD="SB_LVCMOS33")),
+         Resource("user_ledg", 0, Pins("1", dir="o", conn=("pmod", 2)), Attrs(IO_STANDARD="SB_LVCMOS33")),
+         Resource("user_ledg", 1, Pins("2", dir="o", conn=("pmod", 2)), Attrs(IO_STANDARD="SB_LVCMOS33")),
+         Resource("user_ledg", 2, Pins("8", dir="o", conn=("pmod", 2)), Attrs(IO_STANDARD="SB_LVCMOS33")),
+         Resource("user_ledg", 3, Pins("3", dir="o", conn=("pmod", 2)), Attrs(IO_STANDARD="SB_LVCMOS33"))
+    ]
+
+    def toolchain_program(self, products, name):
+        iceprog = os.environ.get("ICEPROG", "iceprog")
+        with products.extract("{}.bin".format(name)) as bitstream_filename:
+            subprocess.run([iceprog, bitstream_filename], check=True)
+
+
+if __name__ == "__main__":
+    from ._blinky import Blinky
+    p = ICEBreakerPlatform()
+    p.add_resources(p.break_off_pmod)
+    p.build(Blinky("clk12"), do_program=True)