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
Did you mean: Explorer
468 Views
Registered: ‎05-23-2017

## Loop latency and function latency

I have some bad time to understand the difference between the loop latency and function latency.

Here is the code.

```void dist_calc_or0(D_point_or *feature_or,D_point_or *query_or,D_dist1 *dist_temp){
#pragma HLS INLINE off

Dtype_l dist_temp_buffer1[D_OR];
#pragma HLS ARRAY_PARTITION variable=dist_temp_buffer1 cyclic factor=32 dim=1
#pragma HLS ALLOCATION instances=fmul limit=32 operation
#pragma HLS ALLOCATION instances=fsub limit=32 operation

loopForReduceDSP:for(int j=0; j<D_OR;j++){
#pragma HLS unroll
dist_temp_buffer1[j]=feature_or->x[j]-query_or->x[j];
dist_temp->x[j]= dist_temp_buffer1[j]*dist_temp_buffer1[j];
}
}```  Take the dist_calc_or0 function as an example.

From the vivado_hls.log file, the depth of the loop is 79.

If I am right I'd like to call the depth is the latency of this loop, right?

Why the latency of the function, which is 76 less than that of the loop (79)?

1 Solution

Accepted Solutions u4223374
Scholar
439 Views
Registered: ‎04-26-2015

## Re: Loop latency and function latency

I assume this function is called in a loop? So the outer loop is the dist_calc_or0 loop?

In that case, you have three things:

Function start interval = 60. Every 60 cycles, the function can be started.

Function latency = 76. It takes 76 cycles to complete the function. However, because some hardware is only used during the second part of the function, the first part can be started while the previous call to the function is still finishing.

Loop pipeline depth = 79. This means that the loop requires a few extra cycles for itself in each iteration (eg. incrementing the loop index) or for other stuff in the loop, so each iteration of the loop actually takes 79 cycles to finish. However, as above, these can be overlapped so the loop can be started every 60 cycles.

2 Replies u4223374
Scholar
440 Views
Registered: ‎04-26-2015

## Re: Loop latency and function latency

I assume this function is called in a loop? So the outer loop is the dist_calc_or0 loop?

In that case, you have three things:

Function start interval = 60. Every 60 cycles, the function can be started.

Function latency = 76. It takes 76 cycles to complete the function. However, because some hardware is only used during the second part of the function, the first part can be started while the previous call to the function is still finishing.

Loop pipeline depth = 79. This means that the loop requires a few extra cycles for itself in each iteration (eg. incrementing the loop index) or for other stuff in the loop, so each iteration of the loop actually takes 79 cycles to finish. However, as above, these can be overlapped so the loop can be started every 60 cycles.

Highlighted Explorer
424 Views
Registered: ‎05-23-2017