[breaking-change] Factor out "led", "button" and "switch" resources.
[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 *LEDResources(pins="AB8 AA8 AC9 AB9 AE26 G19 E18 F16",
22 attrs=Attrs(IOSTANDARD="LVCMOS15")),
23
24 UARTResource(0,
25 rx="M19", tx="K24",
26 attrs=Attrs(IOSTANDARD="LVCMOS33")
27 ),
28 ]
29 connectors = []
30
31 def toolchain_program(self, products, name):
32 openocd = os.environ.get("OPENOCD", "openocd")
33 with products.extract("{}.bit".format(name)) as bitstream_filename:
34 subprocess.check_call([openocd,
35 "-c", "source [find board/kc705.cfg]; init; pld load 0 {}; exit"
36 .format(bitstream_filename)
37 ])
38
39
40 if __name__ == "__main__":
41 from ._blinky import Blinky
42 KC705Platform().build(Blinky(), do_program=True)