Overview of PYNQ project offering FPGA capabilities to Python and data engineers.
Tags: python, fpga, iot, jupyter
Published: 2022-05-05 12:54:53

FPGA is an chip that can be configured via a hardware programming language to make nearly any digital circuit. Hardware engineer can use them while Python developer can’t. But there is a distinct group of Xilinx FPGA based devices that can be used by software developers and data engineers, even with Python. This is possible thanks to PYNQ for Xilinx Zynq chips. In this article I'll showcase this platform and it capabilities.


## Introduction

FPGA is configured by HDL - hardware description language like Verilog. When as on a microcontroller given pin is for example SPI on a FPGA it can be whatever it was programmed to be - wherever it's SPI, I2C or even USB, HDMI, Ethernet and alike. Aside of such I/O FPGA can do various type of processing and logic.

{% embed https://www.youtube.com/watch?v=gUsHwi4M4xE %}

FPGA isn't something we can use as easily as Raspberry Pi, Micro:bit and similar boards. But there is an option to use Xilinx Zynq based chips that contain an FPGA.

Xilinx created an architecture called Zynq. It combines an FPGA with ARM cores and I/O into one product. The ARM part is called Processing System (PS) while the FPGA is called Programmable Logic (PL). Such concept isn't limited only to this company but Xilinx went further and created PYNQ (pink).

PYNQ is a hardware-software stack that allows using an FPGA via Python and Jupyter notebooks running on the chip itself. It doesn't replace Verilog, it doesn't allow you to create designs for the FPGA but it allows interfacing and using designs made by hardware engineers.

PYNQ from the software developer side is aimed mostly at edge data processing and analysis (video, image), data processing function acceleration and machine learning. Depending on design it can compete with edge NPU chips or CPU/GPU platforms like Nvidia Jetson (in terms of power efficiency and or flexibility. One of example usage cases are drones and autonomous robots - processing images and video streams to detect obstacles, collision detection, controlling drone flight and more... but there are simpler usage cases too ;)


## PYNQ

PYNQ is an open source project made by Xilinx for their Zynq based boards. As the project website states you can use it to create high performance applications with:

* parallel hardware execution
* high frame-rate video processing
* hardware accelerated algorithms
* real-time signal processing
* high bandwidth IO
* low latency control

PYNQ big picture is quite simple. A Linux distribution is running on the ARM cores, it has Jupyter web server and configuration for the FPGA so that when the chip boots the FPGA is ready to work.

*PYNQ overlay* is a hardware design of the FPGA - it implements the logic on the FPGA - with Verilog and Vivado designer application. Hardware engineers can make various overlays and software engineers can use them in their applications. In-between we have Linux Kernel drivers and system libraries connect them together.

For PYNQ boards and some basic PYNQ-Z2 board operations visit my tutorial at:

> **https://rk.edu.pl/en/overview-pynq-project-offering-fpga-capabilities-python-and-data-engineers/**