Hey PYNQ — The PYNQ Version of the MicroZed Chronicles!
If that is the primary time you have got come throughout PYNQ, PYNQ is an open supply venture began by Xilinx, which fuses the productiveness of Python with the acceleration supplied by programmable logic throughout the Zynq / Zynq MPSoC.
The tight coupling of processing system (PS) and programmable logic (PL) within the Zynq / Zynq MPSoC permits for the creation of techniques which might be extra responsive, deterministic, and energy environment friendly when in comparison with conventional CPU or GPU-based functions. This enhance in efficiency is because of the means to leverage the parallel nature of the programmable logic to maneuver speed up the applying from the sequential software program world to the parallel world enabled by programmable logic. Nevertheless, growing the programmable logic resolution requires superior digital design expertise limiting accessibility to software program builders.
The PYNQ framework actually is sport changer within the programmable logic world. It permits the efficiency of programmable logic supplied by Xilinx heterogeneous SoCs to be leveraged utilizing Python one of many hottest programming languages, with out the necessity to be taught the digital design expertise.
As PYNQ is such a sport changer, that is the primary weblog in a particular version of the MicroZed Chronicles which shall be centered on PYNQ. On this particular version, we’re going to be trying on the total PYNQ ecosystem. Among the key subjects we’re going to discover embrace:
- Neighborhood overlays — what overlays can be found for our PYNQ functions?
- Creating functions utilizing accessible overlays, e.g. picture processing, BNN, and so forth.
- Creation of our personal overlays — how can we make a easy overlay from scratch?
- Customized PYNQ pictures — how can we construct and deploy PYNQ pictures for customized boards? PYNQ pictures could be generated for each Zynq and Zynq MPSoC-based boards.
Let’s begin our journey into the PYNQ structure by trying on the constituent components of the PYNQ framework.
Beginning on the high, the PYNQ framework makes use of iPython and Juypter notebooks enabling a browser-based growth move.
To have the ability to run the iPython kernel, and Jupyter webserver PYNQ pictures run an Ubuntu-based Linux picture containing Ubuntu’s root file system, bundle supervisor and repositories on the processing system.
As we’ll see after we create our personal PYNQ picture, the PYNQ construct move itself relies upon the usual Xilinx PetaLinux construct move. This permits the PYNQ construct to entry all of the Xilinx Kernel patches, board help packages, and crucially add in new drivers for processor system / programmable logic interfacing.
To switch information between IP throughout the programmable logic and Jupyter notebooks, C-based drivers related to the IP are encased in Python wrappers.
Communication between the processor system and the programmable logic is dependent upon the interface used. In our PYNQ implementations, there are 5 completely different PS / PL interfaces that are used:
1) Bitstream — This configures the programmable logic for the specified software. Within the PYNQ framework, the xdevcfg driver is used.
2) GPIO — This supplies easy IO in each instructions. Within the PYNQ framework, that is supported by the sysgpio driver.
3) Interrupts — Help interrupt era from the programmable logic to the processing system. Within the PYNQ framework, that is supported by the Userspace IO driver.
4) Grasp AXI Interfaces — These are used to switch information between the PS to the PL when the PS is the initiator of the transaction. The PYNQ framework makes use of devmem when using grasp AXI interface.
5) Slave AXI Interfaces — These are used to switch information between the PS and PL when the PL is the initiator of the transaction. The PYNQ framework makes use of xlnk to allow these transfers.
The PYNQ framework builds upon these Linux Kernel drivers and offerse a spread of PYNQ particular APIs, which offer particular PYNQ libraries and drivers. These APIs let the Jupyter notebooks bridge the hole, accessing the programmable logic.
As most of the functions require switch of enormous portions of information between the PS and PL, these APIs embrace help for Direct Reminiscence Entry (DMA) utilizing the xlnk driver.
As builders, we leverage the PYNQ framework by connecting to the Jupyter server over a wired ethernet hyperlink and growing our software in a browser-based interface.
One instance of a PYNQ venture is my latest Hackster.io venture which used the PYNQ Z2 board to implement a PID management algorithm.
This venture implements PID management algorithm to regulate the sunshine degree detected by a ambient mild sensor. On this venture, the programmable logic overlay used incorporates MicroBlaze softcore processors and interfacing logic that management the DAC and ambient mild sensor, whereas the Python software implements the PID algorithm which each reads and writes values to the programmable logic to realize the right illumination degree.
The movies under present the algorithm operating:
Now we perceive the PYNQ framework and what goes into it! In our subsequent PYNQ version weblog, we shall be trying in additional depth at programmable logic overlays and the way we work with them.