|
| 1 | +import os |
| 2 | +import subprocess |
| 3 | + |
| 4 | +from amaranth.build import * |
| 5 | +from amaranth.vendor import XilinxPlatform |
| 6 | +from .resources import * |
| 7 | + |
| 8 | + |
| 9 | +__all__ = ["RedPitaya14Platform"] |
| 10 | + |
| 11 | + |
| 12 | +class RedPitaya14Platform(XilinxPlatform): |
| 13 | + device = "xc7z010" |
| 14 | + package = "clg400" |
| 15 | + speed = "1" |
| 16 | + default_clk = "clk125" |
| 17 | + resources = [ |
| 18 | + Resource("clk125", 0, |
| 19 | + DiffPairs("U18", "U19", dir="i"), Clock(125e6), Attrs(IOSTANDARD="TMDS_33")), |
| 20 | + |
| 21 | + *LEDResources( |
| 22 | + pins="F16 F17 G15 H15 K14 G14 J15 J14", |
| 23 | + attrs=Attrs(IOSTANDARD="LVCMOS33")), |
| 24 | + |
| 25 | + Resource("daisy_io", 0, |
| 26 | + DiffPairs("T12", "U12", dir="i"), Attrs(IOSTANDARD="TMDS_33")), |
| 27 | + Resource("daisy_io", 1, |
| 28 | + DiffPairs("U14", "U15", dir="i"), Attrs(IOSTANDARD="TMDS_33")), |
| 29 | + Resource("daisy_io", 2, |
| 30 | + DiffPairs("P14", "R14", dir="i"), Attrs(IOSTANDARD="TMDS_33")), |
| 31 | + Resource("daisy_io", 3, |
| 32 | + DiffPairs("N18", "P19", dir="i"), Attrs(IOSTANDARD="TMDS_33")), |
| 33 | + ] |
| 34 | + connectors = [ |
| 35 | + Connector("E1", 0, { |
| 36 | + # Outer Analog Header |
| 37 | + "dio0_p": "G17", |
| 38 | + "dio0_n": "G18", |
| 39 | + "dio1_p": "H16", |
| 40 | + "dio1_n": "H17", |
| 41 | + "dio2_p": "J18", |
| 42 | + "dio2_n": "H18", |
| 43 | + "dio3_p": "K17", |
| 44 | + "dio3_n": "K18", |
| 45 | + "dio4_p": "L14", |
| 46 | + "dio4_n": "L15", |
| 47 | + "dio5_p": "L16", |
| 48 | + "dio5_n": "L17", |
| 49 | + "dio6_p": "K16", |
| 50 | + "dio6_n": "J16", |
| 51 | + "dio7_p": "M14", |
| 52 | + "dio7_n": "M15", |
| 53 | + }) |
| 54 | + ] |
| 55 | + |
| 56 | + def toolchain_program(self, products, name, **kwargs): |
| 57 | + with products.extract("{}.bit".format(name)) as bitstream_filename: |
| 58 | + subprocess.check_call(["openFPGALoader", "-c", "digilent_hs2", bitstream_filename]) |
| 59 | + |
| 60 | + |
| 61 | +if __name__ == "__main__": |
| 62 | + from .test.blinky import * |
| 63 | + RedPitaya14Platform().build(Blinky(), do_program=True) |
0 commit comments