4 from nmigen
.build
import *
5 from nmigen
.vendor
.lattice_ice40
import *
6 from .resources
import *
9 __all__
= ["ICE40HX1KBlinkEVNPlatform"]
12 class ICE40HX1KBlinkEVNPlatform(LatticeICE40Platform
):
15 default_clk
= "clk3p3"
17 Resource("clk3p3", 0, Pins("13", dir="i"), Clock(3.3e6
),
18 Attrs(GLOBAL
=True, IO_STANDARD
="SB_LVCMOS")),
20 *LEDResources(pins
="59 56 53 51", attrs
=Attrs(IO_STANDARD
="SB_LVCMOS")),
22 Resource("touch", 0, Pins("60"), Attrs(IO_STANDARD
="SB_LVCMOS")),
23 Resource("touch", 1, Pins("57"), Attrs(IO_STANDARD
="SB_LVCMOS")),
24 Resource("touch", 2, Pins("54"), Attrs(IO_STANDARD
="SB_LVCMOS")),
25 Resource("touch", 3, Pins("52"), Attrs(IO_STANDARD
="SB_LVCMOS")),
28 cs
="49", clk
="48", mosi
="45", miso
="46",
29 attrs
=Attrs(IO_STANDARD
="SB_LVCMOS")
33 Connector("pmod", 1, "10 9 8 7 - - 4 3 2 1 - -"), # J1
34 Connector("pmod", 5, "40 42 62 64 - - 37 41 63 45 - -"), # J5
35 Connector("pmod", 6, "25 24 21 20 - - 26 27 28 33 - -"), # J6
36 Connector("pmod", 11, "49 45 46 48 - -"), # J11
37 Connector("pmod", 12, "59 56 53 51 - -"), # J12
40 def toolchain_program(self
, products
, name
):
41 iceburn
= os
.environ
.get("ICEBURN", "iCEburn")
42 with products
.extract("{}.bin".format(name
)) as bitstream_filename
:
43 subprocess
.check_call([iceburn
, "-evw", bitstream_filename
])
46 if __name__
== "__main__":
47 from .test
.blinky
import *
48 ICE40HX1KBlinkEVNPlatform().build(Blinky(), do_program
=True)