From 92205fb928150245c1683abdf8171fb89a99d629 Mon Sep 17 00:00:00 2001 From: Ian McIntyre Date: Sat, 13 Sep 2025 19:57:43 -0400 Subject: Add Alchitry CuV2 board Once flashed, the J11 LED alternate blinks with all the other LEDs. If you hold the button, all LEDs blink in unison. The board definition is otherwise incomplete. The iceprog '-u' flag is available in my icestorm fork. This needs a bunch of environment variables to build and run. Make sure you have all the other Amaranth things installed. Here's a very manual way to set the env vars, just in case you haven't put anything on your path. YOSYS=yowasp-yosys \ NEXTPNR_ICE40=yowasp-nextpnr-ice40 \ ICEPACK=path/to/your/icepack \ ICEPROG=path/to/your/iceprog \ python3 -m amaranth_boards.alchitry_cuv2 --- amaranth_boards/alchitry_cuv2.py | 50 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 amaranth_boards/alchitry_cuv2.py (limited to 'amaranth_boards') 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) -- cgit v1.2.3