cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
goldshakil
Observer
Observer
881 Views
Registered: ‎11-03-2019

HLS Array Implementation

Jump to solution

Hello,

I have tried make an IP that does simple multiplication of two numbers and returns the answer as follows:

Capture_0.PNG

This one works just fine but my current goal is to extend this so that a,b,answer are arrays.
a ->a[10]

b->b[10]

answer->answer[10]

However, since am not good in HLS envrinoment am not really sure how can I achieve that. I have tried to return a pointer from this function but that doesn't work.

Thank you so much.

0 Kudos
1 Solution

Accepted Solutions
wenchen
Moderator
Moderator
870 Views
Registered: ‎05-27-2018

Hi @goldshakil ,

   Since you are new to HLS, refer to the examples in UG871, UG902 and code examples on HLS home page.

typedef int dina_t;
typedef int dout_t;
typedef int dinb_t;

void array_RAM (dout_t d_o[4], dina_t d_a[4], dinb_t d_b[4]) { int i; For_Loop: for (i=0;i<4;i++) { d_o[i] = d_a[i] * d_b[i]; } }

Wen

 

-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.


**~ Got a minute? Answer our Vitis HLS survey here! ~**


-------------------------------------------------------------------------
如果提供的信息能解决您的问题,请标记为“接受为解决方案”。
如果您认为帖子有帮助,请点击“奖励”。谢谢!
-------------------------------------------------------------------------------------------------

View solution in original post

5 Replies
wenchen
Moderator
Moderator
871 Views
Registered: ‎05-27-2018

Hi @goldshakil ,

   Since you are new to HLS, refer to the examples in UG871, UG902 and code examples on HLS home page.

typedef int dina_t;
typedef int dout_t;
typedef int dinb_t;

void array_RAM (dout_t d_o[4], dina_t d_a[4], dinb_t d_b[4]) { int i; For_Loop: for (i=0;i<4;i++) { d_o[i] = d_a[i] * d_b[i]; } }

Wen

 

-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.


**~ Got a minute? Answer our Vitis HLS survey here! ~**


-------------------------------------------------------------------------
如果提供的信息能解决您的问题,请标记为“接受为解决方案”。
如果您认为帖子有帮助,请点击“奖励”。谢谢!
-------------------------------------------------------------------------------------------------

View solution in original post

goldshakil
Observer
Observer
809 Views
Registered: ‎11-03-2019

I have followed the tutotrial and wrote the following code:

 

Capture00.PNG

However, I have no idea how to use the driver functions in SDK to write and read the arrays.

captrue 01.PNG
can you please help me out? ( I assume the write words and read words should be used but not sure how)

0 Kudos
wenchen
Moderator
Moderator
798 Views
Registered: ‎05-27-2018

Hi @goldshakil ,

      You can have a carefully look at UG871 page93 && chapter 10 to figure out where the HLS IP driver lies and how to use it on ZYNQ device.

HLS_driver.PNG

-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.


**~ Got a minute? Answer our Vitis HLS survey here! ~**


-------------------------------------------------------------------------
如果提供的信息能解决您的问题,请标记为“接受为解决方案”。
如果您认为帖子有帮助,请点击“奖励”。谢谢!
-------------------------------------------------------------------------------------------------
0 Kudos
goldshakil
Observer
Observer
760 Views
Registered: ‎11-03-2019

In pages 90-95 after synthesizing there are no functions to set or get the array.
as far it goes for  chapter 10 it handles integers and that works fine for me too, however when I switch to array it doesn't seem to generate any set and get functions(in the drivers).

the functions I get (in the drivers generated) are XXX_Write_XXX_Words and XXX_Read_XXX_Words

I have been trying my best but I can't seem to figure out how to use these functions.

please help me out.
Thank you so much

0 Kudos
dishlamian
Observer
Observer
736 Views
Registered: ‎12-03-2019

If your target board has a base Vitis platform available (all Alveo boards, ZCU102/104 and zc702/706), I would recommend using the Vitis accelerator flow. Forget about AXI Lite for your arrays, switch to memory-mapped (m_axi) and convert your array arguments to pointers, and follow this example:

https://github.com/Xilinx/Vitis_Accel_Examples/tree/master/hello_world

In this flow there is no need to spend days tinkering with Xilinx SDK tying to figure out how all the random functions to communicate between the host and the FPGA work.

0 Kudos