cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Yuwei_tt
Visitor
Visitor
393 Views
Registered: ‎04-11-2021

hls::stream::size() synthesis fail

Jump to solution

Dear all, I am trying to implement an decimation FIR filter (Down-sampling filter). In order to ensure the stream buffer function properly, I use `hls::stream::size()` function to check number of elements in the stream buffer. (RATE is the down-sampling rate)

if (x->size() >= RATE){
    READ:for(int i=0;i<RATE;i++)
        x_int = x->read();
}

 

However, I got the following error while synthesizing my project:

ERROR: [XFORM 203-733] Function hls::stream::size() (../1061MultiBlockCode/decimate.hpp:22:9) is not synthesizable, it can only be used in C simulation.
ERROR: [HLS 200-70] Pre-synthesis failed.

I am wondering how I can fix this error, or is there any other way of implementation. Thanks!!

 

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
xilinxacct
Professor
Professor
306 Views
Registered: ‎10-23-2018

@Yuwei_tt The general rule for something being synthesizable is based on something being 'known' (or at least a fixed maximum) at the time of synthesis. Anything that is dynamic in nature is not a good fit.

Hope that Helps
If so, Please mark as solution accepted. Kudos also welcomed.

View solution in original post

0 Kudos
4 Replies
xilinxacct
Professor
Professor
370 Views
Registered: ‎10-23-2018

@Yuwei_tt 

If you 'need' a notion of the size that has been put into the stream, (rather than a simple producer/consumer)... you can keep track of the size at production of the things put on the stream... that being said, if you are doing that up front, you may be able to avoid putting the non-needed samples ion the stream in the first place.

Hope that Helps
If so, Please mark as solution accepted. Kudos also welcomed.

0 Kudos
Yuwei_tt
Visitor
Visitor
363 Views
Registered: ‎04-11-2021

Thanks a lot!! Keeping track of the stream is an effective solution.

I still wonder why hls::stream::size() is not synthesizable.

0 Kudos
xilinxacct
Professor
Professor
307 Views
Registered: ‎10-23-2018

@Yuwei_tt The general rule for something being synthesizable is based on something being 'known' (or at least a fixed maximum) at the time of synthesis. Anything that is dynamic in nature is not a good fit.

Hope that Helps
If so, Please mark as solution accepted. Kudos also welcomed.

View solution in original post

0 Kudos
Yuwei_tt
Visitor
Visitor
227 Views
Registered: ‎04-11-2021

I 've got it! Thank you so much.

0 Kudos