bdeb11248947a549b2c814aec55800d33f06c910
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
):
18 Resource("clk12", 0, Pins("21", dir="i"),
19 Clock(12e6
), Attrs(GLOBAL
="1", IO_STANDARD
="SB_LVCMOS33")),
21 Resource("user_led", 0, Pins("99", dir="o"), Attrs(IO_STANDARD
="SB_LVCMOS33")),
22 Resource("user_led", 1, Pins("98", dir="o"), Attrs(IO_STANDARD
="SB_LVCMOS33")),
23 Resource("user_led", 2, Pins("97", dir="o"), Attrs(IO_STANDARD
="SB_LVCMOS33")),
24 Resource("user_led", 3, Pins("96", dir="o"), Attrs(IO_STANDARD
="SB_LVCMOS33")),
25 Resource("user_led", 4, Pins("95", dir="o"), Attrs(IO_STANDARD
="SB_LVCMOS33")),
28 rx
="9", tx
="8", rts
="7", cts
="4", dtr
="3", dsr
="2", dcd
="1",
29 attrs
=Attrs(IO_STANDARD
="SB_LVTTL", PULLUP
="1")
33 rx
="106", tx
="105", sd
="107",
34 attrs
=Attrs(IO_STANDARD
="SB_LVCMOS33")
38 cs
="71", clk
="70", mosi
="67", miso
="68",
39 attrs
=Attrs(IO_STANDARD
="SB_LVCMOS33")
43 Connector("pmod", 0, "78 79 80 81 - - 87 88 90 91 - -"), # J2
45 Connector("j", 1, "- - 112 113 114 115 116 117 118 119"), # J1
46 Connector("j", 3, "- - 62 61 60 56 48 47 45 44"), # J3
49 def toolchain_program(self
, products
, name
):
50 iceprog
= os
.environ
.get("ICEPROG", "iceprog")
51 with products
.extract("{}.bin".format(name
)) as bitstream_filename
:
52 subprocess
.check_call([iceprog
, bitstream_filename
])
55 if __name__
== "__main__":
56 from ._blinky
import build_and_program
57 build_and_program(ICEStickPlatform
)