Adding AXI GPIO to block design Pynq Z2

Hello everyone,

I saw some tutorials on AXI GPIO, but I am still having a hard time connecting the IP to my custom IP built in HLS (with Vitis HLS).

In particular, I have a block design which I am attaching below, where the IP called linear_multistep_0 is my HLS IP. It works fine, I have already tried it with Python, I have tested it and it works fine.

Right now though, I just start the IP with Jupyter Notebook, hence I need a laptop and the Pynq connected through Ethernet. I would like to be able to run the script just pressing a button, i.e., the final result should be a script loaded on the ARM CPU and the ability to start it with just a button. This is a first trial to eventually run a bitstream which loops whenever the board is connected to a power source, without the necessity to start everything.

I understand that using a button would still require me to start the python script with the host, to start listening to the interrupt. In fact, I still don’t know how I could achieve my last goal, but let’s focus on one step at a time (if someone can give me an overview would be amazing though).

Thank you so much in advance for your help.

Best,
Davide

EDIT:
I figured that AXI GPIO couldn’t get synthesized just beacuse Vivado couldn’t find my custom IP. Here’s below the design with the AXI GPIO. It works without any problem and I also could run the core with buttons through this script (I know it’s not clever but I just wanted it to work):

while (not btn[3].read()):
    if (btn[0].read()):  
        iterations = 10
        time = timeit.timeit(lambda: linear_multistep_fpga(), number=iterations)
        print('Average of ' + str(time/iterations) + ' seconds')
        
        print(True == np.allclose(X_FPGA[:], X_CPU[:], rtol=0.00000001))
        
        while (btn[0].read()):
            pass

Still, can anyone tell me how to implement something that doesn’t need a host to run? Thank you so much.

Here’s the block diagram:

@davide-giacomini

Hey, you can do it even smarter =]
Use some debouncing logic to the button and trigger the IRQ of the ZYNQ (ARM A9).
In the Device tree setup the IRQ # and then you just need to write very simple startup listener to the IRQ.

Very easy very good and ultra fast response.

ENJOY~

Hi @davide-giacomini,

You can do what you’re looking for with the boot.py script.
There’re several topics on the forum regarding boot.py

Mario

1 Like

Thank you, I’ll look into that and let you know

@davide-giacomini

Btw what Mario suggest could work but you can try how the boot.py runs after the ZYNQ is boot up.
Meanwhile, the internal IRQ of the ARM did not need such stall as it is load during kernel setup.
So if there are any logic need to activate in such way, before new overlay is reloaded.
Pure IRQ and no AXI-GPIO is fastest as MIO/EMIO trigger and AXI-GPIO response should come afterward.

Btw what is the reason not using EMIO it is also come with trigger by default.

ENJOY~