How to send arrays via DMA

I am trying to create custom IP using HLS with PYNQ Z2. I have function like this
Скриншот 06-07-2021 163609
but i don’t understand how to make the correct IP design to make it work.
I tried a lot of different options of connection, but it fails with code like this:

`
in_buffer = xlnk.cma_array(shape=(num_of_input_bytes,),dtype = np.uint8) #uint8
out_buffer = xlnk.cma_array(shape=(num_of_input_bytes,),dtype = np.uint8)

input_bytes = np.array( bytearray(input_bytes))
np.copyto(in_buffer,input_bytes)

mmio.write(16, num_of_input_bytes ) 
while(not( mmio.read(0x00) & 0x4)) # infinite loop
    pass

`
How should I connect my encrypt module and dma?
Thank you

What PYNQ version are you using? What Vivado/HLS version?

Can you share an image of your block design? What steps have you tried?

1 Like

Pynq Z2, image v 2.4, Vitis HLS 2021.1, Vivado 2021.1.
Now it looks like this


I just typed “Make auto connection”. I tried to connect using this example AES_implementations/PZ1CipherStreamII2.png at master · hplp/AES_implementations (github.com)
but no result.
What steps should I do to make it work?

1 Like

I recommend you to watch this tutorial on how to create an overlay with an AXI4-Stream FIR IP. Most of the concepts are transferable to your design.

1 Like

Thank you! One last question please.
Now i have pragmas like this:

#pragma HLS INTERFACE s_axilite port=Data
#pragma HLS INTERFACE s_axilite port=Data_out
#pragma HLS INTERFACe s_axilite port=return

and now have s_axi_control port. But FIR have S_AXIS_DATA and M_AXIS_DATA:
Скриншот 07-07-2021 131244
What pragmas should I use to make two AXI ports?

1 Like

The interfaces are already AXI4-Stream. If you want to make them AXI4-MM use something like this

#pragma HLS INTERFACE m_axi port=Data
#pragma HLS INTERFACE m_axi port=Data_out

Didn’t work. Here is a comparison
Скриншот 07-07-2021 140212

1 Like

Yes, it did work. AXI4-MM interfaces were generated.

If you want to generate AXI4-Stream interfaces you need to change your code, for instance you cannot use arrays if you want to implement streaming interfaces.

You will have to do something like this

1 Like

Got it, thank you

i am facing the same problem @sticky-tea
can you share your "got it "with me please, why you cannot use arrays if you want to implement streaming interfaces.