Forum Discussion
Altera_Forum
Honored Contributor
13 years agomodulo on parameters
Hi all! I need to do operations on multiple elements of an input vector. The elements should be handled cyclic, so that the modulo operator % would come in handy. But it doesn't work (see below). ...
Altera_Forum
Honored Contributor
13 years agoThank you!
My fix is: parameter index_m1 = ((index-1)<0 ? range+(index-1) : (index-1)); parameter index_p1 = ((index+1)>range-1 ? (index+1)-range: (index+1)); assign out = in[parameter index_m1] | in[parameter index_p1]; This is not really flexible. Do you know a better way?