# Is there an example using AXI with HLS on the PL and transferring data from the PS?

**URL:** <https://discuss.pynq.io/t/is-there-an-example-using-axi-with-hls-on-the-pl-and-transferring-data-from-the-ps/883>\
**Category:** Support\
**Created:** [January 23, 2020, 9:15pm UTC](https://discuss.pynq.io/t/is-there-an-example-using-axi-with-hls-on-the-pl-and-transferring-data-from-the-ps/883 "2020-01-23T21:15:39Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mleeser](https://avatars.discourse-cdn.com/v4/letter/m/a4c791/32.png) [@mleeser](https://discuss.pynq.io/u/mleeser)\
**Post date:** [January 23, 2020, 9:15pm UTC](https://discuss.pynq.io/t/is-there-an-example-using-axi-with-hls-on-the-pl-and-transferring-data-from-the-ps/883/1 "2020-01-23T21:15:39Z")

</div>

Is there an example that lets me transfer a list of data from the PS to the PL and then process it?

Essentially, I would like to use the tutorial on creating an overlay from here [Create a custom PYNQ overlay for PYNQ-Z1 - FPGA Developer](http://www.fpgadeveloper.com/2018/03/create-a-custom-pynq-overlay-for-pynq-z1.html) and the docs, but use streams or lists of data instead of a single value for inputs.

I looked at pynq.allocate which explains the PS side, but not the PL.

Thanks!

---

<div class="post-metadata">

**Author:** ![cathalmccabe](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/cathalmccabe/32/3348_2.png) [@cathalmccabe](https://discuss.pynq.io/u/cathalmccabe)\
**Post date:** [January 24, 2020, 9:59am UTC](https://discuss.pynq.io/t/is-there-an-example-using-axi-with-hls-on-the-pl-and-transferring-data-from-the-ps/883/2 "2020-01-24T09:59:33Z")

</div>

See section 4 here:

> **[GitHub - Xilinx/PYNQ\_Workshop](https://github.com/Xilinx/PYNQ_Workshop)**
>
> Contribute to Xilinx/PYNQ\_Workshop development by creating an account on GitHub.

Cathal

---

<div class="post-metadata">

**Author:** ![mleeser](https://avatars.discourse-cdn.com/v4/letter/m/a4c791/32.png) [@mleeser](https://discuss.pynq.io/u/mleeser)\
**Post date:** [January 24, 2020, 2:05pm UTC](https://discuss.pynq.io/t/is-there-an-example-using-axi-with-hls-on-the-pl-and-transferring-data-from-the-ps/883/3 "2020-01-24T14:05:23Z")

</div>

The examples use Xlnk. The documentation says to use pynq.allocate. I was looking for an example that uses pynq.allocate. Thanks!

---

<div class="post-metadata">

**Author:** ![rock](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/rock/32/32_2.png) [@rock](https://discuss.pynq.io/u/rock)\
**Post date:** [January 25, 2020, 5:52am UTC](https://discuss.pynq.io/t/is-there-an-example-using-axi-with-hls-on-the-pl-and-transferring-data-from-the-ps/883/4 "2020-01-25T05:52:46Z")

</div>

This should be good enough:[Allocate — Python productivity for Zynq (Pynq)](https://pynq.readthedocs.io/en/latest/pynq_libraries/allocate.html#example)

The above doc explains how ot use the API. For the complete example, either use Cathal’s example, or something like: [https://github.com/Xilinx/PYNQ-HelloWorld/blob/master/boards/Pynq-Z1/resizer/notebooks/resizer\_PL.ipynb](https://github.com/Xilinx/PYNQ-HelloWorld/blob/master/boards/Pynq-Z1/resizer/notebooks/resizer_PL.ipynb)

You just have to replace the xlnk calls;

```auto
xlnk = Xlnk()
in_buffer = xlnk.cma_array(shape=(old_height, old_width, 3), 
                           dtype=np.uint8, cacheable=1)
out_buffer = xlnk.cma_array(shape=(new_height, new_width, 3), 
                            dtype=np.uint8, cacheable=1)

```

to the API mentioned at the beginning.

---

<div class="post-metadata">

**Author:** ![mleeser](https://avatars.discourse-cdn.com/v4/letter/m/a4c791/32.png) [@mleeser](https://discuss.pynq.io/u/mleeser)\
**Post date:** [January 27, 2020, 2:59pm UTC](https://discuss.pynq.io/t/is-there-an-example-using-axi-with-hls-on-the-pl-and-transferring-data-from-the-ps/883/5 "2020-01-27T14:59:32Z")

</div>

Thanks. Replacing the xlnk calls with allocate is straightforward. Is there a way to get feedback about the status of memory and buffer? I am looking at these calls from the Pynq workshop session 2, lab 2:

def get\_kb(mmu):  
return int(mmu.cma\_stats()[‘CMA Memory Available’]//1024)

def get\_bufcount(mmu):  
return int(memmanager.cma\_stats()[‘Buffer Count’])

def print\_kb(mmu):  
print("Available Memory (KB): " + str(get\_kb(mmu)))

---

<div class="post-metadata">

**Author:** ![rock](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/rock/32/32_2.png) [@rock](https://discuss.pynq.io/u/rock)\
**Post date:** [January 27, 2020, 5:43pm UTC](https://discuss.pynq.io/t/is-there-an-example-using-axi-with-hls-on-the-pl-and-transferring-data-from-the-ps/883/6 "2020-01-27T17:43:48Z")

</div>

You can probably poke registers based on the DMA axi lite interface.

---

<div class="post-metadata">

**Author:** ![cathalmccabe](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/cathalmccabe/32/3348_2.png) [@cathalmccabe](https://discuss.pynq.io/u/cathalmccabe)\
**Post date:** [January 28, 2020, 9:58am UTC](https://discuss.pynq.io/t/is-there-an-example-using-axi-with-hls-on-the-pl-and-transferring-data-from-the-ps/883/7 "2020-01-28T09:58:28Z")

</div>

For now, you can still use Xlnk to get the CMA status, or use /proc/meminfo

```auto
!cat /proc/meminfo | grep Cma

```

E.g.

```auto
CmaTotal: 131072 kB
CmaFree: 57724 kB

```

Cathal
