We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

Showing results for 
Search instead for 
Did you mean: 
Registered: ‎06-28-2008

How to implement such function in HLS C++ ?




I want to implement such function-------


Every period there is a sync signal.

Then I begin to read M data from RAM.

After N periods, I got M*N data samples.

I need to use this entire M*N matrix for my next algorithm.

I know a for-loop could read data from RAM to local memory,

but it is only one dimension.  

I really do NOT know how to write code

to read and save the data to a two-dimension matrix in HLS.


Please help me !

0 Kudos
2 Replies
Teacher muzaffer
Registered: ‎03-31-2012

Re: How to implement such function in HLS C++ ?

a two dimensional array is just a linear array of memory where you use two different indices to get at the data you want. Basically if you have indices i, j with M with the maximum value of i, to get at any arbitrary element you can use address = i + j * M.
In any case, check whether you need all the data in the array before your "next algorithm" can proceed. Usually you need a number of lines where the number is less than N so you don't need to wait for all the N lines.
- Please mark the Answer as "Accept as solution" if information provided is helpful.
Give Kudos to a post which you think is helpful and reply oriented.
0 Kudos
Scholar u4223374
Registered: ‎04-26-2015

Re: How to implement such function in HLS C++ ?

Have a look at the image processing examples (eg. XAPP 1167). After all, an image is a 2D array of numbers, just like a matrix.


What you'll find is that in RAM images are stored as long 1D arrays, and for streaming they're treated as 1D arrays with a marker to indicate each line (TLAST, set on the last bit of each line).

0 Kudos