Skip to content

Instantly share code, notes, and snippets.

@thehans

thehans/01_blinky.py

Created Feb 29, 2020
Embed
What would you like to do?
# If the design does not create a "sync" clock domain, it is created by the nMigen build system
# using the platform default clock (and default reset, if any).
from nmigen import *
from nmigen_boards.de10_nano import *
class Blinky(Elaboratable):
def elaborate(self, platform):
leds = Array(platform.request("led", i) for i in range(0,8))
timer = Signal(28)
m = Module()
m.d.sync += timer.eq(timer + 1)
for i in range(0,8):
m.d.comb += leds[i].eq(timer[20+i])
return m
if __name__ == "__main__":
platform = DE10NanoPlatform()
platform.build(Blinky(), do_program=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment