4 from nmigen
.build
import *
5 from nmigen
.vendor
.lattice_ice40
import *
6 from .resources
import *
9 __all__
= ["FomuHackerPlatform"]
12 class FomuHackerPlatform(LatticeICE40Platform
):
17 Resource("clk48", 0, Pins("F5", dir="i"),
18 Clock(48e6
), Attrs(GLOBAL
=True, IO_STANDARD
="SB_LVCMOS")),
20 *LEDResources(pins
="A5", invert
=True, attrs
=Attrs(IO_STANDARD
="SB_LVCMOS")),
22 r
="C5", g
="B5", b
="A5", invert
=True,
23 attrs
=Attrs(IO_STANDARD
="SB_LVCMOS")
27 Subsignal("d_p", Pins("A4")),
28 Subsignal("d_n", Pins("A2")),
29 Subsignal("pullup", Pins("D5")),
30 Attrs(IO_STANDARD
="SB_LVCMOS"),
34 cs
="C1", clk
="D1", mosi
="F1", miso
="E1",
35 attrs
=Attrs(IO_STANDARD
="SB_LVCMOS"),
40 Connector("pin", 0, "F4"),
41 Connector("pin", 1, "E5"),
42 Connector("pin", 2, "E4"),
43 Connector("pin", 3, "F2"),
46 def toolchain_program(self
, products
, name
):
47 dfu_util
= os
.environ
.get("DFU_UTIL", "dfu-util")
48 with products
.extract("{}.bin".format(name
)) as bitstream_filename
:
49 subprocess
.check_call([dfu_util
, "-D", bitstream_filename
])
52 if __name__
== "__main__":
53 from .test
.blinky
import *
54 FomuHackerPlatform().build(Blinky(), do_program
=True)