4 from nmigen
.build
import *
5 from nmigen
.vendor
.lattice_ice40
import *
7 from .dev
.uart
import IrDAResource
10 __all__
= ["ICEStickPlatform"]
13 class ICEStickPlatform(LatticeICE40Platform
):
17 Resource("clk12", 0, Pins("21", dir="i"),
18 Clock(12e6
), Attrs(GLOBAL
="1", IO_STANDARD
="SB_LVCMOS33")),
20 Resource("user_led", 0, Pins("99", dir="o"), Attrs(IO_STANDARD
="SB_LVCMOS33")),
21 Resource("user_led", 1, Pins("98", dir="o"), Attrs(IO_STANDARD
="SB_LVCMOS33")),
22 Resource("user_led", 2, Pins("97", dir="o"), Attrs(IO_STANDARD
="SB_LVCMOS33")),
23 Resource("user_led", 3, Pins("96", dir="o"), Attrs(IO_STANDARD
="SB_LVCMOS33")),
24 Resource("user_led", 4, Pins("95", dir="o"), Attrs(IO_STANDARD
="SB_LVCMOS33")),
27 rx
="9", tx
="8", rts
="7", cts
="4", dtr
="3", dsr
="2", dcd
="1",
28 attrs
=Attrs(IO_STANDARD
="SB_LVTTL", PULLUP
="1")
32 rx
="106", tx
="105", sd
="107",
33 attrs
=Attrs(IO_STANDARD
="SB_LVCMOS33")
37 cs
="71", clk
="70", mosi
="67", miso
="68",
38 attrs
=Attrs(IO_STANDARD
="SB_LVCMOS33")
42 Connector("pmod", 0, "78 79 80 81 - - 87 88 90 91 - -"), # J2
44 Connector("j", 1, "- - 112 113 114 115 116 117 118 119"), # J1
45 Connector("j", 3, "- - 62 61 60 56 48 47 45 44"), # J3
48 def toolchain_program(self
, products
, name
):
49 iceprog
= os
.environ
.get("ICEPROG", "iceprog")
50 with products
.extract("{}.bin".format(name
)) as bitstream_filename
:
51 subprocess
.run([iceprog
, bitstream_filename
], check
=True)
54 if __name__
== "__main__":
55 from ._blinky
import build_and_program
56 build_and_program(ICEStickPlatform
, "clk12")