4eb6942fe783338db20958996b18d56a97553cf8
4 from nmigen
.build
import *
5 from nmigen
.vendor
.lattice_ice40
import *
9 __all__
= ["TinyFPGABXPlatform"]
12 class TinyFPGABXPlatform(LatticeICE40Platform
):
17 Resource("clk16", 0, Pins("B2", dir="i"),
18 Clock(16e6
), Attrs(IO_STANDARD
="SB_LVCMOS33")),
20 Resource("user_led", 0, Pins("B3", dir="o"), Attrs(IO_STANDARD
="SB_LVCMOS33")),
23 Subsignal("d_p", Pins("B4", dir="io")),
24 Subsignal("d_n", Pins("A4", dir="io")),
25 Subsignal("pullup", Pins("A3", dir="o")),
26 Attrs(IO_STANDARD
="SB_LVCMOS33")
30 cs
="F7", clk
="G7", mosi
="G6", miso
="H7", wp
="H4", hold
="J8",
31 attrs
=Attrs(IO_STANDARD
="SB_LVCMOS33")
36 # Left side of the board
37 # 1 2 3 4 5 6 7 8 9 10 11 12 13
38 " A2 A1 B1 C2 C1 D2 D1 E2 E1 G2 H1 J1 H2 "
39 # Right side of the board
40 # 14 15 16 17 18 19 20 21 22 23 24
41 " H9 D9 D8 B8 A9 B8 A8 B7 A7 B6 A6 "
43 # 25 26 27 28 29 30 31
44 "G1 J3 J4 G9 J9 E8 J2"
48 def toolchain_program(self
, products
, name
):
49 tinyprog
= os
.environ
.get("TINYPROG", "tinyprog")
50 with products
.extract("{}.bin".format(name
)) as bitstream_filename
:
51 subprocess
.check_call([tinyprog
, "-p", bitstream_filename
])
54 if __name__
== "__main__":
55 from ._blinky
import Blinky
56 TinyFPGABXPlatform().build(Blinky(), do_program
=True)