# Arbitrary precision data transfer between PS and PL

**URL:** <https://discuss.pynq.io/t/arbitrary-precision-data-transfer-between-ps-and-pl/2770>\
**Category:** Support\
**Created:** [June 25, 2021, 7:14am UTC](https://discuss.pynq.io/t/arbitrary-precision-data-transfer-between-ps-and-pl/2770 "2021-06-25T07:14:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![soujanya\_sr](https://avatars.discourse-cdn.com/v4/letter/s/7cd45c/32.png) [@soujanya\_sr](https://discuss.pynq.io/u/soujanya_sr)\
**Post date:** [June 25, 2021, 7:14am UTC](https://discuss.pynq.io/t/arbitrary-precision-data-transfer-between-ps-and-pl/2770/1 "2021-06-25T07:14:14Z")

</div>

Hello,

For some application, I have defined an HLS module that takes integer data of arbitrary precision. Say 6-bit integer. Now I need to stream data from PS to that module on PL. How would I stream such a data? Does Python/Numpy support that? And if DMA involved, I see that DMA IP supports only standard datawidths like 8,16 and so on. How do I manage in that case?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![momo\_flyer](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/momo_flyer/32/874_2.png) [@momo\_flyer](https://discuss.pynq.io/u/momo_flyer)\
**Post date:** [June 25, 2021, 9:11am UTC](https://discuss.pynq.io/t/arbitrary-precision-data-transfer-between-ps-and-pl/2770/2 "2021-06-25T09:11:54Z")

</div>

Hi,

Python, numpy, DMA only support 8,16,32,64b datawidths so you need to cast your data to standard width integers, signed or unsigned according to what you used in hls.  
in VHDL you would do something stupid like taking an 8b output std\_logic\_vector (7 downto 0) :=“00000000”  
[8b-std\_logic\_vectorname] (5 downto 0)\<=[6b-std\_logic\_vectorname]; --this puts the 6 bits in a vector of 8 where the 2 MSb s are “00”

in hls you can probably take a new ap\_int with 8b precision and assign your 6b ap\_int to it, it will probably automagically assign “00” to the MSb s. the 8b ap\_int should be an argument of your function so it can be read from and written to.

if you want to process large chunks of data, it is indeed best to use axi-stream interfaces with axi-DMA,  
link to a post where all necessary tutorials are available, this is how i learnt it:

> [@Understanding how to use custom overlay](https://discuss.pynq.io/t/understanding-how-to-use-custom-overlay/2162/7):
>
> watch these 3 videos: the first is how to make, implement and access an HLS IP 2nd is how to make and implement an HLS AXI-stream IP with AXI-DMA 3rd is how to use it in python on the PS [[- YouTube] ](https://www.youtube.com/watch?v=Dupyek4NUoI)[[VIVADO HLS Training AXI Stream interface #07] ](https://www.youtube.com/watch?v=3So1DPe2_4s)[[- YouTube] ](https://www.youtube.com/watch?v=LoLCtSzj9BU) before calling the DMA.wait() functions, be sure to start the IP by writing 0x01 to adress 0x00 of the IP core (HOG\_accel.write(0x00,0x01) )
