From db54a0f41681cf5af4a98bbe9ceb0e25bc992562 Mon Sep 17 00:00:00 2001 From: Yuval Adam <_@yuv.al> Date: Fri, 29 Aug 2025 19:45:19 +0200 Subject: Initial project files --- blinky.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 blinky.py (limited to 'blinky.py') diff --git a/blinky.py b/blinky.py new file mode 100644 index 0000000..424bf5f --- /dev/null +++ b/blinky.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python3 + +from amaranth import * +from amaranth.build import Platform +from platform_alchitry_pt import AlchitryPtPlatform + + +class Blinky(Elaboratable): + def elaborate(self, platform: Platform) -> Module: + m = Module() + + # Get the LED pins + led = platform.request("led", 0) + + # Create a counter for timing + counter = Signal(24) + + # Increment counter every clock cycle + m.d.sync += counter.eq(counter + 1) + + # Connect the MSB of counter to LED (blinks at ~12Hz at 100MHz) + m.d.comb += led.o.eq(counter[-1]) + + return m + + +if __name__ == "__main__": + platform = AlchitryPtPlatform() + platform.build(Blinky(), do_program=True) \ No newline at end of file -- cgit v1.3.1