Skip to content

Instantly share code, notes, and snippets.

@thehans
Created February 29, 2020 16:23
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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