-
Notifications
You must be signed in to change notification settings - Fork 3
migen Hello World
K. A. Brodzki edited this page Apr 2, 2020
·
1 revision
Things you should have already installed and checked:
- Vivado
- LiteX
- migen
Save the code below to a file, e.g. hello_world.py
from migen import *
from litex.boards.platforms.arty import *
class Blinky(Module):
def __init__(self, platform, maxperiod):
self.led = led = platform.request("user_led", 1)
counter = Signal(max=maxperiod+1)
period = Signal(max=maxperiod+1)
self.comb += period.eq(maxperiod)
self.sync += If(counter == 0,
led.eq(~led),
counter.eq(period)
).Else(
counter.eq(counter -1)
)
plat = Platform()
blinky = Blinky(plat, 300000000)
plat.build(blinky)
python3 hello_world.py
cd build
xc3sprog -c nexys top.bit
What you should see is the blinking LED(LD5) on your board