The case discovered is as follows:
c = (a+

% 255;
x = A[c];
works, but:
x=A [ (a+

%255];
gives an incorrect answer. In my particular case, all variables are "unsigned char", and I haven't tested to know if the type matters.
I don't want to get into why I can't simply change the code, suffice it to say that its begin generated by an automatic tool.
Other expressions in the array index have worked.
Has anyone discovered this, is there a fix?
I'm using version 3.60
Hi Jason,
There may be a timing issue due to the modulus being an asynchronous call to a multi-cycle module. Looking at your code by itself and resulting HDL, it is not obvious whether the error being caused is inherent to the logic itself. There may be other parts of the surrounding code to consider, such as whether the stage also contains an I/O operation such as a co_stream_read/write(). If this may be the case, placing a co_par_break(); after x=A[(a+

%255]; statement may effectively isolate it to avoid the issue. If this doesn't help, please post (or send it to support@impulsec.com) more of your code for review.
Another suggestion more from the point of view of optimization for speed: Multiplication will be faster than division (or modulus) and multiplying by a reciprical may yield the same results in fewer cycles.
Best Regards,
Ed