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

## HLS Array Implementation

Hello,

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

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]

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.

1 Solution

Accepted Solutions
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! ~**

-------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------
5 Replies
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! ~**

-------------------------------------------------------------------------

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

I have followed the tutotrial and wrote the following code:

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

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.

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

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

-------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------
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.