動作環境
Windows 10 Pro (v1909)
PYNQ-Z1 (Digilent) (以下、PYNQと表記)
Vivado v2019.1 (64-bit)
概要
- VivadoにてLEDとButtonを設定してbitstream作成
- AxiGPIOを使ったButtonの押下検知
Block Design
AxiGPIO
switchesの部分をbuttonに読み替えた。
AxiGPIOを使ったButtonの押下検知とLED点灯
from pynq import Overlay
from pynq import PL
OL = Overlay("/home/xilinx/pynq/overlays/base/2020-06-07_LED_SW.bit")
OL.download()
from pynq.lib import AxiGPIO
led_ip = OL.ip_dict['leds']
buttons_ip = OL.ip_dict['buttons']
leds = AxiGPIO(led_ip).channel1
buttons = AxiGPIO(buttons_ip).channel1
buttons.read()
ボタンを押しながら実行すると[8]や[1]などになる。
LEDの点灯は下記でできる。2つ目と4つ目が点灯する。
mask = 0xffffffff
leds.write(10, mask)