+++ /dev/null
-import itertools
-
-from nmigen import *
-from nmigen.build import ResourceError
-
-
-class Blinky(Elaboratable):
- def elaborate(self, platform):
- m = Module()
-
- leds = []
- for n in itertools.count():
- try:
- leds.append(platform.request("led", n))
- except ResourceError:
- break
- leds = Cat(led.o for led in leds)
-
- clk_freq = platform.default_clk_frequency
- ctr = Signal(max=int(clk_freq//2), reset=int(clk_freq//2) - 1)
- with m.If(ctr == 0):
- m.d.sync += ctr.eq(ctr.reset)
- m.d.sync += leds.eq(~leds)
- with m.Else():
- m.d.sync += ctr.eq(ctr - 1)
-
- return m
if __name__ == "__main__":
- from ._blinky import Blinky
+ from .test.blinky import *
ArtyA7Platform().build(Blinky(), do_program=True)
if __name__ == "__main__":
- from ._blinky import Blinky
+ from .test.blinky import *
AtlysPlatform().build(Blinky(), do_program=True)
if __name__ == "__main__":
- from ._blinky import Blinky
+ from .test.blinky import *
BlackIcePlatform().build(Blinky(), do_program=True)
if __name__ == "__main__":
- from ._blinky import Blinky
+ from .test.blinky import *
BlackIceIIPlatform().build(Blinky(), do_program=True)
if __name__ == "__main__":
- from ._blinky import Blinky
+ from .test.blinky import *
FomuHackerPlatform().build(Blinky(), do_program=True)
if __name__ == "__main__":
- from ._blinky import Blinky
+ from .test.blinky import *
ICE40HX1KBlinkEVNPlatform().build(Blinky(), do_program=True)
if __name__ == "__main__":
- from ._blinky import Blinky
+ from .test.blinky import *
ICE40HX8KBEVNPlatform().build(Blinky(), do_program=True)
if __name__ == "__main__":
- from ._blinky import Blinky
+ from .test.blinky import *
p = ICEBreakerPlatform()
p.add_resources(p.break_off_pmod)
p.build(Blinky(), do_program=True)
if __name__ == "__main__":
- from ._blinky import Blinky
+ from .test.blinky import *
ICEStickPlatform().build(Blinky(), do_program=True)
if __name__ == "__main__":
- from ._blinky import Blinky
+ from .test.blinky import *
KC705Platform().build(Blinky(), do_program=True)
if __name__ == "__main__":
- from ._blinky import Blinky
+ from .test.blinky import *
plat = MercuryPlatform()
plat.add_resources(plat.leds)
plat.build(Blinky(), do_program=True)
if __name__ == "__main__":
- from ._blinky import Blinky
+ from .test.blinky import *
NumatoMimasPlatform().build(Blinky())
--- /dev/null
+import itertools
+
+from nmigen import *
+from nmigen.build import ResourceError
+
+
+__all__ = ["Blinky"]
+
+
+class Blinky(Elaboratable):
+ def elaborate(self, platform):
+ m = Module()
+
+ leds = []
+ for n in itertools.count():
+ try:
+ leds.append(platform.request("led", n))
+ except ResourceError:
+ break
+ leds = Cat(led.o for led in leds)
+
+ clk_freq = platform.default_clk_frequency
+ ctr = Signal(max=int(clk_freq//2), reset=int(clk_freq//2) - 1)
+ with m.If(ctr == 0):
+ m.d.sync += ctr.eq(ctr.reset)
+ m.d.sync += leds.eq(~leds)
+ with m.Else():
+ m.d.sync += ctr.eq(ctr - 1)
+
+ return m
if __name__ == "__main__":
- from ._blinky import Blinky
+ from .test.blinky import *
TinyFPGABXPlatform().build(Blinky(), do_program=True)
if __name__ == "__main__":
- from ._blinky import Blinky
+ from .test.blinky import *
VersaECP5Platform().build(Blinky(), do_program=True)
if __name__ == "__main__":
- from ._blinky import Blinky
+ from .test.blinky import *
VersaECP55GPlatform().build(Blinky(), do_program=True)