3.6.1.5 Loop Dependence

Syntax
#pragma HLS loop dependence variable(<var_name>) type(inter) direction(RAW|WAR|WAW) dependent(true|false)
#pragma HLS loop dependence argument(<arg_name>) type(inter) direction(RAW|WAR|WAW) dependent(true|false)
Description
Specifies the loop-carried dependence of a variable to eliminate false dependency and improve pipeline initiation interval (II). HLS loop dependence pragma configuration overrides the loop dependency analysis result in the tool.
Important: Users are advised to carefully verify the loop dependency information specified. An incorrect loop dependency information leads the tool to generate incorrect hardware design.
Parameters
ParameterValueOptionalDefaultDescription
variable/argumentStringNo-Variable/Argument Name.
typeinterNo-Dependence Type. inter is the dependence between different loop iterations.
directionRAW|WAR|WAWYes-Specifies the loop dependence direction. Only valid for type(inter). When direction is not specified, the dependent parameter is applicable to all 3 directions.
dependenttrue|falseYesfalseSpecifies if there is a loop-carried dependence for the given type and direction.
Position
Before the beginning of the loop. If there is a loop label, the pragma should be placed after the label.
Examples
int f(int x[100], int j /*j is odd*/) {
  int res = 0;
loop:
  #pragma HLS loop pipeline
  #pragma HLS loop dependence argument(x) type(inter) direction(RAW) dependent(false)
  for (int i = 0; i < 100; i = i + 2 /*i is even*/) {
     res += x[i];
     x[i + j] += 1;
  }
  return res;
}