How to use PL to accelerate a C++ project

Hello, I am working on a project totally written in C++.

We know on pynq, if we need PL to calculate, we just load the bit file at the beginning of the python file, then use some simple functions in pynq to send data and recieve results from PL.

But when it comes to C++, how can I achieve such functions? Is there any C++ version functions that perform the same as functions in pynq library?

1 Like

not as simple as with python in pynq.
for c++ it’s best to go for a petalinux (i think) and then you’re in the realm of professional use in which good resources are extremely scarce.
just like in pynq, you need to write to and read from mmapped IO but there aren’t any fancy functions to do so easily like
[ipname].write([address],[value])
it’s interesting to learn, but difficult and VERY time consuming, so depending in your needs, it can be better to write your program in python…

Hi Weiji, you are in the PYNQ forum, but your question is almost asking how to not use PYNQ.
You can use the PYNQ image and build your C++. You will need to link the Xilinx libraries to download a bitstream/interact with other parts of the system including IP.
If you want to avoid PYNQ, you may be better asking this on Xilinx forums.

An option for you may be to call your C++ from Python.
PYNQ does this - some parts of the PYNQ Python package are wrapping C++ code that is called from Python.
You can google search for different ways to do this CFFI is one example.
https://cffi.readthedocs.io/en/latest/

Cathal

Sorry that I have such a question. I am working on SLAM, but almost 100% projects are written in C++. I will try your suggestions, thank you very much!

I see, I will try metalinux. Thank you very much!

This isn’t a problem. Other PYNQ projects do this; substantially written in another language and wrap in Python to take advantage of PYNQ APIs, and framework.

Cathal