Compared with software compilers, like gcc, HLS tools are currently relatively immature.
Here is an example from Vivado HLS of a false positive on loop-carried dependency. The following refuses to compile. »LINK
//directive PIPELINE set
uint8_t process_image(uint8_t pxVal)
{
static unsigned int x = 0;
static uint8_t lines[16][WIDTH];
//directive UNROLL set
for(int i=0; i < 15; i++) {
lines[i][x] = lines[i + 1][x];
}
lines[15][x] = pxVal;
uint8_t result = lines[1][x];
x = (x + 1) == WIDTH ? 0 : (x + 1);
return result;
}
Why does this fail? When we convert from a 2-D to a 1-D array by multiplying up the indecies we loose information that the subscripts are manifestly distinct.
| 24: (C) 2012-18, DJ Greaves, University of Cambridge, Computer Laboratory. |