diff options
Diffstat (limited to 'amaranth_boards')
| -rw-r--r-- | amaranth_boards/alchitry_cuv2.py | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/amaranth_boards/alchitry_cuv2.py b/amaranth_boards/alchitry_cuv2.py new file mode 100644 index 0000000..e6bb7ce --- /dev/null +++ b/amaranth_boards/alchitry_cuv2.py @@ -0,0 +1,50 @@ +import os +import subprocess + +from amaranth import * +from amaranth.build import * +from amaranth.vendor import LatticeICE40Platform +from .resources import * + + +class AlchitryCuV2Platform(LatticeICE40Platform): + device = "iCE40HX8K" + package = "CB132" + speed = "1" + default_clk = "clk100" + resources = [ + Resource( + "clk100", 0, Pins("P7", dir="i"), Clock(100e6), Attrs(GLOBAL=True, + IO_STANDARD="SB_LVCMOS") + ), + + Resource("usb", 0, + Subsignal("usb_tx", Pins("P14", dir="o")), + Subsignal("usb_rx", Pins("M9", dir="i")), + Attrs(IO_STANDARD="LVCMOS") + ), + + *SPIFlashResources(0, + cs_n="P13", clk="P12", copi="M11", cipo="P11", + attrs=Attrs(IO_STANDARD="SB_LVCMOS") + ), + + *LEDResources( + pins="J11 K11 G12 H12 K14 J12 L14 K12", attrs=Attrs(IO_STANDARD="SB_LVCMOS") + ), + + *ButtonResources(pins="P8"), + ] + connectors = [ + # TODO(mciantyre) define these. + ] + + def toolchain_program(self, products, name): + iceprog = os.environ.get("ICEPROG", "iceprog") + with products.extract("{}.bin".format(name)) as bitstream_filename: + subprocess.check_call([iceprog, "-u", "-b", bitstream_filename]) + + +if __name__ == "__main__": + from .test.blinky import Blinky + AlchitryCuV2Platform().build(Blinky(), do_program=True) |
