Skip to content

Instantly share code, notes, and snippets.

@thehans
Created February 29, 2020 16:23
Show Gist options
  • Save thehans/6946d991e044fd01259428d4d2c968a9 to your computer and use it in GitHub Desktop.
Save thehans/6946d991e044fd01259428d4d2c968a9 to your computer and use it in GitHub Desktop.
# 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