Forum Discussion
Hi Ranesh,
Below is the expert explanation on the second example (s_outbytecount):
s_output_data[d] <= s_in_data[((W_MODULE_DATA - ((d - s_outbytecount) * 8))- 1) -: 8]; //vector_capture_v2.sv, line number 151
In this case, array index uses logic type variable "s_outbytecount", for which synthesis generates a circuit which ensures no out of bound error happens.
In original use case, when local param is used in the index operation, they are replaced with actual values in compile time, so all possible indices get generated which cause out of bound error during loop unrolling.
e.g.
s_in_data[((W_MODULE_DATA - ((c - c_IN_DESC_BYTE_CNT) * 8)) - 1) -: 8]
Here, c is running from 16 to 31. During loop unrolling, index value is generated for all values of c which causes out of range error.
If you need further detailed explanation, may be we can set up a meeting after January 3rd with internal expert where they can explain the concept of index range being known at compile time.
Thanks,
Best regards,
Sheng