UPGRADE YOUR BROWSER

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!

cancel
Showing results for 
Search instead for 
Did you mean: 
Visitor sirainatou
Visitor
3,412 Views
Registered: ‎04-19-2016

error c simulation filter2D

Hello everyone ,

 

I am trying to Applies an arbitrary linear filter to an image src "numIteration" time !

 

I tried this code !

SHORT_IMAGE u(rows,cols) 

Zero(u);
#pragma HLS INLINE
SHORT_IMAGE internal[numIteration-1];
#pragma HLS array partition variable=internal dim=1
computeDerivatives1(u,internal[0],average);

/*loop:for(int k=0; k<numIteration; k++){
computeDerivatives1(internal[k],internal[k+1],average);

}

 

with : 

template<int ROWS, int COLS, int SRC_T, int DST_T>
void computeDerivatives1(
Mat<ROWS,COLS,SRC_T>& src,
Mat<ROWS,COLS,DST_T>& dst,
const int tab[3][3]){

hls::Window<3,3,int> kernel;
hls::Point_<int> anchor;

for (int i = 0; i <3; i++)
for (int j = 0; j < 3; j++)
kernel.val[i][j] = tab[i][j];

 

anchor.x = -1;
anchor.y = -1;

hls::Filter2D(src, dst, kernel, anchor);
}

 

but i got the error : WARNING: Hls::stream 'hls::stream<float>.21' contains leftover data, which may result in RTL simulation hanging.

Any idea please !! 

 

0 Kudos
6 Replies
Xilinx Employee
Xilinx Employee
3,405 Views
Registered: ‎08-01-2008

Re: error c simulation filter2D

check these links
http://www.xilinx.com/support/answers/57876.html
https://forums.xilinx.com/t5/High-Level-Synthesis-HLS/HLS-Compiler-Bug-Streaming-Based-Design/td-p/349833
Thanks and Regards
Balkrishan
--------------------------------------------------------------------------------------------
Please mark the post as an answer "Accept as solution" in case it helped resolve your query.
Give kudos in case a post in case it guided to the solution.
Visitor sirainatou
Visitor
3,393 Views
Registered: ‎04-19-2016

Re: error c simulation filter2D

the data read while emplty is "internal[0]" !! but I didn't understand why I got this warning despite the fact that I applied the filter !!
in fact, my goal is to apply the filter several times on the same image !!

thanks for your response
Regards,




0 Kudos
Scholar u4223374
Scholar
3,355 Views
Registered: ‎04-26-2015

Re: error c simulation filter2D

Can you post the definitions you're using (eg. what is "SHORT_IMAGE")? And also the complete code, since the first function is clearly incomplete?

 

In this code

SHORT_IMAGE u(rows,cols) 

Zero(u);
#pragma HLS INLINE
SHORT_IMAGE internal[numIteration-1];
#pragma HLS array partition variable=internal dim=1
computeDerivatives1(u,internal[0],average);

(the rest seems to be commented out) is there something that reads internal[0]? And does it read all of internal[0]?

 

In the code that is commented out, each iteration writes to internal[k+1]. Maximum value for k is (numIteration-1) so the maximum image written to is internal[numIteration]. This will obviously cause problems, because you've defined internal has having numIteration-1 elements. It needs numIteration+1 elements.

 

 

 

 

0 Kudos
Visitor sirainatou
Visitor
3,342 Views
Registered: ‎04-19-2016

Re: error c simulation filter2D

Thanks for your help ! 

I posted here the whole code . honestly, I do not know what the instruction internal [numIteration] means ! I influenced the source code of the function:

template<typename OPR_KERNEL, typename BORDERMODE, int ITERATIONS,int SRC_T, int DST_T, typename KN_T, typename POINT_T,
int IMG_HEIGHT,int IMG_WIDTH,int K_HEIGHT,int K_WIDTH>
void filter_opr_iter(
Mat<IMG_HEIGHT, IMG_WIDTH, SRC_T> &_src,
Mat<IMG_HEIGHT, IMG_WIDTH, DST_T> &_dst,
Window<K_HEIGHT,K_WIDTH,KN_T> &_kernel,
Point_<POINT_T> &anchor,
int rows,int cols )
{
#pragma HLS INLINE
Mat<IMG_HEIGHT,IMG_WIDTH,DST_T> internal[ITERATIONS-1];
#pragma HLS array partition variable=internal dim=1
filter_opr_flow_more<OPR_KERNEL,BORDERMODE,SRC_T,DST_T,KN_T,POINT_T>(_src,internal[0],_kernel,anchor,rows,cols);
loop_iterations: for(int iter=0;iter<ITERATIONS-2;iter++)
{
#pragma HLS UNROLL
filter_opr_flow_more<OPR_KERNEL,BORDERMODE,SRC_T,DST_T,KN_T,POINT_T>(internal[iter],internal[iter+1],_kernel,anchor,rows, cols);
}
filter_opr_flow_more<OPR_KERNEL,BORDERMODE,SRC_T,DST_T,KN_T,POINT_T>(internal[ITERATIONS-2],_dst,_kernel,anchor,rows,cols);
}

 

As I said ! I want to apply the same filter many times on the same image!! 

thank you for your help ! 

 

0 Kudos
Scholar u4223374
Scholar
3,336 Views
Registered: ‎04-26-2015

Re: error c simulation filter2D

Okay, now I'm really confused. Two major issues I can see in that code:

 

(1) The initial input to the computeDerivatives1 processing ("u") is initialized to zero. Filtering a blank image is going to give you a blank image, no matter what filter you use. Since the output from this feeds into the subsequent calls to computeDerivatives1, all of those will output zeros too.

 

(2) It does not look like you ever use the output from the filter loop. Where is the output image meant to go?

 

(3) Ix_m gets used twice. This is OK in C, but will not work in HLS (you can only use each Mat once).

0 Kudos
Visitor sirainatou
Visitor
3,334 Views
Registered: ‎04-19-2016

Re: error c simulation filter2D

my code is not finished yet! I am trying to understand the interest of such a statement!
in my application,
u will be changed in each iteration! That's why I changed the u with a non-empty picture !

and I am ok with your third remark !! 

0 Kudos