Remove useless _blinky.build_and_program() function.
[nmigen-boards.git] / nmigen_boards / kc705.py
1 import os
2 import subprocess
3
4 from nmigen.build import *
5 from nmigen.vendor.xilinx_7series import *
6 from .dev import *
7
8
9 __all__ = ["KC705Platform"]
10
11
12 class KC705Platform(Xilinx7SeriesPlatform):
13 device = "xc7k325t"
14 package = "ffg900"
15 speed = "2"
16 default_clk = "clk156"
17 resources = [
18 Resource("clk156", 0, DiffPairs("K28", "K29", dir="i"),
19 Clock(156e6), Attrs(IOSTANDARD="LVDS_25")),
20
21 Resource("user_led", 0, Pins("AB8", dir="o"), Attrs(IOSTANDARD="LVCMOS15")),
22 Resource("user_led", 1, Pins("AA8", dir="o"), Attrs(IOSTANDARD="LVCMOS15")),
23 Resource("user_led", 2, Pins("AC9", dir="o"), Attrs(IOSTANDARD="LVCMOS15")),
24 Resource("user_led", 3, Pins("AB9", dir="o"), Attrs(IOSTANDARD="LVCMOS15")),
25 Resource("user_led", 4, Pins("AE26", dir="o"), Attrs(IOSTANDARD="LVCMOS15")),
26 Resource("user_led", 5, Pins("G19", dir="o"), Attrs(IOSTANDARD="LVCMOS15")),
27 Resource("user_led", 6, Pins("E18", dir="o"), Attrs(IOSTANDARD="LVCMOS15")),
28 Resource("user_led", 7, Pins("F16", dir="o"), Attrs(IOSTANDARD="LVCMOS15")),
29
30 UARTResource(0,
31 rx="M19", tx="K24",
32 attrs=Attrs(IOSTANDARD="LVCMOS33")
33 ),
34 ]
35 connectors = []
36
37 def toolchain_program(self, products, name):
38 openocd = os.environ.get("OPENOCD", "openocd")
39 with products.extract("{}.bit".format(name)) as bitstream_filename:
40 subprocess.check_call([openocd,
41 "-c", "source [find board/kc705.cfg]; init; pld load 0 {}; exit"
42 .format(bitstream_filename)
43 ])
44
45
46 if __name__ == "__main__":
47 from ._blinky import Blinky
48 KC705Platform().build(Blinky(), do_program=True)