aboutsummaryrefslogtreecommitdiff
path: root/amaranth_boards/kcu105.py
blob: 15072db0eeb9ae8c9cc3678df9a6b58b95d9e0b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import os
import subprocess

from amaranth.build import *
from amaranth.vendor.xilinx import *
from .resources import *


__all__ = ["KCU105Platform"]


class KCU105Platform(XilinxPlatform):
    device      = "xcku040"
    package     = "ffva1156"
    speed       = "2-e"
    default_clk = "clk125"
    resources   = [
        Resource("clk125", 0, DiffPairs("G10", "F10", dir="i"),
                 Clock(125e6), Attrs(IOSTANDARD="LVDS")),

        *LEDResources(pins="AP8 H23 P20 P21 N22 M22 R23 P23",
                      attrs=Attrs(IOSTANDARD="LVCMOS18")),
    ]
    connectors  = []

    def toolchain_program(self, products, name):
        openocd = os.environ.get("OPENOCD", "openocd")
        with products.extract("{}.bit".format(name)) as bitstream_filename:
            subprocess.check_call([openocd,
                "-c", "source [find board/kcu105.cfg]; init; pld load 0 {}; exit"
                      .format(bitstream_filename)
            ])


if __name__ == "__main__":
    from .test.blinky import *
    KCU105Platform().build(Blinky(), do_program=True)