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: 
Newbie tobu
Newbie
215 Views
Registered: ‎11-05-2018

loop unrolling not as expected

Hi,

I'm performing a simple example of a multiplication of an array by a constant value. I defined the load and store function that bring inside my top func the data to two local variables (the interface with the multiplication) and i defined them the cyclic partitioning pragma (so multiplier have data ready at every clock cycle ).

I synthesized and work well till the 8th factor of unrolling; From the 8 on, Vivado inserts some sort of logic that i do not understand (it is not inserting just the multiplier in parallel as i was expecting but the urem function etc). When i unroll by 16 everything works well. (as i change the unrolling faction I also change the partitioning factor in order to match) .

 
The code is:

 

 

void top(fx_pt* out, fx_pt* wave,fx_pt c, int nSample)
{
#pragma HLS INTERFACE s_axilite register depth=1 port=nSample bundle=CTRL_BUS
#pragma HLS INTERFACE s_axilite register depth=1 port=c bundle=CTRL_BUS
#pragma HLS INTERFACE m_axi depth=1200 port=wave offset=slave bundle=SRC_BUS
#pragma HLS INTERFACE m_axi depth=1200 port=out offset=slave bundle=DST_BUS
#pragma HLS INTERFACE s_axilite port=return bundle=CTRL_BUS

    fx_pt _inbuff[SIZE];
#pragma HLS ARRAY_PARTITION variable=_inbuff cyclic factor=10 dim=1
	fx_pt _outbuff[SIZE];
#pragma HLS ARRAY_PARTITION variable=_outbuff cyclic factor=10 dim=1

   load(_inbuff, wave,  nSample);

   multiply_constant(_outbuff,_inbuff,c,nSample);

   store( _outbuff, out,  nSample);

}

 

where fp_pt are ap_fixed<16,10> .

 

 

void load(fx_pt _inbuff[SIZE],fx_pt wave[SIZE], unsigned nSample){
#pragma HLS INLINE off
load:
	for(unsigned i=0;i<nSample;i++)
#pragma HLS LOOP_TRIPCOUNT min=1200 max=1200 avg=1200
		_inbuff[i]=wave[i];
}

Same the store.

 

 

 

 

void multiply_constant(fx_pt out[SIZE], fx_pt data[SIZE], fx_pt c,unsigned nSample)
{

mult_c_samples:
    for(unsigned j=0;j<nSample;j++)
#pragma HLS LOOP_TRIPCOUNT min=1200 max=1200 avg=1200
#pragma HLS UNROLL skip_exit_check factor=10
    	out[j] = c* data[j];

}



This is the strange circuit synthesized:

 

Screenshot from 2018-11-06 00-46-04.png

 

While when i unroll for a factor <8 or 16, i obtain this, as expected:

 

Screenshot from 2018-11-06 01-13-14.png

Can you give me some advice of why Vivado is not working as I'm expecting? where I'm wrong?

Thank you so much for your help.

 

0 Kudos