Created
February 29, 2020 16:23
-
-
Save thehans/6946d991e044fd01259428d4d2c968a9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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