PYNQ: PYTHON PRODUCTIVITY FOR ZYNQ

Reduction plotting time in Avnet Ultra96

We are using Avnet Ultra96 board which supports Pynq framework to plot the data in real-time. PS and PL are interfaced using AXI interface and the data from PL is plotted using matplotlib.pyplot library in jupyter notebook. However, time taken for plotting the data in real-time is very high compared to the PL processing speed(100Mhz). Please let us know how to reduce the time taken for plotting or suggest some suitable libraries which solves the problem.

It would help if you could provide (a lot) more info on your design - ideally sharing the design/code/notebook.
It is very difficult for anyone to make suggestions based on the info you have provided.
How much data? The type of data? Your design architecture? Current plot speed? Requirements?

Cathal

Dear Sir,

We are sending the commented Python code and Block diagram of the system.

The data is coming continuously and plotted in real time. To plot a data on an average 0.25 sec is required.

gt_neuron_various_q_v1.py (3.63 KB)

Your data connection is via an AXI GPIO using the PYNQ MMIO class.
Reading back data from the PL using the MMIO class will be relatively slow. By using GPIO you will only be sampling data at the MMIO read rate. The time between MMIO calls may also vary - for example if a system interrupt occurs while you are reading it will take slight longer between reads.

If you want to capture data at a specific rate (e.g. 100MHz you mentioned in your post) you will need to change your design. You could use an AXI stream (+ DMA), or AXI Master port for the interface on your design to write your data directly to DRAM. From there you can then plot it in Python.

You would need to allocate a memory buffer - you can do this using the PYNQ Xlnk class, send the physical address of the memory to your IP, and it could then write the data to memory.
Some info on interfaces here:
https://pynq.readthedocs.io/en/v2.4/overlay_design_methodology/pspl_interface.html

Cathal

Dear sir,

Thanks for the quick response. We shall try out your interfacing scheme. With our current interface using PYNQ MMIO class, data transfer between PS and PL is fast, but the real-time plotting in python is slow which is creating the bottleneck. Let us know if we could reduce the plotting time.

Thanks

Reading data really isn’t that fast.
Inside your loop, this is realtively slow:
if(wtstrb.read() is 1 ):

Is it the while loop that runs slow on each iteration, or is your problem when panning or analyzing your plot?
Can you post full jupyter notebook bitstream? Why are you printing values in the loop? This will also slow the loop.

Cathal