Restructured the amaranth HDL files.
This commit is contained in:
22
re-bba/LedBlinker/LedBlinker.py
Normal file
22
re-bba/LedBlinker/LedBlinker.py
Normal file
@@ -0,0 +1,22 @@
|
||||
from amaranth import *
|
||||
|
||||
class LEDBlinker(Elaboratable):
|
||||
def elaborate(self, platform):
|
||||
m = Module()
|
||||
|
||||
led = platform.request("led")
|
||||
|
||||
half_freq = int(platform.default_clk_frequency // 2)
|
||||
timer = Signal(range(half_freq + 1))
|
||||
|
||||
with m.If(timer == half_freq):
|
||||
m.d.sync += led.eq(~led)
|
||||
m.d.sync += timer.eq(0)
|
||||
with m.Else():
|
||||
m.d.sync += timer.eq(timer + 1)
|
||||
|
||||
return m
|
||||
|
||||
from amaranth_boards.icebreaker import *
|
||||
|
||||
ICEBreakerPlatform().build(LEDBlinker(), do_program=True)
|
||||
Reference in New Issue
Block a user